From: <zy...@us...> - 2016-05-29 22:53:08
|
Revision: 13211 http://sourceforge.net/p/xoops/svn/13211 Author: zyspec Date: 2016-05-29 22:53:05 +0000 (Sun, 29 May 2016) Log Message: ----------- - removed '/' from void HTML elements (<br>, <img>, <input>, etc) - updated phpdocumentor comments (XOOPS copyright, XOOPS Url, etc.) Modified Paths: -------------- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/about.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_footer.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_header.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/index.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/main.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/menu.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/blocks/partners.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/class/constants.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/class/partners.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/docs/changelog.txt XoopsModules/xoopspartners/branches/zyspec/xoopspartners/footer.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/header.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/include/action.module.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/index.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/join.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/language/english/admin.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/language/english/blocks.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/language/english/help/help.html XoopsModules/xoopspartners/branches/zyspec/xoopspartners/language/english/main.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/language/english/modinfo.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/templates/blocks/xoopspartners_block_site.tpl XoopsModules/xoopspartners/branches/zyspec/xoopspartners/templates/xoopspartners_index.tpl XoopsModules/xoopspartners/branches/zyspec/xoopspartners/vpartner.php XoopsModules/xoopspartners/branches/zyspec/xoopspartners/xoops_version.php Modified: XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/about.php =================================================================== --- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/about.php 2016-05-29 20:10:16 UTC (rev 13210) +++ XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/about.php 2016-05-29 22:53:05 UTC (rev 13211) @@ -1,31 +1,34 @@ -<?php -/* - * XoopsPartners module - * - * 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. - */ -/** - * XoopsPartners - a partner affiliation links modulerequire __DIR__ . '/admin_header.php'; - * - * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}$indexAdmin = new ModuleAdmin(); - * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license}$pathImageIcon = XOOPS_URL .'/'. $moduleInfo->getInfo('icons16'); - * @package:: xoopspartners - * @author:: Mage, Mamba - * @since:: 1.11 - * @version:: $Id: $ - */ - -require __DIR__ . '/admin_header.php'; -include '../../../class/xoopsformloader.php'; - -$aboutAdmin = new ModuleAdmin(); - -echo $aboutAdmin->addNavigation('about.php'); -echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); - -include __DIR__ . '/admin_footer.php'; +<?php +/* + * XoopsPartners module + * + * 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. + */ +/** + * Module: XoopsPartners - a partner affiliation links module + * + * @category Module + * @package xoopspartners + * @subpackage admin + * @author Mage, Mamba + * @author XOOPS Module Development Team + * @copyright {@link http://xoops.org 2001-2016 XOOPS Project} + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @link http://xoops.org XOOPS + * @since 1.11 + */ + +require __DIR__ . '/admin_header.php'; +include '../../../class/xoopsformloader.php'; + +$aboutAdmin = new ModuleAdmin(); + +echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); + +include __DIR__ . '/admin_footer.php'; Modified: XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_footer.php =================================================================== --- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_footer.php 2016-05-29 20:10:16 UTC (rev 13210) +++ XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_footer.php 2016-05-29 22:53:05 UTC (rev 13211) @@ -1,35 +1,39 @@ -<?php -/* - * XoopsPartner module - * - * 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:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package:: xoopspartners - * @since:: 1.11 - * @author:: XOOPS Development Team - * @version: $Id: $ - **/ - -if (!isset($moduleInfo) || !is_a($moduleInfo, 'XoopsModule')) { - $module_handler =& xoops_gethandler('module'); - $xoopsModule =& XoopsModule::getByDirname('mylinks'); - $moduleInfo =& $module_handler->get($xoopsModule->getVar('mid')); - $pathIcon32 = $moduleInfo->getInfo('icons32'); -} - -echo "<div class='adminfooter'>\n" - ." <div class='txtcenter'>\n" - ." <a href='" . $moduleInfo->getInfo('author_website_url') . "' target='_blank'><img src='" . $GLOBALS['xoops']->url("www/{$pathIcon32}/xoopsmicrobutton.gif") . "' alt='" . $xoopsModule->getInfo('author_website_name') . "' title='" . $moduleInfo->getInfo('author_website_name') . "' /></a>\n" - ." </div>\n" - ." " . _AM_XPARTNERS_ADMIN_FOOTER . "\n" - ."</div>\n"; - -xoops_cp_footer(); +<?php +/* + * XoopsPartner module + * + * 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. + */ +/** + * Module: XoopsPartners - a partner affiliation links module + * + * @category Module + * @package xoopspartners + * @subpackage admin + * @author XOOPS Module Development Team + * @copyright {@link http://xoops.org 2001-2016 XOOPS Project} + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @link http://xoops.org XOOPS + * @since 1.11 + */ + +if (!isset($moduleInfo) || !is_a($moduleInfo, 'XoopsModule')) { + $module_handler =& xoops_gethandler('module'); + $xoopsModule =& XoopsModule::getByDirname('mylinks'); + $moduleInfo =& $module_handler->get($xoopsModule->getVar('mid')); + $pathIcon32 = $moduleInfo->getInfo('icons32'); +} + +echo "<div class='adminfooter'>\n" + ." <div class='txtcenter'>\n" + ." <a href='" . $moduleInfo->getInfo('author_website_url') . "' target='_blank'><img src='" . $GLOBALS['xoops']->url("www/{$pathIcon32}/xoopsmicrobutton.gif") . "' alt='" . $xoopsModule->getInfo('author_website_name') . "' title='" . $moduleInfo->getInfo('author_website_name') . "'></a>\n" + ." </div>\n" + ." " . _AM_XPARTNERS_ADMIN_FOOTER . "\n" + ."</div>\n"; + +xoops_cp_footer(); Modified: XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_header.php =================================================================== --- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_header.php 2016-05-29 20:10:16 UTC (rev 13210) +++ XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/admin_header.php 2016-05-29 22:53:05 UTC (rev 13211) @@ -1,58 +1,61 @@ -<?php -/* - * XoopsPartners module - * - * 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:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package:: xoopspartners - * @subpackage:: admin - * @since:: 1.11 - * @author:: XOOPS Team - * @version:: $Id: $ - **/ - -require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; -include_once $GLOBALS['xoops']->path('/include/cp_functions.php'); -require $GLOBALS['xoops']->path('/include/cp_header.php'); - -$moduleDirname = basename(dirname(__DIR__)); -xoops_load('constants', $moduleDirname); - -//Load languages -$moduleDirname = $GLOBALS['xoopsModule']->getVar('dirname', 'n'); -xoops_loadLanguage('admin', $moduleDirname); -xoops_loadLanguage('modinfo', $moduleDirname); -xoops_loadLanguage('main', $moduleDirname); - -if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ - include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); - //return true; -} else { - echo xoops_error(_AM_XPARTNERS_ERROR_MODADMIN); - //return false; -} - -$moduleHandler =& xoops_gethandler('module'); -$moduleInfo =& $moduleHandler->get($GLOBALS['xoopsModule']->getVar('mid')); -$pathIcon16 = $GLOBALS['xoopsModule']->getInfo('icons16'); -$pathIcon32 = $GLOBALS['xoopsModule']->getInfo('icons32'); -$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); -//$pathImageIcon = XOOPS_URL .'/'. $moduleInfo->getInfo('icons16'); -//$pathImageAdmin = XOOPS_URL .'/'. $moduleInfo->getInfo('icons32'); - -$myts =& MyTextSanitizer::getInstance(); - -if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { - include_once $GLOBALS['xoops']->path("/class/template.php"); - $GLOBALS['xoopsTpl'] = new XoopsTpl(); -} - -xoops_cp_header(); +<?php +/* + * XoopsPartners module + * + * 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. + */ +/** + * Module: XoopsPartners - a partner affiliation links module + * + * @category Module + * @package xoopspartners + * @subpackage admin + * @author XOOPS Module Development Team + * @copyright {@link http://xoops.org 2001-2016 XOOPS Project} + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @link http://xoops.org XOOPS + * @since 1.11 + */ + +require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; +include_once $GLOBALS['xoops']->path('/include/cp_functions.php'); +require $GLOBALS['xoops']->path('/include/cp_header.php'); + +$moduleDirName = basename(dirname(__DIR__)); +xoops_load('constants', $moduleDirName); + +//Load languages +$moduleDirName = $GLOBALS['xoopsModule']->getVar('dirname', 'n'); +xoops_loadLanguage('admin', $moduleDirName); +xoops_loadLanguage('modinfo', $moduleDirName); +xoops_loadLanguage('main', $moduleDirName); + +if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); + //return true; +} else { + echo xoops_error(_AM_XPARTNERS_ERROR_MODADMIN); + //return false; +} + +$moduleHandler =& xoops_gethandler('module'); +$moduleInfo =& $moduleHandler->get($GLOBALS['xoopsModule']->getVar('mid')); +$pathIcon16 = $GLOBALS['xoopsModule']->getInfo('icons16'); +$pathIcon32 = $GLOBALS['xoopsModule']->getInfo('icons32'); +$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin'); +//$pathImageIcon = XOOPS_URL .'/'. $moduleInfo->getInfo('icons16'); +//$pathImageAdmin = XOOPS_URL .'/'. $moduleInfo->getInfo('icons32'); + +$myts =& MyTextSanitizer::getInstance(); + +if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { + include_once $GLOBALS['xoops']->path("/class/template.php"); + $GLOBALS['xoopsTpl'] = new XoopsTpl(); +} + +xoops_cp_header(); Modified: XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/index.php =================================================================== --- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/index.php 2016-05-29 20:10:16 UTC (rev 13210) +++ XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/index.php 2016-05-29 22:53:05 UTC (rev 13211) @@ -1,62 +1,65 @@ -<?php - -/*------------------------------------------------------------------------ - 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. - - 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 - ------------------------------------------------------------------------ - Author: Raul Recio (AKA UNFOR) - Project: The XOOPS Project - ------------------------------------------------------------------------- - */ -/** - * XoopsParnters Administration - * - * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package:: xoopspartners - * @since:: 1.11 - * @author:: Raul Recio (aka UNFOR) - * @version: $Id: $ - */ - -require __DIR__ . '/admin_header.php'; -$adminClass = new ModuleAdmin(); - -//----------------------- -$xpPartnerHandler =& xoops_getmodulehandler('partners', $xoopsModule->getVar('dirname', 'n')); - -$totalPartners = $xpPartnerHandler->getCount(); -$totalNonActivePartners = $xpPartnerHandler->getCount(new Criteria('status', 0, '=')); -$totalActivePartners = $totalPartners - $totalNonActivePartners; - -$adminClass->addInfoBox(_MD_XPARTNERS_DASHBOARD); - -$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALACTIVE. "</infolabel>", $totalActivePartners, 'Green'); -$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALNONACTIVE. "</infolabel>", $totalNonActivePartners, 'Red'); -$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALPARTNERS. "</infolabel><infotext>", $totalPartners."</infotext>"); -//---------------------------- - -echo $adminClass->addNavigation('index.php'); -echo $adminClass->renderIndex(); - -include __DIR__ . '/admin_footer.php'; +<?php + +/*------------------------------------------------------------------------ + 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. + + 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 + ------------------------------------------------------------------------ + Author: Raul Recio (AKA UNFOR) + Project: The XOOPS Project + ------------------------------------------------------------------------- + */ +/** + * Module: XoopsPartners - a partner affiliation links module + * + * @category Module + * @package xoopspartners + * @subpackage admin + * @author Raul Recio (aka UNFOR) + * @author XOOPS Module Development Team + * @copyright {@link http://xoops.org 2001-2016 XOOPS Project} + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @link http://xoops.org XOOPS + * @since 1.11 + */ + +require __DIR__ . '/admin_header.php'; +$adminClass = new ModuleAdmin(); + +//----------------------- +$xpPartnerHandler =& xoops_getmodulehandler('partners', $xoopsModule->getVar('dirname', 'n')); + +$totalPartners = $xpPartnerHandler->getCount(); +$totalNonActivePartners = $xpPartnerHandler->getCount(new Criteria('status', 0, '=')); +$totalActivePartners = $totalPartners - $totalNonActivePartners; + +$adminClass->addInfoBox(_MD_XPARTNERS_DASHBOARD); + +$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALACTIVE. "</infolabel>", $totalActivePartners, 'Green'); +$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALNONACTIVE. "</infolabel>", $totalNonActivePartners, 'Red'); +$adminClass->addInfoBoxLine(_MD_XPARTNERS_DASHBOARD, "<infolabel>" ._MD_XPARTNERS_TOTALPARTNERS. "</infolabel><infotext>", $totalPartners."</infotext>"); +//---------------------------- + +echo $adminClass->addNavigation('index.php'); +echo $adminClass->renderIndex(); + +include __DIR__ . '/admin_footer.php'; Modified: XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/main.php =================================================================== --- XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/main.php 2016-05-29 20:10:16 UTC (rev 13210) +++ XoopsModules/xoopspartners/branches/zyspec/xoopspartners/admin/main.php 2016-05-29 22:53:05 UTC (rev 13211) @@ -1,363 +1,368 @@ -<?php -/* - ------------------------------------------------------------------------ - 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. - - 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 - ------------------------------------------------------------------------ - Author: Raul Recio (AKA UNFOR) - Project: The XOOPS Project - ------------------------------------------------------------------------- -*/ -/** - * XoopsPartners - a partner affiliation links module - * - * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} - * @license:: {@link http://www.fsf.org/copyleft/gpl.html GNU public license} - * @package:: xoopspartners - * @author:: Raul Recio (aka unfor) - * @version:: $Id: $ - */ -require __DIR__ . '/admin_header.php'; -$adminClass = new ModuleAdmin(); -$pathImageIcon = $GLOBALS['xoops']->url('www/'. $moduleInfo->getInfo('icons16')); - -$myts =& MyTextSanitizer::getInstance(); - -xoops_load('XoopsRequest'); -$op = XoopsRequest::getCmd('op', ''); -$id = XoopsRequest::getInt('id', 0); - -$del = isset($_POST['del']) ? XoopsRequest::getInt('del', XoopspartnersConstants::CONFIRM_NOT_OK, 'POST') : null; -$hits = isset($_POST['hits']) ? XoopsRequest::getint('hits', 0, 'POST') : null; -$url = isset($_POST['url']) ? XoopsRequest::getString('url', '', 'POST') : null; -$image = isset($_POST['image']) ? XoopsRequest::getText('image', '', 'POST') : null; -$title = isset($_POST['title']) ? XoopsRequest::getString('title', '', 'POST') : null; -$description = isset($_POST['description']) ? XoopsRequest::getText('description', '', 'POST') : null; -$status = isset($_POST['status']) ? XoopsRequest::getInt('status', array(), 'POST') : null; - -switch ($op) { - - case 'partnersAdmin': - default: - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - - echo $adminClass->addNavigation('main.php'); - $adminClass->addItemButton(_AM_XPARTNERS_ADD, 'main.php' . '?op=partnersAdminAdd', $icon = 'add'); - echo $adminClass->renderButton(); - - echo " <form action='main.php' method='post' name='reorderform'>\n" - . " <table style='margin: 1px; padding: 0px;' class='outer width100 bnone'>\n" - . " <thead>\n" - . " <tr>\n" - . " <th class='txtcenter width20'>" . _AM_XPARTNERS_TITLE . "</th>\n" - . " <th style='width: 3%; text-align: center;'>" . _AM_XPARTNERS_IMAGE . "</th>\n" - . " <th>" . _AM_XPARTNERS_DESCRIPTION . "</th>\n" - . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_ACTIVE . "</th>\n" - . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_WEIGHT . "</th>\n" - . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_HITS . "</th>\n" - . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_ACTIONS . "</th>\n" - . " </tr>\n" - . " </thead>\n" - . " <tbody\n"; - - $criteria = new CriteriaCompo(); - $criteria->setSort('status DESC, weight ASC, title'); - $criteria->setOrder('DESC'); - $partnerObjs = $xpPartnerHandler->getAll($criteria); - $class = 'even'; - $maxWidth = $GLOBALS['xoopsModuleConfig']['maxwidth']; - $maxHeight = $GLOBALS['xoopsModuleConfig']['maxheight']; - foreach ($partnerObjs as $partnerObj) { - $url = formatURL($partnerObj->getVar('url')); - $image = formatURL($partnerObj->getVar('image')); - $title = $partnerObj->getVar('title'); - $description = $partnerObj->getVar('description'); - //@TODO - find a way to check size of remote image if allow_url_fopen=0 - if ($imageInfo = @getimagesize($image)) { //note this will "fail" if server set with allow_url_fopen=0 - $imageWidth = $imageInfo[0]; - $imageHeight = $imageInfo[1]; - $errorMsg = ($imageWidth > $maxWidth || $imageHeight > $maxHeight) ? "<br />" . _AM_XPARTNERS_IMAGE_ERROR : ''; - } else { - $imageWidth = $maxWidth; - $imageHeight = $maxHeight; - $errorMsg = ''; - } - if (1 == $partnerObj->getVar('status')) { - $check1 = " selected='selected'"; - $check2 = ""; - } else { - $check1 = ""; - $check2 = " selected='selected'"; - } - echo " <tr>\n" - . " <td class='{$class} width20 txtcenter alignmiddle'><a href='{$url}' rel='external'>{$title}</a></td>\n" - . " <td class='{$class} width3 txtcenter'>"; - if (!empty($image)) { - echo "<img src='{$image}' alt='{$title}' style='width: " . intval(.65 * $imageWidth) . "px; height: " . intval(.65 * $imageHeight) . "px;' />{$errorMsg}"; - } else { - echo " "; - } - - echo " </td>\n" - . " <td class='{$class} alignmiddle'>{$description}</td>\n" - . " <td class='{$class} width3 txtcenter alignmiddle'>\n" - . " <select name='status[" . $partnerObj->getVar('id') . "]'>\n" - . " <option value='0'{$check2}>" . _NO . "</option>\n" - . " <option value='1'{$check1}>" . _YES . "</option>\n" - . " </select>\n" - . " <td class='{$class} width3 txtcenter alignmiddle'>\n" - . " <input type='number' class='txtcenter' name='weight[" . $partnerObj->getVar('id') . "]' value='" . $partnerObj->getVar('weight') . "' min='0' size='3' />\n" - . " </td>\n" - . " <td class='{$class} width3 txtcenter alignmiddle'>" . $partnerObj->getVar('hits') . "</td>\n" - . " <td class='{$class} width3 txtcenter alignmiddle'>\n" - . " <a href='main.php?op=editPartner&id=" . $partnerObj->getVar('id') . "'><img src='{$pathImageIcon}/edit.png' alt='" . _EDIT . "' title='" . _EDIT . "' /></a>\n" - . " <a href='main.php?op=delPartner&id=" . $partnerObj->getVar('id') . "'><img src='{$pathImageIcon}/delete.png' alt='" . _DELETE . "' title='" . _DELETE . "' /></a>\n" - . " </td>\n" - . " </tr>\n"; - $class = ($class == 'odd') ? 'even' : 'odd'; - } - if (empty($partnerObjs)) { - echo "<tr><td class='{$class} txtcenter bold line140' colspan='7'>" . _AM_XPARTNERS_NOPARTNERS . "</td></tr>\n"; - $adminButtons = ''; - } else { - $adminButtons = " <input type='button' name='button' onclick=\"location='main.php?op=reorderAutoPartners'\" value='" . _AM_XPARTNERS_AUTOMATIC_SORT . "' />\n" - . " <input type='submit' name='submit' value='" . _AM_XPARTNERS_UPDATE . "' />"; - - } - echo" <tr>\n" - . " <td class='foot txtright' colspan='7'>\n" - . " <input type='hidden' name='op' value='reorderPartners' />\n" -// . " <input type='button' name='button' onclick=\"location='main.php?op=partnersAdminAdd'\" value='" . _AM_XPARTNERS_ADD . "' />\n" - . "{$adminButtons}\n" - . " </td>\n" - . " </tr>\n" - . " </tbody>\n" - . " </table>\n" - . " </form>\n"; - - unset($partnerObjs); - include __DIR__ . '/admin_footer.php'; - break; - - case 'reorderPartners': - $weight = isset($_POST['weight']) ? XoopsRequest::getArray('weight', array(), 'POST') : null; - $status = isset($_POST['status']) ? XoopsRequest::getArray('status', array(), 'POST') : null; - - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $partnerCount = $xpPartnerHandler->getCount(); - if ($partnerCount) { - foreach ($weight as $id => $order) { - if (intval($id) > XoopspartnersConstants::DEFAULT_PID) { - $order = ((!empty($order)) && (intval($order) > XoopspartnersConstants::DEFAULT_WEIGHT)) ? intval($order) : XoopspartnersConstants::DEFAULT_WEIGHT; - $stat = (!empty($status[$id]) && ($status[$id] > XoopspartnersConstants::STATUS_INACTIVE)) ? intval($status[$id]) : XoopspartnersConstants::STATUS_INACTIVE; - $thisObj = $xpPartnerHandler->get($id); - if (!empty($thisObj) && ($thisObj instanceof XoopspartnersPartners)) { - $thisObj->setVars(array('weight' => $order, 'status' => $stat)); - $xpPartnerHandler->insert($thisObj); - unset($thisObj); - } - } - } - redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); - } else { - redirect_header("main.php?op=partnersAdminAdd", XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_EMPTYDATABASE, false); - } - break; - - case 'reorderAutoPartners': - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $partnerObjs = $xpPartnerHandler->getAll(null, array('weight')); - $partnerCount = count($partnerObjs); - $weight = XoopspartnersConstants::DEFAULT_WEIGHT; - if ($partnerCount > 1) { - foreach ($partnerObjs as $thisObj) { - ++$weight; - $thisObj->setVar('weight', $weight); - $xpPartnerHandler->insert($thisObj); - unset($thisObj); - } - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); - } else { - redirect_header('main.php?op=partnersAdminAdd', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_EMPTYDATABASE, false); - } - break; - - case 'partnersAdminAdd': - echo $adminClass->addNavigation('main.php?op=partnersAdminAdd'); - //echo "<h4>"._AM_XPARTNERS_ADD."</h4>"; - - include $GLOBALS['xoops']->path('/class/xoopsformloader.php'); - $form = new XoopsThemeForm(_AM_XPARTNERS_ADDPARTNER, "addform", "main.php", "post", true); - $formWeight = new XoopsFormText(_AM_XPARTNERS_WEIGHT, "weight", 3, 10, XoopspartnersConstants::DEFAULT_WEIGHT); - $formImage = new XoopsFormText(_AM_XPARTNERS_IMAGE, "image", 100, 150, 'http://'); - $formUrl = new XoopsFormText(_AM_XPARTNERS_URL, "url", 100, 150, 'http://'); - $formTitle = new XoopsFormText(_AM_XPARTNERS_TITLE, "title", 100, 150); - $formDesc = new XoopsFormTextArea(_AM_XPARTNERS_DESCRIPTION, "description", "", 10, "60"); - $statOnTxt - = " <img src='{$pathImageIcon}/on.png' alt='" . _AM_XPARTNERS_ACTIVE . "' /> " . _AM_XPARTNERS_ACTIVE - . " "; - $statOffTxt - = " <img src='{$pathImageIcon}/off.png' alt='" . _AM_XPARTNERS_INACTIVE . "' /> " - . _AM_XPARTNERS_INACTIVE . " "; - $formStat = new XoopsFormRadioYN(_AM_XPARTNERS_STATUS, 'status', XoopspartnersConstants::STATUS_ACTIVE, $statOnTxt, $statOffTxt); - $opHidden = new XoopsFormHidden("op", "addPartner"); - $submitButton = new XoopsFormButton("", "submit", _AM_XPARTNERS_ADDPARTNER, "submit"); - $form->addElement($formTitle, true); - $form->addElement($formImage); - $form->addElement($formUrl, true); - $form->addElement($formWeight); - $form->addElement($formDesc, true); - $form->addElement($formStat); - $form->addElement($opHidden); - $form->addElement($submitButton); - $form->display(); - include __DIR__ . '/admin_footer.php'; - break; - - case 'addPartner': - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $newPartner = $xpPartnerHandler->create(); - $status = ((!empty($status)) && (intval($status) > 0)) ? intval($status) : XoopspartnersConstants::STATUS_INACTIVE; - $weight = XoopsRequest::getInt('weight', XoopspartnersConstants::DEFAULT_WEIGHT, 'POST'); - $title = isset($title) ? trim($title) : ''; - $url = isset($url) ? trim($url) : ''; - $image = isset($image) ? trim($image) : ''; - $image = $myts->addSlashes(formatURL($image)); - $description = isset($description) ? trim($description) : ''; - if (empty($title) || empty($url) || empty($description)) { - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_BESURE); - } - $newPartner->setVars(array('url' => $myts->addSlashes(formatURL($url)), - 'image' => $image, - 'title' => $myts->addSlashes($title), - 'description' => $myts->addSlashes($description), - 'status' => $status, - 'weight' => $weight) - ); - - if ($GLOBALS['xoopsSecurity']->check() && $xpPartnerHandler->insert($newPartner)) { - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); - } else { - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_NOTUPDATED . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()) - ); - } - break; - - case 'editPartner': - echo $adminClass->addNavigation('main.php'); - $id = (intval($id) > XoopspartnersConstants::DEFAULT_PID) ? intval($id) : XoopspartnersConstants::DEFAULT_PID; - - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $partnerObj = $xpPartnerHandler->get($id); - if (!empty($partnerObj) && ($partnerObj instanceof XoopspartnersPartners)) { - $partnerVars = $partnerObj->getValues(); - //url, image, title, and description are all txtboxes so they have gone through htmlspecialchars via XoopsObject getVar - - include $GLOBALS['xoops']->path("/class/xoopsformloader.php"); - $form = new XoopsThemeForm(_AM_XPARTNERS_EDITPARTNER, 'editform', 'main.php', "post", true); - $formWeight = new XoopsFormText(_AM_XPARTNERS_WEIGHT, 'weight', 3, 10, $partnerVars['weight']); - $formHits = new XoopsFormText(_AM_XPARTNERS_HITS, 'hits', 3, 10, $partnerVars['hits']); - $formImage = new XoopsFormText(_AM_XPARTNERS_IMAGE, 'image', 50, 150, $partnerVars['image']); - $formUrl = new XoopsFormText(_AM_XPARTNERS_URL, 'url', 50, 150, $partnerVars['url']); - $formTitle = new XoopsFormText(_AM_XPARTNERS_TITLE, 'title', 50, 150, $partnerVars['title']); - $formDesc = new XoopsFormTextArea(_AM_XPARTNERS_DESCRIPTION, 'description', $partnerVars['description'], 10, '100%'); - - $statOnTxt = " <img src='{$pathImageIcon}/on.png' alt='" . _AM_XPARTNERS_ACTIVE . "' /> " . _AM_XPARTNERS_ACTIVE . " "; - $statOffTxt = " <img src='{$pathImageIcon}/off.png' alt='" . _AM_XPARTNERS_INACTIVE . "' /> " . _AM_XPARTNERS_INACTIVE . " "; - $formStat = new XoopsFormRadioYN(_AM_XPARTNERS_STATUS, 'status', $partnerVars['status'], $statOnTxt, $statOffTxt); - - $submitButton = new XoopsFormButton("", "submit", _SUBMIT, "submit"); - $form->addElement($formTitle, true); - $form->addElement($formImage); - $form->addElement($formUrl, true); - $form->addElement($formWeight); - $form->addElement($formDesc, true); - $form->addElement($formHits); - $form->addElement($formStat); - $form->addElement(new XoopsFormHidden("id", $id)); - $form->addElement(new XoopsFormHidden("op", "updatePartner")); - $form->addElement($submitButton); - $form->display(); - include __DIR__ . '/admin_footer.php'; - } else { - redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_INVALIDID); - } - break; - - case 'updatePartner': - $title = isset($title) ? trim($title) : ''; - $image = isset($image) ? trim($image) : ''; - $image = $myts->addSlashes(formatURL($image)); - $url = isset($url) ? trim($url) : ''; - $description = isset($description) ? trim($description) : ''; - $id = ($id > XoopspartnersConstants::DEFAULT_PID) ? $id : XoopspartnersConstants::DEFAULT_PID; - $status = ((!empty($status)) && ($status > XoopspartnersConstants::STATUS_INACTIVE)) ? intval($status) : XoopspartnersConstants::STATUS_INACTIVE; - $weight = XoopsRequest::getInt('weight', XoopspartnersConstants::DEFAULT_WEIGHT, 'POST'); - $weight = (($weight > XoopspartnersConstants::DEFAULT_WEIGHT)) ? $weight : XoopspartnersConstants::DEFAULT_WEIGHT; - $hits = ((!empty($hits)) && (intval($hits) > 0)) ? intval($hits) : 0; - if ($title == '' || $url == '' || empty($id) || $description == '') { - redirect_header("main.php?op=edit_partner&id={$id}", XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_BESURE); - } - /* - if (!empty($image)) { - $image_info = exif_imagetype($image);; - if (false === $image_info) { - redirect_header("main.php?op=edit_partner&id={$id}", 1, _AM_XPARTNERS_NOEXIST); - } - } - */ - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $partnerObj = $xpPartnerHandler->get($id); - if ($GLOBALS['xoopsSecurity']->check() && ($partnerObj instanceof XoopspartnersPartners)) { - $partnerObj->setVar('url', $myts->addSlashes(formatURL($url))); - $partnerObj->setVar('title', $myts->addSlashes($title)); - $partnerObj->setVar('description', $myts->addSlashes($description)); - $partnerObj->setVar('hits', $hits); - $partnerObj->setVar('weight', $weight); - $partnerObj->setVar('status', $status); - $partnerObj->setVar('image', $image); - $success = $xpPartnerHandler->insert($partnerObj); - if ($success) { - redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); - } - } - redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_NOTUPDATED . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); - break; - - case 'delPartner': - if ((XoopspartnersConstants::CONFIRM_OK == $del) && ($id > XoopspartnersConstants::DEFAULT_PID)) { - $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); - $partnerObj = $xpPartnerHandler->get($id); - if ($partnerObj instanceof XoopspartnersPartners) { - if ($xpPartnerHandler->delete($partnerObj)) { - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); - } - } - redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_NOTUPDATED); - } else { - echo $adminClass->addNavigation('main.php'); - xoops_confirm(array('op' => 'delPartner', 'id' => intval($id), 'del' => XoopspartnersConstants::CONFIRM_OK), 'main.php', _AM_XPARTNERS_SUREDELETE); - include __DIR__ . '/admin_footer.php'; - } - break; -} +<?php +/* + ------------------------------------------------------------------------ + 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. + + 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 + ------------------------------------------------------------------------ + Author: Raul Recio (AKA UNFOR) + Project: The XOOPS Project + ------------------------------------------------------------------------- +*/ +/** + * Module: XoopsPartners - a partner affiliation links module + * + * @category Module + * @package xoopspartners + * @subpackage admin + * @author Raul Recio (aka UNFOR) + * @author XOOPS Module Development Team + * @copyright {@link http://xoops.org 2001-2016 XOOPS Project} + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @link http://xoops.org XOOPS + * @since 1.11 + */ + +require __DIR__ . '/admin_header.php'; +$adminClass = new ModuleAdmin(); +$pathImageIcon = $GLOBALS['xoops']->url('www/'. $moduleInfo->getInfo('icons16')); + +$myts =& MyTextSanitizer::getInstance(); + +xoops_load('XoopsRequest'); +$op = XoopsRequest::getCmd('op', ''); +$id = XoopsRequest::getInt('id', 0); + +$del = isset($_POST['del']) ? XoopsRequest::getInt('del', XoopspartnersConstants::CONFIRM_NOT_OK, 'POST') : null; +$hits = isset($_POST['hits']) ? XoopsRequest::getint('hits', 0, 'POST') : null; +$url = isset($_POST['url']) ? XoopsRequest::getString('url', '', 'POST') : null; +$image = isset($_POST['image']) ? XoopsRequest::getText('image', '', 'POST') : null; +$title = isset($_POST['title']) ? XoopsRequest::getString('title', '', 'POST') : null; +$description = isset($_POST['description']) ? XoopsRequest::getText('description', '', 'POST') : null; +$status = isset($_POST['status']) ? XoopsRequest::getInt('status', array(), 'POST') : null; + +switch ($op) { + + case 'partnersAdmin': + default: + $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); + + echo $adminClass->addNavigation('main.php'); + $adminClass->addItemButton(_AM_XPARTNERS_ADD, 'main.php' . '?op=partnersAdminAdd', $icon = 'add'); + echo $adminClass->renderButton(); + + echo " <form action='main.php' method='post' name='reorderform'>\n" + . " <table style='margin: 1px; padding: 0px;' class='outer width100 bnone'>\n" + . " <thead>\n" + . " <tr>\n" + . " <th class='txtcenter width20'>" . _AM_XPARTNERS_TITLE . "</th>\n" + . " <th style='width: 3%; text-align: center;'>" . _AM_XPARTNERS_IMAGE . "</th>\n" + . " <th>" . _AM_XPARTNERS_DESCRIPTION . "</th>\n" + . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_ACTIVE . "</th>\n" + . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_WEIGHT . "</th>\n" + . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_HITS . "</th>\n" + . " <th class='width3 txtcenter'>" . _AM_XPARTNERS_ACTIONS . "</th>\n" + . " </tr>\n" + . " </thead>\n" + . " <tbody\n"; + + $criteria = new CriteriaCompo(); + $criteria->setSort('status DESC, weight ASC, title'); + $criteria->setOrder('DESC'); + $partnerObjs = $xpPartnerHandler->getAll($criteria); + $class = 'even'; + $maxWidth = $GLOBALS['xoopsModuleConfig']['maxwidth']; + $maxHeight = $GLOBALS['xoopsModuleConfig']['maxheight']; + foreach ($partnerObjs as $partnerObj) { + $url = formatURL($partnerObj->getVar('url')); + $image = formatURL($partnerObj->getVar('image')); + $title = $partnerObj->getVar('title'); + $description = $partnerObj->getVar('description'); + //@TODO - find a way to check size of remote image if allow_url_fopen=0 + if ($imageInfo = @getimagesize($image)) { //note this will "fail" if server set with allow_url_fopen=0 + $imageWidth = $imageInfo[0]; + $imageHeight = $imageInfo[1]; + $errorMsg = ($imageWidth > $maxWidth || $imageHeight > $maxHeight) ? "<br>" . _AM_XPARTNERS_IMAGE_ERROR : ''; + } else { + $imageWidth = $maxWidth; + $imageHeight = $maxHeight; + $errorMsg = ''; + } + if (1 == $partnerObj->getVar('status')) { + $check1 = " selected='selected'"; + $check2 = ""; + } else { + $check1 = ""; + $check2 = " selected='selected'"; + } + echo " <tr>\n" + . " <td class='{$class} width20 txtcenter alignmiddle'><a href='{$url}' rel='external'>{$title}</a></td>\n" + . " <td class='{$class} width3 txtcenter'>"; + if (!empty($image)) { + echo "<img src='{$image}' alt='{$title}' style='width: " . intval(.65 * $imageWidth) . "px; height: " . intval(.65 * $imageHeight) . "px;'>{$errorMsg}"; + } else { + echo " "; + } + + echo " </td>\n" + . " <td class='{$class} alignmiddle'>{$description}</td>\n" + . " <td class='{$class} width3 txtcenter alignmiddle'>\n" + . " <select name='status[" . $partnerObj->getVar('id') . "]'>\n" + . " <option value='0'{$check2}>" . _NO . "</option>\n" + . " <option value='1'{$check1}>" . _YES . "</option>\n" + . " </select>\n" + . " <td class='{$class} width3 txtcenter alignmiddle'>\n" + . " <input type='number' class='txtcenter' name='weight[" . $partnerObj->getVar('id') . "]' value='" . $partnerObj->getVar('weight') . "' min='0' size='3'>\n" + . " </td>\n" + . " <td class='{$class} width3 txtcenter alignmiddle'>" . $partnerObj->getVar('hits') . "</td>\n" + . " <td class='{$class} width3 txtcenter alignmiddle'>\n" + . " <a href='main.php?op=editPartner&id=" . $partnerObj->getVar('id') . "'><img src='{$pathImageIcon}/edit.png' alt='" . _EDIT . "' title='" . _EDIT . "'></a>\n" + . " <a href='main.php?op=delPartner&id=" . $partnerObj->getVar('id') . "'><img src='{$pathImageIcon}/delete.png' alt='" . _DELETE . "' title='" . _DELETE . "'></a>\n" + . " </td>\n" + . " </tr>\n"; + $class = ($class == 'odd') ? 'even' : 'odd'; + } + if (empty($partnerObjs)) { + echo "<tr><td class='{$class} txtcenter bold line140' colspan='7'>" . _AM_XPARTNERS_NOPARTNERS . "</td></tr>\n"; + $adminButtons = ''; + } else { + $adminButtons = " <input type='button' name='button' onclick=\"location='main.php?op=reorderAutoPartners'\" value='" . _AM_XPARTNERS_AUTOMATIC_SORT . "'>\n" + . " <input type='submit' name='submit' value='" . _AM_XPARTNERS_UPDATE . "'>"; + + } + echo" <tr>\n" + . " <td class='foot txtright' colspan='7'>\n" + . " <input type='hidden' name='op' value='reorderPartners'>\n" +// . " <input type='button' name='button' onclick=\"location='main.php?op=partnersAdminAdd'\" value='" . _AM_XPARTNERS_ADD . "'>\n" + . "{$adminButtons}\n" + . " </td>\n" + . " </tr>\n" + . " </tbody>\n" + . " </table>\n" + . " </form>\n"; + + unset($partnerObjs); + include __DIR__ . '/admin_footer.php'; + break; + + case 'reorderPartners': + $weight = isset($_POST['weight']) ? XoopsRequest::getArray('weight', array(), 'POST') : null; + $status = isset($_POST['status']) ? XoopsRequest::getArray('status', array(), 'POST') : null; + + $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); + $partnerCount = $xpPartnerHandler->getCount(); + if ($partnerCount) { + foreach ($weight as $id => $order) { + if (intval($id) > XoopspartnersConstants::DEFAULT_PID) { + $order = ((!empty($order)) && (intval($order) > XoopspartnersConstants::DEFAULT_WEIGHT)) ? intval($order) : XoopspartnersConstants::DEFAULT_WEIGHT; + $stat = (!empty($status[$id]) && ($status[$id] > XoopspartnersConstants::STATUS_INACTIVE)) ? intval($status[$id]) : XoopspartnersConstants::STATUS_INACTIVE; + $thisObj = $xpPartnerHandler->get($id); + if (!empty($thisObj) && ($thisObj instanceof XoopspartnersPartners)) { + $thisObj->setVars(array('weight' => $order, 'status' => $stat)); + $xpPartnerHandler->insert($thisObj); + unset($thisObj); + } + } + } + redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); + } else { + redirect_header("main.php?op=partnersAdminAdd", XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_EMPTYDATABASE, false); + } + break; + + case 'reorderAutoPartners': + $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); + $partnerObjs = $xpPartnerHandler->getAll(null, array('weight')); + $partnerCount = count($partnerObjs); + $weight = XoopspartnersConstants::DEFAULT_WEIGHT; + if ($partnerCount > 1) { + foreach ($partnerObjs as $thisObj) { + ++$weight; + $thisObj->setVar('weight', $weight); + $xpPartnerHandler->insert($thisObj); + unset($thisObj); + } + redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); + } else { + redirect_header('main.php?op=partnersAdminAdd', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_EMPTYDATABASE, false); + } + break; + + case 'partnersAdminAdd': + echo $adminClass->addNavigation('main.php?op=partnersAdminAdd'); + //echo "<h4>"._AM_XPARTNERS_ADD."</h4>"; + + include $GLOBALS['xoops']->path('/class/xoopsformloader.php'); + $form = new XoopsThemeForm(_AM_XPARTNERS_ADDPARTNER, "addform", "main.php", "post", true); + $formWeight = new XoopsFormText(_AM_XPARTNERS_WEIGHT, "weight", 3, 10, XoopspartnersConstants::DEFAULT_WEIGHT); + $formImage = new XoopsFormText(_AM_XPARTNERS_IMAGE, "image", 100, 150, 'http://'); + $formUrl = new XoopsFormText(_AM_XPARTNERS_URL, "url", 100, 150, 'http://'); + $formTitle = new XoopsFormText(_AM_XPARTNERS_TITLE, "title", 100, 150); + $formDesc = new XoopsFormTextArea(_AM_XPARTNERS_DESCRIPTION, "description", "", 10, "60"); + $statOnTxt + = " <img src='{$pathImageIcon}/on.png' alt='" . _AM_XPARTNERS_ACTIVE . "'> " . _AM_XPARTNERS_ACTIVE + . " "; + $statOffTxt + = " <img src='{$pathImageIcon}/off.png' alt='" . _AM_XPARTNERS_INACTIVE . "'> " + . _AM_XPARTNERS_INACTIVE . " "; + $formStat = new XoopsFormRadioYN(_AM_XPARTNERS_STATUS, 'status', XoopspartnersConstants::STATUS_ACTIVE, $statOnTxt, $statOffTxt); + $opHidden = new XoopsFormHidden("op", "addPartner"); + $submitButton = new XoopsFormButton("", "submit", _AM_XPARTNERS_ADDPARTNER, "submit"); + $form->addElement($formTitle, true); + $form->addElement($formImage); + $form->addElement($formUrl, true); + $form->addElement($formWeight); + $form->addElement($formDesc, true); + $form->addElement($formStat); + $form->addElement($opHidden); + $form->addElement($submitButton); + $form->display(); + include __DIR__ . '/admin_footer.php'; + break; + + case 'addPartner': + $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); + $newPartner = $xpPartnerHandler->create(); + $status = ((!empty($status)) && (intval($status) > 0)) ? intval($status) : XoopspartnersConstants::STATUS_INACTIVE; + $weight = XoopsRequest::getInt('weight', XoopspartnersConstants::DEFAULT_WEIGHT, 'POST'); + $title = isset($title) ? trim($title) : ''; + $url = isset($url) ? trim($url) : ''; + $image = isset($image) ? trim($image) : ''; + $image = $myts->addSlashes(formatURL($image)); + $description = isset($description) ? trim($description) : ''; + if (empty($title) || empty($url) || empty($description)) { + redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_BESURE); + } + $newPartner->setVars(array('url' => $myts->addSlashes(formatURL($url)), + 'image' => $image, + 'title' => $myts->addSlashes($title), + 'description' => $myts->addSlashes($description), + 'status' => $status, + 'weight' => $weight) + ); + + if ($GLOBALS['xoopsSecurity']->check() && $xpPartnerHandler->insert($newPartner)) { + redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_SHORT, _AM_XPARTNERS_UPDATED); + } else { + redirect_header('main.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_NOTUPDATED . "<br>" . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()) + ); + } + break; + + case 'editPartner': + echo $adminClass->addNavigation('main.php'); + $id = (intval($id) > XoopspartnersConstants::DEFAULT_PID) ? intval($id) : XoopspartnersConstants::DEFAULT_PID; + + $xpPartnerHandler =& xoops_getmodulehandler('partners', $GLOBALS['xoopsModule']->getVar('dirname')); + $partnerObj = $xpPartnerHandler->get($id); + if (!empty($partnerObj) && ($partnerObj instanceof XoopspartnersPartners)) { + $partnerVars = $partnerObj->getValues(); + //url, image, title, and description are all txtboxes so they have gone through htmlspecialchars via XoopsObject getVar + + include $GLOBALS['xoops']->path("/class/xoopsformloader.php"); + $form = new XoopsThemeForm(_AM_XPARTNERS_EDITPARTNER, 'editform', 'main.php', "post", true); + $formWeight = new XoopsFormText(_AM_XPARTNERS_WEIGHT, 'weight', 3, 10, $partnerVars['weight']); + $formHits = new XoopsFormText(_AM_XPARTNERS_HITS, 'hits', 3, 10, $partnerVars['hits']); + $formImage = new XoopsFormText(_AM_XPARTNERS_IMAGE, 'image', 50, 150, $partnerVars['image']); + $formUrl = new XoopsFormText(_AM_XPARTNERS_URL, 'url', 50, 150, $partnerVars['url']); + $formTitle = new XoopsFormText(_AM_XPARTNERS_TITLE, 'title', 50, 150, $partnerVars['title']); + $formDesc = new XoopsFormTextArea(_AM_XPARTNERS_DESCRIPTION, 'description', $partnerVars['description'], 10, '100%'); + + $statOnTxt = " <img src='{$pathImageIcon}/on.png' alt='" . _AM_XPARTNERS_ACTIVE . "'> " . _AM_XPARTNERS_ACTIVE . " "; + $statOffTxt = " <img src='{$pathImageIcon}/off.png' alt='" . _AM_XPARTNERS_INACTIVE . "'> " . _AM_XPARTNERS_INACTIVE . " "; + $formStat = new XoopsFormRadioYN(_AM_XPARTNERS_STATUS, 'status', $partnerVars['status'], $statOnTxt, $statOffTxt); + + $submitButton = new XoopsFormButton("", "submit", _SUBMIT, "submit"); + $form->addElement($formTitle, true); + $form->addElement($formImage); + $form->addElement($formUrl, true); + $form->addElement($formWeight); + $form->addElement($formDesc, true); + $form->addElement($formHits); + $form->addElement($formStat); + $form->addElement(new XoopsFormHidden("id", $id)); + $form->addElement(new XoopsFormHidden("op", "updatePartner")); + $form->addElement($submitButton); + $form->display(); + include __DIR__ . '/admin_footer.php'; + } else { + redirect_header("main.php", XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _AM_XPARTNERS_INVALIDID); + } + break; + + case 'updatePartner': + $title = isset($title) ? trim($title) : ''; + $image = isset($image) ? trim($image) : ''; + $image = $myts->addSlashes(formatURL($image)); + $url = isset($url) ? trim($url) : ''; + $description = isset($description) ? trim($description) : ''... [truncated message content] |