|
From: <be...@us...> - 2013-10-06 04:10:48
|
Revision: 12147
http://sourceforge.net/p/xoops/svn/12147
Author: beckmi
Date: 2013-10-06 04:10:39 +0000 (Sun, 06 Oct 2013)
Log Message:
-----------
Code formatting
Modified Paths:
--------------
XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/images.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/import.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/indexpage.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mimetypes.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/mirrors.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/permissions.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/ratings.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reportsmodifications.php
XoopsModules/wfdownloads/trunk/wfdownloads/admin/reviews.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top.php
XoopsModules/wfdownloads/trunk/wfdownloads/blocks/top_by_cat.php
XoopsModules/wfdownloads/trunk/wfdownloads/brokenfile.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/category.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/dbupdater.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/modification.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/object.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/rating.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/request.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/uploader.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/wfdownloads_lists.php
XoopsModules/wfdownloads/trunk/wfdownloads/class/xoopstree.php
XoopsModules/wfdownloads/trunk/wfdownloads/footer.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/directorychecker.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/filechecker.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/functions.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/module.php
XoopsModules/wfdownloads/trunk/wfdownloads/include/search.inc.php
XoopsModules/wfdownloads/trunk/wfdownloads/index.php
XoopsModules/wfdownloads/trunk/wfdownloads/js/jquery-latest.js
XoopsModules/wfdownloads/trunk/wfdownloads/js/thickbox-compressed.js
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/main.php
XoopsModules/wfdownloads/trunk/wfdownloads/language/english/modinfo.php
XoopsModules/wfdownloads/trunk/wfdownloads/mirror.php
XoopsModules/wfdownloads/trunk/wfdownloads/module.css
XoopsModules/wfdownloads/trunk/wfdownloads/newlist.php
XoopsModules/wfdownloads/trunk/wfdownloads/ratefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/review.php
XoopsModules/wfdownloads/trunk/wfdownloads/rss.php
XoopsModules/wfdownloads/trunk/wfdownloads/singlefile.php
XoopsModules/wfdownloads/trunk/wfdownloads/submit.php
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_categorieslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_downloadslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_mimetypeslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_mirrorslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_ratingslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_reportsmodificationslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/admin/wfdownloads_admin_reviewslist.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_breadcrumb.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_common_letterschoice.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_download.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_index.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_singlefile.html
XoopsModules/wfdownloads/trunk/wfdownloads/templates/wfdownloads_viewcat.html
XoopsModules/wfdownloads/trunk/wfdownloads/thickbox.css
XoopsModules/wfdownloads/trunk/wfdownloads/topten.php
XoopsModules/wfdownloads/trunk/wfdownloads/viewcat.php
XoopsModules/wfdownloads/trunk/wfdownloads/visit.php
XoopsModules/wfdownloads/trunk/wfdownloads/xoops_version.php
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php 2013-10-06 04:04:07 UTC (rev 12146)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/clone.php 2013-10-06 04:10:39 UTC (rev 12147)
@@ -1,164 +1,171 @@
-<?php
-/*
- You may not change or alter any portion of this comment or credits
- of supporting developers from this source code or any supporting source code
- which is considered copyrighted (c) material of the original comment or credit authors.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-/**
- * Wfdownloads module
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
- * @package wfdownload
- * @since 3.23
- * @author Xoops Development Team
- * @version svn:$id$
- */
-$currentFile = basename(__FILE__);
-include_once dirname(__FILE__) . '/admin_header.php';
-
-if (@$_POST['op'] == 'submit') {
- if (!$GLOBALS['xoopsSecurity']->check()) {
- redirect_header($currentFile, 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
- exit();
- }
-
- $cloneDirname = $_POST['clonedirname'];
-
- // Check if name is valid
- if (empty($cloneDirname) || preg_match('/[^a-zA-Z0-9\_\-]/', $cloneDirname)) {
- redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_INVALIDNAME, $cloneDirname));
- exit();
- }
- // Check wether the cloned module exists or not
- if ($cloneDirname && is_dir(XOOPS_ROOT_PATH . '/modules/' . $cloneDirname)) {
- redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_EXISTS, $cloneDirname));
- }
-
- $patterns = array(
- strtolower(WFDOWNLOADS_DIRNAME) => strtolower($cloneDirname),
- strtoupper(WFDOWNLOADS_DIRNAME) => strtoupper($cloneDirname),
- ucfirst(strtolower(WFDOWNLOADS_DIRNAME)) => ucfirst(strtolower($cloneDirname))
- );
-
- $patKeys = array_keys($patterns);
- $patValues = array_values($patterns);
- wfdownloads_cloneFileDir(WFDOWNLOADS_ROOT_PATH);
- $logocreated = wfdownloads_createLogo(strtolower($cloneDirname));
-
- $message = "";
- if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($cloneDirname))) {
- $message .= sprintf(_AM_WFDOWNLOADS_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=installlist'>" . ucfirst(strtolower($cloneDirname)) . "</a>") . "<br />\n";
- if (!$logocreated) {
- $message .= _AM_WFDOWNLOADS_CLONE_IMAGEFAIL;
- }
- } else {
- $message .= _AM_WFDOWNLOADS_CLONE_FAIL;
- }
-
- wfdownloads_xoops_cp_header();
- $indexAdmin = new ModuleAdmin();
- echo $indexAdmin->addNavigation($currentFile);
- echo $message;
- include 'admin_footer.php';
- exit();
-
-} else {
- wfdownloads_xoops_cp_header();
- $indexAdmin = new ModuleAdmin();
- echo $indexAdmin->addNavigation($currentFile);
- include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
- $form = new XoopsThemeForm(sprintf(_AM_WFDOWNLOADS_CLONE_TITLE, $wfdownloads->getModule()->getVar('name', 'E')), 'clone', $currentFile, 'post', true);
- $cloneDirname_text = new XoopsFormText(_AM_WFDOWNLOADS_CLONE_NAME, 'clonedirname', 20, 20, '');
- $cloneDirname_text->setDescription(_AM_WFDOWNLOADS_CLONE_NAME_DSC);
- $form->addElement($cloneDirname_text, true);
- $form->addElement(new XoopsFormHidden('op', 'submit'));
- $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
- $form->display();
- include 'admin_footer.php';
- exit();
-}
-
-// recursive clonning script
-function wfdownloads_cloneFileDir($path)
-{
- global $patKeys;
- global $patValues;
-
- $newPath = str_replace($patKeys[0], $patValues[0], $path);
-
- if (is_dir($path)) {
- // create new dir
- mkdir($newPath);
- // check all files in dir, and process it
- if ($handle = opendir($path)) {
- while ($file = readdir($handle)) {
- if ($file != '.' && $file != '..' && $file != '.svn') {
- wfdownloads_cloneFileDir("{$path}/{$file}");
- }
- }
- closedir($handle);
- }
- } else {
- if (preg_match('/(.jpg|.gif|.png|.zip|.ttf)$/i', $path)) {
- // image
- copy($path, $newPath);
- } else {
- // file, read it
- $content = file_get_contents($path);
- $content = str_replace($patKeys, $patValues, $content);
- file_put_contents($newPath, $content);
- }
- }
-}
-
-function wfdownloads_createLogo($dirname)
-{
- $wfdownloads = WfdownloadsWfdownloads::getInstance();
- // Check extension/functions
- if (!extension_loaded("gd")) {
- return false;
- } else {
- $required_functions = array(
- "imagecreatetruecolor",
- "imagecolorallocate",
- "imagefilledrectangle",
- "imagejpeg",
- "imagedestroy",
- "imageftbbox"
- );
- foreach ($required_functions as $func) {
- if (!function_exists($func)) {
- return false;
- }
- }
- }
- // Check original image/font
- if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png")) {
- return false;
- }
- if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $wfdownloads->getModule()->dirname() . "/images/VeraBd.ttf")) {
- return false;
- }
- // Create image
- $imageModule = imagecreatefrompng($imageBase);
- // Erase old text
- $greyColor = imagecolorallocate($imageModule, 237, 237, 237);
- imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor);
- // Write text
- $textColor = imagecolorallocate($imageModule, 0, 0, 0);
- $space_to_border = (80 - strlen($dirname) * 6.5) / 2;
- imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $textColor, $font, ucfirst($dirname), array());
- // Set transparency color
- $whiteColor = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
- imagefill($imageModule, 0, 0, $whiteColor);
- imagecolortransparent($imageModule, $whiteColor);
- // Save new image
- imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png");
- imagedestroy($imageModule);
- return true;
-}
+<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+/**
+ * Wfdownloads module
+ *
+ * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
+ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package wfdownload
+ * @since 3.23
+ * @author Xoops Development Team
+ * @version svn:$id$
+ */
+$currentFile = basename(__FILE__);
+include_once dirname(__FILE__) . '/admin_header.php';
+
+if (@$_POST['op'] == 'submit') {
+ if (!$GLOBALS['xoopsSecurity']->check()) {
+ redirect_header($currentFile, 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
+ exit();
+ }
+
+ $cloneDirname = $_POST['clonedirname'];
+
+ // Check if name is valid
+ if (empty($cloneDirname) || preg_match('/[^a-zA-Z0-9\_\-]/', $cloneDirname)) {
+ redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_INVALIDNAME, $cloneDirname));
+ exit();
+ }
+ // Check wether the cloned module exists or not
+ if ($cloneDirname && is_dir(XOOPS_ROOT_PATH . '/modules/' . $cloneDirname)) {
+ redirect_header($currentFile, 3, sprintf(_AM_WFDOWNLOADS_CLONE_EXISTS, $cloneDirname));
+ }
+
+ $patterns = array(
+ strtolower(WFDOWNLOADS_DIRNAME) => strtolower($cloneDirname),
+ strtoupper(WFDOWNLOADS_DIRNAME) => strtoupper($cloneDirname),
+ ucfirst(strtolower(WFDOWNLOADS_DIRNAME)) => ucfirst(strtolower($cloneDirname))
+ );
+
+ $patKeys = array_keys($patterns);
+ $patValues = array_values($patterns);
+ wfdownloads_cloneFileDir(WFDOWNLOADS_ROOT_PATH);
+ $logocreated = wfdownloads_createLogo(strtolower($cloneDirname));
+
+ $message = "";
+ if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($cloneDirname))) {
+ $message .= sprintf(
+ _AM_WFDOWNLOADS_CLONE_CONGRAT,
+ "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=installlist'>" . ucfirst(strtolower($cloneDirname)) . "</a>"
+ ) . "<br />\n";
+ if (!$logocreated) {
+ $message .= _AM_WFDOWNLOADS_CLONE_IMAGEFAIL;
+ }
+ } else {
+ $message .= _AM_WFDOWNLOADS_CLONE_FAIL;
+ }
+
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation($currentFile);
+ echo $message;
+ include 'admin_footer.php';
+ exit();
+
+} else {
+ wfdownloads_xoops_cp_header();
+ $indexAdmin = new ModuleAdmin();
+ echo $indexAdmin->addNavigation($currentFile);
+ include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
+ $form = new XoopsThemeForm(sprintf(
+ _AM_WFDOWNLOADS_CLONE_TITLE,
+ $wfdownloads->getModule()->getVar('name', 'E')
+ ), 'clone', $currentFile, 'post', true);
+ $cloneDirname_text = new XoopsFormText(_AM_WFDOWNLOADS_CLONE_NAME, 'clonedirname', 20, 20, '');
+ $cloneDirname_text->setDescription(_AM_WFDOWNLOADS_CLONE_NAME_DSC);
+ $form->addElement($cloneDirname_text, true);
+ $form->addElement(new XoopsFormHidden('op', 'submit'));
+ $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
+ $form->display();
+ include 'admin_footer.php';
+ exit();
+}
+
+// recursive clonning script
+function wfdownloads_cloneFileDir($path)
+{
+ global $patKeys;
+ global $patValues;
+
+ $newPath = str_replace($patKeys[0], $patValues[0], $path);
+
+ if (is_dir($path)) {
+ // create new dir
+ mkdir($newPath);
+ // check all files in dir, and process it
+ if ($handle = opendir($path)) {
+ while ($file = readdir($handle)) {
+ if ($file != '.' && $file != '..' && $file != '.svn') {
+ wfdownloads_cloneFileDir("{$path}/{$file}");
+ }
+ }
+ closedir($handle);
+ }
+ } else {
+ if (preg_match('/(.jpg|.gif|.png|.zip|.ttf)$/i', $path)) {
+ // image
+ copy($path, $newPath);
+ } else {
+ // file, read it
+ $content = file_get_contents($path);
+ $content = str_replace($patKeys, $patValues, $content);
+ file_put_contents($newPath, $content);
+ }
+ }
+}
+
+function wfdownloads_createLogo($dirname)
+{
+ $wfdownloads = WfdownloadsWfdownloads::getInstance();
+ // Check extension/functions
+ if (!extension_loaded("gd")) {
+ return false;
+ } else {
+ $required_functions = array(
+ "imagecreatetruecolor",
+ "imagecolorallocate",
+ "imagefilledrectangle",
+ "imagejpeg",
+ "imagedestroy",
+ "imageftbbox"
+ );
+ foreach ($required_functions as $func) {
+ if (!function_exists($func)) {
+ return false;
+ }
+ }
+ }
+ // Check original image/font
+ if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png")) {
+ return false;
+ }
+ if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $wfdownloads->getModule()->dirname() . "/images/VeraBd.ttf")) {
+ return false;
+ }
+ // Create image
+ $imageModule = imagecreatefrompng($imageBase);
+ // Erase old text
+ $greyColor = imagecolorallocate($imageModule, 237, 237, 237);
+ imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor);
+ // Write text
+ $textColor = imagecolorallocate($imageModule, 0, 0, 0);
+ $space_to_border = (80 - strlen($dirname) * 6.5) / 2;
+ imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $textColor, $font, ucfirst($dirname), array());
+ // Set transparency color
+ $whiteColor = imagecolorallocatealpha($imageModule, 255, 255, 255, 127);
+ imagefill($imageModule, 0, 0, $whiteColor);
+ imagecolortransparent($imageModule, $whiteColor);
+ // Save new image
+ imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png");
+ imagedestroy($imageModule);
+
+ return true;
+}
Modified: XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php
===================================================================
--- XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-10-06 04:04:07 UTC (rev 12146)
+++ XoopsModules/wfdownloads/trunk/wfdownloads/admin/downloads.php 2013-10-06 04:10:39 UTC (rev 12147)
@@ -47,8 +47,8 @@
// Allowed mimetypes list
echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFDOWNLOADS_FILE_ALLOWEDAMIME . "</legend>\n";
echo "<div style='padding: 8px;'>\n";
- $criteria = new Criteria("mime_admin", true);
- $mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
+ $criteria = new Criteria("mime_admin", true);
+ $mimetypes = $wfdownloads->getHandler('mimetype')->getList($criteria);
$allowMimetypes = implode(' | ', $mimetypes);
echo $allowMimetypes;
echo "</div>\n";
@@ -60,14 +60,14 @@
exit();
}
$cid = $download->getVar('cid');
- if(!$category = $wfdownloads->getHandler('category')->get($cid)) {
+ if (!$category = $wfdownloads->getHandler('category')->get($cid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_DOWN_ERROR_CATEGORYNOTFOUND);
exit();
}
$title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFDOWNLOADS_FFS_EDITDOWNLOADTITLE);
} else {
$download = $wfdownloads->getHandler('download')->create();
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
+ $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
$category = $wfdownloads->getHandler('category')->get($cid);
$download->setVar('cid', $cid);
$title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFDOWNLOADS_FFS_DOWNLOADTITLE);
@@ -78,23 +78,29 @@
$sform = $download->getAdminForm($title);
$sform->display();
} elseif ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) {
- $fid = $category->getVar('formulize_fid');
+ $fid = $category->getVar('formulize_fid');
$customArray = array();
- if($fid) {
+ if ($fid) {
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php";
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
- $customArray['fid'] = $fid;
+ $customArray['fid'] = $fid;
$customArray['formulize_mgr'] =& xoops_getmodulehandler('elements', 'formulize');
- $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
- $customArray['prevEntry'] = getEntryValues($download->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], $fid);
- $customArray['entry'] = $download->getVar('formulize_idreq');
- $customArray['go_back'] = "";
- $customArray['parentLinks'] = "";
- if (wfdownloads_checkModule('formulize') < 300)
+ $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $customArray['prevEntry'] = getEntryValues(
+ $download->getVar('formulize_idreq'),
+ $customArray['formulize_mgr'],
+ $customArray['groups'],
+ $fid
+ );
+ $customArray['entry'] = $download->getVar('formulize_idreq');
+ $customArray['go_back'] = "";
+ $customArray['parentLinks'] = "";
+ if (wfdownloads_checkModule('formulize') < 300) {
$owner = getEntryOwner($entry);
- else
+ } else {
$owner = getEntryOwner($entry, $fid);
- $ownerGroups = $member_handler->getGroupsByUser($owner, false);
+ }
+ $ownerGroups = $member_handler->getGroupsByUser($owner, false);
$customArray['owner_groups'] = $ownerGroups;
}
$sform = $download->getAdminForm($title, $customArray);
@@ -155,15 +161,19 @@
$uids[] = $regvotes[$i]->getVar('ratinguser');
}
- $criteria = new Criteria("ratinguser", "(".implode(',', $uids).")", "IN");
+ $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN");
$criteria->setGroupby("ratinguser");
$userratings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
foreach (array_keys($regvotes) as $i) {
$formatted_date = formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), _DATESTRING);
- $useravgrating = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar('ratinguser')]["avg"] : 0;
- $uservotes = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar('ratinguser')]["count"] : 0;
- $ratinguname = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser'));
+ $useravgrating = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar(
+ 'ratinguser'
+ )]["avg"] : 0;
+ $uservotes = isset($userratings[$regvotes[$i]->getVar('ratinguser')]) ? $userratings[$regvotes[$i]->getVar(
+ 'ratinguser'
+ )]["count"] : 0;
+ $ratinguname = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser'));
echo "
<tr><td class='head'>$ratinguname</td>\n
@@ -173,7 +183,8 @@
<td class='even'>$uservotes</th>\n
<td class='even'>$formatted_date</th>\n
<td class='even'>\n
- <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regvotes[$i]->getVar('ratingid') . "'>"
+ . $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
}
@@ -195,14 +206,14 @@
if ($votesanon == 0) {
echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOUNREGVOTES . "</b></td></tr>";
} else {
- $criteria = new Criteria('ratinguser', 0);
- $userratings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
+ $criteria = new Criteria('ratinguser', 0);
+ $userratings = $wfdownloads->getHandler('rating')->getUserAverage($criteria);
$anonymousVotes = $wfdownloads->getHandler('rating')->getObjects($anonymousCriteria);
foreach (array_keys($anonymousVotes) as $i) {
$formatted_date = formatTimestamp($anonymousVotes[$i]->getVar('ratingtimestamp'), _DATESTRING);
- $useravgrating = isset($userratings['avg']) ? $userratings["avg"] : 0;
- $uservotes = isset($userratings['count']) ? $userratings["count"] : 0;
+ $useravgrating = isset($userratings['avg']) ? $userratings["avg"] : 0;
+ $uservotes = isset($userratings['count']) ? $userratings["count"] : 0;
$ratinguname = $GLOBALS['xoopsConfig']['anonymous'];
@@ -214,7 +225,8 @@
<td class='even'>$uservotes</th>\n
<td class='even'>$formatted_date</th>\n
<td class='even'>\n
- <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonymousVotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n
+ <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonymousVotes[$i]->getVar('ratingid') . "'>"
+ . $imagearray['deleteimg'] . "</a>\n
</th></tr>\n
";
}
@@ -227,38 +239,38 @@
case "download.save" :
case "addDownload" :
- $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
- $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
+ $lid = WfdownloadsRequest::getInt('lid', 0, 'POST');
+ $cid = WfdownloadsRequest::getInt('cid', 0, 'POST');
$status = WfdownloadsRequest::getInt('status', 2, 'POST');
if ($lid > 0) {
$thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */
- $download = $wfdownloads->getHandler('download')->get($lid);
+ $download = $wfdownloads->getHandler('download')->get($lid);
} else {
$thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */
- $download = $wfdownloads->getHandler('download')->create();
+ $download = $wfdownloads->getHandler('download')->create();
}
// Define URL
if (empty($_FILES['userfile']['name'])) {
if ($_POST['url'] && $_POST['url'] != "" && $_POST['url'] != "http://") {
- $url = ($_POST['url'] != "http://") ? $_POST['url'] : '';
+ $url = ($_POST['url'] != "http://") ? $_POST['url'] : '';
$filename = '';
$filetype = '';
} else {
- $url = ($_POST["url"] != "http://") ? $_POST['url'] : '';
+ $url = ($_POST["url"] != "http://") ? $_POST['url'] : '';
$filename = $_POST['filename'];
$filetype = $_POST['filetype'];
}
- $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int)$_POST["size"];
+ $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int)$_POST["size"];
$title = trim($_POST['title']);
$download->setVar('filename', $filename);
$download->setVar('filetype', $filetype);
} else {
- $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, false, true);
- $url = ($_POST['url'] != "http://") ? $_POST["url"] : '';
- $size = $down['size'];
+ $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, false, true);
+ $url = ($_POST['url'] != "http://") ? $_POST["url"] : '';
+ $size = $down['size'];
$title = $_FILES['userfile']['name'];
- $ext = rtrim(strrchr($title, '.'), '.');
+ $ext = rtrim(strrchr($title, '.'), '.');
$title = str_replace($ext, '', $title);
$title = (isset($_POST['title_checkbox']) && $_POST['title_checkbox'] == 1) ? $title : trim($_POST['title']);
@@ -268,7 +280,7 @@
$download->setVar('filetype', $filetype);
}
// Get data from form
- $screenshot = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : '';
+ $screenshot = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : '';
$screenshot2 = ($_POST['screenshot2'] != 'blank.png') ? $_POST['screenshot2'] : '';
$screenshot3 = ($_POST['screenshot3'] != 'blank.png') ? $_POST['screenshot3'] : '';
$screenshot4 = ($_POST['screenshot4'] != 'blank.png') ? $_POST['screenshot4'] : '';
@@ -287,15 +299,17 @@
// If both conditions are true, then trigger all three notifications related to modified records.
if (!$thisIsANewRecord and ($download->getVar('version') != $version)) {
// Trigger the three events related to modified files (one for the file, category, and global event categories respectively)
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $category = $wfdownloads->getHandler('category')->get($cid);
- $tags['FILE_VERSION'] = $version;
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $category = $wfdownloads->getHandler('category')->get($cid);
+ $tags['FILE_VERSION'] = $version;
$tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}";
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}";
- if ($wfdownloads->getConfig('autoapprove') == _WFDOWNLOADS_AUTOAPPROVE_DOWNLOAD || $wfdownloads->getConfig('autoapprove') == _WFDOWNLOADS_AUTOAPPROVE_BOTH) {
+ if ($wfdownloads->getConfig('autoapprove') == _WFDOWNLOADS_AUTOAPPROVE_DOWNLOAD
+ || $wfdownloads->getConfig('autoapprove') == _WFDOWNLOADS_AUTOAPPROVE_BOTH
+ ) {
// Then this change will be automatically approved, so the notification needs to go out.
$notification_handler->triggerEvent('global', 0, 'filemodified', $tags);
$notification_handler->triggerEvent('category', $cid, 'filemodified', $tags);
@@ -330,12 +344,12 @@
$versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : '';
$download->setVar('versiontypes', $versiontypes);
- $dhistory = (isset($_POST['dhistory'])) ? $_POST['dhistory'] : '';
+ $dhistory = (isset($_POST['dhistory'])) ? $_POST['dhistory'] : '';
$dhistoryhistory = (isset($_POST['dhistoryaddedd'])) ? $_POST['dhistoryaddedd'] : '';
if ($lid > 0 && !empty($dhistoryhistory)) {
$dhistory = $dhistory . "\n\n";
- $time = time();
+ $time = time();
$dhistory .= _AM_WFDOWNLOADS_FILE_HISTORYVERS . $version . _AM_WFDOWNLOADS_FILE_HISTORDATE . formatTimestamp($time, _DATESTRING) . "\n\n";
$dhistory .= $dhistoryhistory;
}
@@ -351,7 +365,7 @@
$offline = ($_POST['offline'] == 1) ? 1 : 0;
$download->setVar('offline', $offline);
- $approved = (isset($_POST['approved']) && $_POST['approved'] == true) ? true : false;
+ $approved = (isset($_POST['approved']) && $_POST['approved'] == true) ? true : false;
$notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == true);
$expiredate = 0;
@@ -359,7 +373,7 @@
$publishdate = time();
} else {
$publishdate = $_POST['was_published'];
- $expiredate = $_POST['was_expired'];
+ $expiredate = $_POST['was_expired'];
}
if ($approved == 1 && empty($publishdate)) {
$publishdate = time();
@@ -390,35 +404,45 @@
// Added Formulize module support (2006/05/04) jpc - start
if (wfdownloads_checkModule('formulize')) {
$fid = $category->getVar('formulize_fid');
- if($fid) {
+ if ($fid) {
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php";
include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php";
$formulize_mgr =& xoops_getmodulehandler('elements', 'formulize');
if ($lid) {
$entries[$fid][0] = $download->getVar('formulize_idreq');
- if($entries[$fid][0]) {
- if (wfdownloads_checkModule('formulize') < 300)
+ if ($entries[$fid][0]) {
+ if (wfdownloads_checkModule('formulize') < 300) {
$owner = getEntryOwner($entries[$fid][0]);
- else
+ } else {
$owner = getEntryOwner($entries[$fid][0], $fid);
+ }
} else {
print "no idreq";
$entries[$fid][0] = "";
- $owner = "";
+ $owner = "";
}
$cid = $download->getVar('cid');
} else {
- $entries[$fid][0] = "";
- $owner = "";
+ $entries[$fid][0] = "";
+ $owner = "";
}
$ownerGroups =& $member_handler->getGroupsByUser($owner, false);
- $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
- $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
- $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $ownerGroups, $groups, "new"); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that
- if(!$owner) {
- $id_req = $entries[$fid][0];
- $download->setVar('formulize_idreq', $id_req);
- }
+ $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
+ $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
+ $entries = handleSubmission(
+ $formulize_mgr,
+ $entries,
+ $uid,
+ $owner,
+ $fid,
+ $ownerGroups,
+ $groups,
+ "new"
+ ); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that
+ if (!$owner) {
+ $id_req = $entries[$fid][0];
+ $download->setVar('formulize_idreq', $id_req);
+ }
}
}
// Added Formulize module support (2006/05/04) jpc - end
@@ -426,26 +450,26 @@
$newid = (int)$download->getVar('lid');
// Send notifications
if (!$lid) {
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$newid}";
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$newid}";
$tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
}
if ($lid && $approved && $notifypub) {
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
- $category = $wfdownloads->getHandler('category')->get($cid);
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $category = $wfdownloads->getHandler('category')->get($cid);
$tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid;
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
$notification_handler->triggerEvent('file', $lid, 'approve', $tags);
}
- $message = (!$lid) ? _AM_WFDOWNLOADS_FILE_NEWFILEUPLOAD : _AM_WFDOWNLOADS_FILE_FILEMODIFIEDUPDATE ;
+ $message = (!$lid) ? _AM_WFDOWNLOADS_FILE_NEWFILEUPLOAD : _AM_WFDOWNLOADS_FILE_FILEMODIFIEDUPDATE;
$message = ($lid && !$_POST['was_published'] && $approved) ? _AM_WFDOWNLOADS_FILE_FILEAPPROVED : $message;
redirect_header($currentFile, 1, $message);
@@ -453,7 +477,7 @@
case "download.delete" :
$lid = WfdownloadsRequest::getInt('lid', 0);
- $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
+ $ok = WfdownloadsRequest::getBool('ok', false, 'POST');
if (!$download = $wfdownloads->getHandler('download')->get($lid)) {
redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND);
exit();
@@ -475,7 +499,12 @@
}
} else {
wfdownloads_xoops_cp_header();
- xoops_confirm(array('op' => 'download.delete', 'lid' => $lid, 'ok' => true, 'title' => $title), $currentFile, _AM_WFDOWNLOADS_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE);
+ xoops_confirm(
+ array('op' => 'download.delete', 'lid' => $lid, 'ok' => true, 'title' => $title),
+ $currentFile,
+ _AM_WFDOWNLOADS_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title,
+ _DELETE
+ );
xoops_cp_footer();
}
break;
@@ -492,7 +521,7 @@
// Added Formulize module support (2006/05/04) jpc - start
case "patch_formulize" :
if (wfdownloads_checkModule('formulize')) {
- if(!isset($_POST['patch_formulize'])) {
+ if (!isset($_POST['patch_formulize'])) {
print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>";
print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">";
print "</form>";
@@ -500,9 +529,12 @@
global $xoopsDB;
$sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_cat") . " ADD formulize_fid int(5) NOT NULL default '0';";
$sqls[] = "ALTER TABLE " . $xoopsDB->prefix("wfdownloads_downloads") . " ADD formulize_idreq int(5) NOT NULL default '0';";
- foreach($sqls as $sql)
- if(!$result = $xoopsDB->queryF($sql))
- exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql . "<br>Please contact <a hre...@fr...>Freeform Solutions</a> for assistance.");
+ foreach ($sqls as $sql) {
+ if (!$result = $xoopsDB->queryF($sql)) {
+ exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql
+ . "<br>Please contact <a hre...@fr...>Freeform Solutions</a> for assistance.");
+ }
+ }
print "Patching for Formulize completed.";
}
}
@@ -524,14 +556,14 @@
exit();
}
// Trigger notify
- $title = $download->getVar('title');
- $cid = $download->getVar('cid');
- $category = $wfdownloads->getHandler('category')->get($cid);
- $tags = array();
- $tags['FILE_NAME'] = $title;
- $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
+ $title = $download->getVar('title');
+ $cid = $download->getVar('cid');
+ $category = $wfdownloads->getHandler('category')->get($cid);
+ $tags = array();
+ $tags['FILE_NAME'] = $title;
+ $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}";
$tags['CATEGORY_NAME'] = $category->getVar('title');
- $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
+ $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid={$cid}";
$notification_handler->triggerEvent('global', 0, 'new_file', $tags);
$notification_handler->triggerEvent('category', $cid, 'new_file', $tags);
if ($download->getVar('notifypub')) {
@@ -543,29 +575,31 @@
case "downloads.list" :
case "downloads.filter" :
default :
- $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '=');
- $filter_title = WfdownloadsRequest::getString('filter_title', '');
+ $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '=');
+ $filter_title = WfdownloadsRequest::getString('filter_title', '');
$filter_category_title_condition = WfdownloadsRequest::getString('filter_category_title_condition', '=');
- $filter_category_title = WfdownloadsRequest::getString('filter_category_title', '');
- $filter_poster = WfdownloadsRequest::getArray('filter_poster', null);
- $filter_date = WfdownloadsRequest::getArray('filter_date', null);
- $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<');
+ $filter_category_title = WfdownloadsRequest::getString('filter_category_title', '');
+ $filter_poster = WfdownloadsRequest::getArray('filter_poster', null);
+ $filter_date = WfdownloadsRequest::getArray('filter_date', null);
+ $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<');
if ($op == 'downloads.filter') {
- if ($filter_title == '' && $filter_category_title == '' && is_null($filter_poster)) $op = 'downloads.list';
+ if ($filter_title == '' && $filter_category_title == '' && is_null($filter_poster)) {
+ $op = 'downloads.list';
+ }
}
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$categories = $wfdownloads->getHandler('category')->getObjects();
- $start_published = WfdownloadsRequest::getInt('start_published', 0);
- $start_new = WfdownloadsRequest::getInt('start_new', 0);
+ $start_published = WfdownloadsRequest::getInt('start_published', 0);
+ $start_new = WfdownloadsRequest::getInt('start_new', 0);
$start_autopublished = WfdownloadsRequest::getInt('start_autopublished', 0);
- $start_expired = WfdownloadsRequest::getInt('start_expired', 0);
- $start_offline = WfdownloadsRequest::getInt('start_offline', 0);
+ $start_expired = WfdownloadsRequest::getInt('start_expired', 0);
+ $start_offline = WfdownloadsRequest::getInt('start_offline', 0);
- $totalcats = wfdownloads_categoriesCount();
+ $totalcats = wfdownloads_categoriesCount();
$categories = $wfdownloads->getHandler('category')->getObjects(null, true, false);
$totalDownloadsCount = $wfdownloads->getHandler('download')->getCount();
@@ -615,15 +649,15 @@
$criteria->setOrder('DESC');
$criteria->setStart($start_published);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
+ $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria);
$publishedDownloadsCount = $wfdownloads->getHandler('download')->getActiveCount();
$GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadsCount);
if ($publishedDownloadsCount > 0) {
foreach ($publishedDownloads as $publishedDownload) {
- $publishedDownload_array = $publishedDownload->toArray();
- $publishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($publishedDownload_array['title']));
- $publishedDownload_array['category_title'] = $categories[$publishedDownload_array['cid']]['title'];
- $publishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($publishedDownload_array['submitter']);
+ $publishedDownload_array = $publishedDownload->toArray();
+ $publishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($publishedDownload_array['title']));
+ $publishedDownload_array['category_title'] = $categories[$publishedDownload_array['cid']]['title'];
+ $publishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($publishedDownload_array['submitter']);
$publishedDownload_array['published_timestamp'] = formatTimestamp($publishedDownload_array['published'], _DATESTRING);
$GLOBALS['xoopsTpl']->append('published_downloads', $publishedDownload_array);
}
@@ -634,9 +668,9 @@
$GLOBALS['xoopsTpl']->assign('filter_title_condition', $filter_title_condition);
$GLOBALS['xoopsTpl']->assign('filter_category_title', $filter_category_title);
$GLOBALS['xoopsTpl']->assign('filter_category_title_condition', $filter_category_title_condition);
- $poster_select = new XoopsFormSelectUser(null, 'filter_poster', true, $filter_poster, 2, true);
+ $poster_select = new XoopsFormSelectUser(null, 'filter_poster', true, $filter_poster, 2, true);
$GLOBALS['xoopsTpl']->assign('filter_poster_select', $poster_select->render());
- $date_select = new XoopsFormDateTime (null, 'filter_date', 15, time(), false);
+ $date_select = new XoopsFormDateTime (null, 'filter_date', 15, time(), false);
$GLOBALS['xoopsTpl']->assign('filter_date_select', $date_select->render());
$GLOBALS['xoopsTpl']->assign('filter_date_condition', $filter_date_condition);
@@ -646,23 +680,23 @@
$criteria->add(new Criteria('published', 0));
$criteria->setStart($start_new);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $newDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $newDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
$newDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadsCount);
if ($newDownloadsCount > 0) {
foreach ($newDownloads as $newDownload) {
- $newDownload_array = $newDownload->toArray();
- $newDownload_array['rating'] = number_format($newDownload_array['rating'], 2);
- $newDownload_array['title_html'] = $myts->htmlSpecialChars($newDownload_array['title']);
- $newDownload_array['category_title'] = $categories[$newDownload_array['cid']]['title'];
- $url = urldecode($myts->htmlSpecialChars($newDownload_array['url']));
- $homepage = $myts->htmlSpecialChars($newDownload_array['homepage']);
- $version = $myts->htmlSpecialChars($newDownload_array['version']);
- $size = $myts->htmlSpecialChars($newDownload_array['size']);
- $platform = $myts->htmlSpecialChars($newDownload_array['platform']);
- $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']);
+ $newDownload_array = $newDownload->toArray();
+ $newDownload_array['rating'] = number_format($newDownload_array['rating'], 2);
+ $newDownload_array['title_html'] = $myts->htmlSpecialChars($newDownload_array['title']);
+ $newDownload_array['category_title'] = $categories[$newDownload_array['cid']]['title'];
+ $url = urldecode($myts->htmlSpecialChars($newDownload_array['url']));
+ $homepage = $myts->htmlSpecialChars($newDownload_array['homepage']);
+ $version = $myts->htmlSpecialChars($newDownload_array['version']);
+ $size = $myts->htmlSpecialChars($newDownload_array['size']);
+ $platform = $myts->htmlSpecialChars($newDownload_array['platform']);
+ $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']);
$newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']);
- $newDownload_array['date_timestamp'] = formatTimestamp($newDownload_array['date'], _DATESTRING);
+ $newDownload_array['date_timestamp'] = formatTimestamp($newDownload_array['date'], _DATESTRING);
$GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array);
}
}
@@ -676,20 +710,22 @@
$criteria->setOrder("ASC");
$criteria->setStart($start_autopublished);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $autopublishedDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $autopublishedDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
$autopublishedDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadsCount);
if ($autopublishedDownloadsCount > 0) {
foreach ($autopublishedDownloads as $autopublishedDownload) {
- $autopublishedDownload_array = $autopublishedDownload->toArray();
- $autopublishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($autopublishedDownload_array['title']));
- $autopublishedDownload_array['category_title'] = $categories[$autopublishedDownload_array['cid']]['title'];
- $autopublishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($autopublishedDownload_array['submitter']);
+ $autopublishedDownload_array = $autopublishedDownload->toArray();
+ $autopublishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($autopublishedDownload_array['title']));
+ $autopublishedDownload_array['category_title'] = $categories[$autopublishedDownload_array['cid']]['title'];
+ $autopublishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($autopublishedDownload_array['submitter']);
$autopublishedDownload_array['published_timestamp'] = formatTimestamp($autopublishedDownload_array['published'], _DATESTRING);
$GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array);
}
}
- $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_autopublished, 'start_autopublished');
+ $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig(
+ 'admin_perpage'
+ ), $start_autopublished, 'start_autopublished');
$GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav());
// Expired downloads
@@ -700,15 +736,15 @@
$criteria->setOrder('ASC');
$criteria->setStart($start_expired);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
- $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria);
$expiredDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadsCount);
- if ($expiredDownloadsCount > 0) {
+ if ($expiredDownloadsCount > 0) {
foreach ($expired_downloads as $expired_download) {
- $expired_download_array = $expired_download->toArray();
- $expired_download_array['title_html'] = $myts->htmlSpecialChars(trim($expired_download_array['title']));
- $expired_download_array['category_title'] = $categories[$expired_download_array['cid']]['title'];
- $expired_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($expired_download_array['submitter']);
+ $expired_download_array = $expired_download->toArray();
+ $expired_download_array['title_html'] = $myts->htmlSpecialChars(trim($expired_download_array['title']));
+ $expired_download_array['category_title'] = $categories[$expired_download_array['cid']]['title'];
+ $expired_download_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($expired_download_array['submitter']);
$expired_download_array['published_timestamp'] = formatTimestamp($expired_download_array['published'], _DATESTRING);
$GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array);
}
@@ -723,15 +759,15 @@
$criteria->setStart($start_offline);
$criteria->setLimit($wfdownloads->getConfig('admin_perpage'));
$offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
- $offlineDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
+ $offlineDownloads = $wfdownloads->getHandler('download')->getObjects($criteria);
$offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadsCount);
if ($offlineDownloadsCount > 0) {
foreach ($offlineDownloads as $offlineDownload) {
- $offlineDownload_array = $offlineDownload->toArray();
- $offlineDownload_array['title_html'] = $myts->htmlSpecialChars(trim($offlineDownload_array['title']));
- $offlineDownload_array['category_title'] = $categories[$offlineDownload_array['cid']]['title'];
- $offlineDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($offlineDownload_array['submitter']);
+ $offlineDownload_array = $offlineDownload->toArray();
+ $offlineDownload_array['title_html'] = $myts->htmlSpecialChars(trim($offlineDownload_array['title']));
+ $offlineDownload_array['category_title'] = $categories[$offlineDownload_array['cid']]['title'];
+ $offlineDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($offlineDownload_array['submitter']);
$offlineDownload_array['published_timestamp'] = formatTimestamp($offlineDownload_array['published'], _DATESTRING);
$GLOBALS['xoopsTpl']->append('offline_downloads', $offlineDownload_array);
@@ -749,7 +785,7 @@
case "ip_logs.list" :
$lid = WfdownloadsRequest::getInt('lid', 0);
- if(!$lid) {
+ if (!$lid) {
header('Location index.php');
}
@@ -769,15 +805,15 @@
}
$criteria->setSort('date');
$criteria->setOrder('DESC');
- $ip_logs = $wfdownloads->getHandler('ip_log')->getObjects($criteria);
+ $ip_logs = $wfdownloads->getHandler('ip_log')->getObjects($criteria);
$ip_logs_count = $wfdownloads->getHandler('ip_log')->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logs_count);
unset($criteria);
// Get download info
if ($lid != 0) {
- $download = $wfdownloads->getHandler('download')->get($lid);
- $download_array = $download->toArray();
+ $download = $wfdownloads->getHandler('download')->get($lid);
+ $download_array = $download->toArray();
$download_array['log_title'] = sprintf(_AM_WFDOWNLOADS_LOG_FOR_LID, $download_array['title']);
$GLOBALS['xoopsTpl']->assign('download', $download_array);
}
@@ -785,23 +821,25 @@
// Get all logged users
$uidArray = array();
- foreach($ip_logs as $ip_log) {
- if($ip_log->getVar('uid')!= 0 && $ip_log->getVar('uid') != '') {
+ foreach ($ip_logs as $ip_log) {
+ if ($ip_log->getVar('uid') != 0 && $ip_log->getVar('uid') != '') {
$uidArray[] = $ip_log->getVar('uid');
}
}
$criteria = new CriteriaCompo();
- if(!empty($uidArray)) {
+ if (!empty($uidArray)) {
$criteria->add(new Criteria('uid', '(' . implode(', ', $uidArray) . ')', 'IN'));
}
$userList = $member_handler->getUserList($criteria);
- if(empty($ip_logs)){
+ if (empty($ip_logs)) {
// NOP
} else {
- foreach($ip_logs as $ip_log){
- $ip_log_array = $ip_log->toArray();
- $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId($ip_log_array['uid']);//($ip_log_array['uid'] != 0) ? $userList[$ip_log_array['uid']] : _AM_WFDOWNLOADS_ANONYMOUS;
- $ip_log_array['date_timestamp'] = formatTimestamp($ip_log_array['date']);
+ foreach ($ip_logs as $ip_log) {
+ $ip_log_array = $ip_log->toArray();
+ $ip_log_array['uname'] = XoopsUserUtility::getUnameFro...
[truncated message content] |