From: <luc...@us...> - 2013-05-20 19:58:18
|
Revision: 11566 http://sourceforge.net/p/xoops/svn/11566 Author: luciorota Date: 2013-05-20 19:58:14 +0000 (Mon, 20 May 2013) Log Message: ----------- Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top_by_cat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/object.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/rating.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/report.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfd_lists.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_delete.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_edit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_new.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_post.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_reply.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/footer.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/comment_functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/update.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php Added Paths: ----------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -0,0 +1,702 @@ +<?php +/** + * $Id: main.php,v 1.23 2007/09/30 12:39:13 m0nty_ Exp $ + * Module: WF-Downloads + * Version: v2.0.5a + * Release Date: 26 july 2004 + * Author: WF-Sections + * Licence: GNU + */ + +include 'admin_header.php'; +include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; +include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; +include_once WFDOWNLOADS_ROOT_PATH . 'class/wfd_lists.php'; +include_once XOOPS_ROOT_PATH . '/class/tree.php'; +include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; + +//$mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid", "pid"); + +function Download() +{ + $lid = isset($_REQUEST['lid']) ? intval($_REQUEST['lid']) : 0; + + $category_handler = xoops_getmodulehandler('category'); + $numrows = $category_handler->getCount(); + if ($numrows) { + wfdownloads_xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('main.php'); + + //wfdownloads_adminMenu(3, _AM_WFD_MDOWNLOADS); + + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n + <div style='padding: 8px;'>\n"; + + $mime_handler = xoops_getmodulehandler('mimetype'); + $criteria = new Criteria("mime_admin", 1); + $mimetypes = $mime_handler->getList($criteria); + $allowmimetypes = implode(' | ', $mimetypes); + echo $allowmimetypes; + echo "</div>\n + </fieldset><br />\n + "; + + $download_handler = xoops_getmodulehandler('download'); + if ($lid) { + $download = $download_handler->get($lid); + $title = _AM_WFD_FILE_MODIFYFILE; + // added - start - March 4 2006 - jpc + $cid = intval($download->getVar('cid')); + $category = $category_handler->get($cid); + // added - end - March 4 2006 - jpc + // changed - start - April 22 2006 - jwe + //$title = _AM_WFD_FILE_MODIFYFILE; + $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_EDITDOWNLOADTITLE); + // changed - end - April 22 2006 - jwe + } else { + $download = $download_handler->create(); + $title = _AM_WFD_FILE_CREATENEWFILE; + // added - start - March 4 2006 - jpc + $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0 ; + $download->setVar('cid', $cid); + $category = $category_handler->get($cid); + // added - end - March 4 2006 - jpc + // changed - start - April 22 2006 - jwe + //$title = _AM_WFD_FILE_CREATENEWFILE; + $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_DOWNLOADTITLE); + // changed - end - April 22 2006 - jwe + } + + // changed - start - March 4 2006 - jpc + if ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) { + + $fid = $category->getVar('formulize_fid'); + $customArray = array(); + if($fid) { + global $xoopsUser; + include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php"; + include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php"; + + $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'] = ""; + + $owner = getEntryOwner($entry); + $member_handler =& xoops_gethandler('member'); + $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE); + + $customArray['owner_groups'] = $owner_groups; + } + $sform = $download->getAdminForm($title, $customArray); + } elseif(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) { + $sform = $download->getCategoryForm(); + } else { + $sform = $download->getAdminForm($title); + } + $sform->display(); + // changed - end - March 4 2006 - jpc + } else { + redirect_header(WFDOWNLOADS_URL . 'admin/category.php?', 1, _AM_WFD_CCATEGORY_NOEXISTS); + exit(); + } + + if ($lid) { + global $imagearray; + // Vote data + $rating_handler = xoops_getmodulehandler('rating'); + $totalvotes = $rating_handler->getCount(); + + $reg_criteria = new CriteriaCompo(new Criteria('lid', $lid)); + $reg_criteria->add(new Criteria("ratinguser", 0, ">")); + $votesreg = $rating_handler->getCount($reg_criteria); + $reg_criteria->setSort("ratingtimestamp"); + $reg_criteria->setOrder("DESC"); + $regvotes = $rating_handler->getObjects($reg_criteria); + + $anon_criteria = new CriteriaCompo(new Criteria('lid', $lid)); + $anon_criteria->add(new Criteria("ratinguser", 0, "=")); + $votesanon = $rating_handler->getCount($anon_criteria); + $anon_criteria->setSort("ratingtimestamp"); + $anon_criteria->setOrder("DESC"); + + echo " + <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n + <div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n + "; + + printf(_AM_WFD_VOTE_REGUSERVOTES, $votesreg); + + echo "<br />"; + + printf(_AM_WFD_VOTE_ANONUSERVOTES, $votesanon); + + echo " + </div>\n + <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n + <tr>\n + <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n + <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n + </tr>\n + "; + + if ($votesreg == 0) { + echo "<tr><td align='center' colspan='7' class='even'><b>" . _AM_WFD_VOTE_NOREGVOTES . "</b></td></tr>"; + } else { + foreach (array_keys($regvotes) as $i) { + $uids[] = $regvotes[$i]->getVar('ratinguser'); + } + + $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN"); + $criteria->setGroupby("ratinguser"); + $userratings = $rating_handler->getUserAverage($criteria); + + + foreach (array_keys($regvotes) as $i) { + $formatted_date = formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), $xoopsModuleConfig['dateformat']); + $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 align='center' class='head'>$ratinguname</td>\n + <td align='center' class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n + <td align='center' class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n + <td align='center' class='even'>$useravgrating</th>\n + <td align='center' class='even'>$uservotes</th>\n + <td align='center' class='even'>$formatted_date</th>\n + <td align='center' class='even'>\n + <a href='" . WFDOWNLOADS_URL . "admin/main.php?op=delVote&lid=" . $lid . "&rid=" . $regvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n + </th></tr>\n + "; + } + } + echo " + </table>\n + <br />\n + <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n + <tr>\n + <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n + <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n + </tr>\n + "; + if ($votesanon == 0) { + echo "<tr><td colspan='7' align='center' class='even'><b>" . _AM_WFD_VOTE_NOUNREGVOTES . "</b></td></tr>"; + } else { + $criteria = new Criteria("ratinguser", 0); + $userratings = $rating_handler->getUserAverage($criteria); + $anonvotes = $rating_handler->getObjects($anon_criteria); + + foreach (array_keys($anonvotes) as $i) { + $formatted_date = formatTimestamp($anonvotes[$i]->getVar('ratingtimestamp'), $xoopsModuleConfig['dateformat']); + $useravgrating = isset($userratings['avg']) ? $userratings["avg"] : 0; + $uservotes = isset($userratings['count']) ? $userratings["count"] : 0; + + $ratinguname = $GLOBALS['xoopsConfig']['anonymous']; + + echo " + <tr><td align='center' class='head'>$ratinguname</td>\n + <td align='center' class='even'>" . $anonvotes[$i]->getVar('ratinghostname') . "</th>\n + <td align='center' class='even'>" . $anonvotes[$i]->getVar('rating') . "</th>\n + <td align='center' class='even'>$useravgrating</th>\n + <td align='center' class='even'>$uservotes</th>\n + <td align='center' class='even'>$formatted_date</th>\n + <td align='center' class='even'>\n + <a href='" . WFDOWNLOADS_URL . "admin/main.php?op=delVote&lid=" . $lid . "&rid=" . $anonvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n + </th></tr>\n + "; + } + } + echo " + </table>\n + </fieldset>\n + "; + } + xoops_cp_footer(); +} + +function delVote() +{ + global $_GET; + $rating_handler = xoops_getmodulehandler('rating'); + $rating = $rating_handler->get($_GET['rid']); + if ($rating_handler->delete($rating, true)) { + wfd_updaterating(intval($rating->getVar('lid'))); + } + redirect_header(WFDOWNLOADS_URL . 'admin/main.php', 1, _AM_WFD_VOTE_VOTEDELETED); +} + +function addDownload() +{ + global $xoopsUser, $xoopsModuleConfig; + + $lid = (!empty($_POST['lid'])) ? intval($_POST['lid']) : 0; + $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0; + $status = (!empty($_POST['status'])) ? intval($_POST['status']) : 2; + + $download_handler = xoops_getmodulehandler('download'); + if ($lid > 0) { + $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */ + $download = $download_handler->get($lid); + } else { + $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */ + $download = $download_handler->create(); + } + + /** + * Define URL + */ + if (empty($_FILES['userfile']['name'])) { + if ($_POST["url"] && $_POST["url"] != "" && $_POST["url"] != "http://") { + $url = ($_POST["url"] != "http://") ? $_POST["url"] : ''; + $filename = ''; + $filetype = ''; + } else { + $url = ($_POST["url"] != "http://") ? $_POST["url"] : ''; + $filename = $_POST['filename']; + $filetype = $_POST['filetype']; + } + $size = ((empty($_POST["size"]) || !is_numeric($_POST["size"]))) ? 0 : intval($_POST["size"]); + $title = trim($_POST["title"]); + $download->setVar('filename', $filename); + $download->setVar('filetype', $filetype); + } else { + global $_FILES; + $down = wfd_uploading($_FILES, $xoopsModuleConfig['uploaddir'], "", "download.php?op=download", 0, 0); + $url = ($_POST["url"] != "http://") ? $_POST["url"] : ''; + $size = $down['size']; + $title = $_FILES['userfile']['name']; + $ext = rtrim(strrchr($title, '.'), '.'); + $title = str_replace($ext, '', $title); + $title = (isset($_POST["title_checkbox"]) && $_POST["title_checkbox"] == 1) ? $title : trim($_POST["title"]); + + $filename = $down['filename']; + $filetype = $_FILES['userfile']['type']; + $download->setVar('filename', $filename); + $download->setVar('filetype', $filetype); + } + + /** + * Get data from form + */ + $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"] : ''; + + if (!empty($_POST["homepage"]) || $_POST["homepage"] != "http://") { + $download->setVar('homepage', trim($_POST["homepage"])); + $download->setVar('homepagetitle', trim($_POST["homepagetitle"])); + } + + $version = (!empty($_POST["version"])) ? trim($_POST["version"]) : 0; + + /* Added by Lankford on 2007/3/21 */ + // Here, I want to know if: + // a) Are they actually changing the value of version, or is it the same? + // b) Are they actually modifying the record, or is this a new one? + // 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) + $notification_handler = &xoops_gethandler('notification'); + $tags = array(); + $tags['FILE_NAME'] = $title; + $tags['FILE_URL'] = WFDOWNLOADS_URL . 'singlefile.php?cid=' . $cid . '&lid=' . $lid; + $category_handler = xoops_getmodulehandler('category'); + $category = $category_handler->get($cid); + $tags['FILE_VERSION'] = $version; + $tags['CATEGORY_NAME'] = $category->getVar('title'); + $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid; + + if ($xoopsModuleConfig['autoapprove'] == 2 || $xoopsModuleConfig['autoapprove'] == 4) { + // 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); + $notification_handler->triggerEvent('file', $lid, 'filemodified', $tags); + } + } + /* End add block */ + + $download->setVar('version', $version); + $download->setVar('url', $url); + $download->setVar('cid', $cid); + $download->setVar('title', $title); + $download->setVar('status', $status); + $download->setVar('size', $size); + $download->setVar('screenshot', $screenshot); + $download->setVar('screenshot2', $screenshot2); + $download->setVar('screenshot3', $screenshot3); + $download->setVar('screenshot4', $screenshot4); + $download->setVar('platform', trim($_POST["platform"])); + $download->setVar('summary', trim($_POST["summary"])); + $download->setVar('description', trim($_POST["description"])); + $download->setVar('submitter', trim($_POST["submitter"])); + $download->setVar('publisher', trim($_POST["publisher"])); + $download->setVar('price', trim($_POST["price"])); + if (!$xoopsModuleConfig['enable_mirrors']) { + $download->setVar('mirror', formatURL(trim($_POST["mirror"]))); + } + $download->setVar('license', trim($_POST["license"])); + $download->setVar('features', trim($_POST["features"])); + $download->setVar('requirements', trim($_POST["requirements"])); + $limitations = (isset($_POST["limitations"])) ? $_POST["limitations"] : ''; + $download->setVar('limitations', $limitations); + $versiontypes = (isset($_POST["versiontypes"])) ? $_POST["versiontypes"] : ''; + $download->setVar('versiontypes', $versiontypes); + + $dhistory = (isset($_POST["dhistory"])) ? $_POST["dhistory"] : ''; + $dhistoryhistory = (isset($_POST["dhistoryaddedd"])) ? $_POST["dhistoryaddedd"] : ''; + + if ($lid > 0 && !empty($dhistoryhistory)) { + $dhistory = $dhistory . "\n\n"; + $time = time(); + $dhistory .= _AM_WFD_FILE_HISTORYVERS . $version . _AM_WFD_FILE_HISTORDATE . formatTimestamp($time, $xoopsModuleConfig['dateformat']) . "\n\n"; + $dhistory .= $dhistoryhistory; + } + $download->setVar('dhistory', $dhistory); + $download->setVar('dhistoryhistory', $dhistoryhistory); + + $updated = (isset($_POST['was_published']) && $_POST['was_published'] == 0) ? 0 : time(); + + if ($_POST['up_dated'] == 0) { + $updated = 0; + } + $download->setVar('updated', $updated); + + $offline = ($_POST['offline'] == 1) ? 1 : 0; + $download->setVar('offline', $offline); + $approved = (isset($_POST['approved']) && $_POST['approved'] == 1) ? 1 : 0; + $notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == 1); + + $expiredate = 0; + if (!$lid) { + $publishdate = time(); + } else { + $publishdate = $_POST['was_published']; + $expiredate = $_POST['was_expired']; + } + + if ($approved == 1 && empty($publishdate)) + { + $publishdate = time(); + } + + if (isset($_POST['publishdateactivate'])) { + $publishdate = strtotime($_POST['published']['date']) + $_POST['published']['time']; + } + if ($_POST['clearpublish']) { + $publishdate = $download->getVar('published'); + } + + if (isset($_POST['expiredateactivate'])) { + $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time']; + } + if ($_POST['clearexpire']) { + $expiredate = '0'; + } + + $download->setVar('expired', $expiredate); + $download->setVar('published', $publishdate); + $download->setVar('date', time()); + /** + * Update or insert download data into database + */ + if (!$lid) { + $download->setVar('ipaddress', $_SERVER['REMOTE_ADDR']); + } + + // added - start - March 4 2006 - jpc + $category_handler = xoops_getmodulehandler('category'); + $category = $category_handler->get($cid); + $fid = $category->getVar('formulize_fid'); + if($fid) { + global $xoopsUser; + 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]) { + $owner = getEntryOwner($entries[$fid][0]); + } else { + print "no idreq"; + $entries[$fid][0] = ""; + $owner = ""; + } + $cid = $download->getVar('cid'); + } else { + $entries[$fid][0] = ""; + $owner = ""; + } + $member_handler =& xoops_gethandler('member'); + $owner_groups =& $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, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that + + //if (!$lid) + if(!$owner) { + $id_req = $entries[$fid][0]; + $download->setVar('formulize_idreq', $id_req); + } + } + // added - end - March 4 2006 - jpc + + + $download_handler->insert($download); + $newid = intval($download->getVar('lid')); + /** + * Send notifications + */ + if (!$lid) { + $tags = array(); + $tags['FILE_NAME'] = $title; + $tags['FILE_URL'] = WFDOWNLOADS_URL . 'singlefile.php?cid=' . $cid . '&lid=' . $newid; + + // changed - start - March 4 2006 - jpc + //$category_handler = xoops_getmodulehandler('category'); + //$category = $category_handler->get($cid); + // changed - end - March 4 2006 - jpc + $tags['CATEGORY_NAME'] = $category->getVar('title'); + $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid; + $notification_handler = & xoops_gethandler('notification'); + $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_handler = xoops_getmodulehandler('category'); + $category = $category_handler->get($cid); + $tags['CATEGORY_NAME'] = $category->getVar('title'); + $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . 'viewcat.php?cid=' . $cid; + $notification_handler = & xoops_gethandler('notification'); + $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_WFD_FILE_NEWFILEUPLOAD : _AM_WFD_FILE_FILEMODIFIEDUPDATE ; + $message = ($lid && !$_POST['was_published'] && $approved) ? _AM_WFD_FILE_FILEAPPROVED : $message; + + redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, $message); +} + + + +// Page start here +$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'main'; +switch ($op) +{ + case "addDownload": + addDownload(); + break; + + case "download": + case "Download": + Download(); + break; + + case "delDownload": + global $xoopsModule, $xoopsModuleConfig; + $confirm = (isset($_REQUEST['confirm'])) ? true : false; + $lid = (isset($_GET['lid'])) ? intval($_GET['lid']) : 0; + $lid = (isset($_POST['lid'])) ? intval($_POST['lid']) : $lid; + $download_handler = xoops_getmodulehandler('download'); + $download = $download_handler->get($lid); + $title = $download->getVar('title'); + if ($confirm) { + $file = $xoopsModuleConfig['uploaddir'] . "/" . $download->getVar('filename'); + if (is_file($file)) { + @chmod($file, 0777); + @unlink($file); + } + $download_handler->delete($download); + redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $title)); + exit(); + } else { + wfdownloads_xoops_cp_header(); + xoops_confirm(array('op' => 'delDownload', 'lid' => $lid, 'confirm' => true, 'title' => $title), 'download.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE); + xoops_cp_footer(); + } + break; + + case "delVote": + delVote(); + break; + + // added - start - March 4 2006 - jpc + case "patch_formulize": + patch_formulize(); + break; + // added - end - March 4 2006 - jpc + + case 'main': + default: + global $xoopsUser, $xoopsDB, $xoopsConfig; + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + $start = isset($_GET['start']) ? intval($_GET['start']) : 0; + $start1 = isset($_GET['start1']) ? intval($_GET['start1']) : 0; + $start2 = isset($_GET['start2']) ? intval($_GET['start2']) : 0; + $start3 = isset($_GET['start3']) ? intval($_GET['start3']) : 0; + $start4 = isset($_GET['start4']) ? intval($_GET['start4']) : 0; + $totalcats = wfd_totalcategory(); + + $report_handler = xoops_getmodulehandler('report'); + $review_handler = xoops_getmodulehandler('review'); + $mirror_handler = xoops_getmodulehandler('mirror'); + $modification_handler = xoops_getmodulehandler('modification'); + $download_handler = xoops_getmodulehandler('download'); + + $totalbrokendownloads = $report_handler->getCount(); + $totalmodrequests = $modification_handler->getCount(); + $newreviews = $review_handler->getCount(); + $newmirrors = $mirror_handler->getCount(); + $totalnewdownloads = $download_handler->getCount(new Criteria("published", 0)); + $totaldownloads = $download_handler->getCount(new Criteria("published", 0, ">")); + + wfdownloads_xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('main.php'); + //wfdownloads_adminMenu(0, _AM_WFD_BINDEX); + + // echo " + // <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_MINDEX_DOWNSUMMARY . "</legend>\n + // <div style='padding: 8px;'><small>\n + // <a href='category.php'>" . _AM_WFD_SCATEGORY . "</a><b>" . $totalcats . "</b> | \n + // <a href='main.php'>" . _AM_WFD_SFILES . "</a><b>" . $totaldownloads . "</b> | \n + // <a href='newdownloads.php'>" . _AM_WFD_SNEWFILESVAL . "</a><b>" . $totalnewdownloads . "</b> | \n + // <a href='modifications.php'>" . _AM_WFD_SMODREQUEST . "</a><b>" . $totalmodrequests . "</b> | \n + // <a href='brokendown.php'>" . _AM_WFD_SBROKENSUBMIT . "</a><b>" . $totalbrokendownloads . "</b> | \n + // <a href='review.php'>" . _AM_WFD_SREVIEWS . "</a><b>" . $newreviews . "</b> | \n + // <a href='mirror.php'>" . _AM_WFD_SMIRRORS . "</a><b>" . $newmirrors . "</b>\n + // </small></div></fieldset><br />\n + // "; + //echo wfd_serverstats(); + + if ($totaldownloads > 0) { + $criteria = new CriteriaCompo(); + $criteria->setLimit($xoopsModuleConfig['admin_perpage']); + $criteria->setStart($start); + $criteria->setSort("published"); + $criteria->setOrder("DESC"); + $published_array = $download_handler->getActiveDownloads($criteria); + $published_array_count = $download_handler->getActiveCount(); + + wfd_downlistheader(_AM_WFD_MINDEX_PUBLISHEDDOWN); + if ($published_array_count > 0) { + foreach (array_keys($published_array) as $i) { + wfd_downlistbody($published_array[$i]->toArray()); + } + } else { + wfd_downlistfooter(); + } + wfd_downlistpagenav($published_array_count, $start, 'art'); + /** + * Auto Publish + */ + $criteria = new Criteria("published", time(), ">"); + $auto_publish_count = $download_handler->getCount($criteria); + $criteria->setSort("published"); + $criteria->setOrder("ASC"); + $criteria->setLimit($xoopsModuleConfig['admin_perpage']); + $criteria->setStart($start2); + $auto_published_array = $download_handler->getObjects($criteria); + + wfd_downlistheader(_AM_WFD_MINDEX_AUTOPUBLISHEDDOWN); + if ($auto_publish_count > 0) { + foreach (array_keys($auto_published_array) as $i) { + wfd_downlistbody($auto_published_array[$i]->toArray()); + } + } else { + wfd_downlistfooter(); + } + wfd_downlistpagenav($auto_publish_count, $start2, 'art2'); + /** + * Expired downloads + */ + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria("expired", time(), "<"), 'AND'); + $criteria->add(new Criteria("expired", 0, "<>"), 'AND'); + $expired_count = $download_handler->getCount($criteria); + $criteria->setSort("expired"); + $criteria->setOrder("ASC"); + $criteria->setLimit($xoopsModuleConfig['admin_perpage']); + $criteria->setStart($start3); + $expired_array = $download_handler->getObjects($criteria); + + wfd_downlistheader("Expired"); + if ($expired_count > 0) { + foreach (array_keys($expired_array) as $i) { + wfd_downlistbody($expired_array[$i]->toArray()); + } + } else { + wfd_downlistfooter(); + } + wfd_downlistpagenav($expired_count, $start3, 'art3'); + /** + * Offline download + */ + + $criteria = new Criteria("offline", 1); + $offline_count = $download_handler->getCount($criteria); + $criteria->setSort("published"); + $criteria->setOrder("ASC"); + $criteria->setLimit($xoopsModuleConfig['admin_perpage']); + $criteria->setStart($start4); + $offline_array = $download_handler->getObjects($criteria); + + wfd_downlistheader(_AM_WFD_MINDEX_OFFLINEDOWN); + if ($offline_count > 0) { + foreach (array_keys($offline_array) as $i) { + wfd_downlistbody($offline_array[$i]->toArray()); + } + } else { + wfd_downlistfooter(); + } + wfd_downlistpagenav($offline_count, $start4, 'art4'); + } + //xoops_cp_footer(); + include_once "admin_footer.php"; + break; +} + + + +// added - start - March 4 2006 - jpc +function patch_formulize() +{ + if(!isset($_POST['patch_formulize'])) { + print "<form action=\"download.php?op=patch_formulize\" method=post>"; + print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">"; + print "</form>"; + } else { + 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 href=su...@fr...>Freeform Solutions</a> for assistance."); + + print "Patching for Formulize completed."; + } +} +// added - end - March 4 2006 - jpc Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -19,7 +19,6 @@ function Download() { - $lid = isset($_REQUEST['lid']) ? intval($_REQUEST['lid']) : 0; $category_handler = xoops_getmodulehandler('category'); @@ -130,9 +129,9 @@ $anon_criteria->setOrder("DESC"); echo " - <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n - <div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n - "; + <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n + <div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n + "; printf(_AM_WFD_VOTE_REGUSERVOTES, $votesreg); @@ -141,21 +140,21 @@ printf(_AM_WFD_VOTE_ANONUSERVOTES, $votesanon); echo " - </div>\n - <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n - <tr>\n - <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n - <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n - </tr>\n - "; + </div>\n + <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n + <tr>\n + <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n + <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n + </tr>\n + "; if ($votesreg == 0) { - echo "<tr><td align='center' colspan='7' class='even'><b>" . _AM_WFD_VOTE_NOREGVOTES . "</b></td></tr>"; + echo "<tr><td align='center' colspan='8' class='even'><b>" . _AM_WFD_VOTE_NOREGVOTES . "</b></td></tr>"; } else { foreach (array_keys($regvotes) as $i) { $uids[] = $regvotes[$i]->getVar('ratinguser'); @@ -174,8 +173,8 @@ echo " <tr><td align='center' class='head'>$ratinguname</td>\n - <td align='center' class='even'>".$regvotes[$i]->getVar('ratinghostname')."</th>\n - <td align='center' class='even'>".$regvotes[$i]->getVar('rating')."</th>\n + <td align='center' class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n + <td align='center' class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n <td align='center' class='even'>$useravgrating</th>\n <td align='center' class='even'>$uservotes</th>\n <td align='center' class='even'>$formatted_date</th>\n @@ -186,21 +185,21 @@ } } echo " - </table>\n - <br />\n - <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n - <tr>\n - <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n - <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n - </tr>\n - "; + </table>\n + <br />\n + <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n + <tr>\n + <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n + <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n + </tr>\n + "; if ($votesanon == 0) { - echo "<tr><td colspan='7' align='center' class='even'><b>" . _AM_WFD_VOTE_NOUNREGVOTES . "</b></td></tr>"; + echo "<tr><td colspan='8' align='center' class='even'><b>" . _AM_WFD_VOTE_NOUNREGVOTES . "</b></td></tr>"; } else { $criteria = new Criteria("ratinguser", 0); $userratings = $rating_handler->getUserAverage($criteria); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -36,22 +36,22 @@ $adminmenu[$i]['link'] = "admin/main.php"; $adminmenu[$i]["icon"] = $pathIcon32 . '/manage.png'; $i++; -$adminmenu[$i]['title'] = _MI_WFD_INDEXPAGE; -$adminmenu[$i]['link'] = "admin/indexpage.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/index.png'; -$i++; $adminmenu[$i]['title'] = _MI_WFD_MCATEGORY; $adminmenu[$i]['link'] = "admin/category.php"; $adminmenu[$i]["icon"] = $pathIcon32 . '/category.png'; $i++; $adminmenu[$i]['title'] = _MI_WFD_MDOWNLOADS; -$adminmenu[$i]['link'] = "admin/main.php?op=Download"; +$adminmenu[$i]['link'] = "admin/download.php?op=download"; $adminmenu[$i]["icon"] = $pathIcon32 . '/download.png'; //$i++; //$adminmenu[$i]['title'] = _MI_WFD_BROKENDOWN; //$adminmenu[$i]['link'] = "admin/brokendown.php"; //$adminmenu[$i]["icon"] = $pathIcon32 . '/brokenlink.png'; $i++; +$adminmenu[$i]['title'] = _MI_WFD_INDEXPAGE; +$adminmenu[$i]['link'] = "admin/indexpage.php"; +$adminmenu[$i]["icon"] = $pathIcon32 . '/index.png'; +$i++; $adminmenu[$i]['title'] = _MI_WFD_REVIEWS; $adminmenu[$i]['link'] = "admin/review.php"; $adminmenu[$i]["icon"] = $pathIcon32 . '/translations.png'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/index.html =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/index.html 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/index.html 2013-05-20 19:58:14 UTC (rev 11566) @@ -1 +1 @@ - <script>history.go(-1);</script> +<script>history.go(-1);</script> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -1,85 +1,77 @@ -<?php -/** - * $Id: wfdownloads_top.php,v 1.5 2007/05/13 19:38:07 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU - */ - -/** - * Function: b_mydownloads_top_show - * Input : $options[0] = date for the most recent downloads - * hits for the most popular downloads - * $block['content'] = The optional above content - * $options[1] = How many downloads are displayes - * Output : Returns the most recent or most popular downloads - */ -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; - -function b_wfdownloads_top_show($options) -{ - global $xoopsUser; - - $block = array(); - - $modhandler = xoops_gethandler('module'); - $wfModule = $modhandler->getByDirname("wfdownloads"); - $config_handler = xoops_gethandler('config'); - $wf_mid = intval($wfModule->getVar('mid')); - $wfModuleConfig = $config_handler->getConfigsByCat(0, $wf_mid); - - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS); - $gperm_handler = &xoops_gethandler('groupperm'); - $allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wf_mid); - - $criteria = new Criteria("cid", implode(',', $allowed_cats), "IN"); - $criteria = new CriteriaCompo(new Criteria('offline', 0)); - $criteria->setSort($options[0]); - $criteria->setOrder("DESC"); - $criteria->setLimit($options[1]); - $download_handler = xoops_getmodulehandler('download', 'wfdownloads'); - $downloads = $download_handler->getObjects($criteria); - - foreach (array_keys($downloads) as $i) { - $download = $downloads[$i]->toArray(); - if (!in_array(intval($download['cid']), $allowed_cats)) - { - continue; - } - - $download['title'] = xoops_substr($download['title'], 0, ($options[2] -1)); - $download['id'] = intval($download['lid']); - if ($options[0] == "published") - { - $download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']); - } - else { - $download['date'] = formatTimestamp($download['date'], $wfModuleConfig['dateformat']); - } - $download['dirname'] = $wfModule->dirname(); - $block['downloads'][] = $download; - } - return $block; -} - -function b_wfdownloads_top_edit($options) -{ - $form = "" . _MB_WFD_DISP . " "; - $form .= "<input type='hidden' name='options[]' value='"; - if ($options[0] == "published") - { - $form .= "published'"; - } - else - { - $form .= "hits'"; - } - $form .= " />"; - $form .= "<input type='text' name='options[]' value='" . $options[1] . "' /> " . _MB_WFD_FILES . ""; - $form .= " <br />" . _MB_WFD_CHARS . " <input type='text' name='options[]' value='" . $options[2] . "' /> " . _MB_WFD_LENGTH . ""; - return $form; -} - -?> +<?php +/** + * $Id: wfdownloads_top.php,v 1.5 2007/05/13 19:38:07 m0nty_ Exp $ + * Module: WF-Downloads + * Version: v2.0.5a + * Release Date: 26 july 2004 + * Author: WF-Sections + * Licence: GNU + */ + +/** + * Function: b_mydownloads_top_show + * Input : $options[0] = date for the most recent downloads + * hits for the most popular downloads + * $block['content'] = The optional above content + * $options[1] = How many downloads are displayes + * Output : Returns the most recent or most popular downloads + */ +include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; + +function b_wfdownloads_top_show($options) +{ + global $xoopsUser; + + $block = array(); + + $modhandler = xoops_gethandler('module'); + $wfModule = $modhandler->getByDirname("wfdownloads"); + $config_handler = xoops_gethandler('config'); + $wf_mid = intval($wfModule->getVar('mid')); + $wfModuleConfig = $config_handler->getConfigsByCat(0, $wf_mid); + + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $gperm_handler = &xoops_gethandler('groupperm'); + $allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wf_mid); + + $criteria = new Criteria("cid", implode(',', $allowed_cats), "IN"); + $criteria = new CriteriaCompo(new Criteria('offline', 0)); + $criteria->setSort($options[0]); + $criteria->setOrder("DESC"); + $criteria->setLimit($options[1]); + $download_handler = xoops_getmodulehandler('download', 'wfdownloads'); + $downloads = $download_handler->getObjects($criteria); + + foreach (array_keys($downloads) as $i) { + $download = $downloads[$i]->toArray(); + if (!in_array(intval($download['cid']), $allowed_cats)){ + continue; + } + + $download['title'] = xoops_substr($download['title'], 0, ($options[2] -1)); + $download['id'] = intval($download['lid']); + if ($options[0] == "published") { + $download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']); + } else { + $download['date'] = formatTimestamp($download['date'], $wfModuleConfig['dateformat']); + } + $download['dirname'] = $wfModule->dirname(); + $block['downloads'][] = $download; + } + return $block; +} + +function b_wfdownloads_top_edit($options) +{ + $form = "" . _MB_WFD_DISP . " "; + $form .= "<input type='hidden' name='options[]' value='"; + if ($options[0] == "published") { + $form .= "published'"; + } else { + $form .= "hits'"; + } + $form .= " />"; + $form .= "<input type='text' name='options[]' value='" . $options[1] . "' /> " . _MB_WFD_FILES . ""; + $form .= " <br />" . _MB_WFD_CHARS . " <input type='text' name='options[]' value='" . $options[2] . "' /> " . _MB_WFD_LENGTH . ""; + return $form; +} Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top_by_cat.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top_by_cat.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top_by_cat.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -36,7 +36,7 @@ $allowed_cats_string = implode(',', $allowed_cats); $criteria = new Criteria("cid", '(' . $allowed_cats_string . ')', "IN"); - + $criteria = new CriteriaCompo(new Criteria('offline', 0)); $criteria->setSort('date'); $criteria->setOrder("DESC"); @@ -47,15 +47,13 @@ foreach (array_keys($downloads) as $i) { $download = $downloads[$i]->toArray(); - if (!in_array(intval($download['cid']), $allowed_cats)) - { + if (!in_array(intval($download['cid']), $allowed_cats)) { continue; } $download['title'] = xoops_substr($download['title'], 0, ($options[2] -1)); $download['id'] = intval($download['lid']); - if ($options[0] == "published") - { + if ($options[0] == "published") { $download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']); } $download['dirname'] = $wfModule->dirname(); @@ -63,15 +61,15 @@ } $category_handler = xoops_getmodulehandler('category', 'wfdownloads'); - $allsubcats_linked_totop = $category_handler->getAllSubcatsTopParentCid(); - + $allsubcats_linked_totop = $category_handler->getAllSubcatsTopParentCid(); + foreach($category_handler->topCategories as $topcid) { - $block['topcats'][$topcid]['title'] = $category_handler->allCategories[$topcid]->getVar('title'); - $block['topcats'][$topcid]['imgurl'] = $category_handler->allCategories[$topcid]->getVar('imgurl'); + $block['topcats'][$topcid]['title'] = $category_handler->allCategories[$topcid]->getVar('title'); + $block['topcats'][$topcid]['imgurl'] = $category_handler->allCategories[$topcid]->getVar('imgurl'); } - + foreach($block['downloads'] as $k=>$v) { - $block['topcats'][$allsubcats_linked_totop[$v['cid']]]['downloads'][] = $v; + $block['topcats'][$allsubcats_linked_totop[$v['cid']]]['downloads'][] = $v; } return $block; @@ -82,12 +80,9 @@ { $form = "" . _MB_WFD_DISP . " "; $form .= "<input type='hidden' name='options[]' value='"; - if ($options[0] == "published") - { + if ($options[0] == "published") { $form .= "published'"; - } - else - { + } else { $form .= "hits'"; } $form .= " />"; @@ -95,5 +90,3 @@ $form .= " <br />" . _MB_WFD_CHARS . " <input type='text' name='options[]' value='" . $options[2] . "' /> " . _MB_WFD_LENGTH . ""; return $form; } - -?> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -33,7 +33,7 @@ $report_handler = xoops_getmodulehandler('report'); $count = $report_handler->getCount($criteria); if ($count > 0) { - redirect_header(WFDOWNLOADS_URL.'index.php', 2, _MD_WFD_ALREADYREPORTED); + redirect_header(WFDOWNLOADS_URL . 'index.php', 2, _MD_WFD_ALREADYREPORTED); } else { $report = $report_handler->create(); @@ -95,7 +95,7 @@ if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == 1 || ($download->getVar('expired') != 0 && $download->getVar('expired') < time())) { //Download not published, expired or taken offline - redirect - redirect_header(WFDOWNLOADS_URL.'index.php', 3, _MD_WFD_NODOWNLOAD); + redirect_header(WFDOWNLOADS_URL . 'index.php', 3, _MD_WFD_NODOWNLOAD); } $xoopsOption['template_main'] = 'wfdownloads_brokenfile.html'; @@ -136,5 +136,3 @@ } include_once XOOPS_ROOT_PATH . '/footer.php'; } - -?> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -21,7 +21,7 @@ * @link http://www.smartfactory.ca The SmartFactory */ if (!defined("XOOPS_ROOT_PATH")) { -die("XOOPS root path not defined"); + die("XOOPS root path not defined"); } class WfdownloadsTable { Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -27,7 +27,7 @@ // Project: The XOOPS Project // // -------------------------------------------------------------------------// if (!class_exists("XoopsPersistableObjectHandler")) { - include_once XOOPS_ROOT_PATH."/modules/wfdownloads/class/object.php"; + include_once XOOPS_ROOT_PATH . "/modules/wfdownloads/class/object.php"; } class WfdownloadsDownload extends XoopsObject { @@ -867,4 +867,3 @@ return false; } } -?> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -1,29 +1,29 @@ <?php // $Id: img_uploader.php,v 1.4 2007/09/30 13:47:53 m0nty_ Exp $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2000 XOOPS.org // +// <http://www.xoops.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // // // -// 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. // +// 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. See the // -// GNU General Public License for more details. // +// 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. See the // +// GNU General Public License for more details. // // // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // // Project: The XOOPS Project // @@ -81,7 +81,7 @@ * @copyright (c) 2000-2003 The Xoops Project - www.xoops.org */ mt_srand((double) microtime() * 1000000); -require_once XOOPS_ROOT_PATH."/modules/wfdownloads/class/uploader.php"; +require_once XOOPS_ROOT_PATH . "/modules/wfdownloads/class/uploader.php"; class XoopsMediaImgUploader extends XoopsMediaUploader { /** @@ -100,5 +100,3 @@ $this->randomfilename = false; } } - -?> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/index.html =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/index.html 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/index.html 2013-05-20 19:58:14 UTC (rev 11566) @@ -1 +1 @@ - <script>history.go(-1);</script> +<script>history.go(-1);</script> \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php 2013-05-20 18:53:30 UTC (rev 11565) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php 2013-05-20 19:58:14 UTC (rev 11566) @@ -1,9 +1,9 @@ <?php // $Id: report.php,v 1.3 2007/09/30 13:47:53 m0nty_ Exp $ // ------------------------------------------------------------------------ // -// XOOPS - PHP Content Ma... [truncated message content] |
From: <luc...@us...> - 2013-05-21 21:00:23
|
Revision: 11570 http://sourceforge.net/p/xoops/svn/11570 Author: luciorota Date: 2013-05-21 21:00:18 +0000 (Tue, 21 May 2013) Log Message: ----------- - added: sort subcategories by cid or title or weight - fixed: update procedure now updates also permissions - fixed: language definition in modinfo.php - fixed: deprecated "XoopsTree" Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_footer.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header2.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/brokendown.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/cookies.js XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/funcs.js XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ip_log.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/modifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/newdownloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/newstory.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/permissions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/update.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/votedata.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/wfdownloads_top_by_cat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/object.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/rating.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/report.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/uploader.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfd_lists.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_delete.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_edit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_new.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_post.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_reply.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/english/__about.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/footer.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/comment_functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/update.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/admin.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/help/help.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/modinfo.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/module.css XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/notification_update.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/wfdownloads.sql XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_admin_menu.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_brokenfile.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_disclaimer.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_download.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_footer.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_header.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_mirrors.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_newlistindex.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_ratefile.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_reviews.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_singlefile.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_topten.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/thickbox.css XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/visit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Added Paths: ----------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/imageupload.php Removed Paths: ------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/upload.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,23 +1,23 @@ <?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. + 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. */ - /** - * @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 - * @since - * @author XOOPS Development Team - * @version $Id $ + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - include_once dirname(__FILE__) . '/admin_header.php'; xoops_cp_header(); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_footer.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_footer.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_footer.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,23 +1,23 @@ <?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. + 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. */ - /** - * @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 - * @since - * @author XOOPS Development Team - * @version $Id $ + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - echo "<div class='adminfooter'>\n" ." <div style='text-align: center;'>\n" ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,23 +1,23 @@ <?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. + 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. */ - /** - * @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 - * @since - * @author XOOPS Development Team - * @version $Id $ + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - $path = dirname(dirname(dirname(dirname(__FILE__)))); include_once $path . '/mainfile.php'; include_once $path . '/include/cp_functions.php'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header2.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header2.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header2.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,13 +1,23 @@ <?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. + */ /** - * $Id: admin_header.php,v 1.5 2007/08/10 20:59:33 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - include '../../../include/cp_header.php'; include_once(XOOPS_ROOT_PATH . '/modules/wfdownloads/include/functions.php'); include_once(XOOPS_ROOT_PATH . '/modules/wfdownloads/include/common.php'); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/brokendown.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/brokendown.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/brokendown.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,13 +1,23 @@ <?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. + */ /** - * $Id: brokendown.php,v 1.7 2007/09/30 12:39:13 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - include 'admin_header.php'; $op = ''; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/category.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/category.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/category.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,11 +1,22 @@ <?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. + */ /** - * $Id: category.php,v 1.11 2007/09/30 12:39:13 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ include 'admin_header.php'; include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/cookies.js =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/cookies.js 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/cookies.js 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,4 +1,24 @@ +/* + 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. + */ /** + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ + */ + +/** * Read the JavaScript cookies tutorial at: * http://www.netspade.com/articles/javascript/cookies.xml */ Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/download.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,48 +1,59 @@ <?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. + */ /** - * $Id: main.php,v 1.23 2007/09/30 12:39:13 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - include 'admin_header.php'; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -include_once WFDOWNLOADS_ROOT_PATH . 'class/wfd_lists.php'; +include_once WFDOWNLOADS_ROOT_PATH.'class/wfd_lists.php'; include_once XOOPS_ROOT_PATH . '/class/tree.php'; include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; -//$mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid", "pid"); - function Download() { - $lid = isset($_REQUEST['lid']) ? intval($_REQUEST['lid']) : 0; + $download_handler = xoops_getmodulehandler('download'); + $category_handler = xoops_getmodulehandler('category'); - $category_handler = xoops_getmodulehandler('category'); + $lid = wfdownloads_CleanVars($_REQUEST, 'lid', 0, 'int'); + $numrows = $category_handler->getCount(); if ($numrows) { wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); - echo $indexAdmin->addNavigation('main.php'); + echo $indexAdmin->addNavigation('download.php'); - //wfdownloads_adminMenu(3, _AM_WFD_MDOWNLOADS); + $adminMenu = new ModuleAdmin(); + $adminMenu->addItemButton(_MI_WFD_BINDEX, 'download.php?op=list', 'list'); + $adminMenu->addItemButton(_AM_WFD_FFS_DOWNLOADTITLE, 'download.php?op=Download', 'add'); + echo $adminMenu->renderButton(); - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n - <div style='padding: 8px;'>\n"; - + // allowed mimetypes list + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n"; + echo "<div style='padding: 8px;'>\n"; $mime_handler = xoops_getmodulehandler('mimetype'); $criteria = new Criteria("mime_admin", 1); $mimetypes = $mime_handler->getList($criteria); $allowmimetypes = implode(' | ', $mimetypes); echo $allowmimetypes; - echo "</div>\n - </fieldset><br />\n - "; + echo "</div>\n"; + echo "</fieldset><br />\n"; - $download_handler = xoops_getmodulehandler('download'); if ($lid) { $download = $download_handler->get($lid); $title = _AM_WFD_FILE_MODIFYFILE; @@ -80,7 +91,7 @@ $customArray['fid'] = $fid; $customArray['formulize_mgr'] =& xoops_getmodulehandler('elements', 'formulize'); - $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $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'] = ""; @@ -92,7 +103,7 @@ $customArray['owner_groups'] = $owner_groups; } - $sform = $download->getAdminForm($title, $customArray); + $sform = $download->getAdminForm($title, $customArray); } elseif(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) { $sform = $download->getCategoryForm(); } else { @@ -101,7 +112,7 @@ $sform->display(); // changed - end - March 4 2006 - jpc } else { - redirect_header(WFDOWNLOADS_URL . 'admin/category.php?', 1, _AM_WFD_CCATEGORY_NOEXISTS); + redirect_header(WFDOWNLOADS_URL.'admin/category.php?', 1, _AM_WFD_CCATEGORY_NOEXISTS); exit(); } @@ -124,10 +135,8 @@ $anon_criteria->setSort("ratingtimestamp"); $anon_criteria->setOrder("DESC"); - echo " - <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n - <div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n - "; + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n"; + echo "<div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n"; printf(_AM_WFD_VOTE_REGUSERVOTES, $votesreg); @@ -136,18 +145,18 @@ printf(_AM_WFD_VOTE_ANONUSERVOTES, $votesanon); echo " - </div>\n - <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n - <tr>\n - <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n - <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n - </tr>\n - "; + </div>\n + <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n + <tr>\n + <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n + <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n + <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n + </tr>\n + "; if ($votesreg == 0) { echo "<tr><td align='center' colspan='7' class='even'><b>" . _AM_WFD_VOTE_NOREGVOTES . "</b></td></tr>"; @@ -156,7 +165,7 @@ $uids[] = $regvotes[$i]->getVar('ratinguser'); } - $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN"); + $criteria = new Criteria("ratinguser", "(".implode(',', $uids).")", "IN"); $criteria->setGroupby("ratinguser"); $userratings = $rating_handler->getUserAverage($criteria); @@ -175,7 +184,7 @@ <td align='center' class='even'>$uservotes</th>\n <td align='center' class='even'>$formatted_date</th>\n <td align='center' class='even'>\n - <a href='" . WFDOWNLOADS_URL . "admin/main.php?op=delVote&lid=" . $lid . "&rid=" . $regvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n + <a href='" . WFDOWNLOADS_URL . "admin/download.php?op=delVote&lid=" . $lid . "&rid=" . $regvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; } @@ -216,7 +225,7 @@ <td align='center' class='even'>$uservotes</th>\n <td align='center' class='even'>$formatted_date</th>\n <td align='center' class='even'>\n - <a href='" . WFDOWNLOADS_URL . "admin/main.php?op=delVote&lid=" . $lid . "&rid=" . $anonvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n + <a href='" . WFDOWNLOADS_URL . "admin/download.php?op=delVote&lid=" . $lid . "&rid=" . $anonvotes[$i]->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; } @@ -237,7 +246,7 @@ if ($rating_handler->delete($rating, true)) { wfd_updaterating(intval($rating->getVar('lid'))); } - redirect_header(WFDOWNLOADS_URL . 'admin/main.php', 1, _AM_WFD_VOTE_VOTEDELETED); + redirect_header(WFDOWNLOADS_URL . 'admin/download.php', 1, _AM_WFD_VOTE_VOTEDELETED); } function addDownload() @@ -251,9 +260,11 @@ $download_handler = xoops_getmodulehandler('download'); if ($lid > 0) { $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */ + $download = $download_handler->get($lid); } else { $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */ + $download = $download_handler->create(); } @@ -276,7 +287,8 @@ $download->setVar('filetype', $filetype); } else { global $_FILES; - $down = wfd_uploading($_FILES, $xoopsModuleConfig['uploaddir'], "", "download.php?op=download", 0, 0); + + $down = wfd_uploading($_FILES, $xoopsModuleConfig['uploaddir'], "", "download.php", 0, 0); $url = ($_POST["url"] != "http://") ? $_POST["url"] : ''; $size = $down['size']; $title = $_FILES['userfile']['name']; @@ -419,6 +431,7 @@ $download->setVar('ipaddress', $_SERVER['REMOTE_ADDR']); } + // added - start - March 4 2006 - jpc $category_handler = xoops_getmodulehandler('category'); $category = $category_handler->get($cid); @@ -446,9 +459,9 @@ } $member_handler =& xoops_gethandler('member'); $owner_groups =& $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, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that + $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; + $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS); + $entries = handleSubmission($formulize_mgr, $entries, $uid, $owner, $fid, $owner_groups, $groups, "new"); // "new" causes xoops token check to be skipped, since WF-downloads should be doing that //if (!$lid) if(!$owner) { @@ -457,8 +470,6 @@ } } // added - end - March 4 2006 - jpc - - $download_handler->insert($download); $newid = intval($download->getVar('lid')); /** @@ -502,20 +513,18 @@ // Page start here $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'main'; -switch ($op) -{ +switch ($op) { case "addDownload": addDownload(); break; - case "download": case "Download": Download(); break; case "delDownload": global $xoopsModule, $xoopsModuleConfig; - $confirm = (isset($_REQUEST['confirm'])) ? true : false; + $confirm = (isset($_REQUEST['confirm'])) ? 1 : 0; $lid = (isset($_GET['lid'])) ? intval($_GET['lid']) : 0; $lid = (isset($_POST['lid'])) ? intval($_POST['lid']) : $lid; $download_handler = xoops_getmodulehandler('download'); @@ -532,11 +541,11 @@ exit(); } else { wfdownloads_xoops_cp_header(); - xoops_confirm(array('op' => 'delDownload', 'lid' => $lid, 'confirm' => true, 'title' => $title), 'download.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE); + xoops_confirm(array('op' => 'delDownload', 'lid' => $lid, 'confirm' => 1, 'title' => $title), 'download.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE); xoops_cp_footer(); } break; - + case "delVote": delVote(); break; @@ -551,11 +560,11 @@ default: global $xoopsUser, $xoopsDB, $xoopsConfig; include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $start = isset($_GET['start']) ? intval($_GET['start']) : 0; - $start1 = isset($_GET['start1']) ? intval($_GET['start1']) : 0; - $start2 = isset($_GET['start2']) ? intval($_GET['start2']) : 0; - $start3 = isset($_GET['start3']) ? intval($_GET['start3']) : 0; - $start4 = isset($_GET['start4']) ? intval($_GET['start4']) : 0; + $start = wfdownloads_CleanVars($_GET, 'start', 0, 'int'); + $start1 = wfdownloads_CleanVars($_GET, 'start1', 0, 'int'); + $start2 = wfdownloads_CleanVars($_GET, 'start2', 0, 'int'); + $start3 = wfdownloads_CleanVars($_GET, 'start3', 0, 'int'); + $start4 = wfdownloads_CleanVars($_GET, 'start4', 0, 'int'); $totalcats = wfd_totalcategory(); $report_handler = xoops_getmodulehandler('report'); @@ -573,24 +582,15 @@ wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); - echo $indexAdmin->addNavigation('main.php'); - //wfdownloads_adminMenu(0, _AM_WFD_BINDEX); + echo $indexAdmin->addNavigation('download.php'); + + $adminMenu = new ModuleAdmin(); + $adminMenu->addItemButton(_MI_WFD_BINDEX, 'download.php?op=list', 'list'); + $adminMenu->addItemButton(_AM_WFD_FFS_DOWNLOADTITLE, 'download.php?op=Download', 'add'); + echo $adminMenu->renderButton(); - // echo " - // <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_MINDEX_DOWNSUMMARY . "</legend>\n - // <div style='padding: 8px;'><small>\n - // <a href='category.php'>" . _AM_WFD_SCATEGORY . "</a><b>" . $totalcats . "</b> | \n - // <a href='main.php'>" . _AM_WFD_SFILES . "</a><b>" . $totaldownloads . "</b> | \n - // <a href='newdownloads.php'>" . _AM_WFD_SNEWFILESVAL . "</a><b>" . $totalnewdownloads . "</b> | \n - // <a href='modifications.php'>" . _AM_WFD_SMODREQUEST . "</a><b>" . $totalmodrequests . "</b> | \n - // <a href='brokendown.php'>" . _AM_WFD_SBROKENSUBMIT . "</a><b>" . $totalbrokendownloads . "</b> | \n - // <a href='review.php'>" . _AM_WFD_SREVIEWS . "</a><b>" . $newreviews . "</b> | \n - // <a href='mirror.php'>" . _AM_WFD_SMIRRORS . "</a><b>" . $newmirrors . "</b>\n - // </small></div></fieldset><br />\n - // "; - //echo wfd_serverstats(); - if ($totaldownloads > 0) { + // Published Downloads $criteria = new CriteriaCompo(); $criteria->setLimit($xoopsModuleConfig['admin_perpage']); $criteria->setStart($start); @@ -608,9 +608,7 @@ wfd_downlistfooter(); } wfd_downlistpagenav($published_array_count, $start, 'art'); - /** - * Auto Publish - */ + // Auto Published Downloads $criteria = new Criteria("published", time(), ">"); $auto_publish_count = $download_handler->getCount($criteria); $criteria->setSort("published"); @@ -628,9 +626,7 @@ wfd_downlistfooter(); } wfd_downlistpagenav($auto_publish_count, $start2, 'art2'); - /** - * Expired downloads - */ + // Expired downloads $criteria = new CriteriaCompo(); $criteria->add(new Criteria("expired", time(), "<"), 'AND'); $criteria->add(new Criteria("expired", 0, "<>"), 'AND'); @@ -641,7 +637,7 @@ $criteria->setStart($start3); $expired_array = $download_handler->getObjects($criteria); - wfd_downlistheader("Expired"); + wfd_downlistheader(_AM_WFD_MINDEX_EXPIREDDOWN); if ($expired_count > 0) { foreach (array_keys($expired_array) as $i) { wfd_downlistbody($expired_array[$i]->toArray()); @@ -650,10 +646,7 @@ wfd_downlistfooter(); } wfd_downlistpagenav($expired_count, $start3, 'art3'); - /** - * Offline download - */ - + // Offline download $criteria = new Criteria("offline", 1); $offline_count = $download_handler->getCount($criteria); $criteria->setSort("published"); @@ -688,14 +681,11 @@ print "</form>"; } else { 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 href=su...@fr...>Freeform Solutions</a> for assistance."); - print "Patching for Formulize completed."; } } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/funcs.js =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/funcs.js 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/funcs.js 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,3 +1,23 @@ +/* + 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. + */ +/** + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ + */ + function smartsectionPageWrap(id, page) { var revisedMessage; var textareaDom = xoopsGetElementById(id); Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/imageupload.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/imageupload.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/imageupload.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -0,0 +1,143 @@ +<?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. + */ +/** + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ + */ +include 'admin_header.php'; + +include_once XOOPS_ROOT_PATH . '/class/tree.php'; +include_once XOOPS_ROOT_PATH."/class/xoopstree.php"; + +$op = wfdownloads_CleanVars($_REQUEST, 'op', 'default', 'string'); +$rootpath = wfdownloads_CleanVars($_GET, 'rootpath', 0, 'int'); + +switch ($op) { + case "upload": + if ($_FILES['uploadfile']['name'] != "") { + if (file_exists(XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_FILES['uploadfile']['name'])) { + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2, _AM_WFD_DOWN_IMAGEEXIST); + } + $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); + $maxfilesize = $xoopsModuleConfig['maxfilesize']; + $maxfilewidth = $xoopsModuleConfig['maximgwidth']; + $maxfileheight = $xoopsModuleConfig['maximgheight']; + $uploaddir = XOOPS_ROOT_PATH."/".$_POST['uploadpath']; + $screenshot = strtolower($_FILES['uploadfile']['name']); + wfd_uploading($screenshot, XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'], $allowed_mimetypes, "imageupload.php", 1, 0, true); + + include_once WFDOWNLOADS_ROOT_PATH . 'class/img_uploader.php'; + $uploader = new XoopsMediaImgUploader($uploaddir . "/", $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); + + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2 , _AM_WFD_DOWN_IMAGEUPLOAD); + exit(); + + } else { + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 2 , _AM_WFD_DOWN_NOIMAGEEXIST); + exit(); + } + break; + + case "delfile": + if (isset($_POST['confirm']) && $_POST['confirm'] == 1) { + $filetodelete = XOOPS_ROOT_PATH . "/" . $_POST['uploadpath'] . "/" . $_POST['downfile']; + if (file_exists($filetodelete)) { + chmod($filetodelete, 0666); + if (@unlink($filetodelete)) { + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_FILEDELETED); + } else { + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_FILEERRORDELETE); + } + } + exit(); + } else { + if (empty($_POST['downfile'])) { + redirect_header(WFDOWNLOADS_URL . 'admin/imageupload.php', 1, _AM_WFD_DOWN_NOFILEERROR); + exit(); + } + wfdownloads_xoops_cp_header(); + xoops_confirm(array('op' => 'delfile', 'uploadpath' => $_POST['uploadpath'], 'downfile' => $_POST['downfile'], 'confirm' => 1), + 'imageupload.php', _AM_WFD_DOWN_DELETEFILE . "<br /><br />" . $_POST['downfile'], _AM_WFD_BDELETE); + } + break; + + case "default": + default: + include_once WFDOWNLOADS_ROOT_PATH . 'class/wfd_lists.php'; + + $displayimage = ''; + wfdownloads_xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('imageupload.php'); + + Global $xoopsUser, $xoopsDB, $xoopsModuleConfig; + + $dirarray = array(1 => $xoopsModuleConfig['catimage'], 2 => $xoopsModuleConfig['screenshots'], 3 => $xoopsModuleConfig['mainimagedir']); + $namearray = array(1 => _AM_WFD_DOWN_CATIMAGE , 2 => _AM_WFD_DOWN_SCREENSHOTS, 3 => _AM_WFD_DOWN_MAINIMAGEDIR); + $listarray = array(1 => _AM_WFD_DOWN_FCATIMAGE , 2 => _AM_WFD_DOWN_FSCREENSHOTS, 3 => _AM_WFD_DOWN_FMAINIMAGEDIR); + + //wfdownloads_adminMenu(6, _AM_WFD_MUPLOADS); + if ($rootpath > 0) { + echo "<div><b>" . _AM_WFD_DOWN_FUPLOADPATH . "</b> " . XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath] . "</div>\n"; + echo "<div><b>" . _AM_WFD_DOWN_FUPLOADURL . "</b> " . XOOPS_URL . "/" . $dirarray[$rootpath] . "</div><br />\n"; + } + $pathlist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : ''; + $namelist = (isset($listarray[$rootpath])) ? $namearray[$rootpath] : ''; + + $iform = new XoopsThemeForm(_AM_WFD_DOWN_FUPLOADIMAGETO . $pathlist, "op", xoops_getenv('PHP_SELF')); + $iform->setExtra('enctype="multipart/form-data"'); + + ob_start(); + $iform->addElement(new XoopsFormHidden('dir', $rootpath)); + wfd_getDirSelectOption($namelist, $dirarray, $namearray); + $iform->addElement(new XoopsFormLabel(_AM_WFD_DOWN_FOLDERSELECTION, ob_get_contents())); + ob_end_clean(); + + if ($rootpath > 0) { + $graph_array = &WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath], $type = "images"); + $indeximage_select = new XoopsFormSelect('', 'downfile', ''); + $indeximage_select->addOptionArray($graph_array); + $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"downfile\", \"" . $dirarray[$rootpath] . "\", \"\", \"" . XOOPS_URL . "\")'"); + $indeximage_tray = new XoopsFormElementTray(_AM_WFD_DOWN_FSHOWSELECTEDIMAGE, ' '); + $indeximage_tray->addElement($indeximage_select); + if (!empty($_REQUEST['downfile'])) { + $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $dirarray[$rootpath] . "/" . $_REQUEST['downfile'] . "' name='image' id='image' alt='' title='image' />")); + } else { + $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' title='image' />")); + } + $iform->addElement($indeximage_tray); + + $iform->addElement(new XoopsFormFile(_AM_WFD_DOWN_FUPLOADIMAGE, 'uploadfile', 0)); + $iform->addElement(new XoopsFormHidden('uploadpath', $dirarray[$rootpath])); + $iform->addElement(new XoopsFormHidden('rootnumber', $rootpath)); + + $dup_tray = new XoopsFormElementTray('', ''); + $dup_tray->addElement(new XoopsFormHidden('op', 'upload')); + $butt_dup = new XoopsFormButton('', '', _AM_WFD_BUPLOAD, 'submit'); + $butt_dup->setExtra('onclick="this.form.elements.op.value=\'upload\'"'); + $dup_tray->addElement($butt_dup); + + $butt_dupct = new XoopsFormButton('', '', _AM_WFD_BDELETEIMAGE, 'submit'); + $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delfile\'"'); + $dup_tray->addElement($butt_dupct); + $iform->addElement($dup_tray); + } + $iform->display(); + echo wfd_serverstats(); +} +//xoops_cp_footer(); +include_once "admin_footer.php"; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,4 +1,24 @@ <?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. + */ +/** + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ + */ + // ======================================================== // Conversion file for any version before wf-downloads 3 // ======================================================== Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,24 +1,23 @@ <?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. + 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. */ - /** - * @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 - * @since - * @author XOOPS Development Team - * @version $Id $ + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - - require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; include_once dirname(__FILE__) . '/admin_header.php'; @@ -56,7 +55,7 @@ if ($totaldownloads > 0) { $indexAdmin->addInfoBoxLine( - _AM_WFD_MINDEX_DOWNSUMMARY, "<infolabel>" . '<a href="main.php">' . _AM_WFD_SFILES . '</a><b>' + _AM_WFD_MINDEX_DOWNSUMMARY, "<infolabel>" . '<a href="download.php">' . _AM_WFD_SFILES . '</a><b>' . "</infolabel>", $totaldownloads, 'Green' ); } else { Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,13 +1,23 @@ <?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. + */ /** - * $Id: indexpage.php,v 1.6 2007/09/30 12:39:13 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ */ - include 'admin_header.php'; $op = isset($_REQUEST['op']) ?$_REQUEST['op'] : "default"; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ip_log.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ip_log.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ip_log.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,4 +1,23 @@ <?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. + */ +/** + * WF-Downloads module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package wfdownload + * @since 3.23 + * @author WF-Sections, Xoops Development Team, luciorota + * @version svn:$Id$ + */ $lid = isset($_GET['lid']) && $_GET['lid'] != '' ? $_GET['lid'] : 0; if(!$lid) { header('Location index.php'); Deleted: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php 2013-05-21 20:49:57 UTC (rev 11569) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/main.php 2013-05-21 21:00:18 UTC (rev 11570) @@ -1,706 +0,0 @@ -<?php -/** - * $Id: main.php,v 1.23 2007/09/30 12:39:13 m0nty_ Exp $ - * Module: WF-Downloads - * Version: v2.0.5a - * Release Date: 26 july 2004 - * Author: WF-Sections - * Licence: GNU - */ - -include 'admin_header.php'; -include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; -include_once WFDOWNLOADS_ROOT_PATH . 'class/wfd_lists.php'; -include_once XOOPS_ROOT_PATH . '/class/tree.php'; -include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; - -//$mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid", "pid"); - -function Download() -{ - $lid = isset($_REQUEST['lid']) ? intval($_REQUEST['lid']) : 0; - - $category_handler = xoops_getmodulehandler('category'); - $numrows = $category_handler->getCount(); - if ($numrows) { - wfdownloads_xoops_cp_header(); - $indexAdmin = new ModuleAdmin(); - echo $indexAdmin->addNavigation('main.php'); - - //wfdownloads_adminMenu(3, _AM_WFD_MDOWNLOADS); - - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n - <div style='padding: 8px;'>\n"; - - $mime_handler = xoops_getmodulehandler('mimetype'); - $criteria = new Criteria("mime_admin", 1); - $mimetypes = $mime_handler->getList($criteria); - $allowmimetypes = implode(' | ', $mimetypes); - echo $allowmimetypes; - echo "</div>\n - </fieldset><br />\n - "; - - $download_handler = xoops_getmodulehandler('download'); - if ($lid) { - $download = $download_handler->get($lid); - $title = _AM_WFD_FILE_MODIFYFILE; - // added - start - March 4 2006 - jpc - $cid = intval($download->getVar('cid')); - $category = $category_handler->get($cid); - // added - end - March 4 2006 - jpc - - // changed - start - April 22 2006 - jwe - //$title = _AM_WFD_FILE_MODIFYFILE; - $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_EDITDOWNLOADTITLE); - // changed - end - April 22 2006 - jwe - - } else { - $download = $download_handler->create(); - $title = _AM_WFD_FILE_CREATENEWFILE; - // added - start - March 4 2006 - jpc - $cid = (!empty($_POST['cid'])) ? intval($_POST['cid']) : 0 ; - $download->setVar('cid', $cid); - $category = $category_handler->get($cid); - // added - end - March 4 2006 - jpc - - // changed - start - April 22 2006 - jwe - //$title = _AM_WFD_FILE_CREATENEWFILE; - $title = preg_replace("/{category}/", $category->getVar('title'), _AM_WFD_FFS_DOWNLOADTITLE); - // changed - end - April 22 2006 - jwe - - } - - // changed - start - March 4 2006 - jpc - if ((isset($_POST['submit_category']) && !empty($_POST['submit_category'])) || $lid) { - - $fid = $category->getVar('formulize_fid'); - $customArray = array(); - if($fid) { - global $xoopsUser; - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formdisplay.php"; - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php"; - - $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'] = ""; - - $owner = getEntryOwner($entry); - $member_handler =& xoops_gethandler('member'); - $owner_groups =& $member_handler->getGroupsByUser($owner, FALSE); - - $customArray['owner_groups'] = $owner_groups; - } - $sform = $download->getAdminForm($title, $customArray); - } elseif(file_exists(XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php")) { - $sform = $download->getCategoryForm(); - } else { - $sform = $download->getAdminForm($title); - } - $sform->display(); - // changed - end - March 4 2006 - jpc - } else { - redirect_header(WFDOWNLOADS_URL . 'admin/category.php?', 1, _AM_WFD_CCATEGORY_NOEXISTS); - exit(); - } - - if ($lid) { - global $imagearray; - // Vote data - $rating_handler = xoops_getmodulehandler('rating'); - $totalvotes = $rating_handler->getCount(); - - $reg_criteria = new CriteriaCompo(new Criteria('lid', $lid)); - $reg_criteria->add(new Criteria("ratinguser", 0, ">")); - $votesreg = $rating_handler->getCount($reg_criteria); - $reg_criteria->setSort("ratingtimestamp"); - $reg_criteria->setOrder("DESC"); - $regvotes = $rating_handler->getObjects($reg_criteria); - - $anon_criteria = new CriteriaCompo(new Criteria('lid', $lid)); - $anon_criteria->add(new Criteria("ratinguser", 0, "=")); - $votesanon = $rating_handler->getCount($anon_criteria); - $anon_criteria->setSort("ratingtimestamp"); - $anon_criteria->setOrder("DESC"); - - echo " - <fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_VOTE_RATINGINFOMATION . "</legend>\n - <div style='padding: 8px;'><b>" . _AM_WFD_VOTE_TOTALVOTES . "</b>" . $totalvotes . "<br /><br />\n - "; - - printf(_AM_WFD_VOTE_REGUSERVOTES, $votesreg); - - echo "<br />"; - - printf(_AM_WFD_VOTE_ANONUSERVOTES, $votesanon); - - echo " - </div>\n - <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n - <tr>\n - <th align='center'>" . _AM_WFD_VOTE_USER . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_IP . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_RATING . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_USERAVG . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_TOTALRATE . "</td>\n - <th align='center'>" . _AM_WFD_VOTE_DATE . "</td>\n - <th align='center'>" . _AM_WFD_MINDEX_ACTION . "</td>\n - </tr>\n - "; - - if ($votesreg == 0) { - echo "<tr><td align='center' colspan='8' class='even'><b>" . _AM_WFD_VO... [truncated message content] |
From: <luc...@us...> - 2014-09-16 20:31:57
|
Revision: 12782 http://sourceforge.net/p/xoops/svn/12782 Author: luciorota Date: 2014-09-16 20:31:50 +0000 (Tue, 16 Sep 2014) Log Message: ----------- standardize code use absolute path/url where possible Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/permissions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top_by_cat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/rating.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfdownloads_lists.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/xoopstree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_delete.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_edit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_new.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_post.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_reply.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/comment_functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/constants.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/directorychecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/filechecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/notification_update.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_newlistindex.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/visit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -27,4 +27,4 @@ echo $aboutAdmin->addNavigation('about.php'); echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); -include 'admin_footer.php'; +include_once dirname(__FILE__) . '/admin_footer.php'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -35,6 +35,6 @@ xoops_loadLanguage('main', $wfdownloads->getModule()->dirname()); if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once(XOOPS_ROOT_PATH . '/class/template.php'); + include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -91,13 +91,13 @@ case "addCat" : $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $pid = WfdownloadsRequest::getInt('pid', 0, 'POST'); - $weight = (isset($_POST["weight"]) && $_POST["weight"] > 0) ? (int) $_POST["weight"] : 0; + $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int) $_POST["weight"] : 0; $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array(); $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array(); - $spotlighthis = (isset($_POST["lid"])) ? (int) $_POST["lid"] : 0; - $spotlighttop = (isset($_POST["spotlighttop"]) && ($_POST["spotlighttop"] == 1)) ? 1 : 0; + $spotlighthis = (isset($_POST['lid'])) ? (int) $_POST['lid'] : 0; + $spotlighttop = (isset($_POST['spotlighttop']) && ($_POST['spotlighttop'] == 1)) ? 1 : 0; - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; $allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); $maxFileSize = $wfdownloads->getConfig('maxfilesize'); $maxImgWidth = $wfdownloads->getConfig('maximgwidth'); @@ -109,12 +109,12 @@ $uploader->fetchMedia($_POST['xoops_upload_file'][0]); if (!$uploader->upload()) { $errors = $uploader->getErrors(); - redirect_header("javascript:history.go(-1)",3, $errors); + redirect_header('javascript:history.go(-1)',3, $errors); } else { $imgurl = $uploader->getSavedFileName(); } } else { - $imgurl = (isset($_POST["imgurl"]) && $_POST["imgurl"] != "blank.png") ? $myts -> addslashes($_POST["imgurl"]) : ""; + $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts -> addslashes($_POST['imgurl']) : ''; } if (!$cid) { @@ -127,12 +127,12 @@ } } - $categoryObj->setVar('title', $_POST["title"]); + $categoryObj->setVar('title', $_POST['title']); $categoryObj->setVar('pid', $pid); $categoryObj->setVar('weight', $weight); $categoryObj->setVar('imgurl', $imgurl); - $categoryObj->setVar('description', $_POST["description"]); - $categoryObj->setVar('summary', $_POST["summary"]); + $categoryObj->setVar('description', $_POST['description']); + $categoryObj->setVar('summary', $_POST['summary']); $categoryObj->setVar('dohtml', isset($_POST['dohtml'])); $categoryObj->setVar('dosmiley', isset($_POST['dosmiley'])); $categoryObj->setVar('doxcode', isset($_POST['doxcode'])); @@ -140,7 +140,7 @@ $categoryObj->setVar('dobr', isset($_POST['dobr'])); // Formulize module support (2006/05/04) jpc - start if (wfdownloads_checkModule('formulize')) { - $formulize_fid = (isset($_POST["formulize_fid"])) ? (int) $_POST["formulize_fid"] : 0; + $formulize_fid = (isset($_POST['formulize_fid'])) ? (int) $_POST['formulize_fid'] : 0; $categoryObj->setVar('formulize_fid', $formulize_fid); } // Formulize module support (2006/05/04) jpc - end @@ -238,7 +238,7 @@ $form = $categoryObj->getForm(); $form -> display(); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; case 'categories.list' : @@ -261,7 +261,7 @@ } else { redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS); } - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; case 'categories.reorder' : Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -44,8 +44,8 @@ } $patterns = array( - strtolower(WFDOWNLOADS_DIRNAME) => strtolower($cloneDirname), - strtoupper(WFDOWNLOADS_DIRNAME) => strtoupper($cloneDirname), + strtolower(WFDOWNLOADS_DIRNAME) => strtolower($cloneDirname), + strtoupper(WFDOWNLOADS_DIRNAME) => strtoupper($cloneDirname), ucfirst(strtolower(WFDOWNLOADS_DIRNAME)) => ucfirst(strtolower($cloneDirname)) ); @@ -54,7 +54,7 @@ wfdownloads_cloneFileDir(WFDOWNLOADS_ROOT_PATH); $logocreated = wfdownloads_createLogo(strtolower($cloneDirname)); - $message = ""; + $message = ''; if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($cloneDirname))) { $message .= sprintf( _AM_WFDOWNLOADS_CLONE_CONGRAT, @@ -71,7 +71,7 @@ $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); echo $message; - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; exit(); } else { @@ -79,17 +79,14 @@ $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); + $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', 18, 18, ''); $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'; + include_once dirname(__FILE__) . '/admin_footer.php'; exit(); } @@ -138,16 +135,16 @@ { $wfdownloads = WfdownloadsWfdownloads::getInstance(); // Check extension/functions - if (!extension_loaded("gd")) { + if (!extension_loaded('gd')) { return false; } else { $required_functions = array( - "imagecreatetruecolor", - "imagecolorallocate", - "imagefilledrectangle", - "imagejpeg", - "imagedestroy", - "imageftbbox" + 'imagecreatetruecolor', + 'imagecolorallocate', + 'imagefilledrectangle', + 'imagejpeg', + 'imagedestroy', + 'imageftbbox' ); foreach ($required_functions as $func) { if (!function_exists($func)) { @@ -156,10 +153,10 @@ } } // Check original image/font - if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo_blank.png")) { + if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/{$dirname}/assets/images/module_logo_blank.png")) { return false; } - if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $wfdownloads->getModule()->dirname() . "/assets/images/VeraBd.ttf")) { + if (!file_exists($font = XOOPS_ROOT_PATH . "/modules/{$wfdownloads->getModule()->dirname()}/assets/images/VeraBd.ttf")) { return false; } // Create image @@ -168,7 +165,7 @@ $greyColor = imagecolorallocate($imageModule, 237, 237, 237); imagefilledrectangle($imageModule, 5, 35, 85, 46, $greyColor); // Write text - $textColor = imagecolorallocate($imageModule, 0, 0, 0); + $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 @@ -176,7 +173,7 @@ imagefill($imageModule, 0, 0, $whiteColor); imagecolortransparent($imageModule, $whiteColor); // Save new image - imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo.png"); + imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/{$dirname}/assets/images/module_logo.png"); imagedestroy($imageModule); return true; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -41,9 +41,9 @@ $op = WfdownloadsRequest::getString('op', 'downloads.list'); switch ($op) { - case "download.edit" : - case "download.add" : - case "Download" : + case 'download.edit': + case 'download.add': + case 'Download': wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); @@ -59,8 +59,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"; @@ -83,7 +83,7 @@ } else { // create download $downloadObj = $wfdownloads->getHandler('download')->create(); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); + $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $categoryObj = $wfdownloads->getHandler('category')->get($cid); $downloadObj->setVar('cid', $cid); $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE); @@ -97,15 +97,15 @@ $sform = $downloadObj->getAdminForm($title); } elseif ((isset($_POST['submit_category']) && !empty($_POST['submit_category']))) { // two steps form: 2nd step - $fid = $categoryObj->getVar('formulize_fid'); + $fid = $categoryObj->getVar('formulize_fid'); $customArray = array(); 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; + include_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php'; + include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; + $customArray['fid'] = $fid; $customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize'); - $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); - $customArray['prevEntry'] = getEntryValues( // is a Formulize function + $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $customArray['prevEntry'] = getEntryValues( // is a Formulize function $downloadObj->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], @@ -117,14 +117,14 @@ null ); $customArray['entry'] = $downloadObj->getVar('formulize_idreq'); - $customArray['go_back'] = ""; - $customArray['parentLinks'] = ""; + $customArray['go_back'] = ''; + $customArray['parentLinks'] = ''; if (wfdownloads_checkModule('formulize') < 300) { $owner = getEntryOwner($customArray['entry']); // is a Formulize function } else { $owner = getEntryOwner($customArray['entry'], $fid); // is a Formulize function } - $ownerGroups = $member_handler->getGroupsByUser($owner, false); + $ownerGroups = $member_handler->getGroupsByUser($owner, false); $customArray['owner_groups'] = $ownerGroups; } $sform = $downloadObj->getAdminForm($title22, $customArray); @@ -141,29 +141,29 @@ // Vote data list/manager if ($lid) { - $votes_count = $wfdownloads->getHandler('rating')->getCount(); + $ratingCount = $wfdownloads->getHandler('rating')->getCount(); - $registeredCriteria = new CriteriaCompo(new Criteria('lid', $lid)); - $registeredCriteria->add(new Criteria('ratinguser', 0, '>')); - $votesreg = $wfdownloads->getHandler('rating')->getCount($registeredCriteria); - $registeredCriteria->setSort('ratingtimestamp'); - $registeredCriteria->setOrder('DESC'); - $regvotes = $wfdownloads->getHandler('rating')->getObjects($registeredCriteria); + $regUserCriteria = new CriteriaCompo(new Criteria('lid', $lid)); + $regUserCriteria->add(new Criteria('ratinguser', 0, '>')); + $regUserRatingCount = $wfdownloads->getHandler('rating')->getCount($regUserCriteria); + $regUserCriteria->setSort('ratingtimestamp'); + $regUserCriteria->setOrder('DESC'); + $regUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($regUserCriteria); - $anonymousCriteria = new CriteriaCompo(new Criteria('lid', $lid)); - $anonymousCriteria->add(new Criteria('ratinguser', 0, '=')); - $votesanon = $wfdownloads->getHandler('rating')->getCount($anonymousCriteria); - $anonymousCriteria->setSort('ratingtimestamp'); - $anonymousCriteria->setOrder('DESC'); + $anonUserCriteria = new CriteriaCompo(new Criteria('lid', $lid)); + $anonUserCriteria->add(new Criteria('ratinguser', 0, '=')); + $anonUserRatingCount = $wfdownloads->getHandler('rating')->getCount($anonUserCriteria); + $anonUserCriteria->setSort('ratingtimestamp'); + $anonUserCriteria->setOrder('DESC'); echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFDOWNLOADS_VOTE_RATINGINFOMATION . "</legend>\n"; - echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$votes_count}<br /><br />\n"; + echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$ratingCount}<br /><br />\n"; - printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $votesreg); + printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $regUserRatingCount); echo "<br />"; - printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $votesanon); + printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $anonUserRatingCount); echo " </div>\n @@ -179,36 +179,32 @@ </tr>\n "; - if ($votesreg == 0) { + if ($regUserRatingCount == 0) { echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOREGVOTES . "</b></td></tr>"; } else { - foreach (array_keys($regvotes) as $i) { - $uids[] = $regvotes[$i]->getVar('ratinguser'); + foreach ($regUserRatingObjs as $regUserRatingObj) { + $uids[] = $regUserRatingObj->getVar('ratinguser'); } - $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN"); - $criteria->setGroupby("ratinguser"); + $criteria = new Criteria('ratinguser', '(' . implode(',', $uids) . ')', 'IN'); + $criteria->setGroupby('ratinguser'); $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria); - foreach (array_keys($regvotes) as $i) { - $formatted_date = XoopsLocal::formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), 'l'); - $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; - $ratingUserName = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser')); + foreach ($regUserRatingObjs as $regUserRatingObj) { + $formatted_date = XoopsLocal::formatTimestamp($regUserRatingObj->getVar('ratingtimestamp'), 'l'); + $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0; + $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0; + $ratingUserName = XoopsUser :: getUnameFromId($regUserRatingObj->getVar('ratinguser')); echo " <tr><td class='head'>$ratingUserName</td>\n - <td class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n - <td class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n + <td class='even'>" . $regUserRatingObj->getVar('ratinghostname') . "</th>\n + <td class='even'>" . $regUserRatingObj->getVar('rating') . "</th>\n <td class='even'>$userAvgRating</th>\n <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') . "'>" + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; @@ -228,29 +224,29 @@ <th>" . _AM_WFDOWNLOADS_MINDEX_ACTION . "</td>\n </tr>\n "; - if ($votesanon == 0) { + if ($anonUserRatingCount == 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); - $anonymousVotes = $wfdownloads->getHandler('rating')->getObjects($anonymousCriteria); + $criteria = new Criteria('ratinguser', 0); + $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria); + $anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria); - foreach (array_keys($anonymousVotes) as $i) { - $formatted_date = XoopsLocal::formatTimestamp($anonymousVotes[$i]->getVar('ratingtimestamp'), 'l'); - $userAvgRating = isset($userRatings['avg']) ? $userRatings["avg"] : 0; - $userVotes = isset($userRatings['count']) ? $userRatings["count"] : 0; + foreach (array_keys($anonUserRatingObjs) as $anonUserRatingObj) { + $formatted_date = XoopsLocal::formatTimestamp($anonUserRatingObj->getVar('ratingtimestamp'), 'l'); + $userAvgRating = isset($userRatings['avg']) ? $userRatings['avg'] : 0; + $userVotes = isset($userRatings['count']) ? $userRatings['count'] : 0; $ratingUserName = $GLOBALS['xoopsConfig']['anonymous']; echo " <tr><td class='head'>$ratingUserName</td>\n - <td class='even'>" . $anonymousVotes[$i]->getVar('ratinghostname') . "</th>\n - <td class='even'>" . $anonymousVotes[$i]->getVar('rating') . "</th>\n + <td class='even'>" . $anonUserRatingObj->getVar('ratinghostname') . "</th>\n + <td class='even'>" . $anonUserRatingObj->getVar('rating') . "</th>\n <td class='even'>$userAvgRating</th>\n <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') . "'>" + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; @@ -259,32 +255,32 @@ echo "</table>\n"; echo "</fieldset>\n"; } - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; - case "download.save" : - case "addDownload" : - $lid = WfdownloadsRequest::getInt('lid', 0, 'POST'); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); + case 'download.save': + case 'addDownload': + $lid = WfdownloadsRequest::getInt('lid', 0, 'POST'); + $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $status = WfdownloadsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST'); if ($lid > 0) { $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->get($lid); + $downloadObj = $wfdownloads->getHandler('download')->get($lid); } else { $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->create(); + $downloadObj = $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'] : ''; + if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != "http://") { + $url = ($_POST['url'] != "http://") ? $_POST['url'] : ''; $filename = ''; $filetype = ''; // Get size from form $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST["size"]; } else { - $url = ($_POST["url"] != "http://") ? $_POST['url'] : ''; + $url = ($_POST["url"] != "http://") ? $_POST['url'] : ''; $filename = $_POST['filename']; $filetype = $_POST['filetype']; $filePath = $wfdownloads->getConfig('uploaddir') . '/' . $filename; @@ -295,12 +291,12 @@ $downloadObj->setVar('filename', $filename); $downloadObj->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']); @@ -329,11 +325,11 @@ // If both conditions are true, then trigger all three notifications related to modified records. if (!$thisIsANewRecord && ($downloadObj->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}"; - $categoryObj = $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}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags['FILE_VERSION'] = $version; $tags['CATEGORY_NAME'] = $categoryObj->getVar('title'); $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}"; @@ -379,12 +375,12 @@ $versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : ''; $downloadObj->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 . XoopsLocal::formatTimestamp($time, 'l') . "\n\n"; $dhistory .= $dhistoryhistory; } @@ -400,7 +396,7 @@ $offline = ($_POST['offline'] == true) ? true : false; $downloadObj->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; @@ -408,7 +404,7 @@ $publishdate = time(); } else { $publishdate = $_POST['was_published']; - $expiredate = $_POST['was_expired']; + $expiredate = $_POST['was_expired']; } if ($approved == 1 && empty($publishdate)) { $publishdate = time(); @@ -440,8 +436,8 @@ if (wfdownloads_checkModule('formulize')) { $fid = $categoryObj->getVar('formulize_fid'); if ($fid) { - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php"; - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php"; + 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] = $downloadObj->getVar('formulize_idreq'); @@ -452,19 +448,19 @@ $owner = getEntryOwner($entries[$fid][0], $fid); // is a Formulize function } } else { - print "no idreq"; - $entries[$fid][0] = ""; - $owner = ""; + print 'no idreq'; + $entries[$fid][0] = ''; + $owner = ''; } $cid = $downloadObj->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( + $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, @@ -472,7 +468,7 @@ $fid, $ownerGroups, $groups, - "new" + 'new' ); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that if (!$owner) { $id_req = $entries[$fid][0]; @@ -485,21 +481,21 @@ $newid = (int) $downloadObj->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'] = $categoryObj->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}"; - $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags = array(); + $tags['FILE_NAME'] = $title; + $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); $tags['CATEGORY_NAME'] = $categoryObj->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); @@ -510,9 +506,9 @@ redirect_header($currentFile, 1, $message); break; - case "download.delete" : + case 'download.delete': $lid = WfdownloadsRequest::getInt('lid', 0); - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); + $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); exit(); @@ -544,17 +540,17 @@ } break; - case "vote.delete" : - case "delVote" : - $rating = $wfdownloads->getHandler('rating')->get($_GET['rid']); - if ($wfdownloads->getHandler('rating')->delete($rating, true)) { - wfdownloads_updateRating(intval($rating->getVar('lid'))); + case 'vote.delete': + case 'delVote': + $ratingObj = $wfdownloads->getHandler('rating')->get($_GET['rid']); + if ($wfdownloads->getHandler('rating')->delete($ratingObj, true)) { + wfdownloads_updateRating((int) $ratingObj->getVar('lid')); } redirect_header($currentFile, 1, _AM_WFDOWNLOADS_VOTE_VOTEDELETED); break; // Formulize module support (2006/05/04) jpc - start - case "patch_formulize" : + case 'patch_formulize': if (wfdownloads_checkModule('formulize')) { if (!isset($_POST['patch_formulize'])) { print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>"; @@ -576,8 +572,8 @@ break; // Formulize module support (2006/05/04) jpc - end - case "newdownload.approve" : - case "approve" : + case 'newdownload.approve': + case 'approve': $lid = WfdownloadsRequest::getInt('lid', 0); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); @@ -591,14 +587,14 @@ exit(); } // Trigger notify - $title = $downloadObj->getVar('title'); - $cid = $downloadObj->getVar('cid'); - $categoryObj = $wfdownloads->getHandler('category')->get($cid); - $tags = array(); - $tags['FILE_NAME'] = $title; - $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $title = $downloadObj->getVar('title'); + $cid = $downloadObj->getVar('cid'); + $categoryObj = $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'] = $categoryObj->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 ($downloadObj->getVar('notifypub')) { @@ -607,17 +603,18 @@ redirect_header($currentFile, 1, _AM_WFDOWNLOADS_SUB_NEWFILECREATED); break; - case "downloads.list" : - case "downloads.filter" : + case 'downloads.list': + case 'downloads.filter': default : - $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '='); - $filter_title = WfdownloadsRequest::getString('filter_title', ''); + // get filter conditions + $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_submitter = WfdownloadsRequest::getArray('filter_submitter', 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_submitter = WfdownloadsRequest::getArray('filter_submitter', null); + $filter_date = WfdownloadsRequest::getArray('filter_date', null); + $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<'); + // check filter conditions if ($op == 'downloads.filter') { if ($filter_title == '' && $filter_category_title == '' && is_null($filter_submitter)) { $op = 'downloads.list'; @@ -626,16 +623,16 @@ include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $categories = $wfdownloads->getHandler('category')->getObjects(); + $categoryObjs = $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); $totalCategoriesCount = wfdownloads_categoriesCount(); - $categories = $wfdownloads->getHandler('category')->getObjects(null, true, false); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false); $totalDownloadsCount = $wfdownloads->getHandler('download')->getCount(); @@ -683,13 +680,13 @@ $criteria->setOrder('DESC'); $criteria->setStart($start_published); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); - $publishedDownloadsCount = $wfdownloads->getHandler('download')->getActiveCount(); - $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadsCount); + $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); + $publishedDownloadCount = $wfdownloads->getHandler('download')->getActiveCount(); + $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadCount); - if ($publishedDownloadsCount > 0) { - foreach ($publishedDownloads as $publishedDownload) { - $publishedDownload_array = $publishedDownload->toArray(); + if ($publishedDownloadCount > 0) { + foreach ($publishedDownloadObjs as $publishedDownloadObj) { + $publishedDownload_array = $publishedDownloadObj->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']); @@ -723,12 +720,12 @@ $criteria->add(new Criteria('published', 0)); $criteria->setStart($start_new); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $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(); + $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $newDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadCount); + if ($newDownloadCount > 0) { + foreach ($newDownloadObjs as $newDownloadObj) { + $newDownload_array = $newDownloadObj->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']; @@ -743,7 +740,7 @@ $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array); } } - $pagenav = new XoopsPageNav($newDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new'); + $pagenav = new XoopsPageNav($newDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new'); $GLOBALS['xoopsTpl']->assign('new_downloads_pagenav', $pagenav->renderNav()); // Autopublished Downloads @@ -753,12 +750,12 @@ $criteria->setOrder("ASC"); $criteria->setStart($start_autopublished); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $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(); + $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $autopublishedDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadCount); + if ($autopublishedDownloadCount > 0) { + foreach ($autopublishedDownloadObjs as $autopublishedDownloadObj) { + $autopublishedDownload_array = $autopublishedDownloadObj->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']); @@ -766,7 +763,7 @@ $GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array); } } - $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig( + $pagenav = new XoopsPageNav($autopublishedDownloadCount, $wfdownloads->getConfig( 'admin_perpage' ), $start_autopublished, 'start_autopublished'); $GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav()); @@ -779,12 +776,12 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_expired); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria); - $expiredDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria); - $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadsCount); - if ($expiredDownloadsCount > 0) { - foreach ($expired_downloads as $expired_download) { - $expired_download_array = $expired_download->toArray(); + $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $expiredDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount); + if ($expiredDownloadCount > 0) { + foreach ($expiredDownloadObjs as $expiredDownloadObj) { + $expired_download_array = $expiredDownloadObj->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']); @@ -792,7 +789,7 @@ $GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array); } } - $pagenav = new XoopsPageNav($expiredDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired'); + $pagenav = new XoopsPageNav($expiredDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired'); $GLOBALS['xoopsTpl']->assign('expired_downloads_pagenav', $pagenav->renderNav()); // Offline downloads @@ -801,13 +798,12 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_offline); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($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(); + $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $offlineDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadCount); + if ($offlineDownloadCount > 0) { + foreach ($offlineDownloadObjs as $offlineDownloadObj) { + $offlineDownload_array = $offlineDownloadObj->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']); @@ -815,7 +811,7 @@ $GLOBALS['xoopsTpl']->append('offline_downloads', $offlineDownload_array); } } - $pagenav = new XoopsPageNav($offlineDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline'); + $pagenav = new XoopsPageNav($offlineDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline'); $GLOBALS['xoopsTpl']->assign('offline_downloads_pagenav', $pagenav->renderNav()); } else { // NOP @@ -843,10 +839,10 @@ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl"); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; - case "batchfile.add" : + case 'batchfile.add': $batchid = WfdownloadsRequest::getInt('batchid', 0); $extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php'); @@ -873,7 +869,6 @@ $downloadObj->setVar('filename', $savedFileName); $downloadObj->setVar('size', filesize($wfdownloads->getConfig('uploaddir') . '/' . $savedFileName)); $downloadObj->setVar('filetype', $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)]); - $downloadObj->setVar('version', 0); $downloadObj->setVar('status', _WFDOWNLOADS_STATUS_APPROVED); // IN PROGRESS $downloadObj->setVar('published', time()); @@ -892,7 +887,7 @@ redirect_header("{$currentFile}?op=download.edit&lid={$newid}", 3, _AM_WFDOWNLOADS_BATCHFILE_MOVEDEDITNOW); break; - case "batchfile.delete" : + case 'batchfile.delete': $batchid = WfdownloadsRequest::getInt('batchid', 0); $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); @@ -922,7 +917,7 @@ } break; - case "ip_logs.list" : + case 'ip_logs.list': $lid = WfdownloadsRequest::getInt('lid', 0); if (!$lid) { header('Location index.php'); @@ -943,15 +938,15 @@ } $criteria->setSort('date'); $criteria->setOrder('DESC'); - $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria); - $ip_logs_count = $wfdownloads->getHandler('ip_log')->getCount($criteria); - $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logs_count); + $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria); + $ip_logCount = $wfdownloads->getHandler('ip_log')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logCount); unset($criteria); // Get download info if ($lid != 0) { - $downloadObj = $wfdownloads->getHandler('download')->get($lid); - $download_array = $downloadObj->toArray(); + $downloadObj = $wfdownloads->getHandler('download')->get($lid); + $download_array = $downloadObj->toArray(); $download_array['log_title'] = sprintf(_AM_WFDOWNLOADS_LOG_FOR_LID, $download_array['title']); $GLOBALS['xoopsTpl']->assign('download', $download_array); } @@ -972,8 +967,8 @@ // NOP } else { foreach ($ip_logObjs as $ip_logObj) { - $ip_log_array = $ip_logObj->toArray(); - $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId( + $ip_log_array = $ip_logObj->toArray(); + $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId( $ip_log_array['uid'] ); //($ip_log_array['uid'] != 0) ? $userList[$ip_log_array['uid']] : _AM_WFDOWNLOADS_ANONYMOUS; @@ -984,6 +979,6 @@ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_ip_logslist.tpl"); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php 2014-09-15 03:39:05 UTC (rev 12781) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php 2014-09-16 20:31:50 UTC (rev 12782) @@ -36,8 +36,8 @@ $op = WfdownloadsRequest::getString('op', 'images.list'); switch ($op) { - case "image.upload" : - if ($_FILES['uploadfile']['name'] != "") { + case 'image.upload': + if ($_FILES['uploadfile']['name'] != '') { if (file_exists(XOOPS_ROOT_PATH . '/' . $_POST['uploadpath'] . '/' . $_FILES['uploadfile']['name'])) { redirect_header($currentFile, 2, _AM_WFDOWNLOADS_DOWN_IMAGEEXIST); } @@ -60,7 +60,7 @@ } break; - case "image.delete" : + case 'image.delete': $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); if ($ok == true) { @@ -86,11 +86,11 @@ _AM_WFDOWNLOADS_DOWN_DELETEFILE . "<br /><br />" . $_POST['downfile'], _AM_WFDOWNLOADS_BDELETE ); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; } break; - case "images.list" : + case 'images.list': default: include_once WFDOWNLOADS_ROOT_PATH . '/class/wfdownloads_lists.php'; @@ -140,24 +140,16 @@ $iform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADPATH, XOOPS_R... [truncated message content] |
From: <luc...@us...> - 2014-09-17 20:13:31
|
Revision: 12789 http://sourceforge.net/p/xoops/svn/12789 Author: luciorota Date: 2014-09-17 20:13:28 +0000 (Wed, 17 Sep 2014) Log Message: ----------- this is my latest version, start from here Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-17 13:55:08 UTC (rev 12788) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-09-17 20:13:28 UTC (rev 12789) @@ -56,17 +56,17 @@ $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); $sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_BMODIFY, $categoryObjsTree->makeSelBox('target', 'title'))); $create_tray = new XoopsFormElementTray('', ''); - $create_tray -> addElement(new XoopsFormHidden('source', $cid)); - $create_tray -> addElement(new XoopsFormHidden('ok', true)); - $create_tray -> addElement(new XoopsFormHidden('op', 'category.move')); + $create_tray->addElement(new XoopsFormHidden('source', $cid)); + $create_tray->addElement(new XoopsFormHidden('ok', true)); + $create_tray->addElement(new XoopsFormHidden('op', 'category.move')); $butt_save = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BMOVE, 'submit'); - $butt_save -> setExtra('onclick="this.form.elements.op.value=\'category.move\'"'); - $create_tray -> addElement($butt_save); + $butt_save->setExtra('onclick="this.form.elements.op.value=\'category.move\'"'); + $create_tray->addElement($butt_save); $butt_cancel = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BCANCEL, 'submit'); - $butt_cancel -> setExtra('onclick="this.form.elements.op.value=\'cancel\'"'); + $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"'); $create_tray -> addElement($butt_cancel); - $sform -> addElement($create_tray); - $sform -> display(); + $sform->addElement($create_tray); + $sform->display(); xoops_cp_footer(); } else { $source = WfdownloadsRequest::getInt('source', 0, 'POST'); @@ -77,7 +77,7 @@ if (!$target) { redirect_header($currentFile . "?op=category.move&ok=0&cid={$source}", 5, _AM_WFDOWNLOADS_CCATEGORY_MODIFY_FAILEDT); } - $result = $wfdownloads->getHandler('download')->updateAll("cid", $target, new Criteria("cid", $source), true); + $result = $wfdownloads->getHandler('download')->updateAll('cid', $target, new Criteria('cid', $source), true); if (!$result) { $error = _AM_WFDOWNLOADS_DBERROR; trigger_error($error, E_USER_ERROR); @@ -91,26 +91,26 @@ case 'addCat': $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $pid = WfdownloadsRequest::getInt('pid', 0, 'POST'); - $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int) $_POST['weight'] : 0; + $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int) $_POST["weight"] : 0; $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array(); $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array(); $spotlighthis = (isset($_POST['lid'])) ? (int) $_POST['lid'] : 0; $spotlighttop = (isset($_POST['spotlighttop']) && ($_POST['spotlighttop'] == 1)) ? 1 : 0; - $imgurl = 'blank.png'; - include_once XOOPS_ROOT_PATH.'/class/uploader.php'; + include_once XOOPS_ROOT_PATH . '/class/uploader.php'; $allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); + $imgurl = 'blank.png'; $maxFileSize = $wfdownloads->getConfig('maxfilesize'); $maxImgWidth = $wfdownloads->getConfig('maximgwidth'); $maxImgHeight = $wfdownloads->getConfig('maximgheight'); - $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage'); + $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage'); $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { $uploader->setTargetFileName('wfdownloads_' . uniqid(time()) . '--' . strtolower($_FILES['uploadfile']['name'])); $uploader->fetchMedia($_POST['xoops_upload_file'][0]); if (!$uploader->upload()) { $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1)', 3, $errors); + redirect_header('javascript:history.go(-1)',3, $errors); } else { $imgurl = $uploader->getSavedFileName(); } @@ -152,15 +152,17 @@ echo $categoryObj->getHtmlErrors(); } if (!$cid) { - $newid = (int) $categoryObj->getVar('cid'); + if ($cid == 0) { + $newid = (int) $categoryObj->getVar('cid'); + } wfdownloads_savePermissions($down_groups, $newid, 'WFDownCatPerm'); wfdownloads_savePermissions($up_groups, $newid, 'WFUpCatPerm'); // Notify of new category $tags = array(); $tags['CATEGORY_NAME'] = $_POST['title']; $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid; - $notification_handler = & xoops_gethandler('notification'); - $notification_handler -> triggerEvent('global', 0, 'new_category', $tags); + $notification_handler = xoops_gethandler('notification'); + $notification_handler->triggerEvent('global', 0, 'new_category', $tags); $database_mess = _AM_WFDOWNLOADS_CCATEGORY_CREATED; } else { $database_mess = _AM_WFDOWNLOADS_CCATEGORY_MODIFIED; @@ -179,7 +181,6 @@ if ($ok == true) { // get all subcategories under the specified category $childCategoryObjs = $categoryObjsTree->getAllChild($cid); - $cids = array(); foreach ($childCategoryObjs as $childCategoryObj) { // get all category ids $cids[] = $childCategoryObj->getVar('cid'); @@ -238,7 +239,7 @@ $form = $categoryObj->getForm(); $form -> display(); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; case 'categories.list': @@ -261,7 +262,7 @@ } else { redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS); } - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; case 'categories.reorder': Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-17 13:55:08 UTC (rev 12788) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-17 20:13:28 UTC (rev 12789) @@ -41,9 +41,9 @@ $op = WfdownloadsRequest::getString('op', 'downloads.list'); switch ($op) { - case "download.edit" : - case "download.add" : - case "Download" : + case 'download.edit': + case 'download.add': + case 'Download': wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); @@ -59,8 +59,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"; @@ -83,7 +83,7 @@ } else { // create download $downloadObj = $wfdownloads->getHandler('download')->create(); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); + $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $categoryObj = $wfdownloads->getHandler('category')->get($cid); $downloadObj->setVar('cid', $cid); $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE); @@ -97,15 +97,15 @@ $sform = $downloadObj->getAdminForm($title); } elseif ((isset($_POST['submit_category']) && !empty($_POST['submit_category']))) { // two steps form: 2nd step - $fid = $categoryObj->getVar('formulize_fid'); + $fid = $categoryObj->getVar('formulize_fid'); $customArray = array(); 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; + include_once XOOPS_ROOT_PATH . '/modules/formulize/include/formdisplay.php'; + include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; + $customArray['fid'] = $fid; $customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize'); - $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); - $customArray['prevEntry'] = getEntryValues( // is a Formulize function + $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $customArray['prevEntry'] = getEntryValues( // is a Formulize function $downloadObj->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], @@ -117,14 +117,14 @@ null ); $customArray['entry'] = $downloadObj->getVar('formulize_idreq'); - $customArray['go_back'] = ""; - $customArray['parentLinks'] = ""; + $customArray['go_back'] = ''; + $customArray['parentLinks'] = ''; if (wfdownloads_checkModule('formulize') < 300) { $owner = getEntryOwner($customArray['entry']); // is a Formulize function } else { $owner = getEntryOwner($customArray['entry'], $fid); // is a Formulize function } - $ownerGroups = $member_handler->getGroupsByUser($owner, false); + $ownerGroups = $member_handler->getGroupsByUser($owner, false); $customArray['owner_groups'] = $ownerGroups; } $sform = $downloadObj->getAdminForm($title22, $customArray); @@ -141,29 +141,29 @@ // Vote data list/manager if ($lid) { - $votes_count = $wfdownloads->getHandler('rating')->getCount(); + $ratingCount = $wfdownloads->getHandler('rating')->getCount(); - $registeredCriteria = new CriteriaCompo(new Criteria('lid', $lid)); - $registeredCriteria->add(new Criteria('ratinguser', 0, '>')); - $votesreg = $wfdownloads->getHandler('rating')->getCount($registeredCriteria); - $registeredCriteria->setSort('ratingtimestamp'); - $registeredCriteria->setOrder('DESC'); - $regvotes = $wfdownloads->getHandler('rating')->getObjects($registeredCriteria); + $regUserCriteria = new CriteriaCompo(new Criteria('lid', $lid)); + $regUserCriteria->add(new Criteria('ratinguser', 0, '>')); + $regUserRatingCount = $wfdownloads->getHandler('rating')->getCount($regUserCriteria); + $regUserCriteria->setSort('ratingtimestamp'); + $regUserCriteria->setOrder('DESC'); + $regUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($regUserCriteria); - $anonymousCriteria = new CriteriaCompo(new Criteria('lid', $lid)); - $anonymousCriteria->add(new Criteria('ratinguser', 0, '=')); - $votesanon = $wfdownloads->getHandler('rating')->getCount($anonymousCriteria); - $anonymousCriteria->setSort('ratingtimestamp'); - $anonymousCriteria->setOrder('DESC'); + $anonUserCriteria = new CriteriaCompo(new Criteria('lid', $lid)); + $anonUserCriteria->add(new Criteria('ratinguser', 0, '=')); + $anonUserRatingCount = $wfdownloads->getHandler('rating')->getCount($anonUserCriteria); + $anonUserCriteria->setSort('ratingtimestamp'); + $anonUserCriteria->setOrder('DESC'); echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFDOWNLOADS_VOTE_RATINGINFOMATION . "</legend>\n"; - echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$votes_count}<br /><br />\n"; + echo "<div style='padding: 8px;'><b>" . _AM_WFDOWNLOADS_VOTE_TOTALVOTES . "</b>{$ratingCount}<br /><br />\n"; - printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $votesreg); + printf(_AM_WFDOWNLOADS_VOTE_REGUSERVOTES, $regUserRatingCount); echo "<br />"; - printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $votesanon); + printf(_AM_WFDOWNLOADS_VOTE_ANONUSERVOTES, $anonUserRatingCount); echo " </div>\n @@ -179,37 +179,32 @@ </tr>\n "; - if ($votesreg == 0) { + if ($regUserRatingCount == 0) { echo "<tr><td colspan='7' class='even'><b>" . _AM_WFDOWNLOADS_VOTE_NOREGVOTES . "</b></td></tr>"; } else { - $uids = array(); - foreach (array_keys($regvotes) as $i) { - $uids[] = $regvotes[$i]->getVar('ratinguser'); + foreach ($regUserRatingObjs as $regUserRatingObj) { + $uids[] = $regUserRatingObj->getVar('ratinguser'); } - $criteria = new Criteria("ratinguser", "(" . implode(',', $uids) . ")", "IN"); - $criteria->setGroupby("ratinguser"); + $criteria = new Criteria('ratinguser', '(' . implode(',', $uids) . ')', 'IN'); + $criteria->setGroupby('ratinguser'); $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria); - foreach (array_keys($regvotes) as $i) { - $formatted_date = XoopsLocal::formatTimestamp($regvotes[$i]->getVar('ratingtimestamp'), 'l'); - $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; - $ratingUserName = XoopsUser :: getUnameFromId($regvotes[$i]->getVar('ratinguser')); + foreach ($regUserRatingObjs as $regUserRatingObj) { + $formatted_date = XoopsLocal::formatTimestamp($regUserRatingObj->getVar('ratingtimestamp'), 'l'); + $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0; + $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0; + $ratingUserName = XoopsUser :: getUnameFromId($regUserRatingObj->getVar('ratinguser')); echo " <tr><td class='head'>$ratingUserName</td>\n - <td class='even'>" . $regvotes[$i]->getVar('ratinghostname') . "</th>\n - <td class='even'>" . $regvotes[$i]->getVar('rating') . "</th>\n + <td class='even'>" . $regUserRatingObj->getVar('ratinghostname') . "</th>\n + <td class='even'>" . $regUserRatingObj->getVar('rating') . "</th>\n <td class='even'>$userAvgRating</th>\n <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') . "'>" + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; @@ -229,29 +224,29 @@ <th>" . _AM_WFDOWNLOADS_MINDEX_ACTION . "</td>\n </tr>\n "; - if ($votesanon == 0) { + if ($anonUserRatingCount == 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); - $anonymousVotes = $wfdownloads->getHandler('rating')->getObjects($anonymousCriteria); + $criteria = new Criteria('ratinguser', 0); + $userRatings = $wfdownloads->getHandler('rating')->getUserAverage($criteria); + $anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria); - foreach (array_keys($anonymousVotes) as $i) { - $formatted_date = XoopsLocal::formatTimestamp($anonymousVotes[$i]->getVar('ratingtimestamp'), 'l'); - $userAvgRating = isset($userRatings['avg']) ? $userRatings["avg"] : 0; - $userVotes = isset($userRatings['count']) ? $userRatings["count"] : 0; + foreach (array_keys($anonUserRatingObjs) as $anonUserRatingObj) { + $formatted_date = XoopsLocal::formatTimestamp($anonUserRatingObj->getVar('ratingtimestamp'), 'l'); + $userAvgRating = isset($userRatings['avg']) ? $userRatings['avg'] : 0; + $userVotes = isset($userRatings['count']) ? $userRatings['count'] : 0; $ratingUserName = $GLOBALS['xoopsConfig']['anonymous']; echo " <tr><td class='head'>$ratingUserName</td>\n - <td class='even'>" . $anonymousVotes[$i]->getVar('ratinghostname') . "</th>\n - <td class='even'>" . $anonymousVotes[$i]->getVar('rating') . "</th>\n + <td class='even'>" . $anonUserRatingObj->getVar('ratinghostname') . "</th>\n + <td class='even'>" . $anonUserRatingObj->getVar('rating') . "</th>\n <td class='even'>$userAvgRating</th>\n <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') . "'>" + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; @@ -260,32 +255,32 @@ echo "</table>\n"; echo "</fieldset>\n"; } - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; - case "download.save" : - case "addDownload" : - $lid = WfdownloadsRequest::getInt('lid', 0, 'POST'); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); + case 'download.save': + case 'addDownload': + $lid = WfdownloadsRequest::getInt('lid', 0, 'POST'); + $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); $status = WfdownloadsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST'); if ($lid > 0) { $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->get($lid); + $downloadObj = $wfdownloads->getHandler('download')->get($lid); } else { $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->create(); + $downloadObj = $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'] : ''; + if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != "http://") { + $url = ($_POST['url'] != "http://") ? $_POST['url'] : ''; $filename = ''; $filetype = ''; // Get size from form $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST["size"]; } else { - $url = ($_POST["url"] != "http://") ? $_POST['url'] : ''; + $url = ($_POST["url"] != "http://") ? $_POST['url'] : ''; $filename = $_POST['filename']; $filetype = $_POST['filetype']; $filePath = $wfdownloads->getConfig('uploaddir') . '/' . $filename; @@ -296,12 +291,12 @@ $downloadObj->setVar('filename', $filename); $downloadObj->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']); @@ -330,11 +325,11 @@ // If both conditions are true, then trigger all three notifications related to modified records. if (!$thisIsANewRecord && ($downloadObj->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}"; - $categoryObj = $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}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags['FILE_VERSION'] = $version; $tags['CATEGORY_NAME'] = $categoryObj->getVar('title'); $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}"; @@ -380,12 +375,12 @@ $versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : ''; $downloadObj->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 . XoopsLocal::formatTimestamp($time, 'l') . "\n\n"; $dhistory .= $dhistoryhistory; } @@ -401,7 +396,7 @@ $offline = ($_POST['offline'] == true) ? true : false; $downloadObj->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; @@ -409,7 +404,7 @@ $publishdate = time(); } else { $publishdate = $_POST['was_published']; - $expiredate = $_POST['was_expired']; + $expiredate = $_POST['was_expired']; } if ($approved == 1 && empty($publishdate)) { $publishdate = time(); @@ -441,8 +436,8 @@ if (wfdownloads_checkModule('formulize')) { $fid = $categoryObj->getVar('formulize_fid'); if ($fid) { - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/formread.php"; - include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php"; + 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] = $downloadObj->getVar('formulize_idreq'); @@ -453,19 +448,19 @@ $owner = getEntryOwner($entries[$fid][0], $fid); // is a Formulize function } } else { - print "no idreq"; - $entries[$fid][0] = ""; - $owner = ""; + print 'no idreq'; + $entries[$fid][0] = ''; + $owner = ''; } $cid = $downloadObj->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( + $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, @@ -473,7 +468,7 @@ $fid, $ownerGroups, $groups, - "new" + 'new' ); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that if (!$owner) { $id_req = $entries[$fid][0]; @@ -486,21 +481,21 @@ $newid = (int) $downloadObj->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'] = $categoryObj->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}"; - $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags = array(); + $tags['FILE_NAME'] = $title; + $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); $tags['CATEGORY_NAME'] = $categoryObj->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); @@ -511,9 +506,9 @@ redirect_header($currentFile, 1, $message); break; - case "download.delete" : + case 'download.delete': $lid = WfdownloadsRequest::getInt('lid', 0); - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); + $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); exit(); @@ -545,17 +540,17 @@ } break; - case "vote.delete" : - case "delVote" : - $rating = $wfdownloads->getHandler('rating')->get($_GET['rid']); - if ($wfdownloads->getHandler('rating')->delete($rating, true)) { - wfdownloads_updateRating(intval($rating->getVar('lid'))); + case 'vote.delete': + case 'delVote': + $ratingObj = $wfdownloads->getHandler('rating')->get($_GET['rid']); + if ($wfdownloads->getHandler('rating')->delete($ratingObj, true)) { + wfdownloads_updateRating((int) $ratingObj->getVar('lid')); } redirect_header($currentFile, 1, _AM_WFDOWNLOADS_VOTE_VOTEDELETED); break; // Formulize module support (2006/05/04) jpc - start - case "patch_formulize" : + case 'patch_formulize': if (wfdownloads_checkModule('formulize')) { if (!isset($_POST['patch_formulize'])) { print "<form action=\"{$currentFile}?op=patch_formulize\" method=post>"; @@ -577,8 +572,8 @@ break; // Formulize module support (2006/05/04) jpc - end - case "newdownload.approve" : - case "approve" : + case 'newdownload.approve': + case 'approve': $lid = WfdownloadsRequest::getInt('lid', 0); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); @@ -592,14 +587,14 @@ exit(); } // Trigger notify - $title = $downloadObj->getVar('title'); - $cid = $downloadObj->getVar('cid'); - $categoryObj = $wfdownloads->getHandler('category')->get($cid); - $tags = array(); - $tags['FILE_NAME'] = $title; - $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $title = $downloadObj->getVar('title'); + $cid = $downloadObj->getVar('cid'); + $categoryObj = $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'] = $categoryObj->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 ($downloadObj->getVar('notifypub')) { @@ -608,17 +603,18 @@ redirect_header($currentFile, 1, _AM_WFDOWNLOADS_SUB_NEWFILECREATED); break; - case "downloads.list" : - case "downloads.filter" : + case 'downloads.list': + case 'downloads.filter': default : - $filter_title_condition = WfdownloadsRequest::getString('filter_title_condition', '='); - $filter_title = WfdownloadsRequest::getString('filter_title', ''); + // get filter conditions + $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_submitter = WfdownloadsRequest::getArray('filter_submitter', 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_submitter = WfdownloadsRequest::getArray('filter_submitter', null); + $filter_date = WfdownloadsRequest::getArray('filter_date', null); + $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<'); + // check filter conditions if ($op == 'downloads.filter') { if ($filter_title == '' && $filter_category_title == '' && is_null($filter_submitter)) { $op = 'downloads.list'; @@ -627,16 +623,16 @@ include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - $categories = $wfdownloads->getHandler('category')->getObjects(); + $categoryObjs = $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); $totalCategoriesCount = wfdownloads_categoriesCount(); - $categories = $wfdownloads->getHandler('category')->getObjects(null, true, false); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false); $totalDownloadsCount = $wfdownloads->getHandler('download')->getCount(); @@ -684,13 +680,13 @@ $criteria->setOrder('DESC'); $criteria->setStart($start_published); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $publishedDownloads = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); - $publishedDownloadsCount = $wfdownloads->getHandler('download')->getActiveCount(); - $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadsCount); + $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); + $publishedDownloadCount = $wfdownloads->getHandler('download')->getActiveCount(); + $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadCount); - if ($publishedDownloadsCount > 0) { - foreach ($publishedDownloads as $publishedDownload) { - $publishedDownload_array = $publishedDownload->toArray(); + if ($publishedDownloadCount > 0) { + foreach ($publishedDownloadObjs as $publishedDownloadObj) { + $publishedDownload_array = $publishedDownloadObj->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']); @@ -724,12 +720,12 @@ $criteria->add(new Criteria('published', 0)); $criteria->setStart($start_new); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $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(); + $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $newDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadCount); + if ($newDownloadCount > 0) { + foreach ($newDownloadObjs as $newDownloadObj) { + $newDownload_array = $newDownloadObj->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']; @@ -744,7 +740,7 @@ $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array); } } - $pagenav = new XoopsPageNav($newDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new'); + $pagenav = new XoopsPageNav($newDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_new, 'start_new'); $GLOBALS['xoopsTpl']->assign('new_downloads_pagenav', $pagenav->renderNav()); // Autopublished Downloads @@ -754,12 +750,12 @@ $criteria->setOrder("ASC"); $criteria->setStart($start_autopublished); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $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(); + $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $autopublishedDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadCount); + if ($autopublishedDownloadCount > 0) { + foreach ($autopublishedDownloadObjs as $autopublishedDownloadObj) { + $autopublishedDownload_array = $autopublishedDownloadObj->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']); @@ -767,7 +763,7 @@ $GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array); } } - $pagenav = new XoopsPageNav($autopublishedDownloadsCount, $wfdownloads->getConfig( + $pagenav = new XoopsPageNav($autopublishedDownloadCount, $wfdownloads->getConfig( 'admin_perpage' ), $start_autopublished, 'start_autopublished'); $GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav()); @@ -780,12 +776,12 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_expired); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $expired_downloads = $wfdownloads->getHandler('download')->getObjects($criteria); - $expiredDownloadsCount = $wfdownloads->getHandler('download')->getCount($criteria); - $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadsCount); - if ($expiredDownloadsCount > 0) { - foreach ($expired_downloads as $expired_download) { - $expired_download_array = $expired_download->toArray(); + $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $expiredDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount); + if ($expiredDownloadCount > 0) { + foreach ($expiredDownloadObjs as $expiredDownloadObj) { + $expired_download_array = $expiredDownloadObj->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']); @@ -793,7 +789,7 @@ $GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array); } } - $pagenav = new XoopsPageNav($expiredDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired'); + $pagenav = new XoopsPageNav($expiredDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired'); $GLOBALS['xoopsTpl']->assign('expired_downloads_pagenav', $pagenav->renderNav()); // Offline downloads @@ -802,13 +798,12 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_offline); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $offlineDownloadsCount = $wfdownloads->getHandler('download')->getCount($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(); + $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $offlineDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadCount); + if ($offlineDownloadCount > 0) { + foreach ($offlineDownloadObjs as $offlineDownloadObj) { + $offlineDownload_array = $offlineDownloadObj->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']); @@ -816,7 +811,7 @@ $GLOBALS['xoopsTpl']->append('offline_downloads', $offlineDownload_array); } } - $pagenav = new XoopsPageNav($offlineDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline'); + $pagenav = new XoopsPageNav($offlineDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_offline, 'start_offline'); $GLOBALS['xoopsTpl']->assign('offline_downloads_pagenav', $pagenav->renderNav()); } else { // NOP @@ -844,10 +839,10 @@ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl"); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; - case "batchfile.add" : + case 'batchfile.add': $batchid = WfdownloadsRequest::getInt('batchid', 0); $extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php'); @@ -874,7 +869,6 @@ $downloadObj->setVar('filename', $savedFileName); $downloadObj->setVar('size', filesize($wfdownloads->getConfig('uploaddir') . '/' . $savedFileName)); $downloadObj->setVar('filetype', $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)]); - $downloadObj->setVar('version', 0); $downloadObj->setVar('status', _WFDOWNLOADS_STATUS_APPROVED); // IN PROGRESS $downloadObj->setVar('published', time()); @@ -893,7 +887,7 @@ redirect_header("{$currentFile}?op=download.edit&lid={$newid}", 3, _AM_WFDOWNLOADS_BATCHFILE_MOVEDEDITNOW); break; - case "batchfile.delete" : + case 'batchfile.delete': $batchid = WfdownloadsRequest::getInt('batchid', 0); $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); @@ -923,7 +917,7 @@ } break; - case "ip_logs.list" : + case 'ip_logs.list': $lid = WfdownloadsRequest::getInt('lid', 0); if (!$lid) { header('Location index.php'); @@ -944,15 +938,15 @@ } $criteria->setSort('date'); $criteria->setOrder('DESC'); - $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria); - $ip_logs_count = $wfdownloads->getHandler('ip_log')->getCount($criteria); - $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logs_count); + $ip_logObjs = $wfdownloads->getHandler('ip_log')->getObjects($criteria); + $ip_logCount = $wfdownloads->getHandler('ip_log')->getCount($criteria); + $GLOBALS['xoopsTpl']->assign('ip_logs_count', $ip_logCount); unset($criteria); // Get download info if ($lid != 0) { - $downloadObj = $wfdownloads->getHandler('download')->get($lid); - $download_array = $downloadObj->toArray(); + $downloadObj = $wfdownloads->getHandler('download')->get($lid); + $download_array = $downloadObj->toArray(); $download_array['log_title'] = sprintf(_AM_WFDOWNLOADS_LOG_FOR_LID, $download_array['title']); $GLOBALS['xoopsTpl']->assign('download', $download_array); } @@ -973,8 +967,8 @@ // NOP } else { foreach ($ip_logObjs as $ip_logObj) { - $ip_log_array = $ip_logObj->toArray(); - $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId( + $ip_log_array = $ip_logObj->toArray(); + $ip_log_array['uname'] = XoopsUserUtility::getUnameFromId( $ip_log_array['uid'] ); //($ip_log_array['uid'] != 0) ? $userList[$ip_log_array['uid']] : _AM_WFDOWNLOADS_ANONYMOUS; @@ -985,6 +979,6 @@ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_ip_logslist.tpl"); - include 'admin_footer.php'; + include_once dirname(__FILE__) . '/admin_footer.php'; break; } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-17 13:55:08 UTC (rev 12788) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-17 20:13:28 UTC (rev 12789) @@ -23,26 +23,26 @@ $op = WfdownloadsRequest::getString('op', 'reports.modifications.list'); switch ($op) { - case "reports.update" : - $lid = WfdownloadsRequest::getInt('lid', 0); + case 'reports.update': + $lid = WfdownloadsRequest::getInt('lid', 0); $criteria = new Criteria('lid', $lid); if (isset($_GET['ack'])) { $acknowledged = (isset($_GET['ack']) && $_GET['ack'] == 0) ? 1 : 0; - $wfdownloads->getHandler('report')->updateAll("acknowledged", $acknowledged, $criteria, true); + $wfdownloads->getHandler('report')->updateAll('acknowledged', $acknowledged, $criteria, true); $update_mess = _AM_WFDOWNLOADS_BROKEN_NOWACK; } if (isset($_GET['con'])) { $confirmed = (isset($_GET['con']) && $_GET['con'] == 0) ? 1 : 0; - $wfdownloads->getHandler('report')->updateAll("confirmed", $confirmed, $criteria, true); + $wfdownloads->getHandler('report')->updateAll('confirmed', $confirmed, $criteria, true); $update_mess = _AM_WFDOWNLOADS_BROKEN_NOWCON; } redirect_header($currentFile, 1, $update_mess); break; - case "report.delete" : - $lid = WfdownloadsRequest::getInt('lid', 0); + case 'report.delete': + $lid = WfdownloadsRequest::getInt('lid', 0); $criteria = new Criteria('lid', $lid); - $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria); + $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria); if (isset($reportObjs[0])) { $wfdownloads->getHandler('report')->delete($reportObjs[0], true); } @@ -51,31 +51,31 @@ redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKENFILEDELETED); break; - case "report.ignore" : - $lid = WfdownloadsRequest::getInt('lid', 0); + case 'report.ignore': + $lid = WfdownloadsRequest::getInt('lid', 0); $criteria = new Criteria('lid', $lid); - $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria); + $reportObjs = $wfdownloads->getHandler('report')->getObjects($criteria); if (isset($reportObjs[0])) { $wfdownloads->getHandler('report')->delete($reportObjs[0], true); } redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKEN_FILEIGNORED); break; - case "modification.show": + case 'modification.show': $requestid = WfdownloadsRequest::getInt('requestid', 0); - $modificationObj = $wfdownloads->getHandler('modification')->get($requestid); - $modify_user = new XoopsUser($modificationObj->getVar('modifysubmitter')); - $modifyname = XoopsUserUtility::getUnameFromId((int) $modify_user->getVar('uid')); - $modifyemail = $modify_user->getVar('email'); + $modificationObj = $wfdownloads->getHandler('modification')->get($requestid); + $modify_user = new XoopsUser($modificationObj->getVar('modifysubmitter')); + $modifyname = XoopsUserUtility::getUnameFromId((int) $modify_user->getVar('uid')); + $modifyemail = $modify_user->getVar('email'); - $downloadObj = $wfdownloads->getHandler('download')->get($modificationObj->getVar('lid')); - $orig_user = new XoopsUser($downloadObj->getVar('submitter')); + $downloadObj = $wfdownloads->getHandler('download')->get($modificationObj->getVar('lid')); + $orig_user = new XoopsUser($downloadObj->getVar('submitter')); $submittername = XoopsUserUtility::getUnameFromId($downloadObj->getVar('submitter')); // $orig_user->getvar("uname"); $submitteremail = $orig_user->getVar('email'); - $categories = $wfdownloads->getHandler('category')->getObjects(); - $categoryObjsTree = new XoopsObjectTree($categories, 'cid', 'pid'); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); + $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); wfdownloads_xoops_cp_header(); @@ -93,8 +93,8 @@ $downloadVars = $downloadObj->getVars(); $downloadKeys = array_keys($downloadVars); // Get modification keys - $modificationVars = $modificationObj->getVars(); - $modificationKeys = array_keys($modificationVars); + $modificationVars = $modificationObj->getVars(); + $modificationKeys = array_keys($modificationVars); // Get common keys $commonKeys = array_intersect($downloadKeys, $modificationKeys); // Set not allowed keys @@ -108,61 +108,61 @@ if (in_array($key, $notAllowedKeys)) { continue; } - $caption = constant("_AM_WFDOWNLOADS_MOD_" . strtoupper($key)); + $caption = constant('_AM_WFDOWNLOADS_MOD_' . strtoupper($key)); $downloadContent = $downloadObj->getVar($key); $modificationContent = $modificationObj->getVar($key); // Extra jobs for some keys switch ($key) { - case "title" : - case "url" : + case 'title': + case 'url': // NOP break; - case "size" : + case 'size': $downloadContent = wfdownloads_bytesToSize1024($downloadContent); // $modificationContent = wfdownloads_bytesToSize1024($modificationContent); break; - case "date" : - case "published" : - case "expired" : - case "updated" : + case 'date': + case 'published': + case 'expired': + case 'updated': $downloadContent = ($downloadContent != false) ? XoopsLocal::formatTimestamp($downloadContent, 'l') : _NO; // $modificationContent = ($modificationContent != false) ? XoopsLocal::formatTimestamp($modificationContent, 'l') : _NO; break; - case "platform": - case "license": - case "limitations": - case "versiontypes": + case 'platform': + case 'license': + case 'limitations': + case 'versiontypes': $tempArray = $wfdownloads->getConfig($key); $downloadContent = isset($tempArray[$downloadObj->getVar($key)]) ? $tempArray[$downloadObj->getVar($key)] : ''; // $modificationContent = isset($tempArray[$modificationObj->getVar($key)]) ? $tempArray[$modificationObj->getVar($key)] : ''; break; - case "cid": - $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $downloadObj->getVar($key))); + case 'cid': + $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria('cid', $downloadObj->getVar($key))); if (!isset($category_list[0])) continue; $downloadContent = $category_list[0]->getVar('title', 'e'); // - $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria("cid", $modificationObj->getVar($key))); + $category_list = $wfdownloads->getHandler('category')->getObjects(new Criteria('cid', $modificationObj->getVar($key))); if (!isset($category_list[0])) continue; $modificationContent = $category_list[0]->getVar('title', 'e'); break; - case "screenshot": - case "screenshot2": - case "screenshot3": - case "screenshot4": + case 'screenshot': + case 'screenshot2': + case 'screenshot3': + case 'screenshot4': if ($downloadContent != '') $downloadContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$downloadContent}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />"; // if ($modificationContent != '') $modificationContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$modificationContent}' width='{$wfdownl... [truncated message content] |
From: <luc...@us...> - 2014-09-18 21:56:31
|
Revision: 12794 http://sourceforge.net/p/xoops/svn/12794 Author: luciorota Date: 2014-09-18 21:56:17 +0000 (Thu, 18 Sep 2014) Log Message: ----------- $GLOBALS['...] instead of global $... IN PROGRESS Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top_by_cat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/visit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-18 21:15:31 UTC (rev 12793) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-18 21:56:17 UTC (rev 12794) @@ -104,7 +104,7 @@ include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; $customArray['fid'] = $fid; $customArray['formulize_mgr'] = xoops_getmodulehandler('elements', 'formulize'); - $customArray['groups'] = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $customArray['groups'] = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); $customArray['prevEntry'] = getEntryValues( // is a Formulize function $downloadObj->getVar('formulize_idreq'), $customArray['formulize_mgr'], @@ -458,8 +458,8 @@ $owner = ''; } $ownerGroups = $member_handler->getGroupsByUser($owner, false); - $uid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; - $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; + $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); $entries = handleSubmission( $formulize_mgr, $entries, @@ -557,11 +557,10 @@ print "<input type = submit name=patch_formulize value=\"Apply Patch for Formulize\">"; print "</form>"; } else { - 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';"; + $sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_cat') . " ADD formulize_fid int(5) NOT NULL default '0';"; + $sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_downloads') . " ADD formulize_idreq int(5) NOT NULL default '0';"; foreach ($sqls as $sql) { - if (!$result = $xoopsDB->queryF($sql)) { + if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql . "<br>Please contact <a href=su...@fr...>Freeform Solutions</a> for assistance."); } @@ -874,8 +873,8 @@ $downloadObj->setVar('published', time()); $downloadObj->setVar('date', time()); $downloadObj->setVar('ipaddress', $_SERVER['REMOTE_ADDR']); - $downloadObj->setVar('submitter', $xoopsUser->getVar('uid', 'e')); - $downloadObj->setVar('publisher', $xoopsUser->getVar('uid', 'e')); + $downloadObj->setVar('submitter', $GLOBALS['xoopsUser']->getVar('uid', 'e')); + $downloadObj->setVar('publisher', $GLOBALS['xoopsUser']->getVar('uid', 'e')); if (!$wfdownloads->getHandler('download')->insert($downloadObj)) { wfdownloads_delFile($wfdownloads->getConfig('uploaddir') . '/' . $savedFileName); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-18 21:15:31 UTC (rev 12793) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-18 21:56:17 UTC (rev 12794) @@ -248,13 +248,12 @@ */ function import_wfd_to_wfdownloads() { - global $xoopsDB; - $module_handler =& xoops_gethandler('module'); + $module_handler = xoops_gethandler('module'); // Get source module/config $wfdDirname = 'wf' . 'downloads'; // don't modify, is for cloning $wfdModule = $module_handler->getByDirname($wfdDirname); if (empty($wfdModuleConfig)) { - $config_handler = xoops_gethandler("config"); + $config_handler = xoops_gethandler('config'); $wfdModuleConfig = $config_handler->getConfigsByCat(0, $wfdModule->mid()); } $wfdCategoriesHandler = xoops_getModuleHandler('category', $wfdDirname); @@ -301,47 +300,47 @@ echo "<br />"; $destination = array( - "cat" => $xoopsDB->prefix("wfdownloads_cat"), - "downloads" => $xoopsDB->prefix("wfdownloads_downloads"), - "mirrors" => $xoopsDB->prefix("wfdownloads_mirrors"), - "reviews" => $xoopsDB->prefix("wfdownloads_reviews"), - "broken" => $xoopsDB->prefix("wfdownloads_broken"), - "mod" => $xoopsDB->prefix("wfdownloads_mod"), - "votes" => $xoopsDB->prefix("wfdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"), + "mirrors" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mirrors"), + "reviews" => $GLOBALS['xoopsDB']->prefix("wfdownloads_reviews"), + "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata") ); $source = array( - "cat" => $xoopsDB->prefix("wf" . "downloads_cat"), // don't modify, is for cloning - "downloads" => $xoopsDB->prefix("wf" . "downloads_downloads"), // don't modify, is for cloning - "mirrors" => $xoopsDB->prefix("wf" . "downloads_mirrors"), // don't modify, is for cloning - "reviews" => $xoopsDB->prefix("wf" . "downloads_reviews"), // don't modify, is for cloning - "broken" => $xoopsDB->prefix("wf" . "downloads_broken"), // don't modify, is for cloning - "mod" => $xoopsDB->prefix("wf" . "downloads_mod"), // don't modify, is for cloning - "votes" => $xoopsDB->prefix("wf" . "downloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_cat"), // don't modify, is for cloning + "downloads" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_downloads"), // don't modify, is for cloning + "mirrors" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_mirrors"), // don't modify, is for cloning + "reviews" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_reviews"), // don't modify, is for cloning + "broken" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_broken"), // don't modify, is for cloning + "mod" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_mod"), // don't modify, is for cloning + "votes" => $GLOBALS['xoopsDB']->prefix("wf" . "downloads_votedata") ); // don't modify, is for cloning //Add temporary field to category table - $xoopsDB->query("ALTER TABLE {$destination['cat']} ADD `old_cid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE {$destination['cat']} ADD `old_pid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['cat']} ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['cat']} ADD `old_pid` int NOT NULL default 0"); //Add temporary fields to downloads table - $xoopsDB->query("ALTER TABLE {$destination['downloads']} ADD `old_lid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE {$destination['downloads']} ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['downloads']} ADD `old_lid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE {$destination['downloads']} ADD `old_cid` int NOT NULL default 0"); //Get latest mirror ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(mirror_id) FROM {$destination['mirrors']}"); - list($max_mirrorid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(mirror_id) FROM {$destination['mirrors']}"); + list($max_mirrorid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest review ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(review_id) FROM {$destination['reviews']}"); - list($max_reviewid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(review_id) FROM {$destination['reviews']}"); + list($max_reviewid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest mod request ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(requestid) FROM {$destination['mod']}"); - list($max_requestid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM {$destination['mod']}"); + list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest report ID to determine, which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(reportid) FROM {$destination['broken']}"); - list($max_reportid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM {$destination['broken']}"); + list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest vote ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(ratingid) FROM {$destination['votes']}"); - list($max_ratingid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM {$destination['votes']}"); + list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result); //Import data into category table if (wfdownloads_checkModule('wf' . 'downloads') >= 320) { @@ -357,8 +356,8 @@ $sql .= " `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`"; $sql .= " FROM {$source['cat']}"; } - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} categories into {$destination['cat']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} categories into {$destination['cat']}<br />"; //Import data into downloads table if (wfdownloads_checkModule('wf' . 'downloads') >= 320) { @@ -374,8 +373,8 @@ $sql .= " 0, `lid`, `cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`"; $sql .= " FROM {$source['downloads']}"; } - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} downloads into {$destination['downloads']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} downloads into {$destination['downloads']}<br />"; //Import data into mirrors table $sql = "INSERT INTO {$destination['mirrors']} ("; @@ -383,8 +382,8 @@ $sql .= " ) SELECT"; $sql .= " `lid`, `title`, `homeurl`, `location`, `continent`, `downurl`, `submit`, `date`, `uid`"; $sql .= " FROM {$source['mirrors']}"; - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} mirrors into {$destination['mirrors']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} mirrors into {$destination['mirrors']}<br />"; //Import data into reviews table if (wfdownloads_checkModule('wf' . 'downloads') >= 320) { @@ -400,8 +399,8 @@ $sql .= " `lid`, `title`, `review`, `submit`, `date`, `uid`"; $sql .= " FROM {$source['reviews']}"; } - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} reviews into {$destination['reviews']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} reviews into {$destination['reviews']}<br />"; //Import data into brokens table $sql = "INSERT INTO {$destination['broken']} ("; @@ -409,8 +408,8 @@ $sql .= " ) SELECT"; $sql .= " `lid`, `sender`, `date`, `ip`"; $sql .= " FROM {$source['broken']}"; - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} broken reports into {$destination['broken']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} broken reports into {$destination['broken']}<br />"; //Import data into votedata table $sql = "INSERT INTO {$destination['votes']} ("; @@ -418,8 +417,8 @@ $sql .= " ) SELECT"; $sql .= " `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`"; $sql .= " FROM {$source['votes']}"; - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} votes into {$destination['votes']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} votes into {$destination['votes']}<br />"; //Import data into mod request table $sql = "INSERT INTO {$destination['mod']} ("; @@ -427,51 +426,51 @@ $sql .= " SELECT"; $sql .= " `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`, `features`, `requirements`, `publisher`, `dhistory`, `summary`"; $sql .= " FROM {$source['mod']}"; - $xoopsDB->query($sql); - echo "Imported {$xoopsDB->getAffectedRows()} modification requests into {$destination['mod']}<br />"; + $GLOBALS['xoopsDB']->query($sql); + echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} modification requests into {$destination['mod']}<br />"; // Update category ID to new value - $xoopsDB->query("UPDATE {$destination['downloads']} d, {$destination['cat']} c SET d.cid=c.cid WHERE d.old_cid=c.old_cid AND d.old_cid != 0"); - $xoopsDB->query("UPDATE {$destination['cat']} c1, {$destination['cat']} c2 SET c1.pid=c2.cid WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"); + $GLOBALS['xoopsDB']->query("UPDATE {$destination['downloads']} d, {$destination['cat']} c SET d.cid=c.cid WHERE d.old_cid=c.old_cid AND d.old_cid != 0"); + $GLOBALS['xoopsDB']->query("UPDATE {$destination['cat']} c1, {$destination['cat']} c2 SET c1.pid=c2.cid WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0"); // Update lid values in mod table if ($max_requestid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['mod']} m, {$destination['cat']} c SET m.cid=c.cid WHERE m.requestid > {$max_requestid} AND c.old_cid=m.cid" ); - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['mod']} m, {$destination['downloads']} d SET m.lid=d.lid WHERE m.requestid > {$max_requestid} AND m.lid=d.old_lid" ); } // Update lid values in mirrors table if ($max_mirrorid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['mirrors']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.mirror_id > {$max_mirrorid} AND v.lid=d.old_lid" ); } // Update lid values in reviews table if ($max_reviewid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['reviews']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.review_id > {$max_reviewid} AND v.lid=d.old_lid" ); } // Update lid values in votedata table if ($max_ratingid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['votes']} v, {$destination['downloads']} d SET v.lid=d.lid WHERE v.ratingid > {$max_ratingid} AND v.lid=d.old_lid" ); } // Update lid values in broken table if ($max_reportid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE {$destination['broken']} b, {$destination['downloads']} d SET b.lid=d.lid WHERE b.reportid > {$max_reportid} AND b.lid=d.old_lid" ); } //Remove temporary fields - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " DROP `old_pid`"); - $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_lid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " DROP `old_pid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['downloads'] . " DROP `old_lid`"); return null; } @@ -481,111 +480,109 @@ // ========================================================================================= function import_wmpdownloads_to_wfdownloads() { - global $xoopsDB; - echo "<br />"; echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA; echo "<br />"; $destination = array( - "cat" => $xoopsDB->prefix("wfdownloads_cat"), - "downloads" => $xoopsDB->prefix("wfdownloads_downloads"), - "broken" => $xoopsDB->prefix("wfdownloads_broken"), - "mod" => $xoopsDB->prefix("wfdownloads_mod"), - "votes" => $xoopsDB->prefix("wfdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata") ); $source = array( - "cat" => $xoopsDB->prefix("wmpdownloads_cat"), - "downloads" => $xoopsDB->prefix("wmpdownloads_downloads"), - "broken" => $xoopsDB->prefix("wmpdownloads_broken"), - "mod" => $xoopsDB->prefix("wmpdownloads_mod"), - "votes" => $xoopsDB->prefix("wmpdownloads_votedata"), - "text" => $xoopsDB->prefix("wmpdownloads_text") + "cat" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_votedata"), + "text" => $GLOBALS['xoopsDB']->prefix("wmpdownloads_text") ); //Add temporary field to category table - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); //Add temporary fields to downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0, ADD `old_cid` int NOT NULL default 0" ); //Get latest mod request ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']); - list($max_requestid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']); + list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest report ID to determine, which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']); - list($max_reportid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']); + list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest vote ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']); - list($max_ratingid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']); + list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result); //Import data into category table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['cat'] . " (`old_cid`, `old_pid`, `title`, `imgurl`, `summary`)" . " SELECT `cid`, `pid`, `title`, `imgurl`, ''" . " FROM " . $source['cat'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; //Import data into downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['downloads'] . " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`)" . " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '','','', ''" . " FROM " . $source['downloads'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; //Import data into brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['broken'] . " (`lid`, `sender`, `ip`)" . " SELECT `lid`, `sender`, `ip`" . " FROM " . $source['broken'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; //Import data into votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['votes'] . " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)" . "SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`" . " FROM " . $source['votes'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; //Import data into mod request table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['mod'] . " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`)" . " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','',''" . " FROM " . $source['mod'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; //Update category ID to new value - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid" . " WHERE d.old_cid=c.old_cid AND d.old_cid != 0" ); - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid" . " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0" ); if ($max_requestid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid" . " WHERE m.requestid > " . $max_requestid . " AND c.old_cid=m.cid" ); //Update lid values in mod table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid" . " WHERE m.requestid > " . $max_requestid . " AND m.lid=d.old_lid" @@ -593,7 +590,7 @@ } if ($max_ratingid) { //Update lid values in votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid" . " WHERE v.ratingid > " . $max_ratingid . " AND v.lid=d.old_lid" @@ -601,21 +598,21 @@ } if ($max_reportid) { //Update lid values in brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid" . " WHERE b.reportid > " . $max_reportid . " AND b.lid=d.old_lid" ); } //Update description - $xoopsDB->query("UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description" + $GLOBALS['xoopsDB']->query("UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description" . " WHERE t.lid=d.old_lid"); //Remove temporary fields - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); } @@ -624,106 +621,104 @@ // ========================================================================================= function import_pddownloads_to_wfdownloads() { - global $xoopsDB; - echo "<br />"; echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA; echo "<br />"; $destination = array( - "cat" => $xoopsDB->prefix("wfdownloads_cat"), - "downloads" => $xoopsDB->prefix("wfdownloads_downloads"), - "broken" => $xoopsDB->prefix("wfdownloads_broken"), - "mod" => $xoopsDB->prefix("wfdownloads_mod"), - "votes" => $xoopsDB->prefix("wfdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata") ); $source = array( - "cat" => $xoopsDB->prefix("PDdownloads_cat"), - "downloads" => $xoopsDB->prefix("PDdownloads_downloads"), - "broken" => $xoopsDB->prefix("PDdownloads_broken"), - "mod" => $xoopsDB->prefix("PDdownloads_mod"), - "votes" => $xoopsDB->prefix("PDdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("PDdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("PDdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("PDdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("PDdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("PDdownloads_votedata") ); //Add temporary field to category table - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); //Add temporary fields to downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0, ADD `old_cid` int NOT NULL default 0" ); //Get latest mod request ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']); - list($max_requestid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']); + list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest report ID to determine, which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']); - list($max_reportid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']); + list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest vote ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']); - list($max_ratingid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']); + list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result); //Import data into category table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['cat'] . " (`old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `weight`)" . " SELECT `cid`, `pid`, `title`, `imgurl`, `description`, `total`, `weight`" . " FROM " . $source['cat'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; //Import data into downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['downloads'] . " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `ipaddress`, `notifypub`)" . " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `ipaddress`, `notifypub`" . " FROM " . $source['downloads'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; //Import data into brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['broken'] . " (`reportid`, `lid`, `sender`, `ip`, `date`, `confirmed`, `acknowledged`)" . " SELECT `reportid`, `lid`, `sender`, `ip`, `date`, `confirmed`, `acknowledged`" . " FROM " . $source['broken'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; //Import data into votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['votes'] . " (`ratingid`, `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)" . " SELECT `ratingid`, `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`" . " FROM " . $source['votes'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; //Import data into mod request table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['mod'] . " (`lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `modifysubmitter`, `requestdate`)" . " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `homepagetitle`, `version`, `size`, `platform`, `screenshot`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `features`, `forumid`, `dhistory`, `published`, `expired`, `updated`, `offline`, `description`, `modifysubmitter`, `requestdate`" . " FROM " . $source['mod'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; //Update category ID to new value - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid" . " WHERE d.old_cid=c.old_cid AND d.old_cid != 0" ); - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid" . " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0" ); if ($max_requestid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid" . " WHERE m.requestid > " . $max_requestid . " AND c.old_cid=m.cid" ); //Update lid values in mod table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid" . " WHERE m.requestid > " . $max_requestid . " AND m.lid=d.old_lid" @@ -731,7 +726,7 @@ } if ($max_ratingid) { //Update lid values in votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid" . " WHERE v.ratingid > " . $max_ratingid . " AND v.lid=d.old_lid" @@ -739,7 +734,7 @@ } if ($max_reportid) { //Update lid values in brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid" . " WHERE b.reportid > " . $max_reportid . " AND b.lid=d.old_lid" @@ -747,10 +742,10 @@ } //Remove temporary fields - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); } @@ -759,107 +754,105 @@ // ========================================================================================= function import_mydownloads_to_wfdownloads() { - global $xoopsDB; - echo "<br />"; echo _AM_WFDOWNLOADS_IMPORT_IMPORTINGDATA; echo "<br />"; $destination = array( - "cat" => $xoopsDB->prefix("wfdownloads_cat"), - "downloads" => $xoopsDB->prefix("wfdownloads_downloads"), - "broken" => $xoopsDB->prefix("wfdownloads_broken"), - "mod" => $xoopsDB->prefix("wfdownloads_mod"), - "votes" => $xoopsDB->prefix("wfdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata") ); $source = array( - "cat" => $xoopsDB->prefix("mydownloads_cat"), - "downloads" => $xoopsDB->prefix("mydownloads_downloads"), - "broken" => $xoopsDB->prefix("mydownloads_broken"), - "mod" => $xoopsDB->prefix("mydownloads_mod"), - "votes" => $xoopsDB->prefix("mydownloads_votedata"), - "text" => $xoopsDB->prefix("mydownloads_text") + "cat" => $GLOBALS['xoopsDB']->prefix("mydownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("mydownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("mydownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("mydownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("mydownloads_votedata"), + "text" => $GLOBALS['xoopsDB']->prefix("mydownloads_text") ); //Add temporary field to category table - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); //Add temporary fields to downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0, ADD `old_cid` int NOT NULL default 0" ); //Get latest mod request ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']); - list($max_requestid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']); + list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest report ID to determine, which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']); - list($max_reportid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']); + list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest vote ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']); - list($max_ratingid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']); + list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result); //Import data into category table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['cat'] . " (`old_cid`, `old_pid`, `title`, `imgurl`, `summary`)" . " SELECT `cid`, `pid`, `title`, `imgurl`, ''" . " FROM " . $source['cat'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; //Import data into downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['downloads'] . " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`)" . " SELECT 0,`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '','','', ''" . " FROM " . $source['downloads'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; //Import data into brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['broken'] . " (`lid`, `sender`, `ip`)" . " SELECT `lid`, `sender`, `ip`" . " FROM " . $source['broken'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; //Import data into votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['votes'] . " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)" . " SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`" . " FROM " . $source['votes'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; //Import data into mod request table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['mod'] . " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`)" . " SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','',''" . " FROM " . $source['mod'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; //Update category ID to new value - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid" . " WHERE d.old_cid=c.old_cid AND d.old_cid != 0" ); - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid" . " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0" ); if ($max_requestid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid" . " WHERE m.requestid > " . $max_requestid . " AND c.old_cid=m.cid" ); //Update lid values in mod table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid" . " WHERE m.requestid > " . $max_requestid . " AND m.lid=d.old_lid" @@ -867,7 +860,7 @@ } if ($max_ratingid) { //Update lid values in votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid" . " WHERE v.ratingid > " . $max_ratingid . " AND v.lid=d.old_lid" @@ -875,23 +868,23 @@ } if ($max_reportid) { //Update lid values in brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid" . " WHERE b.reportid > " . $max_reportid . " AND b.lid=d.old_lid" ); } //Update description - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['downloads'] . " d, " . $source['text'] . " t SET d.description=t.description" . " WHERE t.lid=d.old_lid" ); //Remove temporary fields - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); + $GLOBALS['xoopsDB']->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_lid`"); } @@ -900,112 +893,110 @@ // ========================================================================================= function import_tdmdownloads_to_wfdownloads() { - global $xoopsDB; - echo "<br /><span style='font-weight: bold;'>Importing Data</span><br />"; $destination = array( - "cat" => $xoopsDB->prefix("wfdownloads_cat"), - "downloads" => $xoopsDB->prefix("wfdownloads_downloads"), - "broken" => $xoopsDB->prefix("wfdownloads_broken"), - "mod" => $xoopsDB->prefix("wfdownloads_mod"), - "votes" => $xoopsDB->prefix("wfdownloads_votedata") + "cat" => $GLOBALS['xoopsDB']->prefix("wfdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("wfdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("wfdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("wfdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("wfdownloads_votedata") ); $source = array( - "cat" => $xoopsDB->prefix("tdmdownloads_cat"), - "downloads" => $xoopsDB->prefix("tdmdownloads_downloads"), - "broken" => $xoopsDB->prefix("tdmdownloads_broken"), - "mod" => $xoopsDB->prefix("tdmdownloads_mod"), - "votes" => $xoopsDB->prefix("tdmdownloads_votedata"), - "field" => $xoopsDB->prefix("tdmdownloads_field"), - "fielddata" => $xoopsDB->prefix("tdmdownloads_fielddata"), - "modfielddata" => $xoopsDB->prefix("tdmdownloads_modfielddata"), - "downlimit" => $xoopsDB->prefix("tdmdownloads_downlimit") + "cat" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_cat"), + "downloads" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_downloads"), + "broken" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_broken"), + "mod" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_mod"), + "votes" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_votedata"), + "field" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_field"), + "fielddata" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_fielddata"), + "modfielddata" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_modfielddata"), + "downlimit" => $GLOBALS['xoopsDB']->prefix("tdmdownloads_downlimit") ); //Add temporary field to category table - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); - $xoopsDB->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_cid` int NOT NULL default 0"); + $GLOBALS['xoopsDB']->query("ALTER TABLE " . $destination['cat'] . " ADD `old_pid` int NOT NULL default 0"); //Add temporary fields to downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "ALTER TABLE " . $destination['downloads'] . " ADD `old_lid` int NOT NULL default 0, ADD `old_cid` int NOT NULL default 0" ); //Get latest mod request ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(requestid) FROM " . $destination['mod']); - list($max_requestid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(requestid) FROM " . $destination['mod']); + list($max_requestid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest report ID to determine, which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(reportid) FROM " . $destination['broken']); - list($max_reportid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(reportid) FROM " . $destination['broken']); + list($max_reportid) = $GLOBALS['xoopsDB']->fetchRow($result); //Get latest vote ID to determine which records will need an updated lid value afterwards - $result = $xoopsDB->query("SELECT MAX(ratingid) FROM " . $destination['votes']); - list($max_ratingid) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT MAX(ratingid) FROM " . $destination['votes']); + list($max_ratingid) = $GLOBALS['xoopsDB']->fetchRow($result); //Import data into category table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['cat'] . " (`old_cid`, `old_pid`, `title`, `imgurl`, `description`, `weight`, `dohtml`)" . " SELECT `cat_cid`, `cat_pid`, `cat_title`, `cat_imgurl`, `cat_description_main`, `cat_weight`, 1" . " FROM " . $source['cat'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " categories into " . $destination['cat'] . "<br />"; //Import data into downloads table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['downloads'] . " (`cid`, `old_lid`, `old_cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `submitter`, `status`, `published`, `hits`, `rating`, `votes`, `comments`, `features`, `requirements`, `dhistory`, `summary`, `description`, `dohtml`)" . " SELECT 0, `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `submitter`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, '', '', '', '', `description`, 1" . " FROM " . $source['downloads'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " downloads into " . $destination['downloads'] . "<br />"; //Import data into brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['broken'] . " (`lid`, `sender`, `ip`)" . " SELECT `lid`, `sender`, `ip`" . " FROM " . $source['broken'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " broken reports into " . $destination['broken'] . "<br />"; //Import data into votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT" . " INTO " . $destination['votes'] . " (`lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`)" . " SELECT `lid`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`" . " FROM " . $source['votes'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " votes into " . $destination['votes'] . "<br />"; /* //Import data into mod request table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "INSERT INTO " . $destination['mod'] . " (`lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `screenshot`, `description`, `modifysubmitter`,`features`, `requirements`, `publisher`, `dhistory`, `summary`) SELECT `lid`, `cid`, `title`, `url`, `homepage`, `version`, `size`, `platform`, `logourl`, `description`, `modifysubmitter`,'','','','','' FROM " . $source['mod'] ); - echo "Imported " . $xoopsDB->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; + echo "Imported " . $GLOBALS['xoopsDB']->getAffectedRows() . " modification requests into " . $destination['mod'] . "<br />"; */ //Update category ID to new value - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['downloads'] . " d, " . $destination['cat'] . " c SET d.cid=c.cid" . " WHERE d.old_cid=c.old_cid AND d.old_cid != 0" ); - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['cat'] . " c1, " . $destination['cat'] . " c2 SET c1.pid=c2.cid" . " WHERE c1.old_pid=c2.old_cid AND c1.old_pid != 0" ); /* if ($max_requestid) { - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['cat'] . " c SET m.cid=c.cid" . " WHERE m.requestid > " . $max_requestid . " AND c.old_cid=m.cid" ); //Update lid values in mod table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['mod'] . " m, " . $destination['downloads'] . " d SET m.lid=d.lid" . " WHERE m.requestid > " . $max_requestid . " AND m.lid=d.old_lid" @@ -1014,7 +1005,7 @@ */ if ($max_ratingid) { //Update lid values in votedata table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['votes'] . " v, " . $destination['downloads'] . " d SET v.lid=d.lid" . " WHERE v.ratingid > " . $max_ratingid . " AND v.lid=d.old_lid" @@ -1022,7 +1013,7 @@ } if ($max_reportid) { //Update lid values in brokens table - $xoopsDB->query( + $GLOBALS['xoopsDB']->query( "UPDATE " . $destination['broken'] . " b, " . $destination['downloads'] . " d SET b.lid=d.lid" . " WHERE b.reportid > " . $max_reportid . " AND b.lid=d.old_lid" @@ -1030,9 +1021,8 @@ } //Remove temporary fields - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_cid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['cat'] . " DROP `old_pid`"); - $xoopsDB->query("ALTER TABLE ." . $destination['downloads'] . " DROP `old_cid`"); - $xoopsDB... [truncated message content] |
From: <luc...@us...> - 2014-09-22 19:57:20
|
Revision: 12797 http://sourceforge.net/p/xoops/svn/12797 Author: luciorota Date: 2014-09-22 19:57:08 +0000 (Mon, 22 Sep 2014) Log Message: ----------- fixed bug in var names, standardize var names fixed bug in db uses screenshots filed and improved update function (task: add possibility to have all the screenshots you wish IN PROGRESS) changed some configuration default values Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_download.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_singlefile.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -273,14 +273,14 @@ } // Define URL if (empty($_FILES['userfile']['name'])) { - if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != "http://") { - $url = ($_POST['url'] != "http://") ? $_POST['url'] : ''; + if ($_POST['url'] && $_POST['url'] != '' && $_POST['url'] != 'http://') { + $url = ($_POST['url'] != 'http://') ? $_POST['url'] : ''; $filename = ''; $filetype = ''; // Get size from form - $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST["size"]; + $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST['size']; } else { - $url = ($_POST["url"] != "http://") ? $_POST['url'] : ''; + $url = ($_POST['url'] != 'http://') ? $_POST['url'] : ''; $filename = $_POST['filename']; $filetype = $_POST['filetype']; $filePath = $wfdownloads->getConfig('uploaddir') . '/' . $filename; @@ -292,7 +292,7 @@ $downloadObj->setVar('filetype', $filetype); } else { $down = wfdownloads_uploading($_FILES, $wfdownloads->getConfig('uploaddir'), '', $currentFile, 0, false, true); - $url = ($_POST['url'] != "http://") ? $_POST["url"] : ''; + $url = ($_POST['url'] != 'http://') ? $_POST['url'] : ''; $size = $down['size']; $title = $_FILES['userfile']['name']; @@ -306,12 +306,13 @@ $downloadObj->setVar('filetype', $filetype); } // Get data from form - $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'] : ''; + $screenshots = array(); + $screenshots[] = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : ''; + $screenshots[] = ($_POST['screenshot2'] != 'blank.png') ? $_POST['screenshot2'] : ''; + $screenshots[] = ($_POST['screenshot3'] != 'blank.png') ? $_POST['screenshot3'] : ''; + $screenshots[] = ($_POST['screenshot4'] != 'blank.png') ? $_POST['screenshot4'] : ''; - if (!empty($_POST['homepage']) || $_POST['homepage'] != "http://") { + if (!empty($_POST['homepage']) || $_POST['homepage'] != 'http://') { $downloadObj->setVar('homepage', trim($_POST['homepage'])); $downloadObj->setVar('homepagetitle', trim($_POST['homepagetitle'])); } @@ -349,10 +350,11 @@ $downloadObj->setVar('title', $title); $downloadObj->setVar('status', $status); $downloadObj->setVar('size', $size); - $downloadObj->setVar('screenshot', $screenshot); - $downloadObj->setVar('screenshot2', $screenshot2); - $downloadObj->setVar('screenshot3', $screenshot3); - $downloadObj->setVar('screenshot4', $screenshot4); + $downloadObj->setVar('screenshot', $screenshots[0]); // old style + $downloadObj->setVar('screenshot2', $screenshots[1]); // old style + $downloadObj->setVar('screenshot3', $screenshots[2]); // old style + $downloadObj->setVar('screenshot4', $screenshots[3]); // old style + $downloadObj->setVar('screenshots', $screenshots); // new style $downloadObj->setVar('platform', trim($_POST['platform'])); $downloadObj->setVar('summary', trim($_POST['summary'])); $downloadObj->setVar('description', trim($_POST['description'])); @@ -438,7 +440,7 @@ 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'); + $formulizeElements_handler = xoops_getmodulehandler('elements', 'formulize'); if ($lid) { $entries[$fid][0] = $downloadObj->getVar('formulize_idreq'); if ($entries[$fid][0]) { @@ -461,7 +463,7 @@ $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); $entries = handleSubmission( - $formulize_mgr, + $formulizeElements_handler, $entries, $uid, $owner, @@ -687,14 +689,14 @@ foreach ($publishedDownloadObjs as $publishedDownloadObj) { $publishedDownload_array = $publishedDownloadObj->toArray(); $publishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($publishedDownload_array['title'])); - $publishedDownload_array['category_title'] = $categories[$publishedDownload_array['cid']]['title']; + $publishedDownload_array['category_title'] = $categoryObjs[$publishedDownload_array['cid']]['title']; $publishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($publishedDownload_array['submitter']); $publishedDownload_array['published_formatted'] = XoopsLocal::formatTimestamp($publishedDownload_array['published'], 'l'); $GLOBALS['xoopsTpl']->append('published_downloads', $publishedDownload_array); } } - $pagenav = new XoopsPageNav($publishedDownloadsCount, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published'); + $pagenav = new XoopsPageNav($publishedDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published'); $GLOBALS['xoopsTpl']->assign('filter_title', $filter_title); $GLOBALS['xoopsTpl']->assign('filter_title_condition', $filter_title_condition); $GLOBALS['xoopsTpl']->assign('filter_category_title', $filter_category_title); @@ -733,7 +735,7 @@ $version = $myts->htmlSpecialChars($newDownload_array['version']); $size = $myts->htmlSpecialChars($newDownload_array['size']); $platform = $myts->htmlSpecialChars($newDownload_array['platform']); - $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']); + $logourl = $myts->htmlSpecialChars($newDownload_array['screenshot']); // IN PROGRESS $newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']); $newDownload_array['date_formatted'] = XoopsLocal::formatTimestamp($newDownload_array['date'], 'l'); $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array); @@ -780,12 +782,12 @@ $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount); if ($expiredDownloadCount > 0) { foreach ($expiredDownloadObjs as $expiredDownloadObj) { - $expired_download_array = $expiredDownloadObj->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_formatted'] = XoopsLocal::formatTimestamp($expired_download_array['published'], 'l'); - $GLOBALS['xoopsTpl']->append('expired_downloads', $expired_download_array); + $expiredDownload_array = $expiredDownloadObj->toArray(); + $expiredDownload_array['title_html'] = $myts->htmlSpecialChars(trim($expiredDownload_array['title'])); + $expiredDownload_array['category_title'] = $categories[$expiredDownload_array['cid']]['title']; + $expiredDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($expiredDownload_array['submitter']); + $expiredDownload_array['published_formatted'] = XoopsLocal::formatTimestamp($expiredDownload_array['published'], 'l'); + $GLOBALS['xoopsTpl']->append('expired_downloads', $expiredDownload_array); } } $pagenav = new XoopsPageNav($expiredDownloadCount, $wfdownloads->getConfig('admin_perpage'), $start_expired, 'start_expired'); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -350,17 +350,17 @@ $submitter = isset($users[$downloadObjs[$reportObj->getVar('lid')]->getVar('submitter')]) ? $users[$downloadObjs[$reportObj->getVar('lid')]->getVar('submitter')] : false; $report_array['submitter_email'] = is_object($submitter) ? $submitter->getVar('email') : ''; - $report_array['submitter_uname'] = is_object($submitter) ? $submitter->getVar('uname') : $xoopsConfig['anonymous']; + $report_array['submitter_uname'] = is_object($submitter) ? $submitter->getVar('uname') : $GLOBALS['xoopsConfig']['anonymous']; } else { $report_array['download_lid'] = false; $download_link = _AM_WFDOWNLOADS_BROKEN_DOWNLOAD_DONT_EXISTS; $report_array['submitter_email'] = ''; - $report_array['submitter_uname'] = $xoopsConfig['anonymous']; + $report_array['submitter_uname'] = $GLOBALS['xoopsConfig']['anonymous']; } $sender = isset($users[$reportObj->getVar('sender')]) ? $users[$reportObj->getVar('sender')] : ''; $report_array['reporter_email'] = isset($users[$reportObj->getVar('sender')]) ? $users[$reportObj->getVar('sender')]->getVar('email') : ''; $report_array['reporter_uname'] = isset($users[$reportObj->getVar('sender')]) ? $users[$reportObj->getVar('sender')]->getVar('uname') - : $xoopsConfig['anonymous']; + : $GLOBALS['xoopsConfig']['anonymous']; $report_array['formatted_date'] = XoopsLocal::formatTimestamp($reportObj->getVar('date'), 'l'); $GLOBALS['xoopsTpl']->append('reports', $report_array); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -97,16 +97,16 @@ $xoopsMailer = & getMailer(); $xoopsMailer->useMail(); - $template_dir = WFDOWNLOADS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/mail_template'; + $template_dir = WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/mail_template'; $xoopsMailer->setTemplateDir($template_dir); $xoopsMailer->setTemplate('filebroken_notify.tpl'); $xoopsMailer->setToEmails($user->email()); - $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); - $xoopsMailer->setFromName($xoopsConfig['sitename']); + $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); $xoopsMailer->assign('X_UNAME', $user->uname()); - $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']); - $xoopsMailer->assign('X_ADMINMAIL', $xoopsConfig['adminmail']); + $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); + $xoopsMailer->assign('X_ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); $xoopsMailer->assign('X_SITEURL', XOOPS_URL . '/'); $xoopsMailer->assign('X_TITLE', $title); $xoopsMailer->assign('X_SUB_DATE', $subdate); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -321,7 +321,7 @@ $allsubcats_linked_totop = array(); foreach ($this->allCategories as $cid => $category) { $parentCategoryObjs = $categoryObjsTree->getAllParent($cid); - if (count($parents) == 0) { + if (count($parentCategoryObjs) == 0) { // is a top category $allsubcats_linked_totop[$cid] = $cid; } else { Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -131,7 +131,6 @@ function getDownloadInfo() { - global $xoopsConfig, $myts; xoops_load('XoopsUserUtility'); $download['id'] = $this->getVar('lid'); @@ -176,95 +175,99 @@ $download['url'] = $this->getVar('url'); $download['filename'] = $this->getVar('filename'); $download['filetype'] = $this->getVar('filetype'); - - if ($this->getVar('screenshot')) { - $download['screenshot_full'] = $this->getVar('screenshot'); - if ($this->getVar('screenshot') +/* + if ($this->getVar('screenshot')) { // IN PROGRESS + $download['screenshot_full'] = $this->getVar('screenshot'); // IN PROGRESS + $download['screenshot_full1'] = $this->getVar('screenshot'); // IN PROGRESS + if ($this->getVar('screenshot') // IN PROGRESS && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot'))) ) { if ($this->wfdownloads->getConfig('usethumbs') == true) { $download['screenshot_thumb'] = wfdownloads_createThumb( - $download['screenshot_full'], - $this->wfdownloads->getConfig('screenshots'), - 'thumbs', - $this->wfdownloads->getConfig('shotwidth'), - $this->wfdownloads->getConfig('shotheight'), - $this->wfdownloads->getConfig('imagequality'), - $this->wfdownloads->getConfig('updatethumbs'), - $this->wfdownloads->getConfig('keepaspect') + $download['screenshot_full'], $this->wfdownloads->getConfig('screenshots'), 'thumbs', + $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'), + $this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect') ); } else { $download['screenshot_thumb'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot')); } + $download['screenshot_thumb1'] = $download['screenshot_thumb']; // IN PROGRESS } } - if ($this->getVar('screenshot2') && $this->wfdownloads->getConfig('max_screenshot') >= 2) { + if ($this->getVar('screenshot2') && $this->wfdownloads->getConfig('max_screenshot') >= 2) { // IN PROGRESS $download['screenshot_full2'] = $this->getVar('screenshot2'); if ($this->getVar('screenshot2') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2'))) ) { if ($this->wfdownloads->getConfig('usethumbs') == true) { $download['screenshot_thumb2'] = wfdownloads_createThumb( - $download['screenshot_full2'], - $this->wfdownloads->getConfig('screenshots'), - 'thumbs', - $this->wfdownloads->getConfig('shotwidth'), - $this->wfdownloads->getConfig('shotheight'), - $this->wfdownloads->getConfig('imagequality'), - $this->wfdownloads->getConfig('updatethumbs'), - $this->wfdownloads->getConfig('keepaspect') + $download['screenshot_full2'], $this->wfdownloads->getConfig('screenshots'), 'thumbs', + $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'), + $this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect') ); } else { $download['screenshot_thumb2'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot2')); } } } - if ($this->getVar('screenshot3') && $this->wfdownloads->getConfig('max_screenshot') >= 3) { + if ($this->getVar('screenshot3') && $this->wfdownloads->getConfig('max_screenshot') >= 3) { // IN PROGRESS $download['screenshot_full3'] = $this->getVar('screenshot3'); if ($this->getVar('screenshot3') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3'))) ) { if ($this->wfdownloads->getConfig('usethumbs') == true) { $download['screenshot_thumb3'] = wfdownloads_createThumb( - $download['screenshot_full3'], - $this->wfdownloads->getConfig('screenshots'), - 'thumbs', - $this->wfdownloads->getConfig('shotwidth'), - $this->wfdownloads->getConfig('shotheight'), - $this->wfdownloads->getConfig('imagequality'), - $this->wfdownloads->getConfig('updatethumbs'), - $this->wfdownloads->getConfig('keepaspect') + $download['screenshot_full3'], $this->wfdownloads->getConfig('screenshots'), 'thumbs', + $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'), + $this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect') ); } else { $download['screenshot_thumb3'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot3')); } } } - if ($this->getVar('screenshot4') && $this->wfdownloads->getConfig('max_screenshot') >= 4) { + if ($this->getVar('screenshot4') && $this->wfdownloads->getConfig('max_screenshot') >= 4) { // IN PROGRESS $download['screenshot_full4'] = $this->getVar('screenshot4'); if ($this->getVar('screenshot4') && file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4'))) ) { if ($this->wfdownloads->getConfig('usethumbs') == true) { $download['screenshot_thumb4'] = wfdownloads_createThumb( - $download['screenshot_full4'], - $this->wfdownloads->getConfig('screenshots'), - 'thumbs', - $this->wfdownloads->getConfig('shotwidth'), - $this->wfdownloads->getConfig('shotheight'), - $this->wfdownloads->getConfig('imagequality'), - $this->wfdownloads->getConfig('updatethumbs'), - $this->wfdownloads->getConfig('keepaspect') + $download['screenshot_full4'], $this->wfdownloads->getConfig('screenshots'), 'thumbs', + $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'), + $this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect') ); } else { $download['screenshot_thumb4'] = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($this->getVar('screenshot4')); } } } +*/ + // IN PROGRESS + $screenshots = $this->getVar('screenshots'); + $download['screenshots'] = array(); + foreach ($screenshots as $key => $screenshot) { + if (file_exists(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($screenshot))) { + if ($this->wfdownloads->getConfig('usethumbs') == true + && $screenshot != '' + ) { + $screenshot_thumb = wfdownloads_createThumb( + $screenshot, $this->wfdownloads->getConfig('screenshots'), 'thumbs', + $this->wfdownloads->getConfig('shotwidth'), $this->wfdownloads->getConfig('shotheight'), + $this->wfdownloads->getConfig('imagequality'), $this->wfdownloads->getConfig('updatethumbs'), $this->wfdownloads->getConfig('keepaspect') + ); + } else { + $screenshot_thumb = XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . xoops_trim($screenshot); + } + $download['screenshots'][$key]['filename'] = $screenshot; + $download['screenshots'][$key]['thumb_url'] = $screenshot_thumb; + unset($screenshot_thumb); + } + } // $download['homepage'] = (!$this->getVar('homepage') || $this->getVar('homepage') == 'http://') ? '' - : $myts->htmlSpecialChars(trim($this->getVar('homepage'))); + : $GLOBALS['myts']->htmlSpecialChars(trim($this->getVar('homepage'))); // $homepagetitle = $this->getVar('homepagetitle'); if ($download['homepage'] && !empty($download['homepage'])) { @@ -306,8 +309,8 @@ // patch for multilanguage summary if xlanguage module is installed if (wfdownloads_checkModule('xlanguage')) { global $xlanguage; - include_once(XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php'); - include_once(XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php'); + include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php' ; + include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php'; $download['summary'] = xlanguage_ml($download['summary']); } // html or plain text auto summary @@ -330,17 +333,17 @@ $limitationsArray = $this->wfdownloads->getConfig('limitations'); $download['limitations'] = ($this->getVar('limitations') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED - : $myts->htmlSpecialChars(trim($limitationsArray[$this->getVar('limitations')])); + : $GLOBALS['myts']->htmlSpecialChars(trim($limitationsArray[$this->getVar('limitations')])); // $versiontypesArray = $this->wfdownloads->getConfig('versiontypes'); $download['versiontypes'] = ($this->getVar('versionypes') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED - : $myts->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')])); + : $GLOBALS['myts']->htmlSpecialChars(trim($versiontypesArray[$this->getVar('versiontypes')])); $licenseArray = $this->wfdownloads->getConfig('license'); // $download['license'] = ($this->getVar('license') == '') ? _MD_WFDOWNLOADS_NOTSPECIFIED - : $myts->htmlSpecialChars(trim($licenseArray[$this->getVar('license')])); + : $GLOBALS['myts']->htmlSpecialChars(trim($licenseArray[$this->getVar('license')])); // $download['submitter'] = XoopsUserUtility::getUnameFromId($this->getVar('submitter')); // @@ -350,10 +353,10 @@ : ''; // $platformArray = $this->wfdownloads->getConfig('platform'); - $download['platform'] = $myts->htmlSpecialChars($platformArray[$this->getVar('platform')]); + $download['platform'] = $GLOBALS['myts']->htmlSpecialChars($platformArray[$this->getVar('platform')]); // $history = $this->getVar('dhistory', 'n'); - $download['history'] = $myts->displayTarea($history, true); + $download['history'] = $GLOBALS['myts']->displayTarea($history, true); // $download['features'] = array(); if ($this->getVar('features')) { @@ -371,9 +374,9 @@ } } // - $download['mail_subject'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $xoopsConfig['sitename'])); + $download['mail_subject'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $GLOBALS['xoopsConfig']['sitename'])); // - $download['mail_body'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $xoopsConfig['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['id']); + $download['mail_body'] = rawurlencode(sprintf(_MD_WFDOWNLOADS_INTFILEFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . WFDOWNLOADS_URL . '/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['id']); // $download['isadmin'] = (wfdownloads_userIsAdmin()) ? true : false; // @@ -417,7 +420,7 @@ // file url $fullFilename = trim($download['filename']); if ((!$download['url'] == '' && !$download['url'] == 'http://') || $fullFilename == '') { - $download['file_url'] = $myts->htmlSpecialChars(preg_replace('/javascript:/si', 'javascript:', $download['url']), ENT_QUOTES); + $download['file_url'] = $GLOBALS['myts']->htmlSpecialChars(preg_replace('/javascript:/si', 'javascript:', $download['url']), ENT_QUOTES); } else { $download['file_url'] = XOOPS_URL . str_replace(XOOPS_ROOT_PATH, '', $this->wfdownloads->getConfig('uploaddir')) . '/' . stripslashes(trim($fullFilename)); } @@ -632,15 +635,15 @@ if (($this->wfdownloads->getConfig('useruploads') && array_intersect($this->wfdownloads->getConfig('useruploadsgroup'), $groups)) || wfdownloads_userIsAdmin() ) { - $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot', 0), false); + $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot', 0), false); // IN PROGRESS if ($this->wfdownloads->getConfig('max_screenshot') >= 2) { - $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot2', 0), false); + $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot2', 0), false); // IN PROGRESS } if ($this->wfdownloads->getConfig('max_screenshot') >= 3) { - $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot3', 0), false); + $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot3', 0), false); // IN PROGRESS } if ($this->wfdownloads->getConfig('max_screenshot') >= 4) { - $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false); + $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false); // IN PROGRESS } } @@ -916,111 +919,64 @@ if (!$this->isNew() && $this->getVar('dhistory') != '') { $sform->addElement(new XoopsFormTextArea(_AM_WFDOWNLOADS_FILE_HISTORYD, 'dhistoryaddedd', '', 7, 60), false); } + // download: screenshot - $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), 'images'); - $indeximage_select = new XoopsFormSelect('', 'screenshot', $this->getVar('screenshot', 'e')); - $indeximage_select->addOptionArray($graph_array); - $indeximage_select->setExtra( - "onchange='showImgSelected(\"image1\", \"screenshot\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL - . "\")'" - ); - $indeximage_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); - $indeximage_tray->addElement($indeximage_select); - if ($this->getVar('screenshot') != '') { - $indeximage_tray->addElement( - new XoopsFormLabel('', - "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar( - 'screenshot', - 'e' - ) . "' id='image1' alt='' title='screenshot 1' />") - ); + $graph_array1 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), 'images'); + $indeximage_select1 = new XoopsFormSelect('', 'screenshot', $this->getVar('screenshot', 'e')); + $indeximage_select1->addOptionArray($graph_array1); + $indeximage_select1->setExtra("onchange='showImgSelected(\"image1\", \"screenshot\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'"); + $indeximage_tray1 = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); + $indeximage_tray1->addElement($indeximage_select1); + if ($this->getVar('screenshot') != '') { // IN PROGRESS + $indeximage_tray1->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot', 'e') . "' id='image1' alt='' title='screenshot 1' />")); } else { - $indeximage_tray->addElement( - new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image1' alt='' title='' />") - ); + $indeximage_tray1->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image1' alt='' title='' />")); } - $sform->addElement($indeximage_tray); + $sform->addElement($indeximage_tray1); + // download: screenshot2 - $graph_array2 = & WfsLists :: getListTypeAsArray( - XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), - $type = 'images' - ); + $graph_array2 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), 'images'); $indeximage_select2 = new XoopsFormSelect('', 'screenshot2', $this->getVar('screenshot2', 'e')); $indeximage_select2->addOptionArray($graph_array2); - $indeximage_select2->setExtra( - "onchange='showImgSelected(\"image2\", \"screenshot2\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL - . "\")'" - ); + $indeximage_select2->setExtra("onchange='showImgSelected(\"image2\", \"screenshot2\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'"); $indeximage_tray2 = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); $indeximage_tray2->addElement($indeximage_select2); if ($this->getVar('screenshot2') != '') { - $indeximage_tray2->addElement( - new XoopsFormLabel('', - "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar( - 'screenshot2', - 'e' - ) . "' id='image2' alt='' title='screenshot 2' />") - ); + $indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot2', 'e') . "' id='image2' alt='' title='screenshot 2' />")); } else { - $indeximage_tray2->addElement( - new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image2' alt='' title='' />") - ); + $indeximage_tray2->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image2' alt='' title='' />")); } $sform->addElement($indeximage_tray2); + // download: screenshot3 - $graph_array3 = & WfsLists :: getListTypeAsArray( - XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), - $type = "images" - ); + $graph_array3 = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), 'images'); $indeximage_select3 = new XoopsFormSelect('', 'screenshot3', $this->getVar('screenshot3', 'e', true)); $indeximage_select3->addOptionArray($graph_array3); - $indeximage_select3->setExtra( - "onchange='showImgSelected(\"image3\", \"screenshot3\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL - . "\")'" - ); + $indeximage_select3->setExtra("onchange='showImgSelected(\"image3\", \"screenshot3\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'"); $indeximage_tray3 = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); $indeximage_tray3->addElement($indeximage_select3); if ($this->getVar('screenshot3') != '') { - $indeximage_tray3->addElement( - new XoopsFormLabel('', - "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar( - 'screenshot3', - 'e' - ) . "' id='image3' alt='' title='screenshot 3' />") - ); + $indeximage_tray3->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot3', 'e') . "' id='image3' alt='' title='screenshot 3' />")); } else { - $indeximage_tray3->addElement( - new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image3' alt='' title='' />") - ); + $indeximage_tray3->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image3' alt='' title='' />")); } $sform->addElement($indeximage_tray3); + // download: screenshot4 - $graph_array4 = & WfsLists :: getListTypeAsArray( - XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), - $type = 'images' - ); + $graph_array4 = WfsLists::getListTypeAsArray( + XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('screenshots'), 'images'); $indeximage_select4 = new XoopsFormSelect('', 'screenshot4', $this->getVar('screenshot4', 'e')); $indeximage_select4->addOptionArray($graph_array4); - $indeximage_select4->setExtra( - "onchange='showImgSelected(\"image4\", \"screenshot4\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL - . "\")'" - ); + $indeximage_select4->setExtra("onchange='showImgSelected(\"image4\", \"screenshot4\", \"" . $this->wfdownloads->getConfig('screenshots') . "\", \"\", \"" . XOOPS_URL . "\")'"); $indeximage_tray4 = new XoopsFormElementTray(_AM_WFDOWNLOADS_FILE_SHOTIMAGE, ' '); $indeximage_tray4->addElement($indeximage_select4); if ($this->getVar('screenshot4') != "") { - $indeximage_tray4->addElement( - new XoopsFormLabel('', - "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar( - 'screenshot4', - 'e' - ) . "' id='image4' alt='' title='screenshot 4' />") - ); + $indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . '/' . $this->wfdownloads->getConfig('screenshots') . '/' . $this->getVar('screenshot4', 'e') . "' id='image4' alt='' title='screenshot 4' />")); } else { - $indeximage_tray4->addElement( - new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image4' alt='' title='' />") - ); + $indeximage_tray4->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' id='image4' alt='' title='' />")); } $sform->addElement($indeximage_tray4); + $sform->insertBreak(sprintf(_AM_WFDOWNLOADS_FILE_MUSTBEVALID, "<b>" . $this->wfdownloads->getConfig('screenshots') . "</b>"), "even"); // download: published Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/img_uploader.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -71,8 +71,8 @@ * @copyright (c) 2000-2003 The Xoops Project - www.xoops.org */ mt_srand((double) microtime() * 1000000); -//require_once XOOPS_ROOT_PATH . "/modules/wfdownloads/class/uploader.php"; -require_once XOOPS_ROOT_PATH . "/class/uploader.php"; +//require_once XOOPS_ROOT_PATH . '/modules/wfdownloads/class/uploader.php'; +require_once XOOPS_ROOT_PATH . '/class/uploader.php'; /** * Class XoopsMediaImgUploader Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt 2014-09-22 19:57:08 UTC (rev 12797) @@ -1,4 +1,4 @@ -<b><u>=> Version 3.23 RC2 (2014-09-03)</u></b> +<b><u>=> Version 3.23 RC2 (2014-09-22)</u></b> - todo: Swish-e files indexing support - removed obsolete eval() that was used for PHP4 (mamba) - removed object.php file (mamba) Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -25,7 +25,7 @@ */ function wfdownloads_notify_iteminfo($category, $item_id) { - global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; + global $xoopsModule, $xoopsModuleConfig; if (empty($xoopsModule) || $xoopsModule->dirname() != 'wfdownloads') { $module_handler = xoops_gethandler('module'); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -20,7 +20,7 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once dirname(__FILE__) . '/common.php'; -@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/admin.php'; +@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; define('INDEX_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/index.html'); define('BLANK_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/blank.gif'); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -20,7 +20,7 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once dirname(__FILE__) . '/common.php'; -@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/admin.php'; +@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; /** * @param $xoopsModule Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -20,26 +20,26 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once dirname(__FILE__) . '/common.php'; -@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/admin.php'; +@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; include_once WFDOWNLOADS_ROOT_PATH . '/class/dbupdater.php'; /** * @param $xoopsModule - * @param $prev_version + * @param $previousVersion * * @return bool */ -function xoops_module_update_wfdownloads(&$xoopsModule, $prev_version) +function xoops_module_update_wfdownloads(&$xoopsModule, $previousVersion) { ob_start(); invert_nohtm_dohtml_values(); - if ($prev_version <= 322) { + if ($previousVersion < 322) { update_tables_to_322($xoopsModule); } - if ($prev_version <= 323) { + if ($previousVersion < 323) { update_permissions_to_323($xoopsModule); + update_tables_to_323($xoopsModule); } - update_tables_to_323($xoopsModule); $feedback = ob_get_clean(); if (method_exists($xoopsModule, 'setMessage')) { $xoopsModule->setMessage($feedback); @@ -106,7 +106,7 @@ "summary" => array("Type" => "text NOT NULL", "Default" => false), "formulize_idreq" => array("Type" => "int(5) NOT NULL default '0'", "Default" => true), // added 3.23 - "screenshots" => array("Type" => "text NOT NULL default ''", "Default" => true), + "screenshots" => array("Type" => "text NOT NULL", "Default" => true), "dohtml" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), @@ -118,7 +118,7 @@ //); echo "<br /><span style='font-weight: bold;'>Checking Download table</span><br />"; $download_handler = xoops_getmodulehandler('download', 'wfdownloads'); - $download_table = new WfdownloadsTable("wfdownloads_downloads"); + $download_table = new WfdownloadsTable('wfdownloads_downloads'); $fields = get_table_info($download_handler->table, $download_fields); // check for renamed fields //rename_fields($download_table, $renamed_fields, $fields, $download_fields); @@ -128,7 +128,20 @@ echo "Downloads table updated<br />"; } unset($fields); + // populate screenshots with screenshot, screenshot2, screenshot3, screenshot4 values + $downloadsObjs = $download_handler->getObjects(); + foreach ($downloadsObjs as $downloadsObj) { + $screenshots = array(); + $screenshots[] = $downloadsObj->getVar('screenshot'); + $screenshots[] = $downloadsObj->getVar('screenshot2'); + $screenshots[] = $downloadsObj->getVar('screenshot3'); + $screenshots[] = $downloadsObj->getVar('screenshot4'); + $downloadsObj->setVar('screenshots', $screenshots); + unset($screenshots); + $download_handler->insert($downloadsObj); + } + // update wfdownloads_mod table $mod_fields = array( "requestid" => array("Type" => "int(11) NOT NULL auto_increment", "Default" => false), @@ -189,7 +202,7 @@ //); echo "<br /><span style='font-weight: bold;'>Checking Modified Downloads table</span><br />"; $mod_handler = xoops_getmodulehandler('modification', 'wfdownloads'); - $mod_table = new WfdownloadsTable("wfdownloads_mod"); + $mod_table = new WfdownloadsTable('wfdownloads_mod'); $fields = get_table_info($mod_handler->table, $mod_fields); // check for renamed fields //rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -110,7 +110,7 @@ if ($wfdownloads->getHandler('rating')->insert($ratingObj)) { // All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. wfdownloads_updateRating($lid); - $thankyouMessage = _MD_WFDOWNLOADS_VOTEAPPRE . "<br />" . sprintf(_MD_WFDOWNLOADS_THANKYOU, $xoopsConfig['sitename']); + $thankyouMessage = _MD_WFDOWNLOADS_VOTEAPPRE . "<br />" . sprintf(_MD_WFDOWNLOADS_THANKYOU, $GLOBALS['xoopsConfig']['sitename']); redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 4, $thankyouMessage); } else { echo $ratingObj->getHtmlErrors(); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -31,7 +31,7 @@ $xoopsOption['template_main'] = 'system_' . $feed_type . '.tpl'; error_reporting(0); -include_once(XOOPS_ROOT_PATH . '/class/template.php'); +include_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new XoopsTpl(); // Find case @@ -63,7 +63,7 @@ } $xoopsTpl->caching = true; -$xoopsTpl->cache_lifetime = $xoopsConfig['module_cache'][(int) $wfdownloads->getModule()->mid()]; +$xoopsTpl->cache_lifetime = $GLOBALS['xoopsConfig']['module_cache'][(int) $wfdownloads->getModule()->mid()]; if (!$xoopsTpl->is_cached('db:' . $xoopsOption['template_main'], $cache_prefix)) { // Get content $limit = 30; @@ -77,8 +77,8 @@ default: case 'all': $shorthand = 'all'; - $title = $xoopsConfig['sitename'] . ' - ' . htmlspecialchars($wfdownloads->getModule()->getVar('name'), ENT_QUOTES); - $desc = $xoopsConfig['slogan']; + $title = $GLOBALS['xoopsConfig']['sitename'] . ' - ' . htmlspecialchars($wfdownloads->getModule()->getVar('name'), ENT_QUOTES); + $desc = $GLOBALS['xoopsConfig']['slogan']; $channel_url = XOOPS_URL . '/modules/' . $wfdownloads->getModule()->getVat('dirname') . '/rss.php'; $criteria->add(new Criteria('cid', '(' . implode(',', $allowedDownCategoriesIds) . ')', 'IN')); @@ -88,8 +88,8 @@ case 'category': $shorthand = 'cat'; - $title = $xoopsConfig['sitename'] . ' - ' . htmlspecialchars($categoryObj->getVar('title'), ENT_QUOTES); - $desc = $xoopsConfig['slogan'] . ' - ' . htmlspecialchars($categoryObj->getVar('title'), ENT_QUOTES); + $title = $GLOBALS['xoopsConfig']['sitename'] . ' - ' . htmlspecialchars($categoryObj->getVar('title'), ENT_QUOTES); + $desc = $GLOBALS['xoopsConfig']['slogan'] . ' - ' . htmlspecialchars($categoryObj->getVar('title'), ENT_QUOTES); $channel_url = XOOPS_URL . '/modules/' . $wfdownloads->getModule()->getVat('dirname') . '/rss.php?cid=' . (int) $categoryObj->getVar('cid'); $criteria->add(new Criteria('cid', (int) $categoryObj->getVar('cid'))); @@ -103,9 +103,9 @@ $xoopsTpl->assign('channel_desc', xoops_utf8_encode($desc, 'n')); $xoopsTpl->assign('channel_link', $channel_url); $xoopsTpl->assign('channel_lastbuild', formatTimestamp(time(), $feed_type)); - $xoopsTpl->assign('channel_webmaster', $xoopsConfig['adminmail']); - $xoopsTpl->assign('channel_editor', $xoopsConfig['adminmail']); - $xoopsTpl->assign('channel_editor_name', $xoopsConfig['sitename']); + $xoopsTpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail']); + $xoopsTpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail']); + $xoopsTpl->assign('channel_editor_name', $GLOBALS['xoopsConfig']['sitename']); $xoopsTpl->assign('channel_category', $wfdownloads->getModule()->getVar('name', 'e')); $xoopsTpl->assign('channel_generator', 'PHP'); $xoopsTpl->assign('channel_language', _LANGCODE); @@ -128,7 +128,7 @@ $link = $url . 'singlefile.php?lid=' . (int) $item->getVar('lid'); $title = htmlspecialchars($item->getVar('title', 'n')); $teaser = htmlspecialchars($item->getVar('summary', 'n')); - $author = isset($users[$item->getVar('submitter')]) ? isset($users[$item->getVar('submitter')]) : $xoopsConfig['anonymous']; + $author = isset($users[$item->getVar('submitter')]) ? isset($users[$item->getVar('submitter')]) : $GLOBALS['xoopsConfig']['anonymous']; $xoopsTpl->append( 'items', Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php 2014-09-22 19:57:08 UTC (rev 12797) @@ -241,7 +241,7 @@ } else { $user_reviews = "cid={$cid}&lid={$lid}\">" . _MD_WFDOWNLOADS_NOUSERREVIEWS; } -$xoopsTpl->assign('lang_user_reviews', $xoopsConfig['sitename'] . ' ' . _MD_WFDOWNLOADS_USERREVIEWSTITLE); +$xoopsTpl->assign('lang_user_reviews', $GLOBALS['xoopsConfig']['sitename'] . ' ' . _MD_WFDOWNLOADS_USERREVIEWSTITLE); $xoopsTpl->assign('lang_UserReviews', sprintf($user_reviews, $downloadObj->getVar('title'))); $xoopsTpl->assign('review_amount', $reviewCount); @@ -255,7 +255,7 @@ } else { $user_mirrors = "cid={$cid}&lid={$lid}\">" . _MD_WFDOWNLOADS_NOUSERMIRRORS; } -$xoopsTpl->assign('lang_user_mirrors', $xoopsConfig['sitename'] . ' ' . _MD_WFDOWNLOADS_USERMIRRORSTITLE); +$xoopsTpl->assign('lang_user_mirrors', $GLOBALS['xoopsConfig']['sitename'] . ' ' . _MD_WFDOWNLOADS_USERMIRRORSTITLE); $xoopsTpl->assign('lang_UserMirrors', sprintf($user_mirrors, $downloadObj->getVar('title'))); $xoopsTpl->assign('mirror_amount', $mirrorCount); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2014-09-22 08:23:59 UTC (rev 12796) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2014-09-22 19:57:08 UTC (rev 12797) @@ -3,14 +3,14 @@ # CREATE TABLE wfdownloads_broken ( - reportid int(5) NOT NULL auto_increment, - lid int(11) NOT NULL default '0', - sender int(11) NOT NULL default '0', - ip varchar(20) NOT NULL default '', - date varchar(11) NOT NULL default '0', - confirmed tinyint(1) NOT NULL default '0', - acknowledged tinyint(1) NOT NULL default '0', - PRIMARY KEY (reportid), + reportid int(5) NOT NULL auto_increment, + lid int(11) NOT NULL default '0', + sender int(11) NOT NULL default '0', + ip varchar(20) NOT NULL default '', + date varchar(11) NOT NULL default '0', + confirmed tinyint(1) NOT NULL default '0', + acknowledged tinyint(1) NOT NULL default '0', + PRIMARY KEY (reportid), KEY lid (lid), KEY sender (sender), KEY ip (ip) @@ -28,23 +28,23 @@ # CREATE TABLE wfdownloads_cat ( - cid int(5) unsigned NOT NULL auto_increment, - pid int(5) unsigned NOT NULL default '0', - title varchar(255) NOT NULL default '', - imgurl varchar(255) NOT NULL default '', - description text NOT NULL, - total int(11) NOT NULL default '0', - summary text NOT NULL, - spotlighttop int(11) NOT NULL default '0', - spotlighthis int(11) NOT NULL default '0', - dohtml tinyint(1) NOT NULL default '0', - dosmiley tinyint(1) NOT NULL default '1', - doxcode tinyint(1) NOT NULL default '1', - doimage tinyint(1) NOT NULL default '1', - dobr tinyint(1) NOT NULL default '1', - weight int(11) NOT NULL default '0', - formulize_fid int(5) NOT NULL default '0', - PRIMARY KEY (cid), + cid int(5) unsigned NOT NULL auto_increment, + pid int(5) unsigned NOT NULL default '0', + title varchar(255) NOT NULL default '', + imgurl varchar(255) NOT NULL default '', + description text NOT NULL, + total int(11) NOT NULL default '0', + summary text NOT NULL, + spotlighttop int(11) NOT NULL default '0', + spotlighthis int(11) NOT NULL default '0', + dohtml tinyint(1) NOT NULL default '0', + dosmiley tinyint(1) NOT NULL default '1', + doxcode tinyint(1) NOT NULL default '1', + doimage tinyint(1) NOT NULL default '1', + dobr tinyint(1) NOT NULL default '1', + weight int(11) NOT NULL default '0', + formulize_fid int(5) NOT NULL default '0', + PRIMARY KEY (cid), KEY pid (pid) ) ENGINE=MyISAM; @@ -59,55 +59,55 @@ # CREATE TABLE wfdownloads_downloads ( - lid int(11) unsigned NOT NULL auto_increment, - cid int(5) unsigned NOT NULL default '0', - title varchar(255) NOT NULL default '', - url varchar(255) NOT NULL default '', - filename varchar(150) NOT NULL default '', - filetype varchar(100) NOT NULL default '', - homepage varchar(100) NOT NULL default '', - version varchar(20) NOT NULL default '', - size int(8) NOT NULL default '0', - platform varchar(50) NOT NULL default '', - screenshot varchar(255) NOT NULL default '', - screenshot2 varchar(255) NOT NULL default '', - screenshot3 varchar(255) NOT NULL default '', - screenshot4 varchar(255) NOT NULL default '', - submitter int(11) NOT NULL default '0', - publisher varchar(255) NOT NULL default '', - status tinyint(2) NOT NULL default '0', - date int(10) NOT NULL default '0', - hits int(11) unsigned NOT NULL default '0', - rating double(6,4) NOT NULL default '0.0000', - votes int(11) unsigned NOT NULL default '0', - comments int(11) unsigned NOT NULL default '0', - license varchar(255) NOT NULL default '', - mirror varchar(255) NOT NULL d... [truncated message content] |
From: <luc...@us...> - 2014-09-23 20:08:00
|
Revision: 12799 http://sourceforge.net/p/xoops/svn/12799 Author: luciorota Date: 2014-09-23 20:07:56 +0000 (Tue, 23 Sep 2014) Log Message: ----------- use screenshots field instead of screenshot, screentshot1, ... IN PROGRESS Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -730,12 +730,14 @@ $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']); // IN PROGRESS +*/ $newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']); $newDownload_array['date_formatted'] = XoopsLocal::formatTimestamp($newDownload_array['date'], 'l'); $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array); @@ -746,9 +748,9 @@ // Autopublished Downloads $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('published', time(), ">")); + $criteria->add(new Criteria('published', time(), '>')); $criteria->setSort('published'); - $criteria->setOrder("ASC"); + $criteria->setOrder('ASC'); $criteria->setStart($start_autopublished); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); @@ -856,9 +858,9 @@ } $batchFile = $batchFiles[$batchid]; - $savedFileName = iconv("UTF-8", "ASCII//TRANSLIT", $batchFile); + $savedFileName = iconv('UTF-8', "ASCII//TRANSLIT", $batchFile); $savedFileName = preg_replace('!\s+!', '_', $savedFileName); - $savedFileName = preg_replace("/[^a-zA-Z0-9\._-]/", "", $savedFileName); + $savedFileName = preg_replace('/[^a-zA-Z0-9\._-]/', '', $savedFileName); $savedFileName = uniqid(time()) . '--' . $savedFileName; if (!wfdownloads_copyFile($batchPath . '/' . $batchFile, $wfdownloads->getConfig('uploaddir') . '/' . $savedFileName)) { Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -375,7 +375,11 @@ } $GLOBALS['xoopsDB']->query($sql); echo "Imported {$GLOBALS['xoopsDB']->getAffectedRows()} downloads into {$destination['downloads']}<br />"; +// IN PROGRESS +// IN PROGRESS IMPORT AND UPDATE SCREENSHOTS +// IN PROGRESS + //Import data into mirrors table $sql = "INSERT INTO {$destination['mirrors']} ("; $sql .= " `lid`, `title`, `homeurl`, `location`, `continent`, `downurl`, `submit`, `date`, `uid`"; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -98,7 +98,7 @@ // Get common keys $commonKeys = array_intersect($downloadKeys, $modificationKeys); // Set not allowed keys - $notAllowedKeys = array('lid', 'submitter', 'publisher', 'requestid', 'forumid', 'modifysubmitter', 'screenshots', 'paypalemail'); + $notAllowedKeys = array('lid', 'submitter', 'publisher', 'requestid', 'forumid', 'modifysubmitter', 'paypalemail'); $i = 0; $mcform->addElement(null, false, null, null); @@ -156,6 +156,21 @@ // if ($modificationContent != '') $modificationContent = "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$modificationContent}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />"; break; + case 'screenshots': + $downloadScreenshots = $downloadContent; + $modificationScreenshots = $modificationContent; + unset($downloadContent); + unset($modificationContent); + $downloadContent = ''; + $modificationContent = ''; + foreach ($downloadScreenshots as $key => $value) { + $downloadScreenshot = $downloadScreenshots[$key]; + $modificationScreenshot = $modificationScreenshots[$key]; + if ($downloadScreenshot != '') $downloadContent += "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$downloadScreenshot}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />"; + // + if ($modificationContent != '') $modificationContent += "<img src='" . XOOPS_URL . "/{$wfdownloads->getConfig('screenshots')}/{$modificationScreenshot}' width='{$wfdownloads->getConfig('shotwidth')}' alt='' title='' />"; + } + break; case 'publisher': $downloadContent = XoopsUserUtility::getUnameFromId($downloadContent); // Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -81,6 +81,7 @@ // $this->initVar('ipaddress', XOBJ_DTYPE_TXTBOX, ''); // $this->initVar('notifypub', XOBJ_DTYPE_INT, 0); // added 3.23 + $this->initVar('screenshots', XOBJ_DTYPE_ARRAY, array()); // IN PROGRESS $this->initVar('dohtml', XOBJ_DTYPE_INT, false); // boolean $this->initVar('dosmiley', XOBJ_DTYPE_INT, true); // boolean $this->initVar('doxcode', XOBJ_DTYPE_INT, true); // boolean @@ -156,6 +157,7 @@ d.updated = m.updated, d.summary = m.summary, d.description = m.description, + d.screenshots = m.screenshots, d.dohtml = m.dohtml, d.dosmiley = m.dosmiley, d.doxcode = m.doxcode, Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -191,6 +191,7 @@ // ??? "formulize_idreq" => array("Type" => "int(5) NOT NULL default '0'", "Default" => true), // added 3.23 + "screenshots" => array("Type" => "text NOT NULL", "Default" => true), "dohtml" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), @@ -361,7 +362,7 @@ ); echo "<br /><span style='font-weight: bold;'>Checking Download table</span><br />"; $download_handler = xoops_getmodulehandler('download', 'wfdownloads'); - $download_table = new WfdownloadsTable("wfdownloads_downloads"); + $download_table = new WfdownloadsTable('wfdownloads_downloads'); $fields = get_table_info($download_handler->table, $download_fields); // check for renamed fields rename_fields($download_table, $renamed_fields, $fields, $download_fields); @@ -425,7 +426,7 @@ ); echo "<br /><span style='font-weight: bold;'>Checking Modified Downloads table</span><br />"; $mod_handler = xoops_getmodulehandler('modification', 'wfdownloads'); - $mod_table = new WfdownloadsTable("wfdownloads_mod"); + $mod_table = new WfdownloadsTable('wfdownloads_mod'); $fields = get_table_info($mod_handler->table, $mod_fields); rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); update_table($mod_fields, $fields, $mod_table); @@ -455,7 +456,7 @@ ); echo "<br /><span style='font-weight: bold;'>Checking Category table</span><br />"; $cat_handler = xoops_getmodulehandler('category', 'wfdownloads'); - $cat_table = new WfdownloadsTable("wfdownloads_cat"); + $cat_table = new WfdownloadsTable('wfdownloads_cat'); $fields = get_table_info($cat_handler->table, $cat_fields); update_table($cat_fields, $fields, $cat_table); if ($dbupdater->updateTable($cat_table)) { @@ -475,7 +476,7 @@ ); echo "<br /><span style='font-weight: bold;'>Checking Broken Report table</span><br />"; $broken_handler = xoops_getmodulehandler('report', 'wfdownloads'); - $broken_table = new WfdownloadsTable("wfdownloads_broken"); + $broken_table = new WfdownloadsTable('wfdownloads_broken'); $fields = get_table_info($broken_handler->table, $broken_fields); update_table($broken_fields, $fields, $broken_table); if ($dbupdater->updateTable($broken_table)) { Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2014-09-23 20:07:56 UTC (rev 12799) @@ -344,6 +344,7 @@ description text NOT NULL, modifysubmitter int(11) NOT NULL default '0', requestdate int(11) NOT NULL default '0', + screenshots text NOT NULL, dohtml tinyint(1) NOT NULL default '0', dosmiley tinyint(1) NOT NULL default '1', doxcode tinyint(1) NOT NULL default '1', Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php 2014-09-22 20:06:12 UTC (rev 12798) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php 2014-09-23 20:07:56 UTC (rev 12799) @@ -357,7 +357,7 @@ $owner_groups, $groups, 'new' - ); // "new" causes xoops token check to be skipped, since Wfdownloads should be doing that + ); // 'new' causes xoops token check to be skipped, since Wfdownloads should be doing that if (!$owner) { $id_req = $entries[$fid][0]; $downloadObj->setVar('formulize_idreq', $id_req); @@ -445,12 +445,12 @@ $offline = (isset($_POST['offline']) && $_POST['offline'] == 1) ? true : false; $downloadObj->setVar('offline', $offline); $downloadObj->setVar('date', time()); - +/* $screenshot1 = ''; $screenshot2 = ''; $screenshot3 = ''; $screenshot4 = ''; - +*/ if ($lid == 0) { $notifypub = (isset($_POST['notifypub']) && $_POST['notifypub'] == true); $downloadObj->setVar('notifypub', $notifypub); |
From: <luc...@us...> - 2014-11-26 21:42:23
|
Revision: 12875 http://sourceforge.net/p/xoops/svn/12875 Author: luciorota Date: 2014-11-26 21:42:17 +0000 (Wed, 26 Nov 2014) Log Message: ----------- - update to latest mamba work - fixed: use DateTime object instead of strtotime function (luciorota) Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/images.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/menu.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/permissions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/blocks/top_by_cat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/dbupdater.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/ip_log.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/multicolumnsthemeform.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/rating.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/report.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/session.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/tree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfdownloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/wfdownloads_lists.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/xoopstree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/comment_new.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/credits.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/install.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/lang_diff.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/readme.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/header.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/comment_functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/directorychecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/filechecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/notification.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/search.inc.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/admin.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_filemodified_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_filesubmit_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/category_newfile_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/file_approve_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/file_filemodified_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/filebroken_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filebroken_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filemodified_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filemodify_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_filesubmit_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_newcategory_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/global_newfile_notify.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/mail_template/index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/modinfo.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/index.html XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/rss.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_letterschoice.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_singlefile.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/visit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-11-26 21:38:33 UTC (rev 12874) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/about.php 2014-11-26 21:42:17 UTC (rev 12875) @@ -18,7 +18,7 @@ * @author Xoops Development Team * @version svn:$id$ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); @@ -27,4 +27,4 @@ echo $aboutAdmin->addNavigation('about.php'); echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); -include_once dirname(__FILE__) . '/admin_footer.php'; +include_once __DIR__ . '/admin_footer.php'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-11-26 21:38:33 UTC (rev 12874) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/admin_header.php 2014-11-26 21:42:17 UTC (rev 12875) @@ -18,8 +18,8 @@ * @author Xoops Development Team * @version svn:$id$ */ -include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; -include_once dirname(dirname(__FILE__)) . '/include/common.php'; +include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; +include_once dirname(__DIR__) . '/include/common.php'; // Include xoops admin header include_once XOOPS_ROOT_PATH . '/include/cp_header.php'; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-11-26 21:38:33 UTC (rev 12874) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2014-11-26 21:42:17 UTC (rev 12875) @@ -19,7 +19,7 @@ * @version svn:$id$ */ $currentFile = basename(__FILE__); -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; // Check directories if (!is_dir($wfdownloads->getConfig('uploaddir'))) { @@ -39,38 +39,38 @@ exit(); } -$op = WfdownloadsRequest::getString('op', 'categories.list'); +$op = XoopsRequest::getString('op', 'categories.list'); switch ($op) { case 'category.move': case 'move': - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); + $ok = XoopsRequest::getBool('ok', false, 'POST'); if ($ok == false) { - $cid = WfdownloadsRequest::getInt('cid', 0); + $cid = XoopsRequest::getInt('cid', 0); wfdownloads_xoops_cp_header(); include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $sform = new XoopsThemeForm(_AM_WFDOWNLOADS_CCATEGORY_MOVE, 'move', xoops_getenv('PHP_SELF')); - $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); $sform->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_BMODIFY, $categoryObjsTree->makeSelBox('target', 'title'))); - $create_tray = new XoopsFormElementTray('', ''); - $create_tray->addElement(new XoopsFormHidden('source', $cid)); - $create_tray->addElement(new XoopsFormHidden('ok', true)); - $create_tray->addElement(new XoopsFormHidden('op', 'category.move')); - $butt_save = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BMOVE, 'submit'); - $butt_save->setExtra('onclick="this.form.elements.op.value=\'category.move\'"'); - $create_tray->addElement($butt_save); - $butt_cancel = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BCANCEL, 'submit'); - $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"'); - $create_tray -> addElement($butt_cancel); + $create_tray = new XoopsFormElementTray('', ''); + $create_tray->addElement(new XoopsFormHidden('source', $cid)); + $create_tray->addElement(new XoopsFormHidden('ok', true)); + $create_tray->addElement(new XoopsFormHidden('op', 'category.move')); + $butt_save = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BMOVE, 'submit'); + $butt_save->setExtra('onclick="this.form.elements.op.value=\'category.move\'"'); + $create_tray->addElement($butt_save); + $butt_cancel = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BCANCEL, 'submit'); + $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"'); + $create_tray->addElement($butt_cancel); $sform->addElement($create_tray); $sform->display(); xoops_cp_footer(); } else { - $source = WfdownloadsRequest::getInt('source', 0, 'POST'); - $target = WfdownloadsRequest::getInt('target', 0, 'POST'); + $source = XoopsRequest::getInt('source', 0, 'POST'); + $target = XoopsRequest::getInt('target', 0, 'POST'); if ($target == $source) { redirect_header($currentFile . "?op=category.move&ok=0&cid={$source}", 5, _AM_WFDOWNLOADS_CCATEGORY_MODIFY_FAILED); } @@ -89,40 +89,40 @@ case 'category.save': case 'addCat': - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); - $pid = WfdownloadsRequest::getInt('pid', 0, 'POST'); - $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int) $_POST["weight"] : 0; - $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array(); - $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array(); - $spotlighthis = (isset($_POST['lid'])) ? (int) $_POST['lid'] : 0; + $cid = XoopsRequest::getInt('cid', 0, 'POST'); + $pid = XoopsRequest::getInt('pid', 0, 'POST'); + $weight = (isset($_POST['weight']) && $_POST['weight'] > 0) ? (int)$_POST["weight"] : 0; + $down_groups = isset($_POST['groups']) ? $_POST['groups'] : array(); + $up_groups = isset($_POST['up_groups']) ? $_POST['up_groups'] : array(); + $spotlighthis = (isset($_POST['lid'])) ? (int)$_POST['lid'] : 0; $spotlighttop = (isset($_POST['spotlighttop']) && ($_POST['spotlighttop'] == 1)) ? 1 : 0; include_once XOOPS_ROOT_PATH . '/class/uploader.php'; $allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); - $imgurl = 'blank.png'; - $maxFileSize = $wfdownloads->getConfig('maxfilesize'); - $maxImgWidth = $wfdownloads->getConfig('maximgwidth'); - $maxImgHeight = $wfdownloads->getConfig('maximgheight'); - $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage'); - $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight); + $imgurl = 'blank.png'; + $maxFileSize = $wfdownloads->getConfig('maxfilesize'); + $maxImgWidth = $wfdownloads->getConfig('maximgwidth'); + $maxImgHeight = $wfdownloads->getConfig('maximgheight'); + $uploadDirectory = XOOPS_ROOT_PATH . '/' . $wfdownloads->getConfig('catimage'); + $uploader = new XoopsMediaUploader($uploadDirectory, $allowedMimetypes, $maxFileSize, $maxImgWidth, $maxImgHeight); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { $uploader->setTargetFileName('wfdownloads_' . uniqid(time()) . '--' . strtolower($_FILES['uploadfile']['name'])); $uploader->fetchMedia($_POST['xoops_upload_file'][0]); if (!$uploader->upload()) { $errors = $uploader->getErrors(); - redirect_header('javascript:history.go(-1)',3, $errors); + redirect_header('javascript:history.go(-1)', 3, $errors); } else { $imgurl = $uploader->getSavedFileName(); } } else { - $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts -> addslashes($_POST['imgurl']) : ''; + $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts->addslashes($_POST['imgurl']) : ''; } if (!$cid) { $categoryObj = $wfdownloads->getHandler('category')->create(); } else { $categoryObj = $wfdownloads->getHandler('category')->get($cid); - $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj); + $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj); if ($pid == $cid || in_array($pid, array_keys($childcats))) { $categoryObj->setErrors(_AM_WFDOWNLOADS_CCATEGORY_CHILDASPARENT); } @@ -141,7 +141,7 @@ $categoryObj->setVar('dobr', isset($_POST['dobr'])); // Formulize module support (2006/05/04) jpc - start if (wfdownloads_checkModule('formulize')) { - $formulize_fid = (isset($_POST['formulize_fid'])) ? (int) $_POST['formulize_fid'] : 0; + $formulize_fid = (isset($_POST['formulize_fid'])) ? (int)$_POST['formulize_fid'] : 0; $categoryObj->setVar('formulize_fid', $formulize_fid); } // Formulize module support (2006/05/04) jpc - end @@ -153,15 +153,15 @@ } if (!$cid) { if ($cid == 0) { - $newid = (int) $categoryObj->getVar('cid'); + $newid = (int)$categoryObj->getVar('cid'); } wfdownloads_savePermissions($down_groups, $newid, 'WFDownCatPerm'); wfdownloads_savePermissions($up_groups, $newid, 'WFUpCatPerm'); // Notify of new category - $tags = array(); + $tags = array(); $tags['CATEGORY_NAME'] = $_POST['title']; - $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid; - $notification_handler = xoops_gethandler('notification'); + $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $newid; + $notification_handler = xoops_gethandler('notification'); $notification_handler->triggerEvent('global', 0, 'new_category', $tags); $database_mess = _AM_WFDOWNLOADS_CCATEGORY_CREATED; } else { @@ -174,11 +174,11 @@ case 'category.delete': case 'del': - $cid = WfdownloadsRequest::getInt('cid', 0); - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); - $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); + $cid = XoopsRequest::getInt('cid', 0); + $ok = XoopsRequest::getBool('ok', false, 'POST'); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); - if ($ok == true) { + if ($ok === true) { // get all subcategories under the specified category $childCategoryObjs = $categoryObjsTree->getAllChild($cid); foreach ($childCategoryObjs as $childCategoryObj) { @@ -199,7 +199,7 @@ $wfdownloads->getHandler('report')->deleteAll($download_criteria); $wfdownloads->getHandler('download')->deleteAll($download_criteria); foreach (array_keys($downloads) as $lid) { - xoops_comment_delete($wfdownloads->getModule()->mid(), (int) $lid); + xoops_comment_delete($wfdownloads->getModule()->mid(), (int)$lid); } // all downloads for each category is deleted, now delete the category data @@ -207,8 +207,8 @@ $error = _AM_WFDOWNLOADS_DBERROR; foreach ($cids as $cid) { - xoops_groupperm_deletebymoditem ($wfdownloads->getModule()->mid(), 'WFDownCatPerm', $cid); - xoops_groupperm_deletebymoditem ($wfdownloads->getModule() -> mid(), 'WFUpCatPerm', $cid); + xoops_groupperm_deletebymoditem($wfdownloads->getModule()->mid(), 'WFDownCatPerm', $cid); + xoops_groupperm_deletebymoditem($wfdownloads->getModule()->mid(), 'WFUpCatPerm', $cid); } redirect_header($currentFile, 1, _AM_WFDOWNLOADS_CCATEGORY_DELETED); @@ -237,9 +237,9 @@ $categoryObj = $wfdownloads->getHandler('category')->create(); } $form = $categoryObj->getForm(); - $form -> display(); + $form->display(); - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; break; case 'categories.list': @@ -257,22 +257,22 @@ if ($totalCategories > 0) { $sorted_categories = wfdownloads_sortCategories(); $GLOBALS['xoopsTpl']->assign('sorted_categories', $sorted_categories); - $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); + $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML()); $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_categorieslist.tpl"); } else { redirect_header("{$currentFile}?op=category.add", 1, _AM_WFDOWNLOADS_CCATEGORY_NOEXISTS); } - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; break; case 'categories.reorder': if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); + redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } if (isset($_POST['new_weights']) && count($_POST['new_weights']) > 0) { $new_weights = $_POST['new_weights']; - $ids = array(); + $ids = array(); foreach ($new_weights as $cid => $new_weight) { $categoryObj = $wfdownloads->getHandler('category')->get($cid); $categoryObj->setVar('weight', $new_weight); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-11-26 21:38:33 UTC (rev 12874) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2014-11-26 21:42:17 UTC (rev 12875) @@ -19,7 +19,7 @@ * @version svn:$id$ */ $currentFile = basename(__FILE__); -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; if (@$_POST['op'] == 'submit') { if (!$GLOBALS['xoopsSecurity']->check()) { @@ -71,7 +71,7 @@ $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); echo $message; - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; exit(); } else { @@ -86,7 +86,7 @@ $form->addElement(new XoopsFormHidden('op', 'submit')); $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit')); $form->display(); - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; exit(); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-11-26 21:38:33 UTC (rev 12874) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2014-11-26 21:42:17 UTC (rev 12875) @@ -19,7 +19,7 @@ * @version svn:$id$ */ $currentFile = basename(__FILE__); -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; // Check directories if (!is_dir($wfdownloads->getConfig('uploaddir'))) { @@ -39,7 +39,7 @@ exit(); } -$op = WfdownloadsRequest::getString('op', 'downloads.list'); +$op = XoopsRequest::getString('op', 'downloads.list'); switch ($op) { case 'download.edit': case 'download.add': @@ -52,15 +52,15 @@ $adminMenu->addItemButton(_MI_WFDOWNLOADS_MENU_DOWNLOADS, "{$currentFile}?op=downloads.list", 'list'); echo $adminMenu->renderButton(); - $lid = WfdownloadsRequest::getInt('lid', 0); + $lid = XoopsRequest::getInt('lid', 0); $categoriesCount = $wfdownloads->getHandler('category')->getCount(); if ($categoriesCount) { // 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"; @@ -77,16 +77,16 @@ redirect_header($currentFile, 4, _AM_WFDOWNLOADS_DOWN_ERROR_CATEGORYNOTFOUND); exit(); } - $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_EDIT); + $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_EDIT); $title12 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_1STEP); $title22 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_EDITDOWNLOADTITLE); } else { // create download $downloadObj = $wfdownloads->getHandler('download')->create(); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); + $cid = XoopsRequest::getInt('cid', 0, 'POST'); $categoryObj = $wfdownloads->getHandler('category')->get($cid); $downloadObj->setVar('cid', $cid); - $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE); + $title = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FILE_CREATE); $title12 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_1STEP); $title22 = preg_replace("/{category}/", $categoryObj->getVar('title'), _AM_WFDOWNLOADS_FFS_DOWNLOADTITLE); } @@ -97,15 +97,16 @@ $sform = $downloadObj->getAdminForm($title); } elseif ((isset($_POST['submit_category']) && !empty($_POST['submit_category']))) { // two steps form: 2nd step - $fid = $categoryObj->getVar('formulize_fid'); + $fid = $categoryObj->getVar('formulize_fid'); $customArray = array(); 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'] = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); - $customArray['prevEntry'] = getEntryValues( // is a Formulize function + $customArray['groups'] = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $customArray['prevEntry'] = getEntryValues( + // is a Formulize function $downloadObj->getVar('formulize_idreq'), $customArray['formulize_mgr'], $customArray['groups'], @@ -124,7 +125,7 @@ } else { $owner = getEntryOwner($customArray['entry'], $fid); // is a Formulize function } - $ownerGroups = $member_handler->getGroupsByUser($owner, false); + $ownerGroups = $member_handler->getGroupsByUser($owner, false); $customArray['owner_groups'] = $ownerGroups; } $sform = $downloadObj->getAdminForm($title22, $customArray); @@ -192,9 +193,9 @@ foreach ($regUserRatingObjs as $regUserRatingObj) { $formatted_date = XoopsLocal::formatTimestamp($regUserRatingObj->getVar('ratingtimestamp'), 'l'); - $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0; - $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0; - $ratingUserName = XoopsUser :: getUnameFromId($regUserRatingObj->getVar('ratinguser')); + $userAvgRating = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['avg'] : 0; + $userVotes = isset($userRatings[$regUserRatingObj->getVar('ratinguser')]) ? $userRatings[$regUserRatingObj->getVar('ratinguser')]['count'] : 0; + $ratingUserName = XoopsUser:: getUnameFromId($regUserRatingObj->getVar('ratinguser')); echo " <tr><td class='head'>$ratingUserName</td>\n @@ -204,8 +205,7 @@ <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=" . $regUserRatingObj->getVar('ratingid') . "'>" - . $imagearray['deleteimg'] . "</a>\n + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $regUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; } @@ -227,14 +227,14 @@ if ($anonUserRatingCount == 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); $anonUserRatingObjs = $wfdownloads->getHandler('rating')->getObjects($anonUserCriteria); foreach (array_keys($anonUserRatingObjs) as $anonUserRatingObj) { $formatted_date = XoopsLocal::formatTimestamp($anonUserRatingObj->getVar('ratingtimestamp'), 'l'); - $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; $ratingUserName = $GLOBALS['xoopsConfig']['anonymous']; @@ -246,8 +246,7 @@ <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=" . $anonUserRatingObj->getVar('ratingid') . "'>" - . $imagearray['deleteimg'] . "</a>\n + <a href='{$currentFile}?op=vote.delete&lid={$lid}&rid=" . $anonUserRatingObj->getVar('ratingid') . "'>" . $imagearray['deleteimg'] . "</a>\n </th></tr>\n "; } @@ -255,32 +254,32 @@ echo "</table>\n"; echo "</fieldset>\n"; } - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; break; case 'download.save': case 'addDownload': - $lid = WfdownloadsRequest::getInt('lid', 0, 'POST'); - $cid = WfdownloadsRequest::getInt('cid', 0, 'POST'); - $status = WfdownloadsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST'); + $lid = XoopsRequest::getInt('lid', 0, 'POST'); + $cid = XoopsRequest::getInt('cid', 0, 'POST'); + $status = XoopsRequest::getInt('status', _WFDOWNLOADS_STATUS_UPDATED, 'POST'); if ($lid > 0) { $thisIsANewRecord = false; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->get($lid); + $downloadObj = $wfdownloads->getHandler('download')->get($lid); } else { $thisIsANewRecord = true; /* Added by Lankford on 2007/3/21 */ - $downloadObj = $wfdownloads->getHandler('download')->create(); + $downloadObj = $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 = ''; // Get size from form - $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int) $_POST['size']; + $size = (empty($_POST['size']) || !is_numeric($_POST['size'])) ? 0 : (int)$_POST['size']; } else { - $url = ($_POST['url'] != 'http://') ? $_POST['url'] : ''; + $url = ($_POST['url'] != 'http://') ? $_POST['url'] : ''; $filename = $_POST['filename']; $filetype = $_POST['filetype']; $filePath = $wfdownloads->getConfig('uploaddir') . '/' . $filename; @@ -291,12 +290,12 @@ $downloadObj->setVar('filename', $filename); $downloadObj->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']); @@ -306,7 +305,7 @@ $downloadObj->setVar('filetype', $filetype); } // Get data from form - $screenshots = array(); + $screenshots = array(); $screenshots[] = ($_POST['screenshot'] != 'blank.png') ? $_POST['screenshot'] : ''; $screenshots[] = ($_POST['screenshot2'] != 'blank.png') ? $_POST['screenshot2'] : ''; $screenshots[] = ($_POST['screenshot3'] != 'blank.png') ? $_POST['screenshot3'] : ''; @@ -326,11 +325,11 @@ // If both conditions are true, then trigger all three notifications related to modified records. if (!$thisIsANewRecord && ($downloadObj->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}"; - $categoryObj = $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}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags['FILE_VERSION'] = $version; $tags['CATEGORY_NAME'] = $categoryObj->getVar('title'); $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . "/viewcat.php?cid='{$cid}"; @@ -377,12 +376,12 @@ $versiontypes = (isset($_POST['versiontypes'])) ? $_POST['versiontypes'] : ''; $downloadObj->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 . XoopsLocal::formatTimestamp($time, 'l') . "\n\n"; $dhistory .= $dhistoryhistory; } @@ -398,7 +397,7 @@ $offline = ($_POST['offline'] == true) ? true : false; $downloadObj->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; @@ -406,19 +405,23 @@ $publishdate = time(); } else { $publishdate = $_POST['was_published']; - $expiredate = $_POST['was_expired']; + $expiredate = $_POST['was_expired']; } if ($approved == 1 && empty($publishdate)) { $publishdate = time(); } if (isset($_POST['publishdateactivate'])) { - $publishdate = strtotime($_POST['published']['date']) + $_POST['published']['time']; + $obj = DateTime::createFromFormat(_SHORTDATESTRING, $_POST['published']['date']); + $obj->setTime(0, 0, 0); + $publishdate = $obj->getTimestamp() + $_POST['published']['time']; } if ($_POST['clearpublish']) { $publishdate = $downloadObj->getVar('published'); } if (isset($_POST['expiredateactivate'])) { - $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time']; + $obj = DateTime::createFromFormat(_SHORTDATESTRING, $_POST['expired']['date']); + $obj->setTime(0, 0, 0); + $expiredate = $obj->getTimestamp() + $_POST['expired']['time']; } if ($_POST['clearexpire']) { $expiredate = '0'; @@ -452,17 +455,17 @@ } else { print 'no idreq'; $entries[$fid][0] = ''; - $owner = ''; + $owner = ''; } $cid = $downloadObj->getVar('cid'); } else { $entries[$fid][0] = ''; - $owner = ''; + $owner = ''; } $ownerGroups = $member_handler->getGroupsByUser($owner, false); - $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; - $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); - $entries = handleSubmission( + $uid = !empty($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; + $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + $entries = handleSubmission( $formulizeElements_handler, $entries, $uid, @@ -480,24 +483,24 @@ } // Formulize module support (2006/05/04) jpc - end $wfdownloads->getHandler('download')->insert($downloadObj); - $newid = (int) $downloadObj->getVar('lid'); + $newid = (int)$downloadObj->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'] = $categoryObj->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}"; - $categoryObj = $wfdownloads->getHandler('category')->get($cid); + $tags = array(); + $tags['FILE_NAME'] = $title; + $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $categoryObj = $wfdownloads->getHandler('category')->get($cid); $tags['CATEGORY_NAME'] = $categoryObj->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); @@ -509,14 +512,14 @@ break; case 'download.delete': - $lid = WfdownloadsRequest::getInt('lid', 0); - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); + $lid = XoopsRequest::getInt('lid', 0); + $ok = XoopsRequest::getBool('ok', false, 'POST'); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); exit(); } $title = $downloadObj->getVar('title'); - if ($ok == true) { + if ($ok === true) { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } @@ -546,7 +549,7 @@ case 'delVote': $ratingObj = $wfdownloads->getHandler('rating')->get($_GET['rid']); if ($wfdownloads->getHandler('rating')->delete($ratingObj, true)) { - wfdownloads_updateRating((int) $ratingObj->getVar('lid')); + wfdownloads_updateRating((int)$ratingObj->getVar('lid')); } redirect_header($currentFile, 1, _AM_WFDOWNLOADS_VOTE_VOTEDELETED); break; @@ -563,8 +566,7 @@ $sqls[] = "ALTER TABLE " . $GLOBALS['xoopsDB']->prefix('wfdownloads_downloads') . " ADD formulize_idreq int(5) NOT NULL default '0';"; foreach ($sqls as $sql) { if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { - exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql - . "<br>Please contact <a href=su...@fr...>Freeform Solutions</a> for assistance."); + exit("Error patching for Formulize.<br>SQL dump:<br>" . $sql . "<br>Please contact <a href=su...@fr...>Freeform Solutions</a> for assistance."); } } print "Patching for Formulize completed."; @@ -575,7 +577,7 @@ case 'newdownload.approve': case 'approve': - $lid = WfdownloadsRequest::getInt('lid', 0); + $lid = XoopsRequest::getInt('lid', 0); if (!$downloadObj = $wfdownloads->getHandler('download')->get($lid)) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_DOWNLOADNOTFOUND); exit(); @@ -588,14 +590,14 @@ exit(); } // Trigger notify - $title = $downloadObj->getVar('title'); - $cid = $downloadObj->getVar('cid'); - $categoryObj = $wfdownloads->getHandler('category')->get($cid); - $tags = array(); - $tags['FILE_NAME'] = $title; - $tags['FILE_URL'] = WFDOWNLOADS_URL . "/singlefile.php?cid={$cid}&lid={$lid}"; + $title = $downloadObj->getVar('title'); + $cid = $downloadObj->getVar('cid'); + $categoryObj = $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'] = $categoryObj->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 ($downloadObj->getVar('notifypub')) { @@ -608,13 +610,13 @@ case 'downloads.filter': default : // get filter conditions - $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_submitter = WfdownloadsRequest::getArray('filter_submitter', null); - $filter_date = WfdownloadsRequest::getArray('filter_date', null); - $filter_date_condition = WfdownloadsRequest::getString('filter_date_condition', '<'); + $filter_title_condition = XoopsRequest::getString('filter_title_condition', '='); + $filter_title = XoopsRequest::getString('filter_title', ''); + $filter_category_title_condition = XoopsRequest::getString('filter_category_title_condition', '='); + $filter_category_title = XoopsRequest::getString('filter_category_title', ''); + $filter_submitter = XoopsRequest::getArray('filter_submitter', null); + $filter_date = XoopsRequest::getArray('filter_date', null); + $filter_date_condition = XoopsRequest::getString('filter_date_condition', '<'); // check filter conditions if ($op == 'downloads.filter') { if ($filter_title == '' && $filter_category_title == '' && is_null($filter_submitter)) { @@ -626,14 +628,14 @@ $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); - $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_published = XoopsRequest::getInt('start_published', 0); + $start_new = XoopsRequest::getInt('start_new', 0); + $start_autopublished = XoopsRequest::getInt('start_autopublished', 0); + $start_expired = XoopsRequest::getInt('start_expired', 0); + $start_offline = XoopsRequest::getInt('start_offline', 0); - $totalCategoriesCount = wfdownloads_categoriesCount(); - $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false); + $totalCategoriesCount = wfdownloads_categoriesCount(); + $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false); $totalDownloadsCount = $wfdownloads->getHandler('download')->getCount(); @@ -681,7 +683,7 @@ $criteria->setOrder('DESC'); $criteria->setStart($start_published); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); + $publishedDownloadObjs = $wfdownloads->getHandler('download')->getActiveDownloads($criteria); $publishedDownloadCount = $wfdownloads->getHandler('download')->getActiveCount(); $GLOBALS['xoopsTpl']->assign('published_downloads_count', $publishedDownloadCount); @@ -701,7 +703,7 @@ $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); - $submitters = array(); + $submitters = array(); $downloadsSubmitters_array = $wfdownloads->getHandler('download')->getAll(null, array('submitter'), false, false); foreach ($downloadsSubmitters_array as $downloadSubmitters_array) { $submitters[$downloadSubmitters_array['submitter']] = XoopsUserUtility::getUnameFromId($downloadSubmitters_array['submitter']); @@ -721,23 +723,23 @@ $criteria->add(new Criteria('published', 0)); $criteria->setStart($start_new); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $newDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); $newDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); $GLOBALS['xoopsTpl']->assign('new_downloads_count', $newDownloadCount); if ($newDownloadCount > 0) { foreach ($newDownloadObjs as $newDownloadObj) { - $newDownload_array = $newDownloadObj->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']); // IN PROGRESS -*/ + $newDownload_array = $newDownloadObj->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']); // IN PROGRESS + */ $newDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($newDownload_array['submitter']); $newDownload_array['date_formatted'] = XoopsLocal::formatTimestamp($newDownload_array['date'], 'l'); $GLOBALS['xoopsTpl']->append('new_downloads', $newDownload_array); @@ -753,7 +755,7 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_autopublished); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $autopublishedDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); $autopublishedDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); $GLOBALS['xoopsTpl']->assign('autopublished_downloads_count', $autopublishedDownloadCount); if ($autopublishedDownloadCount > 0) { @@ -766,9 +768,11 @@ $GLOBALS['xoopsTpl']->append('autopublished_downloads', $autopublishedDownload_array); } } - $pagenav = new XoopsPageNav($autopublishedDownloadCount, $wfdownloads->getConfig( - 'admin_perpage' - ), $start_autopublished, 'start_autopublished'); + $pagenav = new XoopsPageNav( + $autopublishedDownloadCount, $wfdownloads->getConfig( + 'admin_perpage' + ), $start_autopublished, 'start_autopublished' + ); $GLOBALS['xoopsTpl']->assign('autopublished_downloads_pagenav', $pagenav->renderNav()); // Expired downloads @@ -779,7 +783,7 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_expired); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $expiredDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); $expiredDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); $GLOBALS['xoopsTpl']->assign('expired_downloads_count', $expiredDownloadCount); if ($expiredDownloadCount > 0) { @@ -801,7 +805,7 @@ $criteria->setOrder('ASC'); $criteria->setStart($start_offline); $criteria->setLimit($wfdownloads->getConfig('admin_perpage')); - $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); + $offlineDownloadObjs = $wfdownloads->getHandler('download')->getObjects($criteria); $offlineDownloadCount = $wfdownloads->getHandler('download')->getCount($criteria); $GLOBALS['xoopsTpl']->assign('offline_downloads_count', $offlineDownloadCount); if ($offlineDownloadCount > 0) { @@ -822,19 +826,19 @@ // Batch files $extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php'); - $batchPath = $wfdownloads->getConfig('batchdir'); + $batchPath = $wfdownloads->getConfig('batchdir'); $GLOBALS['xoopsTpl']->assign('batch_path', $batchPath); - $batchFiles = wfdownloads_getFiles($batchPath . '/'); + $batchFiles = wfdownloads_getFiles($batchPath . '/'); $batchFilesCount = count($batchFiles); $GLOBALS['xoopsTpl']->assign('batch_files_count', $batchFilesCount); if ($batchFilesCount > 0) { - foreach($batchFiles as $key => $batchFile) { - $batchFile_array = array(); - $batchFile_array['id'] = $key; - $batchFile_array['filename'] = $batchFile; - $batchFile_array['size'] = wfdownloads_bytesToSize1024(filesize($batchPath . '/' . $batchFile)); + foreach ($batchFiles as $key => $batchFile) { + $batchFile_array = array(); + $batchFile_array['id'] = $key; + $batchFile_array['filename'] = $batchFile; + $batchFile_array['size'] = wfdownloads_bytesToSize1024(filesize($batchPath . '/' . $batchFile)); $batchFile_array['extension'] = pathinfo($batchFile, PATHINFO_EXTENSION); - $batchFile_array['mimetype'] = $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)]; + $batchFile_array['mimetype'] = $extensionToMime[pathinfo($batchFile, PATHINFO_EXTENSION)]; $GLOBALS['xoopsTpl']->append('batch_files', $batchFile_array); unset($batchFile_array); } @@ -842,15 +846,15 @@ $GLOBALS['xoopsTpl']->display("db:{$wfdownloads->getModule()->dirname()}_am_downloadslist.tpl"); - include_once dirname(__FILE__) . '/admin_footer.php'; + include_once __DIR__ . '/admin_footer.php'; break; case 'batchfile.add': - $batchid = WfdownloadsRequest::getInt('batchid', 0); + $batchid = XoopsRequest::getInt('batchid', 0); $extensionToMime = include $GLOBALS['xoops']->path('include/mimetypes.inc.php'); - $batchPath = $wfdownloads->getConfig('batchdir'); - $batchFiles = wfdownloads_getFiles($batchPath . '/'); + $batchPath = $wfdownloads->getConfig('batchdir'); + $batchFiles = wfdownloads_getFiles($batchPath . '/'); if (!isset($batchFiles[$batchid]) || !is_file($batchPath . '/' . $batchFiles[$batchid])) { redirect_header($currentFile, 4, _AM_WFDOWNLOADS_ERROR_BATCHFILENOTFOUND); @@ -891,10 +895,10 @@ break; case 'batchfile.delete': - $batchid = WfdownloadsRequest::getInt('batchid', 0); - $ok = WfdownloadsRequest::getBool('ok', false, 'POST'); + $batchid = XoopsRequest::getInt('batchid', 0); + $ok = XoopsRequest::getBool('ok', false, 'POST'); - $batchPath = $wfdownloads->getConfig('batchdir'); + $batchPath = $wfdownloads->getConfig('batchdir'); $batchFiles = wfdownloads_getFiles($batchPath); if (!isset($batchFiles[$batchid]) || !is_file($batchPath . '/' . $batchFiles[$batchid])) { @@ ... [truncated message content] |
From: <luc...@us...> - 2015-02-03 22:20:50
|
Revision: 12964 http://sourceforge.net/p/xoops/svn/12964 Author: luciorota Date: 2015-02-03 22:20:34 +0000 (Tue, 03 Feb 2015) Log Message: ----------- xoops 2.5.7.1 compatible change directory structure code cleanup fixed bug when using XoopsFormSelectUser form element Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mimetype.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/index.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/mirror.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/ratefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/review.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_header.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_reviews.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/topten.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Added Paths: ----------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/directorychecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/filechecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/session.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/tree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/xoopstree.php Removed Paths: ------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/session.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/tree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/xoopstree.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/directorychecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/filechecker.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_breadcrumb.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_letterschoice.tpl Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/categories.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -49,7 +49,7 @@ wfdownloads_xoops_cp_header(); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $sform = new XoopsThemeForm(_AM_WFDOWNLOADS_CCATEGORY_MOVE, 'move', xoops_getenv('PHP_SELF')); $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); @@ -99,7 +99,7 @@ include_once XOOPS_ROOT_PATH . '/class/uploader.php'; $allowedMimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'); - $imgurl = 'blank.png'; + $imgUrl = 'blank.png'; $maxFileSize = $wfdownloads->getConfig('maxfilesize'); $maxImgWidth = $wfdownloads->getConfig('maximgwidth'); $maxImgHeight = $wfdownloads->getConfig('maximgheight'); @@ -112,17 +112,17 @@ $errors = $uploader->getErrors(); redirect_header('javascript:history.go(-1)', 3, $errors); } else { - $imgurl = $uploader->getSavedFileName(); + $imgUrl = $uploader->getSavedFileName(); } } else { - $imgurl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts->addslashes($_POST['imgurl']) : ''; + $imgUrl = (isset($_POST['imgurl']) && $_POST['imgurl'] != 'blank.png') ? $myts->addslashes($_POST['imgurl']) : ''; } if (!$cid) { $categoryObj = $wfdownloads->getHandler('category')->create(); } else { $categoryObj = $wfdownloads->getHandler('category')->get($cid); - $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj); + $childcats = $wfdownloads->getHandler('category')->getChildCats($categoryObj); if ($pid == $cid || in_array($pid, array_keys($childcats))) { $categoryObj->setErrors(_AM_WFDOWNLOADS_CCATEGORY_CHILDASPARENT); } @@ -131,7 +131,7 @@ $categoryObj->setVar('title', $_POST['title']); $categoryObj->setVar('pid', $pid); $categoryObj->setVar('weight', $weight); - $categoryObj->setVar('imgurl', $imgurl); + $categoryObj->setVar('imgurl', $imgUrl); $categoryObj->setVar('description', $_POST['description']); $categoryObj->setVar('summary', $_POST['summary']); $categoryObj->setVar('dohtml', isset($_POST['dohtml'])); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/clone.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -78,7 +78,7 @@ wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $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', 18, 18, ''); $cloneDirname_text->setDescription(_AM_WFDOWNLOADS_CLONE_NAME_DSC); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -609,6 +609,8 @@ case 'downloads.list': case 'downloads.filter': default : + xoops_load('XoopsPageNav'); + // // get filter conditions $filter_title_condition = XoopsRequest::getString('filter_title_condition', '='); $filter_title = XoopsRequest::getString('filter_title', ''); @@ -623,22 +625,17 @@ $op = 'downloads.list'; } } - - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; - - $categoryObjs = $wfdownloads->getHandler('category')->getObjects(); - + // $start_published = XoopsRequest::getInt('start_published', 0); $start_new = XoopsRequest::getInt('start_new', 0); $start_autopublished = XoopsRequest::getInt('start_autopublished', 0); $start_expired = XoopsRequest::getInt('start_expired', 0); $start_offline = XoopsRequest::getInt('start_offline', 0); - + // $totalCategoriesCount = wfdownloads_categoriesCount(); - $categoryObjs = $wfdownloads->getHandler('category')->getObjects(null, true, false); - + $categories = $wfdownloads->getHandler('category')->getObjects(null, true, false); // as array $totalDownloadsCount = $wfdownloads->getHandler('download')->getCount(); - + // wfdownloads_xoops_cp_header(); $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation($currentFile); @@ -691,7 +688,7 @@ foreach ($publishedDownloadObjs as $publishedDownloadObj) { $publishedDownload_array = $publishedDownloadObj->toArray(); $publishedDownload_array['title_html'] = $myts->htmlSpecialChars(trim($publishedDownload_array['title'])); - $publishedDownload_array['category_title'] = $categoryObjs[$publishedDownload_array['cid']]['title']; + $publishedDownload_array['category_title'] = $categories[$publishedDownload_array['cid']]['title']; $publishedDownload_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($publishedDownload_array['submitter']); $publishedDownload_array['published_formatted'] = XoopsLocal::formatTimestamp($publishedDownload_array['published'], 'l'); $GLOBALS['xoopsTpl']->append('published_downloads', $publishedDownload_array); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/import.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -137,7 +137,7 @@ echo "</fieldset>\n"; //ask what to do - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $form = new XoopsThemeForm(_AM_WFDOWNLOADS_IMPORT_BUTTON_IMPORT, 'form', $_SERVER['REQUEST_URI']); // Avoid module to import form itself Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/index.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -24,8 +24,8 @@ define('INDEX_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/index.html'); define('BLANK_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/blank.gif'); -include_once dirname(__DIR__) . '/include/directorychecker.php'; -include_once dirname(__DIR__) . '/include/filechecker.php'; +include_once dirname(__DIR__) . '/class/common/directorychecker.php'; +include_once dirname(__DIR__) . '/class/common/filechecker.php'; xoops_cp_header(); $indexAdmin = new ModuleAdmin(); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/indexpage.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -76,7 +76,7 @@ case "indexpage.form": default: include_once WFDOWNLOADS_ROOT_PATH . '/class/wfdownloads_lists.php'; - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $sql = "SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign"; $sql .= " FROM {$GLOBALS['xoopsDB']->prefix('wfdownloads_indexpage')} "; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mimetypes.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -207,7 +207,7 @@ $GLOBALS['xoopsTpl']->append('mimetypes', $mimetype_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav = new XoopsPageNav($mimetypes_count, 20, $start, 'start'); $GLOBALS['xoopsTpl']->assign('mimetypes_pagenav', $pagenav->renderNav()); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/mirrors.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -155,7 +155,7 @@ $GLOBALS['xoopsTpl']->append('mirrors_waiting', $mirror_waiting_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_waiting = new XoopsPageNav($waiting_count, $wfdownloads->getConfig('admin_perpage'), $start_waiting, 'start_waiting'); $GLOBALS['xoopsTpl']->assign('mirrors_waiting_pagenav', $pagenav_waiting->renderNav()); } @@ -179,7 +179,7 @@ $GLOBALS['xoopsTpl']->append('mirrors_published', $mirror_published_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_published = new XoopsPageNav($published_count, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published'); $GLOBALS['xoopsTpl']->assign('mirrors_published_pagenav', $pagenav_published->renderNav()); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/ratings.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -74,7 +74,7 @@ } } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $ratings_pagenav = new XoopsPageNav($ratings_count, $wfdownloads->getConfig('admin_perpage'), $start, 'start'); $GLOBALS['xoopsTpl']->assign('ratings_pagenav', $ratings_pagenav->renderNav()); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -401,7 +401,7 @@ $GLOBALS['xoopsTpl']->append('reports', $report_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_report = new XoopsPageNav($reports_count, $wfdownloads->getConfig('admin_perpage'), $start_report, 'start_report'); $GLOBALS['xoopsTpl']->assign('reports_pagenav', $pagenav_report->renderNav()); } @@ -428,7 +428,7 @@ $GLOBALS['xoopsTpl']->append('modifications', $modification_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_modification = new XoopsPageNav( $modifications_count, $wfdownloads->getConfig( 'admin_perpage' Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reviews.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -161,7 +161,7 @@ $GLOBALS['xoopsTpl']->append('reviews_waiting', $review_waiting_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_waiting = new XoopsPageNav($waiting_count, $wfdownloads->getConfig('admin_perpage'), $start_waiting, 'start_waiting'); $GLOBALS['xoopsTpl']->assign('reviews_waiting_pagenav', $pagenav_waiting->renderNav()); } @@ -191,7 +191,7 @@ $GLOBALS['xoopsTpl']->append('reviews_published', $review_published_array); } //Include page navigation - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + xoops_load('XoopsPageNav'); $pagenav_published = new XoopsPageNav($published_count, $wfdownloads->getConfig('admin_perpage'), $start_published, 'start_published'); $GLOBALS['xoopsTpl']->assign('reviews_published_pagenav', $pagenav_published->renderNav()); } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/swishe.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -48,7 +48,7 @@ echo "OK"; } else { echo "NOT OK" . "<br />"; - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $form = new XoopsThemeForm(_AM_WFDOWNLOADS_SWISHE_CONFIG, 'config', $currentFile, 'post', true); $form->addElement(new XoopsFormHidden('op', 'submit')); $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit')); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -48,7 +48,7 @@ } // Breadcrumb -include_once XOOPS_ROOT_PATH . '/class/tree.php'; +xoops_load('XoopsObjectTree'); $categoryObjsTree = new XoopsObjectTree($wfdownloads->getHandler('category')->getObjects(), 'cid', 'pid'); $breadcrumb = new WfdownloadsBreadcrumb(); $breadcrumb->addLink($wfdownloads->getModule()->getVar('name'), WFDOWNLOADS_URL); @@ -139,7 +139,7 @@ $xoopsTpl->assign('wfdownloads_breadcrumb', $breadcrumb->render()); // Generate form - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); $sform = new XoopsThemeForm(_MD_WFDOWNLOADS_RATETHISFILE, 'reportform', xoops_getenv('PHP_SELF')); $sform->addElement(new XoopsFormHidden('lid', $lid)); $sform->addElement(new XoopsFormHidden('cid', $cid)); Deleted: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/breadcrumb.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -1,79 +0,0 @@ -<?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. - */ -/** - * WfdownloadsBreadcrumb Class - * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @author lucio <luc...@gm...> - * @package Wfdownloads - * @since 3.23 - * @version $Id:$ - * - * Example: - * $breadcrumb = new WfdownloadsBreadcrumb(); - * $breadcrumb->addLink( 'bread 1', 'index1.php' ); - * $breadcrumb->addLink( 'bread 2', '' ); - * $breadcrumb->addLink( 'bread 3', 'index3.php' ); - * echo $breadcrumb->render(); - */ -defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); - -/** - * Class WfdownloadsBreadcrumb - */ -class WfdownloadsBreadcrumb -{ - var $dirname; - var $_bread = array(); - - /** - * - */ - function __construct() - { - $this->dirname = basename(dirname(__DIR__)); - } - - /** - * Add link to breadcrumb - * - * @param string $title - * @param string $link - */ - function addLink( $title='', $link='' ) - { - $this->_bread[] = array( - 'link' => $link, - 'title' => $title - ); - } - - /** - * Render Wfdownloads BreadCrumb - * - */ - function render() - { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { - include_once $GLOBALS['xoops']->path('/class/theme.php'); - $GLOBALS['xoTheme'] = new xos_opal_Theme(); - } - - require_once $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new XoopsTpl(); - $breadcrumbTpl->assign('breadcrumb', $this->_bread); - $html = $breadcrumbTpl->fetch("db:{$this->dirname}_co_breadcrumb.tpl"); - unset($breadcrumbTpl); - - return $html; - } -} Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php 2015-02-03 22:11:05 UTC (rev 12963) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/category.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -85,7 +85,7 @@ } $title = $this->isNew() ? _AM_WFDOWNLOADS_CCATEGORY_CREATENEW : _AM_WFDOWNLOADS_CCATEGORY_MODIFY; - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + xoops_load('XoopsFormLoader'); include_once WFDOWNLOADS_ROOT_PATH . '/class/wfdownloads_lists.php'; $form = new XoopsThemeForm($title, 'form_error', $action, 'post', true); @@ -111,18 +111,18 @@ $groups_up_select->setDescription(_AM_WFDOWNLOADS_FCATEGORY_GROUPPROMPT_UP_DESC); $form->addElement($groups_up_select); // category: imgurl - $imgurl_path = $this->getVar('imgurl') ? $this->wfdownloads->getConfig('catimage') . '/' . $this->getVar('imgurl') : WFDOWNLOADS_IMAGES_URL . '/blank.gif'; - $imgurl_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FCATEGORY_CIMAGE, '<br />'); - $imgurl_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('catimage'))); - $imgurl_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADURL, XOOPS_URL . '/' . $this->wfdownloads->getConfig('catimage'))); + $imgUrl_path = $this->getVar('imgurl') ? $this->wfdownloads->getConfig('catimage') . '/' . $this->getVar('imgurl') : WFDOWNLOADS_IMAGES_URL . '/blank.gif'; + $imgUrl_tray = new XoopsFormElementTray(_AM_WFDOWNLOADS_FCATEGORY_CIMAGE, '<br />'); + $imgUrl_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADPATH, XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('catimage'))); + $imgUrl_tray->addElement(new XoopsFormLabel(_AM_WFDOWNLOADS_DOWN_FUPLOADURL, XOOPS_URL . '/' . $this->wfdownloads->getConfig('catimage'))); $graph_array = WfsLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $this->wfdownloads->getConfig('catimage'), 'images'); - $imgurl_select = new XoopsFormSelect('', 'imgurl', $this->getVar('imgurl')); - $imgurl_select->addOptionArray($graph_array); - $imgurl_select->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $this->wfdownloads->getConfig('catimage') . "\", \"\", \"" . XOOPS_URL . "\")'"); - $imgurl_tray->addElement($imgurl_select, false); - $imgurl_tray->addElement(new XoopsFormLabel( '', "<img src='" . XOOPS_URL . "/" . $imgurl_path . "' name='image' id='image' alt='' />")); - $imgurl_tray->addElement(new XoopsFormFile(_AM_WFDOWNLOADS_BUPLOAD , 'uploadfile', 0), false); - $form->addElement($imgurl_tray); + $imgUrl_select = new XoopsFormSelect('', 'imgurl', $this->getVar('imgurl')); + $imgUrl_select->addOptionArray($graph_array); + $imgUrl_select->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $this->wfdownloads->getConfig('catimage') . "\", \"\", \"" . XOOPS_URL . "\")'"); + $imgUrl_tray->addElement($imgUrl_select, false); + $imgUrl_tray->addElement(new XoopsFormLabel( '', "<img src='" . XOOPS_URL . "/" . $imgUrl_path . "' name='image' id='image' alt='' />")); + $imgUrl_tray->addElement(new XoopsFormFile(_AM_WFDOWNLOADS_BUPLOAD , 'uploadfile', 0), false); + $form->addElement($imgUrl_tray); // category: description $description_textarea = new XoopsFormDhtmlTextArea(_AM_WFDOWNLOADS_FCATEGORY_DESCRIPTION, 'description', $this->getVar('description', 'e'), 15, 60); $description_textarea->setDescription(_AM_WFDOWNLOADS_FCATEGORY_DESCRIPTION_DESC); @@ -227,7 +227,7 @@ */ function getNicePath($cid, $root_filename = 'index.php', $item_filename = 'viewcat.php?op=') { - include_once WFDOWNLOADS_ROOT_PATH . '/class/xoopstree.php'; + //include_once WFDOWNLOADS_ROOT_PATH . '/class/common/xoopstree.php'; $mytree = new WfdownloadsXoopsTree($this->table, $this->keyName, 'pid'); $pathString = $mytree->getNicePathFromId($cid, $this->identifierName, $item_filename); @@ -299,10 +299,10 @@ */ function getChildCats($category) { + xoops_load('XoopsObjectTree'); + // $categoryObjs = $this->getObjects(); - include_once XOOPS_ROOT_PATH . '/class/tree.php'; $categoryObjsTree = new XoopsObjectTree($categoryObjs, $this->keyName, 'pid'); - return $categoryObjsTree->getAllChild($category->getVar($this->keyName)); } @@ -311,11 +311,12 @@ */ function getAllSubcatsTopParentCid() { + xoops_load('XoopsObjectTree'); + // if (!$this->allCategories) { $this->allCategories = $this->getObjects(null, true); } - include_once XOOPS_ROOT_PATH . '/class/tree.php'; $categoryObjsTree = new XoopsObjectTree($this->allCategories, $this->keyName, 'pid'); $allsubcats_linked_totop = array(); Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,86 @@ +<?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. + */ +/** + * WfdownloadsBreadcrumb Class + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author lucio <luc...@gm...> + * @package wfdownloads + * @since 3.23 + * @version $Id:$ + * + * Example: + * $breadcrumb = new WfdownloadsBreadcrumb(); + * $breadcrumb->addLink( 'bread 1', 'index1.php' ); + * $breadcrumb->addLink( 'bread 2', '' ); + * $breadcrumb->addLink( 'bread 3', 'index3.php' ); + * echo $breadcrumb->render(); + */ +defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +/** + * Class WfdownloadsBreadcrumb + */ +class WfdownloadsBreadcrumb +{ + private $dirname; + private $_bread = array(); + + /** + * + */ + public function __construct() + { + $this->dirname = basename(dirname(dirname(__DIR__))); + } + + /** + * Add link to breadcrumb + * + * @param string $title + * @param string $link + */ + public function addLink( $title='', $link='' ) + { + $this->_bread[] = array( + 'link' => $link, + 'title' => $title + ); + } + + /** + * Render Wfdownloads BreadCrumb + * + */ + public function render() + { + $ret = ''; + + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + include_once $GLOBALS['xoops']->path('/class/theme.php'); + $GLOBALS['xoTheme'] = new xos_opal_Theme(); + } + require_once $GLOBALS['xoops']->path('/class/template.php'); + $breadcrumbTpl = new XoopsTpl(); + $breadcrumbTpl->assign('breadcrumb', $this->_bread); +// IN PROGRESS +// IN PROGRESS +// IN PROGRESS + //$ret .= $breadcrumbTpl->fetch(__DIR__ . '_breadcrumb.tpl'); + $tplSource = file_get_contents(__DIR__ . '/breadcrumb.tpl'); +// $ret .= $choiceByLetterTpl->fetchFromData($tplSource, false, null); + $ret .= $breadcrumbTpl->fetchFromData($tplSource, false, null); + unset($breadcrumbTpl); + + return $ret; + } +} Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,16 @@ +<div class="wfdownloads_headertable"> + <div class="wfdownloads_breadcrumb"> + <{foreach item=bread from=$breadcrumb name=bcloop}> + <span class="bread"> + <{if ($bread.link)}> + <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a> + <{else}> + <{$bread.title}> + <{/if}> + </span> + <{if !$smarty.foreach.bcloop.last}> + <span class="delimiter">></span> + <{/if}> + <{/foreach}> + </div> +</div> Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,138 @@ +<?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. + */ +/** + * WfdownloadsChoiceByLetter class + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author lucio <luc...@gm...> + * @package wfdownloads + * @since 1.00 + * @version $Id:$ + * + * Example: + * $choicebyletter = new WfdownloadsChoiceByLetter($objHandler, null, null, range('a', 'z'), 'letter'); + * echo $choicebyletter->render(); + */ +defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +/** + * Class WfdownloadsChoiceByLetter + */ +class WfdownloadsChoiceByLetter +{ + /** + * *#@+ + * + * @access private + */ + private $objHandler; + private $criteria; + private $field_name; + private $alphabet; + private $arg_name; + private $url; + private $extra; + private $caseSensitive; + + /** + * *#@- + */ + + /** + * Constructor + * + * @param object $objHandler {@link XoopsPersistableObjectHandler} + * @param object $criteria {@link CriteriaElement} + * @param string $field_name search by field + * @param array $alphabet array of alphabet letters + * @param string $arg_name item on the current page + * @param string $url + * @param string $extra_arg Additional arguments to pass in the URL + * @param boolean $caseSensitive + */ + public function __construct($objHandler, $criteria = null, $field_name = null, $alphabet = array(), $arg_name = 'letter', $url = null, $extra_arg = '', $caseSensitive = false) + { + $this->objHandler = $objHandler; + $this->criteria = is_null($criteria) ? new CriteriaCompo() : $criteria; + $this->field_name = is_null($field_name) ? $this->objHandler->identifierName : $field_name; + $this->alphabet = (count($alphabet) > 0) ? $alphabet : range('a', 'z'); // is there a way to get locale alphabet? + $this->arg_name = $arg_name; + $this->url = is_null($url) ? $_SERVER['PHP_SELF'] : $url; + if ($extra_arg != '' && (substr($extra_arg, - 5) != '&' || substr($extra_arg, - 1) != '&')) { + $this->extra = '&' . $extra_arg; + } + $this->caseSensitive = $caseSensitive; + } + + /** + * Create choice by letter + * + * @return string + */ + public function render() + { + $ret = ''; + // + if (!$this->caseSensitive) { + $this->criteria->setGroupby('UPPER(LEFT(' . $this->field_name . ',1))'); + } else { + $this->criteria->setGroupby('LEFT(' . $this->field_name . ',1)'); + } + $countsByLetters = $this->objHandler->getCounts($this->criteria); + // fill alphabet array + $alphabet_array = array(); + foreach ($this->alphabet as $letter) { + $letter_array = array(); + if (!$this->caseSensitive) { + if (isset($countsByLetters[strtoupper($letter)])) { + $letter_array['letter'] = $letter; + $letter_array['count'] = $countsByLetters[strtoupper($letter)]; + $letter_array['url'] = $this->url . '?' . $this->arg_name . '=' . $letter . $this->extra; + } else { + $letter_array['letter'] = $letter; + $letter_array['count'] = 0; + $letter_array['url'] = ""; + } + } else { + if (isset($countsByLetters[$letter])) { + $letter_array['letter'] = $letter; + $letter_array['count'] = $countsByLetters[$letter]; + $letter_array['url'] = $this->url . '?' . $this->arg_name . '=' . $letter . $this->extra; + } else { + $letter_array['letter'] = $letter; + $letter_array['count'] = 0; + $letter_array['url'] = ""; + } + } + $alphabet_array[$letter] = $letter_array; + unset($letter_array); + } + // render output + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + include_once $GLOBALS['xoops']->path('/class/theme.php'); + $GLOBALS['xoTheme'] = new xos_opal_Theme(); + } + require_once $GLOBALS['xoops']->path('/class/template.php'); + $choiceByLetterTpl = new XoopsTpl(); + $choiceByLetterTpl->caching = false; // Disable cache + $choiceByLetterTpl->assign('alphabet', $alphabet_array); +// IN PROGRESS +// IN PROGRESS +// IN PROGRESS + //$ret .= $choiceByLetterTpl->fetch(__DIR__ . '/choicebyletter.tpl'); + $tplSource = file_get_contents(__DIR__ . '/choicebyletter.tpl'); + $ret .= $choiceByLetterTpl->fetchFromData($tplSource, false, null); + unset($choiceByLetterTpl); + + return $ret; + } +} Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,96 @@ +<style type="text/css"> + .button_green { + -moz-box-shadow: inset 0 1px 0 0 #d9fbbe; + -webkit-box-shadow: inset 0 1px 0 0 #d9fbbe; + box-shadow: inset 0 1px 0 0 #d9fbbe; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #d9fbbe), color-stop(1, #d9fbbe)); + background: -moz-linear-gradient(center top, #a5cc52 5%, #d9fbbe 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9fbbe', endColorstr='#b8e356'); + background-color: #d9fbbe; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + text-indent: 0; + border: 1px solid #83c41a; + display: inline-block; + color: inherit; + font-family: inherit; + font-size: 12px; + font-weight: bold; + font-style: normal; + height: 20px; + line-height: 20px; + width: auto; + min-width: 10px; + text-decoration: none; + text-align: center; + text-shadow: 1px 1px 0 #d9fbbe; + margin: 2px 0; + padding: 0 4px; + } + + .button_green:hover { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #b8e356), color-stop(1, #a5cc52)); + background: -moz-linear-gradient(center top, #b8e356 5%, #a5cc52 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8e356', endColorstr='#a5cc52'); + background-color: #86ae47; + } + + .button_green:active { + position: relative; + top: 1px; + } + + .button_grey { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf)); + background: -moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + background-color: #ededed; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + text-indent: 0; + border: 1px solid #dcdcdc; + display: inline-block; + color: inherit; + font-family: inherit; + font-size: 12px; + font-weight: bold; + font-style: normal; + height: 20px; + line-height: 20px; + width: auto; + min-width: 10px; + text-decoration: none; + text-align: center; + text-shadow: 1px 1px 0 #ffffff; + margin: 2px 0; + padding: 0 4px; + } + + .button_grey:hover { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed)); + background: -moz-linear-gradient(center top, #dfdfdf 5%, #ededed 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); + background-color: #dfdfdf; + } + + .button_grey:active { + position: relative; + top: 1px; + } +</style> +<br/> +<div> + <{assign var="alphabetcount" value=$alphabet|@count}> + <{foreach name=letters item=letter from=$alphabet}> + <{if ($letter.count > 0)}> + <a class='button_green' href='<{$letter.url}>' title='<{$letter.count}>'><{$letter.letter}></a> + <{else}> + <span class='button_grey'><{$letter.letter}></span> + <{/if}> + <{if ($smarty.foreach.letters.iteration == (round($alphabetcount/2))+1)}> +</div> +<div><{else}><{/if}> + <{/foreach}> +</div> Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/directorychecker.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/directorychecker.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/directorychecker.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,155 @@ +<?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$ + */ + +//defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/include/cp_header.php'; +$mydirname = basename(dirname(dirname(__DIR__))); +xoops_loadLanguage('directorychecker', $mydirname); + +/** + * Class DirectoryChecker + * check status of a directory + */ +class DirectoryChecker +{ + /** + * @param $path + * @param int $mode + * @param $redirectFile + * + * @return bool|string + */ + public static function getDirectoryStatus($path, $mode = 0777, $redirectFile = null) + { + global $pathIcon16; + + if (empty($path)) { + return false; + } + if (is_null($redirectFile)) { + $redirectFile = $_SERVER['PHP_SELF']; + } + if (!@is_dir($path)) { + $path_status = "<img src='$pathIcon16/0.png' >"; + $path_status .= "$path (" . _DC_WFDOWNLOADS_NOTAVAILABLE . ") "; + $path_status .= "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>"; + $path_status .= "<input type='hidden' name='op' value='createdir'>"; + $path_status .= "<input type='hidden' name='path' value='$path'>"; + $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>"; + $path_status .= "<button class='submit' onClick='this.form.submit();'>" . _DC_WFDOWNLOADS_CREATETHEDIR . "</button>"; + $path_status .= "</form>"; + } elseif (@is_writable($path)) { + $path_status = "<img src='$pathIcon16/1.png' >"; + $path_status .= "$path (" . _DC_WFDOWNLOADS_AVAILABLE . ") "; + $currentMode = (substr(decoct(fileperms($path)), 2)); + if ($currentMode != decoct($mode)) { + $path_status = "<img src='$pathIcon16/0.png' >"; + $path_status .= $path . sprintf(_DC_WFDOWNLOADS_NOTWRITABLE, decoct($mode), $currentMode); + $path_status .= "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>"; + $path_status .= "<input type='hidden' name='op' value='setdirperm'>"; + $path_status .= "<input type='hidden' name='mode' value='$mode'>"; + $path_status .= "<input type='hidden' name='path' value='$path'>"; + $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>"; + $path_status .= "<button class='submit' onClick='this.form.submit();'>" . _DC_WFDOWNLOADS_SETMPERM . "</button>"; + $path_status .= "</form>"; + } + } else { + $currentMode = (substr(decoct(fileperms($path)), 2)); + $path_status = "<img src='$pathIcon16/0.png' >"; + $path_status .= $path . sprintf(_DC_WFDOWNLOADS_NOTWRITABLE, decoct($mode), $currentMode); + $path_status .= "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>"; + $path_status .= "<input type='hidden' name='op' value='setdirperm'>"; + $path_status .= "<input type='hidden' name='mode' value='$mode'>"; + $path_status .= "<input type='hidden' name='path' value='$path'>"; + $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>"; + $path_status .= "<button class='submit' onClick='this.form.submit();'>" . _DC_WFDOWNLOADS_SETMPERM . "</button>"; + $path_status .= "</form>"; + } + + return $path_status; + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function createDirectory($target, $mode = 0777) + { + $target = str_replace('..', '', $target); + // http://www.php.net/manual/en/function.mkdir.php + return is_dir($target) || (self::createDirectory(dirname($target), $mode) && mkdir($target, $mode)); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setDirectoryPermissions($target, $mode = 0777) + { + $target = str_replace('..', '', $target); + + return @chmod($target, (int) $mode); + } + + /** + * @param $dir_path + * + * @return bool + */ + public static function dirExists($dir_path) + { + return is_dir($dir_path); + } +} + +$op = (isset($_POST['op'])) ? $_POST['op'] : ""; +switch ($op) { + case 'createdir': + if (isset($_POST['path'])) { + $path = $_POST['path']; + } + if (isset($_POST['redirect'])) { + $redirect = $_POST['redirect']; + } + $msg = (DirectoryChecker::createDirectory($path)) ? _DC_WFDOWNLOADS_DIRCREATED : _DC_WFDOWNLOADS_DIRNOTCREATED; + redirect_header($redirect, 2, $msg . ': ' . $path); + exit(); + break; + case 'setdirperm': + if (isset($_POST['path'])) { + $path = $_POST['path']; + } + if (isset($_POST['redirect'])) { + $redirect = $_POST['redirect']; + } + if (isset($_POST['mode'])) { + $mode = $_POST['mode']; + } + $msg = (DirectoryChecker::setDirectoryPermissions($path, $mode)) ? _DC_WFDOWNLOADS_PERMSET : _DC_WFDOWNLOADS_PERMNOTSET; + redirect_header($redirect, 2, $msg . ': ' . $path); + exit(); + break; +} Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/filechecker.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/filechecker.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/filechecker.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,161 @@ +<?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$ + */ + +//defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/include/cp_header.php'; +$mydirname = basename(dirname(dirname(__DIR__))); +xoops_loadLanguage('filechecker', $mydirname); + +/** + * Class FileChecker + * check status of a directory + */ +class FileChecker +{ + /** + * @param $file_path + * @param null $original_file_path + * @param $redirectFile + * + * @internal param $path + * @internal param int $mode + * @return bool|string + */ + public static function getFileStatus($file_path, $original_file_path = null, $redirectFile) + { + global $pathIcon16; + + if (empty($file_path)) { + return false; + } + if (is_null($redirectFile)) { + $redirectFile = $_SERVER['PHP_SELF']; + } + if (is_null($original_file_path)) { + if (self::fileExists($file_path)) { + $path_status = "<img src='$pathIcon16/1.png' >"; + $path_status .= "$file_path (" . _FC_WFDOWNLOADS_AVAILABLE . ") "; + } else { + $path_status = "<img src='$pathIcon16/0.png' >"; + $path_status .= "$file_path (" . _FC_WFDOWNLOADS_NOTAVAILABLE . ") "; + } + } else { + if (self::compareFiles($file_path, $original_file_path)) { + $path_status = "<img src='$pathIcon16/1.png' >"; + $path_status .= "$file_path (" . _FC_WFDOWNLOADS_AVAILABLE . ") "; + } else { + $path_status = "<img src='$pathIcon16/0.png' >"; + $path_status .= "$file_path (" . _FC_WFDOWNLOADS_NOTAVAILABLE . ") "; + $path_status .= "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'>"; + $path_status .= "<input type='hidden' name='op' value='copyfile'>"; + $path_status .= "<input type='hidden' name='file_path' value='$file_path'>"; + $path_status .= "<input type='hidden' name='original_file_path' value='$original_file_path'>"; + $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>"; + $path_status .= "<button class='submit' onClick='this.form.submit();'>" . _FC_WFDOWNLOADS_CREATETHEFILE . "</button>"; + $path_status .= "</form>"; + } + } + + return $path_status; + } + + /** + * @param $source_path + * @param $destination_path + * + * @return bool + */ + public static function copyFile($source_path, $destination_path) + { + $source_path = str_replace('..', '', $source_path); + $destination_path = str_replace('..', '', $destination_path); + + return @copy($source_path, $destination_path); + } + + /** + * @param $file1_path + * @param $file2_path + * + * @return bool + */ + public static function compareFiles($file1_path, $file2_path) + { + if (!self::fileExists($file1_path) || !self::fileExists($file2_path)) { + return false; + } + if (filetype($file1_path) !== filetype($file2_path)) { + return false; + } + if (filesize($file1_path) !== filesize($file2_path)) { + return false; + } + $crc1 = strtoupper(dechex(crc32(file_get_contents($file1_path)))); + $crc2 = strtoupper(dechex(crc32(file_get_contents($file2_path)))); + if ($crc1 !== $crc2) { + return false; + } + + return true; + } + + /** + * @param $file_path + * + * @return bool + */ + public static function fileExists($file_path) + { + return is_file($file_path); + } + + /** + * @param $target + * @param int $mode + * + * @return bool + */ + public static function setFilePermissions($target, $mode = 0777) + { + $target = str_replace('..', '', $target); + + return @chmod($target, (int) $mode); + } +} + +$op = (isset($_POST['op'])) ? $_POST['op'] : ""; +switch ($op) { + case 'copyfile': + if (isset($_POST['original_file_path'])) { + $original_file_path = $_POST['original_file_path']; + } + if (isset($_POST['file_path'])) { + $file_path = $_POST['file_path']; + } + if (isset($_POST['redirect'])) { + $redirect = $_POST['redirect']; + } + $msg = (FileChecker::copyFile($original_file_path, $file_path)) ? _FC_WFDOWNLOADS_FILECOPIED : _FC_WFDOWNLOADS_FILENOTCOPIED; + redirect_header($redirect, 2, $msg . ': ' . $file_path); + exit(); + break; +} Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/session.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/session.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/session.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,110 @@ +<?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. + */ +/** + * WfdownloadsSession class + * + * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package Wfdownloads + * @since 3.23 + * @author trabis <lus...@gm...> + * @author Harry Fuecks (PHP Anthology Volume II) + * @version $Id: session.php 10283 2012-11-28 13:39:36Z trabis $ + */ +defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +include_once dirname(dirname(__DIR__)) . '/include/common.php'; + +/** + * Class WfdownloadsSession + */ +class WfdownloadsSession +{ + /** + * Session constructor<br /> + * Starts the session with session_start() + * <strong>Note:</strong> that if the session has already started, + * session_start() does nothing + */ + protected function __construct() + { + @session_start(); + } + + /** + * Sets a session variable + * + * @param string $name name of variable + * @param mixed $value value of variable + * + * @return void + * @access public + */ + public function set($name, $value) + { + $_SESSION[$name] = $value; + } + + /** + * Fetches a session variable + * + * @param string $name name of variable + * + * @return mixed value of session variable + * @access public + */ + public function get($name) + { + if (isset($_SESSION[$name])) { + return $_SESSION[$name]; + } else { + return false; + } + } + + /** + * Deletes a session variable + * + * @param string $name name of variable + * + * @return void + * @access public + */ + public function del($name) + { + unset($_SESSION[$name]); + } + + /** + * Destroys the whole session + * + * @return void + * @access public + */ + public function destroy() + { + $_SESSION = array(); + session_destroy(); + } + + /** + * @return WfdownloadsSession + */ + public static function &getInstance() + { + static $_sess; + if (!isset($_sess)) { + $_sess = new WfdownloadsSession(); + } + + return $_sess; + } +} Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/tree.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/tree.php (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/tree.php 2015-02-03 22:20:34 UTC (rev 12964) @@ -0,0 +1,80 @@ +<?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. + */ +/** + * WfdownloadsObjectTree + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @author lucio <luc...@gm...> + * @package Wfdownloads + * @since 3.23 + * @version $Id:$ + */ + +defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +//xoops_load('XoopsObjectTree'); +include_once XOOPS_ROOT_PATH . '/class/tree.php'; + +/** + * Form element that ... + */ +class WfdownloadsObjectTree extends XoopsObjectTree +{ + /** + * Make options for a select box from + * + * @param string $fieldName Name of the member variable from the node objects that should be used as the title for the options. + * @param int $key ID of the object to display as the root of select options + * @param string $optionsArray (reference to a string when called from outside) Result from previous recursions + * @param string $prefix_orig String to indent items at deeper levels + * @param string $prefix_curr String to indent the cur... [truncated message content] |
From: <luc...@us...> - 2015-02-13 22:47:44
|
Revision: 12976 http://sourceforge.net/p/xoops/svn/12976 Author: luciorota Date: 2015-02-13 22:47:42 +0000 (Fri, 13 Feb 2015) Log Message: ----------- added: sort downloads by weight Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_downloadslist.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/downloads.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -346,6 +346,7 @@ $downloadObj->setVar('version', $version); $downloadObj->setVar('url', $url); $downloadObj->setVar('cid', $cid); + $downloadObj->setVar('weight', $_POST['weight']); $downloadObj->setVar('title', $title); $downloadObj->setVar('status', $status); $downloadObj->setVar('size', $size); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/admin/reportsmodifications.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -115,6 +115,7 @@ switch ($key) { case 'title': case 'url': + case 'weight': // NOP break; case 'size': Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -95,6 +95,7 @@ $this->initVar('doxcode', XOBJ_DTYPE_INT, true); // boolean $this->initVar('doimage', XOBJ_DTYPE_INT, true); // boolean $this->initVar('dobr', XOBJ_DTYPE_INT, true); // boolean + $this->initVar('weight', XOBJ_DTYPE_INT, 0); if (isset($id)) { $item = $this->wfdownloads->getHandler('item')->get($id); @@ -133,6 +134,8 @@ { xoops_load('XoopsUserUtility'); + $download = $this->toArray(); // as array + $download['id'] = $this->getVar('lid'); $download['cid'] = $this->getVar('cid'); @@ -456,14 +459,14 @@ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); // get max file size (setup and php.ini) $phpiniMaxFileSize = (min((int)(ini_get('upload_max_filesize')), (int)(ini_get('post_max_size')), (int)(ini_get('memory_limit')))) * 1024 * 1024; // bytes - $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); + $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); // get allowed mimetypes if (wfdownloads_userIsAdmin()) { - $criteria = new Criteria('mime_admin', true); + $mimetypeCriteria = new Criteria('mime_admin', true); } else { - $criteria = new Criteria('mime_user', true); + $mimetypeCriteria = new Criteria('mime_user', true); } - $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria); + $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($mimetypeCriteria); $allowedExtensions = implode(' | ', $mimetypes); $userfile_file->setDescription( sprintf( @@ -490,6 +493,8 @@ $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); $sform->addElement(new XoopsFormLabel(_MD_WFDOWNLOADS_CATEGORYC, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e')))); } + // download: weight + $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_WEIGHT, 'weight', 50, 255, $this->getVar('weight', 'e')), false); if (count($customArray) == 0) { // download: homepagetitle @@ -641,7 +646,6 @@ $sform->addElement(new XoopsFormFile(_MD_WFDOWNLOADS_DUPLOADSCRSHOT, 'screenshot4', 0), false); // IN PROGRESS } } - // download: notifypub $option_tray = new XoopsFormElementTray(_MD_WFDOWNLOADS_OPTIONS, '<br />'); $notify_checkbox = new XoopsFormCheckBox('', 'notifypub'); @@ -707,11 +711,7 @@ // download: submitter if (!$this->isNew()) { $userCount = $member_handler->getUserCount(); -// IN PROGRESS -// IN PROGRESS -// IN PROGRESS if ($userCount > 200) { - //$sform -> addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_SUBMITTERID, 'submitter', 10, 10, $this->getVar('submitter', 'e')), true); $submitter_select = new XoopsFormSelectUser ( _AM_WFDOWNLOADS_FILE_SUBMITTER, 'submitter', false, $this->getVar( 'submitter', @@ -742,10 +742,10 @@ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); // get max file size (setup and php.ini) $phpiniMaxFileSize = min((int)(ini_get('upload_max_filesize')), (int)(ini_get('post_max_size')), (int)(ini_get('memory_limit'))) * 1024 * 1024; // bytes - $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); + $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); // get allowed mimetypes - $criteria = new Criteria('mime_admin', true); - $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria); + $mimetypeCriteria = new Criteria('mime_admin', true); + $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($mimetypeCriteria); $allowedExtensions = implode(' | ', $mimetypes); $userfile_file->setDescription( sprintf( @@ -759,11 +759,13 @@ ); $sform->addElement($userfile_file, false); // download: cid - $categoryObjs = $this->wfdownloads->getHandler('category')->getObjects(); + $categoryObjs = $this->wfdownloads->getHandler('category')->getObjects(); $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); $sform->addElement( new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_CATEGORY, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))) ); + // download: weight + $sform->addElement(new XoopsFormText(_MD_WFDOWNLOADS_WEIGHT, 'weight', 50, 255, $this->getVar('weight', 'e')), false); // Formulize module support (2006/03/06, 2006/03/08) jpc - start if (count($customArray) == 0) { // download: homepagetitle @@ -1222,17 +1224,17 @@ * * @return array */ - public function getActiveDownloads($crit = null) + public function getActiveDownloads($criteria = null) { - if (is_object($crit)) { - $criteria = $crit; + if (is_object($criteria)) { + $downloadsCriteria = $criteria; } else { - $criteria = new CriteriaCompo(); + $downloadsCriteria = new CriteriaCompo(); } - $active_crit = $this->getActiveCriteria(); - $criteria->add($active_crit); + $activeDownloadsCriteria = $this->getActiveCriteria(); + $downloadsCriteria->add($activeDownloadsCriteria); - return $this->getObjects($criteria); + return $this->getObjects($downloadsCriteria); } /** @@ -1242,14 +1244,14 @@ * * @return array/int */ - public function getActiveCount($crit = null) + public function getActiveCount($criteria = null) { - $criteria = $this->getActiveCriteria(); - if (is_object($crit)) { - $criteria->add($crit); + $activeDownloadsCriteria = $this->getActiveCriteria(); + if (is_object($criteria)) { + $activeDownloadsCriteria->add($criteria); } - return $this->getCount($criteria); + return $this->getCount($activeDownloadsCriteria); } /** @@ -1272,24 +1274,24 @@ * * @return bool */ - public function delete($download, $force = false) + public function delete($downloadsObj, $force = false) { - if (parent::delete($download, $force)) { - $criteria = new Criteria('lid', (int)$download->getVar('lid')); - $this->wfdownloads->getHandler('rating')->deleteAll($criteria); - $this->wfdownloads->getHandler('mirror')->deleteAll($criteria); - $this->wfdownloads->getHandler('review')->deleteAll($criteria); - $this->wfdownloads->getHandler('report')->deleteAll($criteria); + if (parent::delete($downloadsObj, $force)) { + $downloadsCriteria = new Criteria('lid', (int)$download->getVar('lid')); + $this->wfdownloads->getHandler('rating')->deleteAll($downloadsCriteria); + $this->wfdownloads->getHandler('mirror')->deleteAll($downloadsCriteria); + $this->wfdownloads->getHandler('review')->deleteAll($downloadsCriteria); + $this->wfdownloads->getHandler('report')->deleteAll($downloadsCriteria); // delete comments - xoops_comment_delete((int)$this->wfdownloads->getModule()->mid(), (int)$download->getVar('lid')); + xoops_comment_delete((int)$this->wfdownloads->getModule()->mid(), (int)$downloadsObj->getVar('lid')); // Formulize module support (2006/05/04) jpc - start if (wfdownloads_checkModule('formulize')) { - if (file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php') && $download->getVar('formulize_idreq') > 0) { + if (file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php') && $downloadsObj->getVar('formulize_idreq') > 0) { include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; //deleteFormEntries(array($download->getVar('formulize_idreq'))); - $category = $this->wfdownloads->getHandler('category')->get($download->getVar('cid')); - deleteFormEntries(array($download->getVar('formulize_idreq')), $category->getVar('formulize_fid')); + $categoryObj = $this->wfdownloads->getHandler('category')->get($downloadsObj->getVar('cid')); + deleteFormEntries(array($downloadsObj->getVar('formulize_idreq')), $categoryObj->getVar('formulize_fid')); } } // Formulize module support (2006/05/04) jpc - end Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/modification.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -87,6 +87,7 @@ $this->initVar('doxcode', XOBJ_DTYPE_INT, true); // boolean $this->initVar('doimage', XOBJ_DTYPE_INT, true); // boolean $this->initVar('dobr', XOBJ_DTYPE_INT, true); // boolean + $this->initVar('weight', XOBJ_DTYPE_INT, 0); //Obsolete unset($this->vars['ipaddress']); @@ -163,7 +164,8 @@ d.dosmiley = m.dosmiley, d.doxcode = m.doxcode, d.doimage = m.doimage, - d.dobr = m.dobr"; + d.dobr = m.dobr, + d.weight = m.weight"; $sql .= " WHERE d.lid = m.lid AND m.requestid='{$requestid}'"; if ($this->db->query($sql)) { return $this->deleteAll(new Criteria('requestid', (int)$requestid)); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/docs/changelog.txt 2015-02-13 22:47:42 UTC (rev 12976) @@ -1,4 +1,4 @@ -<b><u>=> Version 3.23 RC5 (2015-02-02)</u></b> +<b><u>=> Version 3.23 RC5 (2015-02-13)</u></b> - fixed: use DateTime object instead of strtotime function (luciorota) - fixed: source code for HTML5/CSS3 (mamba) - fixed: jQuery bug in templates (luciorota) @@ -14,6 +14,7 @@ - fixed: deprecated XoopsTree (mamba) - fixed: English translations (mamba) - fixed: small changes based on testing tool feedback (mamba) +- added: sort downloads by weight (luciorota) - added: directories check (luciorota) - added: no size limit for uploads by Admin (mamba) - added: preview for images, audio, video, pdf files (luciorota) Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -30,11 +30,13 @@ xoops_loadLanguage('common', WFDOWNLOADS_DIRNAME); xoops_load('XoopsFormLoader'); -//include_once XOOPS_ROOT_PATH . '/class/tree.php'; xoops_load('XoopsObjectTree'); xoops_load('XoopsPageNav'); +xoops_load('XoopsUserUtility'); +xoops_load('XoopsLocal'); +xoops_load('XoopsRequest'); -include_once WFDOWNLOADS_ROOT_PATH . '/class/wfdownloads.php'; // WfdownloadsWfdownloads class +xoops_load('Wfdownloads', WFDOWNLOADS_DIRNAME); // WfdownloadsWfdownloads class include_once WFDOWNLOADS_ROOT_PATH . '/include/functions.php'; include_once WFDOWNLOADS_ROOT_PATH . '/include/constants.php'; include_once WFDOWNLOADS_ROOT_PATH . '/class/common/session.php'; // WfdownloadsSession class @@ -44,9 +46,6 @@ include_once WFDOWNLOADS_ROOT_PATH . '/class/common/xoopstree.php'; // WfdownloadsXoopsTree class include_once WFDOWNLOADS_ROOT_PATH . '/class/multicolumnsthemeform.php'; // WfdownloadsMulticolumnsThemeForm class -xoops_load('XoopsUserUtility'); -xoops_load('XoopsLocal'); -xoops_load('XoopsRequest'); // MyTextSanitizer object $myts = MyTextSanitizer::getInstance(); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/functions.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -781,139 +781,146 @@ return $icons; } -if (!function_exists('convertorderbyin')) { - // Reusable Link Sorting Functions - /** - * convertorderbyin() - * - * @param $orderby - * - * @return string - */ - function convertorderbyin($orderby) - { - switch (trim($orderby)) { - case 'titleA': - $orderby = 'title ASC'; - break; - case 'titleD': - $orderby = 'title DESC'; - break; - case 'dateA': - $orderby = 'published ASC'; - break; - case 'dateD': - $orderby = 'published DESC'; - break; - case 'hitsA': - $orderby = 'hits ASC'; - break; - case 'hitsD': - $orderby = 'hits DESC'; - break; - case 'ratingA': - $orderby = 'rating ASC'; - break; - case 'ratingD': - $orderby = 'rating DESC'; - break; - case 'sizeD': - $orderby = 'size DESC'; - break; - case 'sizeA': - $orderby = 'size ASC'; - break; - default: - $orderby = 'published DESC'; - break; - } +/** + * wfdownloads_convertorderbyin() + * + * @param $orderby + * + * @return string + */ +function wfdownloads_convertorderbyin($orderby) +{ + switch (trim($orderby)) { + case 'titleA': + $orderby = 'title ASC'; + break; + case 'titleD': + $orderby = 'title DESC'; + break; + case 'dateA': + $orderby = 'published ASC'; + break; + case 'dateD': + $orderby = 'published DESC'; + break; + case 'hitsA': + $orderby = 'hits ASC'; + break; + case 'hitsD': + $orderby = 'hits DESC'; + break; + case 'ratingA': + $orderby = 'rating ASC'; + break; + case 'ratingD': + $orderby = 'rating DESC'; + break; + case 'sizeD': + $orderby = 'size DESC'; + break; + case 'sizeA': + $orderby = 'size ASC'; + break; + case 'weightD': + $orderby = 'weight DESC'; + break; + case 'weightA': + $orderby = 'weight ASC'; + break; + default: + $orderby = 'published DESC'; + break; + } - return $orderby; - } + return $orderby; } -if (!function_exists('convertorderbytrans')) { - /** - * @param $orderby - * - * @return string - */ - function convertorderbytrans($orderby) - { - if ($orderby == 'title ASC') { - $orderbyTrans = _MD_WFDOWNLOADS_TITLEATOZ; - } - if ($orderby == 'title DESC') { - $orderbyTrans = _MD_WFDOWNLOADS_TITLEZTOA; - } - if ($orderby == 'published ASC') { - $orderbyTrans = _MD_WFDOWNLOADS_DATEOLD; - } - if ($orderby == 'published DESC') { - $orderbyTrans = _MD_WFDOWNLOADS_DATENEW; - } - if ($orderby == 'hits ASC') { - $orderbyTrans = _MD_WFDOWNLOADS_POPULARITYLTOM; - } - if ($orderby == 'hits DESC') { - $orderbyTrans = _MD_WFDOWNLOADS_POPULARITYMTOL; - } - if ($orderby == 'rating ASC') { - $orderbyTrans = _MD_WFDOWNLOADS_RATINGLTOH; - } - if ($orderby == 'rating DESC') { - $orderbyTrans = _MD_WFDOWNLOADS_RATINGHTOL; - } - if ($orderby == 'size ASC') { - $orderbyTrans = _MD_WFDOWNLOADS_SIZELTOH; - } - if ($orderby == 'size DESC') { - $orderbyTrans = _MD_WFDOWNLOADS_SIZEHTOL; - } - return $orderbyTrans; +/** + * @param $orderby + * + * @return string + */ +function wfdownloads_convertorderbytrans($orderby) +{ + if ($orderby == 'title ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_TITLEATOZ; } + if ($orderby == 'title DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_TITLEZTOA; + } + if ($orderby == 'published ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_DATEOLD; + } + if ($orderby == 'published DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_DATENEW; + } + if ($orderby == 'hits ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_POPULARITYLTOM; + } + if ($orderby == 'hits DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_POPULARITYMTOL; + } + if ($orderby == 'rating ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_RATINGLTOH; + } + if ($orderby == 'rating DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_RATINGHTOL; + } + if ($orderby == 'size ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_SIZELTOH; + } + if ($orderby == 'size DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_SIZEHTOL; + } + if ($orderby == 'weight ASC') { + $orderbyTrans = _MD_WFDOWNLOADS_WEIGHTLTOH; + } + if ($orderby == 'weight DESC') { + $orderbyTrans = _MD_WFDOWNLOADS_WEIGHTHTOL; + } + + return $orderbyTrans; } -if (!function_exists('convertorderbyout')) { - /** - * @param $orderby - * - * @return string - */ - function convertorderbyout($orderby) - { - if ($orderby == 'title ASC') { - $orderby = 'titleA'; - } - if ($orderby == 'title DESC') { - $orderby = 'titleD'; - } - if ($orderby == 'published ASC') { - $orderby = 'dateA'; - } - if ($orderby == 'published DESC') { - $orderby = 'dateD'; - } - if ($orderby == 'hits ASC') { - $orderby = 'hitsA'; - } - if ($orderby == 'hits DESC') { - $orderby = 'hitsD'; - } - if ($orderby == 'rating ASC') { - $orderby = 'ratingA'; - } - if ($orderby == 'rating DESC') { - $orderby = 'ratingD'; - } - if ($orderby == 'size ASC') { - $orderby = 'sizeA'; - } - if ($orderby == 'size DESC') { - $orderby = 'sizeD'; - } - return $orderby; +function wfdownloads_convertorderbyout($orderby) +{ + if ($orderby == 'title ASC') { + $orderby = 'titleA'; } + if ($orderby == 'title DESC') { + $orderby = 'titleD'; + } + if ($orderby == 'published ASC') { + $orderby = 'dateA'; + } + if ($orderby == 'published DESC') { + $orderby = 'dateD'; + } + if ($orderby == 'hits ASC') { + $orderby = 'hitsA'; + } + if ($orderby == 'hits DESC') { + $orderby = 'hitsD'; + } + if ($orderby == 'rating ASC') { + $orderby = 'ratingA'; + } + if ($orderby == 'rating DESC') { + $orderby = 'ratingD'; + } + if ($orderby == 'size ASC') { + $orderby = 'sizeA'; + } + if ($orderby == 'size DESC') { + $orderby = 'sizeD'; + } + if ($orderby == 'weight ASC') { + $orderby = 'weightA'; + } + if ($orderby == 'weight DESC') { + $orderby = 'weightD'; + } + return $orderby; } /** Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -113,7 +113,8 @@ "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doimage" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), - "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true) + "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), + "weight" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true) ); //$renamed_fields = array( // "old_name" => "new_name" @@ -197,7 +198,8 @@ "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doimage" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), - "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true) + "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), + "weight" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true) ); //$renamed_fields = array( // "old_name" => "new_name" Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -372,3 +372,8 @@ define('_MD_WFDOWNLOADS_ERROR_CATIMAGEDIRNOTEXISTS', "Warning: contact the administrator, the upload directory does not exist"); define('_MD_WFDOWNLOADS_FFS_SUBMIT1ST_STEP', "1st step: choose category"); + +// class/download.php +define('_MD_WFDOWNLOADS_WEIGHT', "Weight"); +define('_MD_WFDOWNLOADS_WEIGHTLTOH', "Weight (lowest to highest value)"); +define('_MD_WFDOWNLOADS_WEIGHTHTOL', "Weight (highest to lowest value)"); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/sql/mysql.sql 2015-02-13 22:47:42 UTC (rev 12976) @@ -107,6 +107,7 @@ doxcode tinyint(1) NOT NULL default '1', doimage tinyint(1) NOT NULL default '1', dobr tinyint(1) NOT NULL default '1', + weight int(11) NOT NULL default '0', PRIMARY KEY (lid), KEY cid (cid), KEY status (status), @@ -350,6 +351,7 @@ doxcode tinyint(1) NOT NULL default '1', doimage tinyint(1) NOT NULL default '1', dobr tinyint(1) NOT NULL default '1', + weight int(11) NOT NULL default '0', PRIMARY KEY (requestid) ) ENGINE=MyISAM; Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/submit.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -381,6 +381,7 @@ $downloadObj->setVar('title', $title); $downloadObj->setVar('url', $url); $downloadObj->setVar('cid', (int)$cid); + $downloadObj->setVar('weight', (int)$weight); $downloadObj->setVar('filename', $filename); $downloadObj->setVar('filetype', $filetype); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl 2015-02-13 22:47:42 UTC (rev 12976) @@ -17,7 +17,6 @@ <a href='../viewcat.php?cid=<{$sorted_category.category.cid}>'><{$sorted_category.category.title}></a> </td> <td> - <label for="new_weights[<{$sorted_category.category.cid}>]">Category:</label> <input type="text" name="new_weights[<{$sorted_category.category.cid}>]" id="new_weights[<{$sorted_category.category.cid}>]" size="11" maxlength="11" value="<{$sorted_category.category.weight}>"/> </td> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_downloadslist.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_downloadslist.tpl 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_downloadslist.tpl 2015-02-13 22:47:42 UTC (rev 12976) @@ -10,6 +10,7 @@ <th><{$smarty.const._AM_WFDOWNLOADS_MINDEX_ID}></th> <th><{$smarty.const._AM_WFDOWNLOADS_MINDEX_TITLE}></th> <th><{$smarty.const._AM_WFDOWNLOADS_FCATEGORY_TITLE}></th> + <th><{$smarty.const._MD_WFDOWNLOADS_WEIGHT}></th> <th><{$smarty.const._AM_WFDOWNLOADS_MINDEX_POSTER}></th> <th><{$smarty.const._AM_WFDOWNLOADS_MINDEX_SUBMITTED}></th> <th><{$smarty.const._AM_WFDOWNLOADS_MINDEX_ONLINESTATUS}></th> @@ -35,6 +36,7 @@ </select> <input id='filter_category_title' type='text' value='<{$filter_category_title}>' maxlength='100' size='15' title='' name='filter_category_title'> </td> + <td> </td> <td><{$filter_submitter_select}></td> <td> <{* @@ -68,6 +70,7 @@ <td> <a href='../viewcat.php?cid=<{$download.cid}>'><{$download.category_title}></a> </td> + <td><{$download.weight}></td> <td><{$download.submitter_uname}></td> <td><{$download.published_formatted}></td> <td align='center'> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl 2015-02-13 22:47:42 UTC (rev 12976) @@ -245,6 +245,23 @@ title="<{$smarty.const._MD_WFDOWNLOADS_SIZEHTOL}>"><{$smarty.const._MD_WFDOWNLOADS_SIZE}> <img src="<{xoModuleIcons16 down.gif}>" alt="↓"></a> <{/if}> + | + <{if ($orderby == "weightA")}> + <span class='button_green' title="<{$smarty.const._MD_WFDOWNLOADS_WEIGHTLTOH}>"><{$smarty.const._MD_WFDOWNLOADS_WEIGHT}> <img + src="<{xoModuleIcons16 up.gif}>" alt="↑"></span> + <{else}> + <a class='button_grey' href="viewcat.php?cid=<{$category_cid}>&orderby=weightA" + title="<{$smarty.const._MD_WFDOWNLOADS_WEIGHTLTOH}>"><{$smarty.const._MD_WFDOWNLOADS_WEIGHT}> <img + src="<{xoModuleIcons16 up.gif}>" alt="↑"></a> + <{/if}> + <{if ($orderby == "weightD")}> + <span class='button_green' title="<{$smarty.const._MD_WFDOWNLOADS_WEIGHTHTOL}>"><{$smarty.const._MD_WFDOWNLOADS_WEIGHT}> <img + src="<{xoModuleIcons16 down.gif}>" alt="↓"></span> + <{else}> + <a class='button_grey' href="viewcat.php?cid=<{$category_cid}>&orderby=weightD" + title="<{$smarty.const._MD_WFDOWNLOADS_WEIGHTHTOL}>"><{$smarty.const._MD_WFDOWNLOADS_WEIGHT}> <img + src="<{xoModuleIcons16 down.gif}>" alt="↓"></a> + <{/if}> </div> </div> <{/if}> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -25,7 +25,7 @@ $start = XoopsRequest::getInt('start', 0); //$list = XoopsRequest::getString('list', null); //$orderby = XoopsRequest::getString('orderby', null); -$orderby = isset($_GET['orderby']) ? convertorderbyin($_GET['orderby']) : $wfdownloads->getConfig('filexorder'); +$orderby = isset($_GET['orderby']) ? wfdownloads_convertorderbyin($_GET['orderby']) : $wfdownloads->getConfig('filexorder'); $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); @@ -297,10 +297,10 @@ $xoopsTpl->assign('show_links', false); if ($downloads_count > 1 && $cid != 0) { $xoopsTpl->assign('show_links', true); - $orderbyTrans = convertorderbytrans($orderby); - $xoopsTpl->assign('orderby', convertorderbyout($orderby)); - $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_WFDOWNLOADS_CURSORTBY, convertorderbytrans($orderby))); - $orderby = convertorderbyout($orderby); + $orderbyTrans = wfdownloads_convertorderbytrans($orderby); + $xoopsTpl->assign('orderby', wfdownloads_convertorderbyout($orderby)); + $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_WFDOWNLOADS_CURSORTBY, wfdownloads_convertorderbytrans($orderby))); + $orderby = wfdownloads_convertorderbyout($orderby); } // Screenshots display $xoopsTpl->assign('show_screenshot', false); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php 2015-02-11 21:44:09 UTC (rev 12975) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php 2015-02-13 22:47:42 UTC (rev 12976) @@ -42,8 +42,8 @@ $modversion['onUpdate'] = 'include/onupdate.php'; $modversion['onUninstall'] = 'include/onuninstall.php'; -$modversion['date'] = '2015-02-03'; -$modversion['release_date'] = '2015-02-03'; +$modversion['date'] = '2015-02-13'; +$modversion['release_date'] = '2015-02-13'; $modversion['status'] = 'RC5'; $modversion['teammembers'] = 'Bender, David, FrankBlack, Xpider, M0nty, Mithrandir, Marcan, felix[fx2024], Sudhaker, Jegelstaff'; @@ -902,7 +902,9 @@ _MI_WFDOWNLOADS_RATING . $qa => 'rating ASC', _MI_WFDOWNLOADS_RATING . $qd => 'rating DESC', _MI_WFDOWNLOADS_POPULARITY . $qa => 'hits ASC', - _MI_WFDOWNLOADS_POPULARITY . $qd => 'hits DESC' + _MI_WFDOWNLOADS_POPULARITY . $qd => 'hits DESC', + _MI_WFDOWNLOADS_WEIGHT . $qa => 'weight ASC', + _MI_WFDOWNLOADS_WEIGHT . $qd => 'weight DESC' ), 'default' => 'title ASC' ); |
From: <luc...@us...> - 2015-02-16 19:00:49
|
Revision: 12984 http://sourceforge.net/p/xoops/svn/12984 Author: luciorota Date: 2015-02-16 19:00:46 +0000 (Mon, 16 Feb 2015) Log Message: ----------- code cleanup in templates/wfdownloads_singlefile.tpl update Magnific Plugin move Magnific Plugin from php script to template Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/jquery.magnific-popup.min.js XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/magnific-popup.css XoopsModules/wfdownloads/branches/luciorota/wfdownloads/brokenfile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/common.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/language/english/main.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/newlist.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/singlefile.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/admin/wfdownloads_am_categorieslist.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_newlistindex.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_singlefile.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_viewcat.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/viewcat.php Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/jquery.magnific-popup.min.js =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/jquery.magnific-popup.min.js 2015-02-16 14:09:28 UTC (rev 12983) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/jquery.magnific-popup.min.js 2015-02-16 19:00:46 UTC (rev 12984) @@ -1,430 +1,4 @@ -/*! Magnific Popup - v0.9.9 - 2013-12-27 - * http://dimsemenov.com/plugins/magnific-popup/ - * Copyright (c) 2013 Dmitry Semenov; */ -(function (e) { - var t, n, i, o, r, a, s, l = "Close", c = "BeforeClose", d = "AfterClose", u = "BeforeAppend", p = "MarkupParse", f = "Open", m = "Change", g = "mfp", h = "." + g, v = "mfp-ready", C = "mfp-removing", y = "mfp-prevent-close", w = function () { - }, b = !!window.jQuery, I = e(window), x = function (e, n) { - t.ev.on(g + e + h, n) - }, k = function (t, n, i, o) { - var r = document.createElement("div"); - return r.className = "mfp-" + t, i && (r.innerHTML = i), o ? n && n.appendChild(r) : (r = e(r), n && r.appendTo(n)), r - }, T = function (n, i) { - t.ev.triggerHandler(g + n, i), t.st.callbacks && (n = n.charAt(0).toLowerCase() + n.slice(1), t.st.callbacks[n] && t.st.callbacks[n].apply(t, e.isArray(i) ? i : [i])) - }, E = function (n) { - return n === s && t.currTemplate.closeBtn || (t.currTemplate.closeBtn = e(t.st.closeMarkup.replace("%title%", t.st.tClose)), s = n), t.currTemplate.closeBtn - }, _ = function () { - e.magnificPopup.instance || (t = new w, t.init(), e.magnificPopup.instance = t) - }, S = function () { - var e = document.createElement("p").style, t = ["ms", "O", "Moz", "Webkit"]; - if (void 0 !== e.transition)return!0; - for (; t.length;)if (t.pop() + "Transition"in e)return!0; - return!1 - }; - w.prototype = {constructor: w, init: function () { - var n = navigator.appVersion; - t.isIE7 = -1 !== n.indexOf("MSIE 7."), t.isIE8 = -1 !== n.indexOf("MSIE 8."), t.isLowIE = t.isIE7 || t.isIE8, t.isAndroid = /android/gi.test(n), t.isIOS = /iphone|ipad|ipod/gi.test(n), t.supportsTransition = S(), t.probablyMobile = t.isAndroid || t.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent), o = e(document), t.popupsCache = {} - }, open : function (n) { - i || (i = e(document.body)); - var r; - if (n.isObj === !1) { - t.items = n.items.toArray(), t.index = 0; - var s, l = n.items; - for (r = 0; l.length > r; r++)if (s = l[r], s.parsed && (s = s.el[0]), s === n.el[0]) { - t.index = r; - break - } - } else t.items = e.isArray(n.items) ? n.items : [n.items], t.index = n.index || 0; - if (t.isOpen)return t.updateItemHTML(), void 0; - t.types = [], a = "", t.ev = n.mainEl && n.mainEl.length ? n.mainEl.eq(0) : o, n.key ? (t.popupsCache[n.key] || (t.popupsCache[n.key] = {}), t.currTemplate = t.popupsCache[n.key]) : t.currTemplate = {}, t.st = e.extend(!0, {}, e.magnificPopup.defaults, n), t.fixedContentPos = "auto" === t.st.fixedContentPos ? !t.probablyMobile : t.st.fixedContentPos, t.st.modal && (t.st.closeOnContentClick = !1, t.st.closeOnBgClick = !1, t.st.showCloseBtn = !1, t.st.enableEscapeKey = !1), t.bgOverlay || (t.bgOverlay = k("bg").on("click" + h, function () { - t.close() - }), t.wrap = k("wrap").attr("tabindex", -1).on("click" + h, function (e) { - t._checkIfClose(e.target) && t.close() - }), t.container = k("container", t.wrap)), t.contentContainer = k("content"), t.st.preloader && (t.preloader = k("preloader", t.container, t.st.tLoading)); - var c = e.magnificPopup.modules; - for (r = 0; c.length > r; r++) { - var d = c[r]; - d = d.charAt(0).toUpperCase() + d.slice(1), t["init" + d].call(t) - } - T("BeforeOpen"), t.st.showCloseBtn && (t.st.closeBtnInside ? (x(p, function (e, t, n, i) { - n.close_replaceWith = E(i.type) - }), a += " mfp-close-btn-in") : t.wrap.append(E())), t.st.alignTop && (a += " mfp-align-top"), t.fixedContentPos ? t.wrap.css({overflow: t.st.overflowY, overflowX: "hidden", overflowY: t.st.overflowY}) : t.wrap.css({top: I.scrollTop(), position: "absolute"}), (t.st.fixedBgPos === !1 || "auto" === t.st.fixedBgPos && !t.fixedContentPos) && t.bgOverlay.css({height: o.height(), position: "absolute"}), t.st.enableEscapeKey && o.on("keyup" + h, function (e) { - 27 === e.keyCode && t.close() - }), I.on("resize" + h, function () { - t.updateSize() - }), t.st.closeOnContentClick || (a += " mfp-auto-cursor"), a && t.wrap.addClass(a); - var u = t.wH = I.height(), m = {}; - if (t.fixedContentPos && t._hasScrollBar(u)) { - var g = t._getScrollbarSize(); - g && (m.marginRight = g) - } - t.fixedContentPos && (t.isIE7 ? e("body, html").css("overflow", "hidden") : m.overflow = "hidden"); - var C = t.st.mainClass; - return t.isIE7 && (C += " mfp-ie7"), C && t._addClassToMFP(C), t.updateItemHTML(), T("BuildControls"), e("html").css(m), t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo || i), t._lastFocusedEl = document.activeElement, setTimeout(function () { - t.content ? (t._addClassToMFP(v), t._setFocus()) : t.bgOverlay.addClass(v), o.on("focusin" + h, t._onFocusIn) - }, 16), t.isOpen = !0, t.updateSize(u), T(f), n - }, close : function () { - t.isOpen && (T(c), t.isOpen = !1, t.st.removalDelay && !t.isLowIE && t.supportsTransition ? (t._addClassToMFP(C), setTimeout(function () { - t._close() - }, t.st.removalDelay)) : t._close()) - }, _close : function () { - T(l); - var n = C + " " + v + " "; - if (t.bgOverlay.detach(), t.wrap.detach(), t.container.empty(), t.st.mainClass && (n += t.st.mainClass + " "), t._removeClassFromMFP(n), t.fixedContentPos) { - var i = {marginRight: ""}; - t.isIE7 ? e("body, html").css("overflow", "") : i.overflow = "", e("html").css(i) - } - o.off("keyup" + h + " focusin" + h), t.ev.off(h), t.wrap.attr("class", "mfp-wrap").removeAttr("style"), t.bgOverlay.attr("class", "mfp-bg"), t.container.attr("class", "mfp-container"), !t.st.showCloseBtn || t.st.closeBtnInside && t.currTemplate[t.currItem.type] !== !0 || t.currTemplate.closeBtn && t.currTemplate.closeBtn.detach(), t._lastFocusedEl && e(t._lastFocusedEl).focus(), t.currItem = null, t.content = null, t.currTemplate = null, t.prevHeight = 0, T(d) - }, updateSize : function (e) { - if (t.isIOS) { - var n = document.documentElement.clientWidth / window.innerWidth, i = window.innerHeight * n; - t.wrap.css("height", i), t.wH = i - } else t.wH = e || I.height(); - t.fixedContentPos || t.wrap.css("height", t.wH), T("Resize") - }, updateItemHTML : function () { - var n = t.items[t.index]; - t.contentContainer.detach(), t.content && t.content.detach(), n.parsed || (n = t.parseEl(t.index)); - var i = n.type; - if (T("BeforeChange", [t.currItem ? t.currItem.type : "", i]), t.currItem = n, !t.currTemplate[i]) { - var o = t.st[i] ? t.st[i].markup : !1; - T("FirstMarkupParse", o), t.currTemplate[i] = o ? e(o) : !0 - } - r && r !== n.type && t.container.removeClass("mfp-" + r + "-holder"); - var a = t["get" + i.charAt(0).toUpperCase() + i.slice(1)](n, t.currTemplate[i]); - t.appendContent(a, i), n.preloaded = !0, T(m, n), r = n.type, t.container.prepend(t.contentContainer), T("AfterChange") - }, appendContent : function (e, n) { - t.content = e, e ? t.st.showCloseBtn && t.st.closeBtnInside && t.currTemplate[n] === !0 ? t.content.find(".mfp-close").length || t.content.append(E()) : t.content = e : t.content = "", T(u), t.container.addClass("mfp-" + n + "-holder"), t.contentContainer.append(t.content) - }, parseEl : function (n) { - var i, o = t.items[n]; - if (o.tagName ? o = {el: e(o)} : (i = o.type, o = {data: o, src: o.src}), o.el) { - for (var r = t.types, a = 0; r.length > a; a++)if (o.el.hasClass("mfp-" + r[a])) { - i = r[a]; - break - } - o.src = o.el.attr("data-mfp-src"), o.src || (o.src = o.el.attr("href")) - } - return o.type = i || t.st.type || "inline", o.index = n, o.parsed = !0, t.items[n] = o, T("ElementParse", o), t.items[n] - }, addGroup : function (e, n) { - var i = function (i) { - i.mfpEl = this, t._openClick(i, e, n) - }; - n || (n = {}); - var o = "click.magnificPopup"; - n.mainEl = e, n.items ? (n.isObj = !0, e.off(o).on(o, i)) : (n.isObj = !1, n.delegate ? e.off(o).on(o, n.delegate, i) : (n.items = e, e.off(o).on(o, i))) - }, _openClick : function (n, i, o) { - var r = void 0 !== o.midClick ? o.midClick : e.magnificPopup.defaults.midClick; - if (r || 2 !== n.which && !n.ctrlKey && !n.metaKey) { - var a = void 0 !== o.disableOn ? o.disableOn : e.magnificPopup.defaults.disableOn; - if (a)if (e.isFunction(a)) { - if (!a.call(t))return!0 - } else if (a > I.width())return!0; - n.type && (n.preventDefault(), t.isOpen && n.stopPropagation()), o.el = e(n.mfpEl), o.delegate && (o.items = i.find(o.delegate)), t.open(o) - } - }, updateStatus : function (e, i) { - if (t.preloader) { - n !== e && t.container.removeClass("mfp-s-" + n), i || "loading" !== e || (i = t.st.tLoading); - var o = {status: e, text: i}; - T("UpdateStatus", o), e = o.status, i = o.text, t.preloader.html(i), t.preloader.find("a").on("click", function (e) { - e.stopImmediatePropagation() - }), t.container.addClass("mfp-s-" + e), n = e - } - }, _checkIfClose : function (n) { - if (!e(n).hasClass(y)) { - var i = t.st.closeOnContentClick, o = t.st.closeOnBgClick; - if (i && o)return!0; - if (!t.content || e(n).hasClass("mfp-close") || t.preloader && n === t.preloader[0])return!0; - if (n === t.content[0] || e.contains(t.content[0], n)) { - if (i)return!0 - } else if (o && e.contains(document, n))return!0; - return!1 - } - }, _addClassToMFP : function (e) { - t.bgOverlay.addClass(e), t.wrap.addClass(e) - }, _removeClassFromMFP : function (e) { - this.bgOverlay.removeClass(e), t.wrap.removeClass(e) - }, _hasScrollBar : function (e) { - return(t.isIE7 ? o.height() : document.body.scrollHeight) > (e || I.height()) - }, _setFocus : function () { - (t.st.focus ? t.content.find(t.st.focus).eq(0) : t.wrap).focus() - }, _onFocusIn : function (n) { - return n.target === t.wrap[0] || e.contains(t.wrap[0], n.target) ? void 0 : (t._setFocus(), !1) - }, _parseMarkup : function (t, n, i) { - var o; - i.data && (n = e.extend(i.data, n)), T(p, [t, n, i]), e.each(n, function (e, n) { - if (void 0 === n || n === !1)return!0; - if (o = e.split("_"), o.length > 1) { - var i = t.find(h + "-" + o[0]); - if (i.length > 0) { - var r = o[1]; - "replaceWith" === r ? i[0] !== n[0] && i.replaceWith(n) : "img" === r ? i.is("img") ? i.attr("src", n) : i.replaceWith('<img src="' + n + '" class="' + i.attr("class") + '" />') : i.attr(o[1], n) - } - } else t.find(h + "-" + e).html(n) - }) - }, _getScrollbarSize : function () { - if (void 0 === t.scrollbarSize) { - var e = document.createElement("div"); - e.id = "mfp-sbm", e.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;", document.body.appendChild(e), t.scrollbarSize = e.offsetWidth - e.clientWidth, document.body.removeChild(e) - } - return t.scrollbarSize - }}, e.magnificPopup = {instance: null, proto: w.prototype, modules: [], open: function (t, n) { - return _(), t = t ? e.extend(!0, {}, t) : {}, t.isObj = !0, t.index = n || 0, this.instance.open(t) - }, close : function () { - return e.magnificPopup.instance && e.magnificPopup.instance.close() - }, registerModule : function (t, n) { - n.options && (e.magnificPopup.defaults[t] = n.options), e.extend(this.proto, n.proto), this.modules.push(t) - }, defaults : {disableOn: 0, key: null, midClick: !1, mainClass: "", preloader: !0, focus: "", closeOnContentClick: !1, closeOnBgClick: !0, closeBtnInside: !0, showCloseBtn: !0, enableEscapeKey: !0, modal: !1, alignTop: !1, removalDelay: 0, prependTo: null, fixedContentPos: "auto", fixedBgPos: "auto", overflowY: "auto", closeMarkup: '<button title="%title%" type="button" class="mfp-close">×</button>', tClose: "Close (Esc)", tLoading: "Loading..."}}, e.fn.magnificPopup = function (n) { - _(); - var i = e(this); - if ("string" == typeof n)if ("open" === n) { - var o, r = b ? i.data("magnificPopup") : i[0].magnificPopup, a = parseInt(arguments[1], 10) || 0; - r.items ? o = r.items[a] : (o = i, r.delegate && (o = o.find(r.delegate)), o = o.eq(a)), t._openClick({mfpEl: o}, i, r) - } else t.isOpen && t[n].apply(t, Array.prototype.slice.call(arguments, 1)); else n = e.extend(!0, {}, n), b ? i.data("magnificPopup", n) : i[0].magnificPopup = n, t.addGroup(i, n); - return i - }; - var P, O, z, M = "inline", B = function () { - z && (O.after(z.addClass(P)).detach(), z = null) - }; - e.magnificPopup.registerModule(M, {options: {hiddenClass: "hide", markup: "", tNotFound: "Content not found"}, proto: {initInline: function () { - t.types.push(M), x(l + "." + M, function () { - B() - }) - }, getInline : function (n, i) { - if (B(), n.src) { - var o = t.st.inline, r = e(n.src); - if (r.length) { - var a = r[0].parentNode; - a && a.tagName && (O || (P = o.hiddenClass, O = k(P), P = "mfp-" + P), z = r.after(O).detach().removeClass(P)), t.updateStatus("ready") - } else t.updateStatus("error", o.tNotFound), r = e("<div>"); - return n.inlineElement = r, r - } - return t.updateStatus("ready"), t._parseMarkup(i, {}, n), i - }}}); - var F, H = "ajax", L = function () { - F && i.removeClass(F) - }, A = function () { - L(), t.req && t.req.abort() - }; - e.magnificPopup.registerModule(H, {options: {settings: null, cursor: "mfp-ajax-cur", tError: '<a href="%url%">The content</a> could not be loaded.'}, proto: {initAjax: function () { - t.types.push(H), F = t.st.ajax.cursor, x(l + "." + H, A), x("BeforeChange." + H, A) - }, getAjax : function (n) { - F && i.addClass(F), t.updateStatus("loading"); - var o = e.extend({url: n.src, success: function (i, o, r) { - var a = {data: i, xhr: r}; - T("ParseAjax", a), t.appendContent(e(a.data), H), n.finished = !0, L(), t._setFocus(), setTimeout(function () { - t.wrap.addClass(v) - }, 16), t.updateStatus("ready"), T("AjaxContentAdded") - }, error : function () { - L(), n.finished = n.loadError = !0, t.updateStatus("error", t.st.ajax.tError.replace("%url%", n.src)) - }}, t.st.ajax.settings); - return t.req = e.ajax(o), "" - }}}); - var j, N = function (n) { - if (n.data && void 0 !== n.data.title)return n.data.title; - var i = t.st.image.titleSrc; - if (i) { - if (e.isFunction(i))return i.call(t, n); - if (n.el)return n.el.attr(i) || "" - } - return"" - }; - e.magnificPopup.registerModule("image", {options: {markup: '<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>', cursor: "mfp-zoom-out-cur", titleSrc: "title", verticalFit: !0, tError: '<a href="%url%">The image</a> could not be loaded.'}, proto: {initImage: function () { - var e = t.st.image, n = ".image"; - t.types.push("image"), x(f + n, function () { - "image" === t.currItem.type && e.cursor && i.addClass(e.cursor) - }), x(l + n, function () { - e.cursor && i.removeClass(e.cursor), I.off("resize" + h) - }), x("Resize" + n, t.resizeImage), t.isLowIE && x("AfterChange", t.resizeImage) - }, resizeImage : function () { - var e = t.currItem; - if (e && e.img && t.st.image.verticalFit) { - var n = 0; - t.isLowIE && (n = parseInt(e.img.css("padding-top"), 10) + parseInt(e.img.css("padding-bottom"), 10)), e.img.css("max-height", t.wH - n) - } - }, _onImageHasSize : function (e) { - e.img && (e.hasSize = !0, j && clearInterval(j), e.isCheckingImgSize = !1, T("ImageHasSize", e), e.imgHidden && (t.content && t.content.removeClass("mfp-loading"), e.imgHidden = !1)) - }, findImageSize : function (e) { - var n = 0, i = e.img[0], o = function (r) { - j && clearInterval(j), j = setInterval(function () { - return i.naturalWidth > 0 ? (t._onImageHasSize(e), void 0) : (n > 200 && clearInterval(j), n++, 3 === n ? o(10) : 40 === n ? o(50) : 100 === n && o(500), void 0) - }, r) - }; - o(1) - }, getImage : function (n, i) { - var o = 0, r = function () { - n && (n.img[0].complete ? (n.img.off(".mfploader"), n === t.currItem && (t._onImageHasSize(n), t.updateStatus("ready")), n.hasSize = !0, n.loaded = !0, T("ImageLoadComplete")) : (o++, 200 > o ? setTimeout(r, 100) : a())) - }, a = function () { - n && (n.img.off(".mfploader"), n === t.currItem && (t._onImageHasSize(n), t.updateStatus("error", s.tError.replace("%url%", n.src))), n.hasSize = !0, n.loaded = !0, n.loadError = !0) - }, s = t.st.image, l = i.find(".mfp-img"); - if (l.length) { - var c = document.createElement("img"); - c.className = "mfp-img", n.img = e(c).on("load.mfploader", r).on("error.mfploader", a), c.src = n.src, l.is("img") && (n.img = n.img.clone()), c = n.img[0], c.naturalWidth > 0 ? n.hasSize = !0 : c.width || (n.hasSize = !1) - } - return t._parseMarkup(i, {title: N(n), img_replaceWith: n.img}, n), t.resizeImage(), n.hasSize ? (j && clearInterval(j), n.loadError ? (i.addClass("mfp-loading"), t.updateStatus("error", s.tError.replace("%url%", n.src))) : (i.removeClass("mfp-loading"), t.updateStatus("ready")), i) : (t.updateStatus("loading"), n.loading = !0, n.hasSize || (n.imgHidden = !0, i.addClass("mfp-loading"), t.findImageSize(n)), i) - }}}); - var W, R = function () { - return void 0 === W && (W = void 0 !== document.createElement("p").style.MozTransform), W - }; - e.magnificPopup.registerModule("zoom", {options: {enabled: !1, easing: "ease-in-out", duration: 300, opener: function (e) { - return e.is("img") ? e : e.find("img") - }}, proto : {initZoom: function () { - var e, n = t.st.zoom, i = ".zoom"; - if (n.enabled && t.supportsTransition) { - var o, r, a = n.duration, s = function (e) { - var t = e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"), i = "all " + n.duration / 1e3 + "s " + n.easing, o = {position: "fixed", zIndex: 9999, left: 0, top: 0, "-webkit-backface-visibility": "hidden"}, r = "transition"; - return o["-webkit-" + r] = o["-moz-" + r] = o["-o-" + r] = o[r] = i, t.css(o), t - }, d = function () { - t.content.css("visibility", "visible") - }; - x("BuildControls" + i, function () { - if (t._allowZoom()) { - if (clearTimeout(o), t.content.css("visibility", "hidden"), e = t._getItemToZoom(), !e)return d(), void 0; - r = s(e), r.css(t._getOffset()), t.wrap.append(r), o = setTimeout(function () { - r.css(t._getOffset(!0)), o = setTimeout(function () { - d(), setTimeout(function () { - r.remove(), e = r = null, T("ZoomAnimationEnded") - }, 16) - }, a) - }, 16) - } - }), x(c + i, function () { - if (t._allowZoom()) { - if (clearTimeout(o), t.st.removalDelay = a, !e) { - if (e = t._getItemToZoom(), !e)return; - r = s(e) - } - r.css(t._getOffset(!0)), t.wrap.append(r), t.content.css("visibility", "hidden"), setTimeout(function () { - r.css(t._getOffset()) - }, 16) - } - }), x(l + i, function () { - t._allowZoom() && (d(), r && r.remove(), e = null) - }) - } - }, _allowZoom : function () { - return"image" === t.currItem.type - }, _getItemToZoom : function () { - return t.currItem.hasSize ? t.currItem.img : !1 - }, _getOffset : function (n) { - var i; - i = n ? t.currItem.img : t.st.zoom.opener(t.currItem.el || t.currItem); - var o = i.offset(), r = parseInt(i.css("padding-top"), 10), a = parseInt(i.css("padding-bottom"), 10); - o.top -= e(window).scrollTop() - r; - var s = {width: i.width(), height: (b ? i.innerHeight() : i[0].offsetHeight) - a - r}; - return R() ? s["-moz-transform"] = s.transform = "translate(" + o.left + "px," + o.top + "px)" : (s.left = o.left, s.top = o.top), s - }}}); - var Z = "iframe", q = "//about:blank", D = function (e) { - if (t.currTemplate[Z]) { - var n = t.currTemplate[Z].find("iframe"); - n.length && (e || (n[0].src = q), t.isIE8 && n.css("display", e ? "block" : "none")) - } - }; - e.magnificPopup.registerModule(Z, {options: {markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>', srcAction: "iframe_src", patterns: {youtube: {index: "youtube.com", id: "v=", src: "//www.youtube.com/embed/%id%?autoplay=1"}, vimeo: {index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1"}, gmaps: {index: "//maps.google.", src: "%id%&output=embed"}}}, proto: {initIframe: function () { - t.types.push(Z), x("BeforeChange", function (e, t, n) { - t !== n && (t === Z ? D() : n === Z && D(!0)) - }), x(l + "." + Z, function () { - D() - }) - }, getIframe : function (n, i) { - var o = n.src, r = t.st.iframe; - e.each(r.patterns, function () { - return o.indexOf(this.index) > -1 ? (this.id && (o = "string" == typeof this.id ? o.substr(o.lastIndexOf(this.id) + this.id.length, o.length) : this.id.call(this, o)), o = this.src.replace("%id%", o), !1) : void 0 - }); - var a = {}; - return r.srcAction && (a[r.srcAction] = o), t._parseMarkup(i, a, n), t.updateStatus("ready"), i - }}}); - var K = function (e) { - var n = t.items.length; - return e > n - 1 ? e - n : 0 > e ? n + e : e - }, Y = function (e, t, n) { - return e.replace(/%curr%/gi, t + 1).replace(/%total%/gi, n) - }; - e.magnificPopup.registerModule("gallery", {options: {enabled: !1, arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', preload: [0, 2], navigateByImgClick: !0, arrows: !0, tPrev: "Previous (Left arrow key)", tNext: "Next (Right arrow key)", tCounter: "%curr% of %total%"}, proto: {initGallery: function () { - var n = t.st.gallery, i = ".mfp-gallery", r = Boolean(e.fn.mfpFastClick); - return t.direction = !0, n && n.enabled ? (a += " mfp-gallery", x(f + i, function () { - n.navigateByImgClick && t.wrap.on("click" + i, ".mfp-img", function () { - return t.items.length > 1 ? (t.next(), !1) : void 0 - }), o.on("keydown" + i, function (e) { - 37 === e.keyCode ? t.prev() : 39 === e.keyCode && t.next() - }) - }), x("UpdateStatus" + i, function (e, n) { - n.text && (n.text = Y(n.text, t.currItem.index, t.items.length)) - }), x(p + i, function (e, i, o, r) { - var a = t.items.length; - o.counter = a > 1 ? Y(n.tCounter, r.index, a) : "" - }), x("BuildControls" + i, function () { - if (t.items.length > 1 && n.arrows && !t.arrowLeft) { - var i = n.arrowMarkup, o = t.arrowLeft = e(i.replace(/%title%/gi, n.tPrev).replace(/%dir%/gi, "left")).addClass(y), a = t.arrowRight = e(i.replace(/%title%/gi, n.tNext).replace(/%dir%/gi, "right")).addClass(y), s = r ? "mfpFastClick" : "click"; - o[s](function () { - t.prev() - }), a[s](function () { - t.next() - }), t.isIE7 && (k("b", o[0], !1, !0), k("a", o[0], !1, !0), k("b", a[0], !1, !0), k("a", a[0], !1, !0)), t.container.append(o.add(a)) - } - }), x(m + i, function () { - t._preloadTimeout && clearTimeout(t._preloadTimeout), t._preloadTimeout = setTimeout(function () { - t.preloadNearbyImages(), t._preloadTimeout = null - }, 16) - }), x(l + i, function () { - o.off(i), t.wrap.off("click" + i), t.arrowLeft && r && t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(), t.arrowRight = t.arrowLeft = null - }), void 0) : !1 - }, next : function () { - t.direction = !0, t.index = K(t.index + 1), t.updateItemHTML() - }, prev : function () { - t.direction = !1, t.index = K(t.index - 1), t.updateItemHTML() - }, goTo : function (e) { - t.direction = e >= t.index, t.index = e, t.updateItemHTML() - }, preloadNearbyImages : function () { - var e, n = t.st.gallery.preload, i = Math.min(n[0], t.items.length), o = Math.min(n[1], t.items.length); - for (e = 1; (t.direction ? o : i) >= e; e++)t._preloadItem(t.index + e); - for (e = 1; (t.direction ? i : o) >= e; e++)t._preloadItem(t.index - e) - }, _preloadItem : function (n) { - if (n = K(n), !t.items[n].preloaded) { - var i = t.items[n]; - i.parsed || (i = t.parseEl(n)), T("LazyLoad", i), "image" === i.type && (i.img = e('<img class="mfp-img" />').on("load.mfploader", function () { - i.hasSize = !0 - }).on("error.mfploader", function () { - i.hasSize = !0, i.loadError = !0, T("LazyLoadError", i) - }).attr("src", i.src)), i.preloaded = !0 - } - }}}); - var U = "retina"; - e.magnificPopup.registerModule(U, {options: {replaceSrc: function (e) { - return e.src.replace(/\.\w+$/, function (e) { - return"@2x" + e - }) - }, ratio : 1}, proto: {initRetina: function () { - if (window.devicePixelRatio > 1) { - var e = t.st.retina, n = e.ratio; - n = isNaN(n) ? n() : n, n > 1 && (x("ImageHasSize." + U, function (e, t) { - t.img.css({"max-width": t.img[0].naturalWidth / n, width: "100%"}) - }), x("ElementParse." + U, function (t, i) { - i.src = e.replaceSrc(i, n) - })) - } - }}}), function () { - var t = 1e3, n = "ontouchstart"in window, i = function () { - I.off("touchmove" + r + " touchend" + r) - }, o = "mfpFastClick", r = "." + o; - e.fn.mfpFastClick = function (o) { - return e(this).each(function () { - var a, s = e(this); - if (n) { - var l, c, d, u, p, f; - s.on("touchstart" + r, function (e) { - u = !1, f = 1, p = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0], c = p.clientX, d = p.clientY, I.on("touchmove" + r, function (e) { - p = e.originalEvent ? e.originalEvent.touches : e.touches, f = p.length, p = p[0], (Math.abs(p.clientX - c) > 10 || Math.abs(p.clientY - d) > 10) && (u = !0, i()) - }).on("touchend" + r, function (e) { - i(), u || f > 1 || (a = !0, e.preventDefault(), clearTimeout(l), l = setTimeout(function () { - a = !1 - }, t), o()) - }) - }) - } - s.on("click" + r, function () { - a || o() - }) - }) - }, e.fn.destroyMfpFastClick = function () { - e(this).off("touchstart" + r + " click" + r), n && I.off("touchmove" + r + " touchend" + r) - } - }(), _() -})(window.jQuery || window.Zepto); +/*! Magnific Popup - v1.0.0 - 2015-01-03 +* http://dimsemenov.com/plugins/magnific-popup/ +* Copyright (c) 2015 Dmitry Semenov; */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=-1!==c.indexOf("MSIE 7."),b.isIE8=-1!==c.indexOf("MSIE 8."),b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",b.ev=c.mainEl&&c.mainEl.length?c.mainEl.eq(0):d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.wrap.css(b.fixedContentPos?{overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}:{top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),b.currTemplate[d]=f?a(f):!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||2!==c.which&&!c.ctrlKey&&!c.metaKey){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()}); \ No newline at end of file Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/magnific-popup.css =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/magnific-popup.css 2015-02-16 14:09:28 UTC (rev 12983) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/assets/js/magnific/magnific-popup.css 2015-02-16 19:00:46 UTC (rev 12984) @@ -1,219 +1,182 @@ /* Magnific Popup CSS */ .mfp-bg { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1042; - overflow: hidden; - position: fixed; - background: #0b0b0b; - opacity: 0.8; - filter: alpha(opacity=80); -} + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1042; + overflow: hidden; + position: fixed; + background: #0b0b0b; + opacity: 0.8; + filter: alpha(opacity=80); } .mfp-wrap { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1043; - position: fixed; - outline: none !important; - -webkit-backface-visibility: hidden; -} + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1043; + position: fixed; + outline: none !important; + -webkit-backface-visibility: hidden; } .mfp-container { - text-align: center; - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - padding: 0 8px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} + text-align: center; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + padding: 0 8px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } .mfp-container:before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; -} + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; } .mfp-align-top .mfp-container:before { - display: none; -} + display: none; } .mfp-content { - position: relative; - display: inline-block; - vertical-align: middle; - margin: 0 auto; - text-align: left; - z-index: 1045; -} + position: relative; + display: inline-block; + vertical-align: middle; + margin: 0 auto; + text-align: left; + z-index: 1045; } .mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content { - width: 100%; - cursor: auto; -} + width: 100%; + cursor: auto; } .mfp-ajax-cur { - cursor: progress; -} + cursor: progress; } .mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close { - cursor: -moz-zoom-out; - cursor: -webkit-zoom-out; - cursor: zoom-out; -} + cursor: -moz-zoom-out; + cursor: -webkit-zoom-out; + cursor: zoom-out; } .mfp-zoom { - cursor: pointer; - cursor: -webkit-zoom-in; - cursor: -moz-zoom-in; - cursor: zoom-in; -} + cursor: pointer; + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; } .mfp-auto-cursor .mfp-content { - cursor: auto; -} + cursor: auto; } .mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; -} + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } .mfp-loading.mfp-figure { - display: none; -} + display: none; } .mfp-hide { - display: none !important; -} + display: none !important; } .mfp-preloader { - color: #cccccc; - position: absolute; - top: 50%; - width: auto; - text-align: center; - margin-top: -0.8em; - left: 8px; - right: 8px; - z-index: 1044; -} + color: #CCC; + position: absolute; + top: 50%; + width: auto; + text-align: center; + margin-top: -0.8em; + left: 8px; + right: 8px; + z-index: 1044; } + .mfp-preloader a { + color: #CCC; } + .mfp-preloader a:hover { + color: #FFF; } -.mfp-preloader a { - color: #cccccc; -} - -.mfp-preloader a:hover { - color: white; -} - .mfp-s-ready .mfp-preloader { - display: none; -} + display: none; } .mfp-s-error .mfp-content { - display: none; -} + display: none; } button.mfp-close, button.mfp-arrow { - overflow: visible; - cursor: pointer; - background: transparent; - b... [truncated message content] |
From: <luc...@us...> - 2015-02-18 17:22:47
|
Revision: 12994 http://sourceforge.net/p/xoops/svn/12994 Author: luciorota Date: 2015-02-18 17:22:44 +0000 (Wed, 18 Feb 2015) Log Message: ----------- fixed bug in install, uninstall, update move all .tpl to templates folder Modified Paths: -------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php Added Paths: ----------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_breadcrumb.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_choicebyletter.tpl Removed Paths: ------------- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -26,12 +26,19 @@ * echo $breadcrumb->render(); */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); +include_once dirname(dirname(__DIR__)) . '/include/common.php'; /** * Class WfdownloadsBreadcrumb */ class WfdownloadsBreadcrumb { + /** + * @var WfdownloadsWfdownloads + * @access public + */ + public $wfdownloads = null; + private $dirname; private $_bread = array(); @@ -40,7 +47,8 @@ */ public function __construct() { - $this->dirname = basename(dirname(dirname(__DIR__))); + $this->wfdownloads = WfdownloadsWfdownloads::getInstance(); + $this->dirname = basename(dirname(dirname(__DIR__))); } /** @@ -75,10 +83,7 @@ // IN PROGRESS // IN PROGRESS // IN PROGRESS - //$ret .= $breadcrumbTpl->fetch(__DIR__ . '_breadcrumb.tpl'); - $tplSource = file_get_contents(__DIR__ . '/breadcrumb.tpl'); -// $ret .= $choiceByLetterTpl->fetchFromData($tplSource, false, null); - $ret .= $breadcrumbTpl->fetchFromData($tplSource, false, null); + $ret .= $breadcrumbTpl->fetch("db:{$this->wfdownloads->getModule()->dirname()}_co_breadcrumb.tpl"); unset($breadcrumbTpl); return $ret; Deleted: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/breadcrumb.tpl 2015-02-18 17:22:44 UTC (rev 12994) @@ -1,16 +0,0 @@ -<div class="wfdownloads_headertable"> - <div class="wfdownloads_breadcrumb"> - <{foreach item=bread from=$breadcrumb name=bcloop}> - <span class="bread"> - <{if ($bread.link)}> - <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a> - <{else}> - <{$bread.title}> - <{/if}> - </span> - <{if !$smarty.foreach.bcloop.last}> - <span class="delimiter">></span> - <{/if}> - <{/foreach}> - </div> -</div> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -23,6 +23,7 @@ * echo $choicebyletter->render(); */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); +include_once dirname(dirname(__DIR__)) . '/include/common.php'; /** * Class WfdownloadsChoiceByLetter @@ -30,6 +31,12 @@ class WfdownloadsChoiceByLetter { /** + * @var WfdownloadsWfdownloads + * @access public + */ + public $wfdownloads = null; + + /** * *#@+ * * @access private @@ -61,6 +68,7 @@ */ public function __construct($objHandler, $criteria = null, $field_name = null, $alphabet = array(), $arg_name = 'letter', $url = null, $extra_arg = '', $caseSensitive = false) { + $this->wfdownloads = WfdownloadsWfdownloads::getInstance(); $this->objHandler = $objHandler; $this->criteria = is_null($criteria) ? new CriteriaCompo() : $criteria; $this->field_name = is_null($field_name) ? $this->objHandler->identifierName : $field_name; @@ -128,9 +136,7 @@ // IN PROGRESS // IN PROGRESS // IN PROGRESS - //$ret .= $choiceByLetterTpl->fetch(__DIR__ . '/choicebyletter.tpl'); - $tplSource = file_get_contents(__DIR__ . '/choicebyletter.tpl'); - $ret .= $choiceByLetterTpl->fetchFromData($tplSource, false, null); + $ret .= $choiceByLetterTpl->fetch("db:{$this->wfdownloads->getModule()->dirname()}_co_choicebyletter.tpl"); unset($choiceByLetterTpl); return $ret; Deleted: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/common/choicebyletter.tpl 2015-02-18 17:22:44 UTC (rev 12994) @@ -1,96 +0,0 @@ -<style type="text/css"> - .button_green { - -moz-box-shadow: inset 0 1px 0 0 #d9fbbe; - -webkit-box-shadow: inset 0 1px 0 0 #d9fbbe; - box-shadow: inset 0 1px 0 0 #d9fbbe; - background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #d9fbbe), color-stop(1, #d9fbbe)); - background: -moz-linear-gradient(center top, #a5cc52 5%, #d9fbbe 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9fbbe', endColorstr='#b8e356'); - background-color: #d9fbbe; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - text-indent: 0; - border: 1px solid #83c41a; - display: inline-block; - color: inherit; - font-family: inherit; - font-size: 12px; - font-weight: bold; - font-style: normal; - height: 20px; - line-height: 20px; - width: auto; - min-width: 10px; - text-decoration: none; - text-align: center; - text-shadow: 1px 1px 0 #d9fbbe; - margin: 2px 0; - padding: 0 4px; - } - - .button_green:hover { - background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #b8e356), color-stop(1, #a5cc52)); - background: -moz-linear-gradient(center top, #b8e356 5%, #a5cc52 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8e356', endColorstr='#a5cc52'); - background-color: #86ae47; - } - - .button_green:active { - position: relative; - top: 1px; - } - - .button_grey { - background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf)); - background: -moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); - background-color: #ededed; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - text-indent: 0; - border: 1px solid #dcdcdc; - display: inline-block; - color: inherit; - font-family: inherit; - font-size: 12px; - font-weight: bold; - font-style: normal; - height: 20px; - line-height: 20px; - width: auto; - min-width: 10px; - text-decoration: none; - text-align: center; - text-shadow: 1px 1px 0 #ffffff; - margin: 2px 0; - padding: 0 4px; - } - - .button_grey:hover { - background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed)); - background: -moz-linear-gradient(center top, #dfdfdf 5%, #ededed 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); - background-color: #dfdfdf; - } - - .button_grey:active { - position: relative; - top: 1px; - } -</style> -<br/> -<div> - <{assign var="alphabetcount" value=$alphabet|@count}> - <{foreach name=letters item=letter from=$alphabet}> - <{if ($letter.count > 0)}> - <a class='button_green' href='<{$letter.url}>' title='<{$letter.count}>'><{$letter.letter}></a> - <{else}> - <span class='button_grey'><{$letter.letter}></span> - <{/if}> - <{if ($smarty.foreach.letters.iteration == (round($alphabetcount/2))+1)}> -</div> -<div><{else}><{/if}> - <{/foreach}> -</div> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/class/download.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -459,14 +459,14 @@ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); // get max file size (setup and php.ini) $phpiniMaxFileSize = (min((int)(ini_get('upload_max_filesize')), (int)(ini_get('post_max_size')), (int)(ini_get('memory_limit')))) * 1024 * 1024; // bytes - $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); + $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); // get allowed mimetypes if (wfdownloads_userIsAdmin()) { - $mimetypeCriteria = new Criteria('mime_admin', true); + $criteria = new Criteria('mime_admin', true); } else { - $mimetypeCriteria = new Criteria('mime_user', true); + $criteria = new Criteria('mime_user', true); } - $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($mimetypeCriteria); + $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria); $allowedExtensions = implode(' | ', $mimetypes); $userfile_file->setDescription( sprintf( @@ -711,7 +711,11 @@ // download: submitter if (!$this->isNew()) { $userCount = $member_handler->getUserCount(); +// IN PROGRESS +// IN PROGRESS +// IN PROGRESS if ($userCount > 200) { + //$sform -> addElement(new XoopsFormText(_AM_WFDOWNLOADS_FILE_SUBMITTERID, 'submitter', 10, 10, $this->getVar('submitter', 'e')), true); $submitter_select = new XoopsFormSelectUser ( _AM_WFDOWNLOADS_FILE_SUBMITTER, 'submitter', false, $this->getVar( 'submitter', @@ -742,10 +746,10 @@ $userfile_file = new XoopsFormFile(_MD_WFDOWNLOADS_UPLOAD_FILEC, 'userfile', 0); // get max file size (setup and php.ini) $phpiniMaxFileSize = min((int)(ini_get('upload_max_filesize')), (int)(ini_get('post_max_size')), (int)(ini_get('memory_limit'))) * 1024 * 1024; // bytes - $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); + $maxFileSize = wfdownloads_bytesToSize1024(min($this->wfdownloads->getConfig('maxfilesize'), $phpiniMaxFileSize)); // get allowed mimetypes - $mimetypeCriteria = new Criteria('mime_admin', true); - $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($mimetypeCriteria); + $criteria = new Criteria('mime_admin', true); + $mimetypes = $this->wfdownloads->getHandler('mimetype')->getList($criteria); $allowedExtensions = implode(' | ', $mimetypes); $userfile_file->setDescription( sprintf( @@ -759,7 +763,7 @@ ); $sform->addElement($userfile_file, false); // download: cid - $categoryObjs = $this->wfdownloads->getHandler('category')->getObjects(); + $categoryObjs = $this->wfdownloads->getHandler('category')->getObjects(); $categoryObjsTree = new XoopsObjectTree($categoryObjs, 'cid', 'pid'); $sform->addElement( new XoopsFormLabel(_AM_WFDOWNLOADS_FILE_CATEGORY, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))) @@ -1224,17 +1228,17 @@ * * @return array */ - public function getActiveDownloads($criteria = null) + public function getActiveDownloads($crit = null) { - if (is_object($criteria)) { - $downloadsCriteria = $criteria; + if (is_object($crit)) { + $criteria = $crit; } else { - $downloadsCriteria = new CriteriaCompo(); + $criteria = new CriteriaCompo(); } - $activeDownloadsCriteria = $this->getActiveCriteria(); - $downloadsCriteria->add($activeDownloadsCriteria); + $active_crit = $this->getActiveCriteria(); + $criteria->add($active_crit); - return $this->getObjects($downloadsCriteria); + return $this->getObjects($criteria); } /** @@ -1244,14 +1248,14 @@ * * @return array/int */ - public function getActiveCount($criteria = null) + public function getActiveCount($crit = null) { - $activeDownloadsCriteria = $this->getActiveCriteria(); - if (is_object($criteria)) { - $activeDownloadsCriteria->add($criteria); + $criteria = $this->getActiveCriteria(); + if (is_object($crit)) { + $criteria->add($crit); } - return $this->getCount($activeDownloadsCriteria); + return $this->getCount($criteria); } /** @@ -1274,24 +1278,24 @@ * * @return bool */ - public function delete($downloadsObj, $force = false) + public function delete($download, $force = false) { - if (parent::delete($downloadsObj, $force)) { - $downloadsCriteria = new Criteria('lid', (int)$download->getVar('lid')); - $this->wfdownloads->getHandler('rating')->deleteAll($downloadsCriteria); - $this->wfdownloads->getHandler('mirror')->deleteAll($downloadsCriteria); - $this->wfdownloads->getHandler('review')->deleteAll($downloadsCriteria); - $this->wfdownloads->getHandler('report')->deleteAll($downloadsCriteria); + if (parent::delete($download, $force)) { + $criteria = new Criteria('lid', (int)$download->getVar('lid')); + $this->wfdownloads->getHandler('rating')->deleteAll($criteria); + $this->wfdownloads->getHandler('mirror')->deleteAll($criteria); + $this->wfdownloads->getHandler('review')->deleteAll($criteria); + $this->wfdownloads->getHandler('report')->deleteAll($criteria); // delete comments - xoops_comment_delete((int)$this->wfdownloads->getModule()->mid(), (int)$downloadsObj->getVar('lid')); + xoops_comment_delete((int)$this->wfdownloads->getModule()->mid(), (int)$download->getVar('lid')); // Formulize module support (2006/05/04) jpc - start if (wfdownloads_checkModule('formulize')) { - if (file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php') && $downloadsObj->getVar('formulize_idreq') > 0) { + if (file_exists(XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php') && $download->getVar('formulize_idreq') > 0) { include_once XOOPS_ROOT_PATH . '/modules/formulize/include/functions.php'; //deleteFormEntries(array($download->getVar('formulize_idreq'))); - $categoryObj = $this->wfdownloads->getHandler('category')->get($downloadsObj->getVar('cid')); - deleteFormEntries(array($downloadsObj->getVar('formulize_idreq')), $categoryObj->getVar('formulize_fid')); + $category = $this->wfdownloads->getHandler('category')->get($download->getVar('cid')); + deleteFormEntries(array($download->getVar('formulize_idreq')), $category->getVar('formulize_fid')); } } // Formulize module support (2006/05/04) jpc - end Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/oninstall.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -20,8 +20,6 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once __DIR__ . '/common.php'; -//@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; -xoops_loadLanguage('admin', $wfdownloads->getModule()->dirname()); define('INDEX_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/index.html'); define('BLANK_FILE_PATH', XOOPS_ROOT_PATH . '/uploads/blank.gif'); @@ -33,6 +31,7 @@ */ function xoops_module_pre_install_wfdownloads(&$xoopsModule) { + xoops_loadLanguage('admin', $xoopsModule->dirname()); // NOP return true; } @@ -44,6 +43,7 @@ */ function xoops_module_install_wfdownloads(&$xoopsModule) { + xoops_loadLanguage('admin', $xoopsModule->dirname()); // get module config values $hModConfig = xoops_gethandler('config'); $configArray = $hModConfig->getConfigsByCat(0, $xoopsModule->getVar('mid')); Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onuninstall.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -20,8 +20,6 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once __DIR__ . '/common.php'; -//@include_once WFDOWNLOADS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/admin.php'; -xoops_loadLanguage('admin', $wfdownloads->getModule()->dirname()); /** * @param $xoopsModule @@ -30,6 +28,7 @@ */ function xoops_module_pre_uninstall_wfdownloads(&$xoopsModule) { + xoops_loadLanguage('admin', $xoopsModule->dirname()); // NOP return true; } @@ -39,5 +38,6 @@ */ function xoops_module_uninstall_wfdownloads(&$xoopsModule) { + xoops_loadLanguage('admin', $xoopsModule->dirname()); // NOP } Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/include/onupdate.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -20,8 +20,7 @@ */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); include_once __DIR__ . '/common.php'; -$wfdownloads = WfdownloadsWfdownloads::getInstance(); -xoops_loadLanguage('admin', $wfdownloads->getModule()->dirname()); + include_once WFDOWNLOADS_ROOT_PATH . '/class/dbupdater.php'; /** @@ -32,6 +31,7 @@ */ function xoops_module_update_wfdownloads(&$xoopsModule, $previousVersion) { + xoops_loadLanguage('admin', $xoopsModule->dirname()); ob_start(); invert_nohtm_dohtml_values(); if ($previousVersion < 322) { Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_breadcrumb.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_breadcrumb.tpl (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_breadcrumb.tpl 2015-02-18 17:22:44 UTC (rev 12994) @@ -0,0 +1,16 @@ +<div class="wfdownloads_headertable"> + <div class="wfdownloads_breadcrumb"> + <{foreach item=bread from=$breadcrumb name=bcloop}> + <span class="bread"> + <{if ($bread.link)}> + <a href="<{$bread.link}>" title="<{$bread.title}>"><{$bread.title}></a> + <{else}> + <{$bread.title}> + <{/if}> + </span> + <{if !$smarty.foreach.bcloop.last}> + <span class="delimiter">></span> + <{/if}> + <{/foreach}> + </div> +</div> Added: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_choicebyletter.tpl =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_choicebyletter.tpl (rev 0) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/templates/wfdownloads_co_choicebyletter.tpl 2015-02-18 17:22:44 UTC (rev 12994) @@ -0,0 +1,96 @@ +<style type="text/css"> + .button_green { + -moz-box-shadow: inset 0 1px 0 0 #d9fbbe; + -webkit-box-shadow: inset 0 1px 0 0 #d9fbbe; + box-shadow: inset 0 1px 0 0 #d9fbbe; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #d9fbbe), color-stop(1, #d9fbbe)); + background: -moz-linear-gradient(center top, #a5cc52 5%, #d9fbbe 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9fbbe', endColorstr='#b8e356'); + background-color: #d9fbbe; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + text-indent: 0; + border: 1px solid #83c41a; + display: inline-block; + color: inherit; + font-family: inherit; + font-size: 12px; + font-weight: bold; + font-style: normal; + height: 20px; + line-height: 20px; + width: auto; + min-width: 10px; + text-decoration: none; + text-align: center; + text-shadow: 1px 1px 0 #d9fbbe; + margin: 2px 0; + padding: 0 4px; + } + + .button_green:hover { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #b8e356), color-stop(1, #a5cc52)); + background: -moz-linear-gradient(center top, #b8e356 5%, #a5cc52 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8e356', endColorstr='#a5cc52'); + background-color: #86ae47; + } + + .button_green:active { + position: relative; + top: 1px; + } + + .button_grey { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf)); + background: -moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + background-color: #ededed; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + text-indent: 0; + border: 1px solid #dcdcdc; + display: inline-block; + color: inherit; + font-family: inherit; + font-size: 12px; + font-weight: bold; + font-style: normal; + height: 20px; + line-height: 20px; + width: auto; + min-width: 10px; + text-decoration: none; + text-align: center; + text-shadow: 1px 1px 0 #ffffff; + margin: 2px 0; + padding: 0 4px; + } + + .button_grey:hover { + background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed)); + background: -moz-linear-gradient(center top, #dfdfdf 5%, #ededed 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); + background-color: #dfdfdf; + } + + .button_grey:active { + position: relative; + top: 1px; + } +</style> +<br/> +<div> + <{assign var="alphabetcount" value=$alphabet|@count}> + <{foreach name=letters item=letter from=$alphabet}> + <{if ($letter.count > 0)}> + <a class='button_green' href='<{$letter.url}>' title='<{$letter.count}>'><{$letter.letter}></a> + <{else}> + <span class='button_grey'><{$letter.letter}></span> + <{/if}> + <{if ($smarty.foreach.letters.iteration == (round($alphabetcount/2))+1)}> +</div> +<div><{else}><{/if}> + <{/foreach}> +</div> Modified: XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php =================================================================== --- XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php 2015-02-18 16:22:25 UTC (rev 12993) +++ XoopsModules/wfdownloads/branches/luciorota/wfdownloads/xoops_version.php 2015-02-18 17:22:44 UTC (rev 12994) @@ -42,8 +42,8 @@ $modversion['onUpdate'] = 'include/onupdate.php'; $modversion['onUninstall'] = 'include/onuninstall.php'; -$modversion['date'] = '2015-02-13'; -$modversion['release_date'] = '2015-02-13'; +$modversion['date'] = '2015-02-18'; +$modversion['release_date'] = '2015-02-18'; $modversion['status'] = 'RC5'; $modversion['teammembers'] = 'Bender, David, FrankBlack, Xpider, M0nty, Mithrandir, Marcan, felix[fx2024], Sudhaker, Jegelstaff'; @@ -327,9 +327,20 @@ ); // Common templates +$modversion['templates'][] = array( + 'file' => $modversion['dirname'] . '_co_breadcrumb.tpl', + 'type' => 'class/common', + 'description' => '' +); +$modversion['templates'][] = array( + 'file' => $modversion['dirname'] . '_co_choicebyletter.tpl', + 'type' => 'class/common', + 'description' => '' +); + // ------------------- Preferences ------------------- xoops_load('XoopsEditorHandler'); |