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] |