From 94214d1f53c542f19ceddeabd13e2cd6f5a35786 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 25 Jan 2016 22:55:01 -0500 Subject: [PATCH 1/3] remove travis.yml, update help.html --- .travis.yml | 8 -------- language/english/help/help.html | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 53b5f0b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: php -script: - - phpunit -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 diff --git a/language/english/help/help.html b/language/english/help/help.html index cb2b1d1..e60e559 100644 --- a/language/english/help/help.html +++ b/language/english/help/help.html @@ -24,7 +24,7 @@

Install/uninstall

extract the /marquee folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

Detailed instructions on installing modules are available in the - XOOPS Operations Manual

+ XOOPS Operations Manual

Operating instructions

@@ -41,7 +41,7 @@

Operating instructions

Detailed instructions on configuring the access rights for user groups are available in the - XOOPS Operations Manual

+ XOOPS Operations Manual

Tutorial

From a7fd6a49a0e3fb9fd1b75b2795d33b0c5397884d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 26 Mar 2016 22:02:47 -0400 Subject: [PATCH 2/3] 2.5.0 (XOOPS 2.5.8, PHP7) --- admin/about.php | 16 +- admin/admin_footer.php | 19 +- admin/admin_header.php | 38 +- admin/functions.php | 132 ++--- admin/index.html | 2 +- admin/index.php | 22 +- admin/main.php | 322 ++++++++++++ admin/marquee.php | 305 ----------- admin/menu.php | 67 +-- assets/css/index.html | 1 + {images => assets/images}/bg.png | Bin assets/images/index.html | 1 + {images => assets/images}/left_both.png | Bin .../images/logo_module.png | Bin {images => assets/images}/right_both.png | Bin {images => assets/images}/selectedEnd.gif | Bin {images => assets/images}/selectedStart.gif | Bin {images => assets/images}/unselectedEnd.gif | Bin .../images}/unselected_right.gif | Bin assets/index.html | 1 + assets/js/index.html | 1 + assets/js/xbMarquee.js | 426 ++++++++++++++++ blocks/index.html | 2 +- blocks/marquee_bloc.php | 60 ++- class/PersistableObjectHandler.php | 358 ++++++------- class/marquee.php | 181 ++++--- class/marquee_utils.php | 227 ++++----- css/index.html | 1 - docs/changelog.txt | 91 ++-- docs/credits.txt | 2 +- docs/index.html | 2 +- docs/install.txt | 2 +- docs/readme.txt | 6 +- header.php | 32 +- images/index.html | 1 - include/functions.php | 73 +-- include/index.html | 2 +- include/update.php | 75 ++- index.html | 2 +- js/index.html | 1 - js/xbMarquee.js | 474 ------------------ language/english/admin.php | 94 ++-- language/english/blocks.php | 10 +- language/english/extension.php | 14 +- language/english/help/help.html | 30 +- language/english/help/index.html | 2 +- language/english/index.html | 2 +- language/english/modinfo.php | 56 +-- language/index.html | 2 +- plugins/article.php | 92 ++-- plugins/catads.php | 60 ++- plugins/comments.php | 53 +- plugins/index.html | 2 +- plugins/mydownloads.php | 57 ++- plugins/mylinks.php | 49 +- plugins/newbb.php | 105 ++-- plugins/news.php | 49 +- plugins/smartclient.php | 41 +- plugins/smartfaq.php | 57 ++- plugins/smartmedia.php | 45 +- plugins/smartpartner.php | 63 +-- plugins/smartsection.php | 53 +- plugins/tplleaguestats.php | 94 ++-- plugins/wfdownloads.php | 55 +- plugins/wfsection.php | 65 +-- plugins/xfaq.php | 50 +- plugins/xfsection.php | 51 +- plugins/xoopsfaq.php | 47 +- plugins/xoopspartners.php | 76 +-- plugins/xoopspoll.php | 47 +- sql/index.html | 2 +- templates/blocks/index.html | 2 +- ...rquee_block01.html => marquee_block01.tpl} | 0 ...rquee_block02.html => marquee_block02.tpl} | 0 ...rquee_block03.html => marquee_block03.tpl} | 0 ...rquee_block04.html => marquee_block04.tpl} | 0 templates/index.html | 2 +- test/AddBlock | 2 +- test/AddMarquee | 2 +- test/DeleteMarquee | 2 +- test/readme.txt | 8 +- xoops_version.php | 215 ++++---- 82 files changed, 2407 insertions(+), 2194 deletions(-) create mode 100644 admin/main.php delete mode 100644 admin/marquee.php create mode 100644 assets/css/index.html rename {images => assets/images}/bg.png (100%) create mode 100644 assets/images/index.html rename {images => assets/images}/left_both.png (100%) rename images/marquee_slogo.png => assets/images/logo_module.png (100%) rename {images => assets/images}/right_both.png (100%) rename {images => assets/images}/selectedEnd.gif (100%) rename {images => assets/images}/selectedStart.gif (100%) rename {images => assets/images}/unselectedEnd.gif (100%) rename {images => assets/images}/unselected_right.gif (100%) create mode 100644 assets/index.html create mode 100644 assets/js/index.html create mode 100644 assets/js/xbMarquee.js delete mode 100644 css/index.html delete mode 100644 images/index.html delete mode 100644 js/index.html delete mode 100644 js/xbMarquee.js rename templates/blocks/{marquee_block01.html => marquee_block01.tpl} (100%) rename templates/blocks/{marquee_block02.html => marquee_block02.tpl} (100%) rename templates/blocks/{marquee_block03.html => marquee_block03.tpl} (100%) rename templates/blocks/{marquee_block04.html => marquee_block04.tpl} (100%) diff --git a/admin/about.php b/admin/about.php index 52ebfa1..3bf7030 100644 --- a/admin/about.php +++ b/admin/about.php @@ -9,21 +9,21 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project (http://www.xoops.org) - * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) - * @package Marquee + * @copyright XOOPS Project (http://xoops.org) + * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html) + * @package Marquee * @since 2.5.0 - * @author Mage, Mamba - * @version $Id $ + * @author Mage, Mamba + * @version $Id $ **/ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $aboutAdmin = new ModuleAdmin(); -echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->addNavigation(basename(__FILE__)); echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); -include 'admin_footer.php'; +include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index 4a58547..c60df76 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -9,19 +9,14 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (http://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Marquee - * @since 2.5.0 - * @author Mamba (www.xoops.org) - * @version $Id $ -**/ + * @package Marquee + * @since 2.5.0 + * @author Mamba (www.xoops.org) + * @version $Id $ + **/ -echo "
\n" - ."
\n" - ." XOOPS\n" - ."
\n" - ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" - ."
"; +echo "
\n" . "
\n" . " XOOPS\n" . "
\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
'; xoops_cp_footer(); diff --git a/admin/admin_header.php b/admin/admin_header.php index c3faaf3..9004aac 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -9,33 +9,33 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (http://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Marquee - * @since 2.5.0 - * @author XOOPS Module Team - * @version $Id $ -**/ + * @package Marquee + * @since 2.5.0 + * @author XOOPS Module Team + * @version $Id $ + **/ -$path = dirname(dirname(dirname(dirname(__FILE__)))); -include_once $path . '/mainfile.php'; -include_once $path . '/include/cp_functions.php'; -require_once $path . '/include/cp_header.php'; +$rootPath = dirname(dirname(dirname(__DIR__))); +include_once $rootPath . '/mainfile.php'; +include_once $rootPath . '/include/cp_functions.php'; +require_once $rootPath . '/include/cp_header.php'; global $xoopsModule; -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +$moduleFolder = dirname(__DIR__); //if functions.php file exist -require_once dirname(dirname(__FILE__)) . '/include/functions.php'; +require_once $moduleFolder . '/include/functions.php'; // Load language files -xoops_loadLanguage('admin', $thisModuleDir); -xoops_loadLanguage('modinfo', $thisModuleDir); -xoops_loadLanguage('main', $thisModuleDir); +xoops_loadLanguage('admin', $moduleFolder); +xoops_loadLanguage('modinfo', $moduleFolder); +xoops_loadLanguage('main', $moduleFolder); -$pathIcon16 = '../'.$xoopsModule->getInfo('icons16'); -$pathIcon32 = '../'.$xoopsModule->getInfo('icons32'); -$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); +$pathIcon16 = XOOPS_URL . '/' . $xoopsModule->getInfo('icons16'); +$pathIcon32 = XOOPS_URL . '/' . $xoopsModule->getInfo('icons32'); +$pathModuleAdmin = XOOPS_ROOT_PATH . '/' . $xoopsModule->getInfo('dirmoduleadmin'); -include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); +require_once $pathModuleAdmin . '/moduleadmin/moduleadmin.php'; diff --git a/admin/functions.php b/admin/functions.php index a858b34..fd0dc4d 100644 --- a/admin/functions.php +++ b/admin/functions.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,67 +11,68 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param int $currentoption + * @param string $breadcrumb */ -if (!defined('XOOPS_ROOT_PATH')) { - die('XOOPS root path not defined'); -} +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); function marquee_adminmenu($currentoption = 0, $breadcrumb = '') { -///* include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; -// -// /* Nice buttons styles */ -// echo " -// -// "; -// global $xoopsModule, $xoopsConfig; -// -// $tblColors = array('','','','',''); -// if($currentoption >= 0) { -// $tblColors[$currentoption] = 'current'; -// } -// -// if (file_exists(XOOPS_ROOT_PATH . '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php')) { -// include_once XOOPS_ROOT_PATH. '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php'; -// } else { -// include_once XOOPS_ROOT_PATH . '/modules/marquee/language/english/modinfo.php'; -// } -// -// echo "
"; -// echo ""; -// echo ""; -// echo ""; -// echo "
getVar('mid')."\">" . _AM_MARQUEE_GENERALSET . "" . $xoopsModule->name() . " " . _AM_MARQUEE_MODULEADMIN . " " . $breadcrumb . "
"; -// echo "
"; -// -// echo "
"; -// echo "
"; -// echo "

 
 

";*/ + ///* include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; + // + // /* Nice buttons styles */ + // echo " + // + // "; + // global $xoopsModule, $xoopsConfig; + // + // $tblColors = array('','','','',''); + // if ($currentoption >= 0) { + // $tblColors[$currentoption] = 'current'; + // } + // + // if (file_exists(XOOPS_ROOT_PATH . '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php')) { + // include_once XOOPS_ROOT_PATH. '/modules/marquee/language/' . $xoopsConfig['language'] . '/modinfo.php'; + // } else { + // include_once XOOPS_ROOT_PATH . '/modules/marquee/language/english/modinfo.php'; + // } + // + // echo "
"; + // echo ""; + // echo ""; + // echo ""; + // echo "
getVar('mid')."\">" . _AM_MARQUEE_GENERALSET . "" . $xoopsModule->name() . " " . _AM_MARQUEE_MODULEADMIN . " " . $breadcrumb . "
"; + // echo "
"; + // + // echo "
"; + // echo "
"; + // echo "

 
 

";*/ } /** @@ -79,12 +80,13 @@ function marquee_adminmenu($currentoption = 0, $breadcrumb = '') * * Some hosts have disabled the Php glob() function, that's why this function exists * - * @package Marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @copyright (c) Hervé Thouzard + * @package Marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @copyright (c) HervĂ© Thouzard + * + * @param string $folder Folder where you want to grab files from (terminated with a slash) + * @param string $pattern Pattern used to filter files * - * @param string $folder Folder where you want to grab files from (terminated with a slash) - * @param string $pattern Pattern used to filter files * @return array Files that match the pattern in the selected folder */ function myglob($folder = '', $pattern = 'php') @@ -92,18 +94,18 @@ function myglob($folder = '', $pattern = 'php') $result = array(); if ($dir = @opendir($folder)) { while (($file = readdir($dir)) !== false) { - if(!is_dir($file)) { - $ext = basename($file); - $ext = explode('.', $ext); - $extension = strtolower($ext[count($ext)-1]); - if($extension == $pattern) { + if (!is_dir($file)) { + $ext = basename($file); + $ext = explode('.', $ext); + $extension = strtolower($ext[count($ext) - 1]); + if ($extension == $pattern) { $result[] = $file; } } } closedir($dir); } else { - echo "Error, impossible to open the folder ".$folder; + echo 'Error, impossible to open the folder ' . $folder; } return $result; diff --git a/admin/index.html b/admin/index.html index 990cbd6..2c5cdd3 100644 --- a/admin/index.html +++ b/admin/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/admin/index.php b/admin/index.php index faaa767..72ef94e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,23 +11,23 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; -include_once dirname(__FILE__) . '/admin_header.php'; +require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); - $indexAdmin = new ModuleAdmin(); +$indexAdmin = new ModuleAdmin(); - echo $indexAdmin->addNavigation('index.php'); - echo $indexAdmin->renderIndex(); +echo $indexAdmin->addNavigation(basename(__FILE__)); +echo $indexAdmin->renderIndex(); -include "admin_footer.php"; +include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/main.php b/admin/main.php new file mode 100644 index 0000000..f92e4ab --- /dev/null +++ b/admin/main.php @@ -0,0 +1,322 @@ +queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + + return ($xoopsDB->getRowsNum($result) > 0); +} + +// Verify if the table is up to date +if (!marquee_FieldExists('marquee_marqueeid', $xoopsDB->prefix('marquee'))) { + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `marqueeid` `marquee_marqueeid` INT( 8 ) NOT NULL AUTO_INCREMENT'); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `uid` `marquee_uid` MEDIUMINT( 8 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `direction` `marquee_direction` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `scrollamount` `marquee_scrollamount` INT( 11 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `behaviour` `marquee_behaviour` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `bgcolor` `marquee_bgcolor` VARCHAR( 7 ) NOT NULL'); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `align` `marquee_align` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `height` `marquee_height` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `width` `marquee_width` VARCHAR( 4 ) NOT NULL'); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `hspace` `marquee_hspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `scrolldelay` `marquee_scrolldelay` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `stoponmouseover` `marquee_stoponmouseover` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `loop` `marquee_loop` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `vspace` `marquee_vspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . ' CHANGE `content` `marquee_content` TEXT NOT NULL'); + $result = $xoopsDB->queryF('ALTER TABLE ' . $xoopsDB->prefix('marquee') . " CHANGE `source` `marquee_source` VARCHAR( 255 ) NOT NULL DEFAULT 'fixed'"); +} + +$marquee_handler = xoops_getModuleHandler('marquee', 'marquee'); + +// Function used to add and modify an element +/** + * @param $marqueeid + * @param $Action + * @param $FormTitle + * @param $contentvalue + * @param $bgcolorvalue + * @param $widthvalue + * @param $heightvalue + * @param $scrollamountvalue + * @param $hspacevalue + * @param $vspacevalue + * @param $scrolldelayvalue + * @param $directionvalue + * @param $behaviourvalue + * @param $alignvalue + * @param $loopvalue + * @param $stopvalue + * @param $LabelSubmitButton + * @param string $sourcevalue + */ +function AddEditMarqueeForm($marqueeid, $Action, $FormTitle, $contentvalue, $bgcolorvalue, $widthvalue, $heightvalue, $scrollamountvalue, $hspacevalue, $vspacevalue, $scrolldelayvalue, $directionvalue, $behaviourvalue, $alignvalue, $loopvalue, $stopvalue, $LabelSubmitButton, $sourcevalue = 'fixed') +{ + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + global $xoopsModule, $xoopsModuleConfig; + + $sform = new XoopsThemeForm($FormTitle, 'marqueeform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php'); + + $source = new XoopsFormSelect(_AM_MARQUEE_SOURCE, 'source', $sourcevalue); + $source->addOption('fixed', _AM_MARQUEE_SOURCE_FIXED); + $fileslst = myglob(XOOPS_ROOT_PATH . '/modules/marquee/plugins/', 'php'); + foreach ($fileslst as $onefile) { + $onefile = basename($onefile, '.php'); + $source->addOption($onefile, $onefile); + } + $sform->addElement($source); + + $editor =& MarqueeUtilities::getWysiwygForm(_AM_MARQUEE_CONTENT, 'content', $contentvalue, 15, 60, 'content_text_hidden'); + if ($editor) { + $sform->addElement($editor, false); + } + + if (marquee_getmoduleoption('methodtouse') !== 'DHTML') { + // $sform->addElement(new XoopsFormText(_AM_MARQUEE_BGCOLOR, 'bgcolor', 7, 7, $bgcolorvalue), false); + $sform->addElement(new XoopsFormColorPicker(_AM_MARQUEE_BGCOLOR, 'bgcolor', $bgcolorvalue), false); + } + $sform->addElement(new XoopsFormText(_AM_MARQUEE_WIDTH, 'width', 4, 4, $widthvalue), false); + $sform->addElement(new XoopsFormText(_AM_MARQUEE_HEIGHT, 'height', 4, 4, $heightvalue), false); + $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRAMOUNT, 'scrollamount', 4, 4, $scrollamountvalue), false); + if (marquee_getmoduleoption('methodtouse') !== 'DHTML') { + $sform->addElement(new XoopsFormText(_AM_MARQUEE_HSPACE, 'hspace', 4, 4, $hspacevalue), false); + $sform->addElement(new XoopsFormText(_AM_MARQUEE_VSPACE, 'vspace', 4, 4, $vspacevalue), false); + } + + $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRDELAY, 'scrolldelay', 6, 6, $scrolldelayvalue), false); + $direction = new XoopsFormSelect(_AM_MARQUEE_DIRECTION, 'direction', $directionvalue); + $direction->addOption('0', _AM_MARQUEE_DIRECTION1); + $direction->addOption('1', _AM_MARQUEE_DIRECTION2); + $direction->addOption('2', _AM_MARQUEE_DIRECTION3); + $direction->addOption('3', _AM_MARQUEE_DIRECTION4); + $sform->addElement($direction, true); + + $behaviour = new XoopsFormSelect(_AM_MARQUEE_BEHAVIOUR, 'behaviour', $behaviourvalue); + $behaviour->addOption('0', _AM_MARQUEE_BEHAVIOUR1); + if (marquee_getmoduleoption('methodtouse') !== 'DHTML') { + $behaviour->addOption('1', _AM_MARQUEE_BEHAVIOUR2); + } + $behaviour->addOption('2', _AM_MARQUEE_BEHAVIOUR3); + $sform->addElement($behaviour, true); + + if (marquee_getmoduleoption('methodtouse') !== 'DHTML') { + $align = new XoopsFormSelect(_AM_MARQUEE_ALIGN, 'align', $alignvalue); + $align->addOption('0', _AM_MARQUEE_ALIGN1); + $align->addOption('1', _AM_MARQUEE_ALIGN2); + $align->addOption('2', _AM_MARQUEE_ALIGN3); + $sform->addElement($align, true); + } + + $loop = new XoopsFormSelect(_AM_MARQUEE_LOOP, 'loop', $loopvalue); + $loop->addOption('0', _AM_MARQUEE_INFINITELOOP); + for ($i = 1; $i <= 100; ++$i) { + $loop->addOption($i, $i); + } + if (marquee_getmoduleoption('methodtouse') !== 'DHTML') { + $sform->addElement($loop, true); + $sform->addElement(new XoopsFormRadioYN(_AM_MARQUEE_STOP, 'stoponmouseover', $stopvalue, _YES, _NO)); + } + + $sform->addElement(new XoopsFormHidden('op', $Action), false); + if (!empty($marqueeid)) { + $sform->addElement(new XoopsFormHidden('marqueeid', $marqueeid), false); + } + $button_tray = new XoopsFormElementTray('', ''); + $submit_btn = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); + $button_tray->addElement($submit_btn); + $cancel_btn = new XoopsFormButton('', 'reset', _AM_MARQUEE_RESETBUTTON, 'reset'); + $button_tray->addElement($cancel_btn); + $sform->addElement($button_tray); + $sform->display(); +} + +// ****************************************************************************************************************************************** +// **** Main ******************************************************************************************************************************** +// ****************************************************************************************************************************************** +switch ($op) { + // Verify before to edit an element + case 'verifybeforeedit': + if (isset($_POST['submit']) && $_POST['submit'] != '') { + $marquee = $marquee_handler->get((int)$_POST['marqueeid']); + if (is_object($marquee)) { + $marquee->setVar('marquee_uid', $xoopsUser->getVar('uid')); + $marquee->setVar('marquee_direction', $_POST['direction']); + $marquee->setVar('marquee_scrollamount', $_POST['scrollamount']); + $marquee->setVar('marquee_behaviour', $_POST['behaviour']); + $marquee->setVar('marquee_bgcolor', isset($_POST['bgcolor']) ? $_POST['bgcolor'] : ''); + $marquee->setVar('marquee_align', isset($_POST['align']) ? $_POST['align'] : 0); + $marquee->setVar('marquee_height', $_POST['height']); + $marquee->setVar('marquee_width', $_POST['width']); + $marquee->setVar('marquee_hspace', isset($_POST['hspace']) ? $_POST['hspace'] : 0); + $marquee->setVar('marquee_scrolldelay', $_POST['scrolldelay']); + $marquee->setVar('marquee_stoponmouseover', isset($_POST['stoponmouseover']) ? $_POST['stoponmouseover'] : 0); + $marquee->setVar('marquee_loop', isset($_POST['loop']) ? $_POST['loop'] : 0); + $marquee->setVar('marquee_vspace', isset($_POST['vspace']) ? $_POST['vspace'] : 0); + $marquee->setVar('marquee_content', $_POST['content']); + $marquee->setVar('marquee_source', $_POST['source']); + if (!$marquee_handler->insert($marquee)) { + redirect_header('main.php', 1, _AM_MARQUEE_ERROR_MODIFY_DB); + } + redirect_header('main.php', 1, _AM_MARQUEE_DBUPDATED); + } else { + redirect_header('main.php', 3, _ERRORS); + } + } + break; + + // Edit an element + case 'edit': + xoops_cp_header(); + echo $indexAdmin->addNavigation(basename(__FILE__)); + + echo '
'; + if (isset($_GET['marqueeid'])) { + $marqueeid = (int)$_GET['marqueeid']; + $marquee = $marquee_handler->get($marqueeid); + AddEditMarqueeForm($marqueeid, 'verifybeforeedit', _AM_MARQUEE_CONFIG, $marquee->getVar('marquee_content', 'e'), $marquee->getVar('marquee_bgcolor', 'e'), $marquee->getVar('marquee_width', 'e'), $marquee->getVar('marquee_height', 'e'), $marquee->getVar('marquee_scrollamount', 'e'), $marquee->getVar('marquee_hspace', 'e'), $marquee->getVar('marquee_vspace', 'e'), $marquee->getVar('marquee_scrolldelay', 'e'), $marquee->getVar('marquee_direction', 'e'), $marquee->getVar('marquee_behaviour', 'e'), $marquee->getVar('marquee_align', 'e'), $marquee->getVar('marquee_loop', 'e'), $marquee->getVar('marquee_stoponmouseover', 'e'), _AM_MARQUEE_UPDATE, $marquee->getVar('marquee_source', 'e')); + } + break; + + // Delete an element + case 'delete': + if (!isset($_POST['ok'])) { + xoops_cp_header(); + echo $indexAdmin->addNavigation(basename(__FILE__)); + // echo '

' . _AM_MARQUEE_CONFIG . '

'; + xoops_confirm(array('op' => 'delete', 'marqueeid' => $_GET['marqueeid'], 'ok' => 1), 'main.php', _AM_MARQUEE_RUSUREDEL); + } else { + if (empty($_POST['marqueeid'])) { + redirect_header('main.php', 2, _AM_MARQUEE_ERROR_ADD_MARQUEE); + } + $marqueeid = (int)$_POST['marqueeid']; + $marquee = $marquee_handler->deleteAll(new Criteria('marquee_marqueeid', $marqueeid, '=')); + redirect_header('main.php', 1, _AM_MARQUEE_DBUPDATED); + } + break; + + // Verify before to add an element + case 'verifytoadd': + if (isset($_POST['submit']) && $_POST['submit'] != '') { + $vres = $marquee_handler->quickInsert(array( + 'marquee_uid' => $xoopsUser->getVar('uid'), + 'marquee_direction' => $_POST['direction'], + 'marquee_scrollamount' => $_POST['scrollamount'], + 'marquee_behaviour' => $_POST['behaviour'], + 'marquee_bgcolor' => isset($_POST['bgcolor']) ? $_POST['bgcolor'] : '', + 'marquee_align' => isset($_POST['align']) ? $_POST['align'] : 0, + 'marquee_height' => $_POST['height'], + 'marquee_width' => $_POST['width'], + 'marquee_hspace' => isset($_POST['hspace']) ? $_POST['hspace'] : 0, + 'marquee_scrolldelay' => $_POST['scrolldelay'], + 'marquee_stoponmouseover' => isset($_POST['stoponmouseover']) ? $_POST['stoponmouseover'] : 0, + 'marquee_loop' => isset($_POST['loop']) ? $_POST['loop'] : 0, + 'marquee_vspace' => isset($_POST['vspace']) ? $_POST['vspace'] : 0, + 'marquee_content' => $_POST['content'], + 'marquee_source' => $_POST['source'])); + if (!$vres) { + redirect_header('main.php', 1, _AM_MARQUEE_ERROR_ADD_MARQUEE); + } + redirect_header('main.php', 1, _AM_MARQUEE_ADDED_OK); + } + break; + + // Display the form to add an element + case 'addmarquee': + xoops_cp_header(); + echo $indexAdmin->addNavigation(basename(__FILE__)); + + echo '
'; + AddEditMarqueeForm(0, 'verifytoadd', _AM_MARQUEE_CONFIG, '', '', '', '', '', 0, 0, '', 0, 0, 0, 0, 0, _AM_MARQUEE_ADDBUTTON, 'fixed'); + break; + + // Default action, list all elements + case 'default': + xoops_cp_header(); + echo $indexAdmin->addNavigation(basename(__FILE__)); + + // echo '

' . _AM_MARQUEE_CONFIG . "


\n"; + echo "\n"; + echo "\n"; + $marqueearray = $marquee_handler->getObjects(); + $class = 'even'; + $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php'; + $tbldirection = array(_AM_MARQUEE_DIRECTION1, _AM_MARQUEE_DIRECTION2, _AM_MARQUEE_DIRECTION3, _AM_MARQUEE_DIRECTION4); + $tblbehaviour = array(_AM_MARQUEE_BEHAVIOUR1, _AM_MARQUEE_BEHAVIOUR2, _AM_MARQUEE_BEHAVIOUR3); + if (count($marqueearray) > 0) { + foreach ($marqueearray as $marquee) { + // $action_edit=""._AM_MARQUEE_EDIT.""; + // $action_delete=""._AM_MARQUEE_DELETE.""; + + $action_edit = 'getVar('marquee_marqueeid') . '>'; + $action_delete = 'getVar('marquee_marqueeid') . '>'; + + $bgcolorvalue = $marquee->getVar('marquee_bgcolor'); + $direction = $tbldirection[$marquee->getVar('marquee_direction')]; + $behaviour = $tblbehaviour[$marquee->getVar('marquee_behaviour')]; + $stop = _YES; + if ($marquee->getVar('marquee_stoponmouseover') == 0) { + $stop = _NO; + } + $source = $marquee->getVar('marquee_source'); + if ($marquee->getVar('marquee_source') === 'fixed') { + $source = _AM_MARQUEE_SOURCE_FIXED; + } + echo "\n"; + $class = ($class === 'even') ? 'odd' : 'even'; + } + } + + // echo ""; + $indexAdmin->addItemButton(_AM_MARQUEE_ADDMARQUEE, 'main.php?op=addmarquee', 'add', ''); + echo $indexAdmin->renderButton('left', ''); + echo '
" . _AM_MARQUEE_ID . "" . _AM_MARQUEE_CONTENT . "" . _AM_MARQUEE_BGCOLOR_SHORT . "" . _AM_MARQUEE_BEHAVIOUR . "" . _AM_MARQUEE_SOURCE . "" . _AM_MARQUEE_STOP . "" . _AM_MARQUEE_DIRECTION . "" . _AM_MARQUEE_ACTION . "
" . $marquee->getVar('marquee_marqueeid') . "" . xoops_substr(strip_tags($marquee->getVar('marquee_content')), 0, 60) . "" . "
" . $bgcolorvalue + + . "
" . $behaviour . "" . $source . "" . $stop . "" . $direction . "" . $action_edit . '  ' . $action_delete . "
'; + break; +} + +include_once __DIR__ . '/admin_footer.php'; +//xoops_cp_footer(); diff --git a/admin/marquee.php b/admin/marquee.php deleted file mode 100644 index 96c65aa..0000000 --- a/admin/marquee.php +++ /dev/null @@ -1,305 +0,0 @@ -queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); - - return($xoopsDB->getRowsNum($result) > 0); -} - -// Verify if the table is up to date -if (!marquee_FieldExists('marquee_marqueeid',$xoopsDB->prefix('marquee'))) { - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `marqueeid` `marquee_marqueeid` INT( 8 ) NOT NULL AUTO_INCREMENT"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `uid` `marquee_uid` MEDIUMINT( 8 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `direction` `marquee_direction` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `scrollamount` `marquee_scrollamount` INT( 11 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `behaviour` `marquee_behaviour` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `bgcolor` `marquee_bgcolor` VARCHAR( 7 ) NOT NULL"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `align` `marquee_align` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `height` `marquee_height` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `width` `marquee_width` VARCHAR( 4 ) NOT NULL"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `hspace` `marquee_hspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `scrolldelay` `marquee_scrolldelay` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `stoponmouseover` `marquee_stoponmouseover` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `loop` `marquee_loop` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `vspace` `marquee_vspace` SMALLINT( 6 ) NOT NULL DEFAULT '0'"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `content` `marquee_content` TEXT NOT NULL"); - $result = $xoopsDB->queryF('ALTER TABLE '.$xoopsDB->prefix('marquee')." CHANGE `source` `marquee_source` VARCHAR( 255 ) NOT NULL DEFAULT 'fixed'"); -} - -$marquee_handler =& xoops_getmodulehandler('marquee', 'marquee'); - -// Function used to add and modify an element -function AddEditMarqueeForm($marqueeid, $Action, $FormTitle, $contentvalue, $bgcolorvalue,$widthvalue,$heightvalue,$scrollamountvalue,$hspacevalue, $vspacevalue,$scrolldelayvalue,$directionvalue,$behaviourvalue,$alignvalue,$loopvalue,$stopvalue , $LabelSubmitButton, $sourcevalue='fixed') -{ - require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - global $xoopsModule, $xoopsModuleConfig; - - $sform = new XoopsThemeForm($FormTitle, 'marqueeform', XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/admin/marquee.php'); - - $source = new XoopsFormSelect(_AM_MARQUEE_SOURCE, 'source', $sourcevalue); - $source->addOption('fixed', _AM_MARQUEE_SOURCE_FIXED); - $fileslst = myglob(XOOPS_ROOT_PATH.'/modules/marquee/plugins/','php'); - foreach($fileslst as $onefile) { - $onefile = basename($onefile,'.php'); - $source->addOption($onefile, $onefile); - } - $sform->addElement($source); - - $editor = marquee_utils::getWysiwygForm(_AM_MARQUEE_CONTENT, 'content', $contentvalue, 15, 60, 'content_text_hidden'); - if($editor) { - $sform->addElement($editor, false); - } - - if(marquee_getmoduleoption('methodtouse') != 'DHTML') { - // $sform->addElement(new XoopsFormText(_AM_MARQUEE_BGCOLOR, 'bgcolor', 7, 7, $bgcolorvalue), false); - $sform->addElement(new XoopsFormColorPicker(_AM_MARQUEE_BGCOLOR,'bgcolor',$bgcolorvalue), false); - } - $sform->addElement(new XoopsFormText(_AM_MARQUEE_WIDTH, 'width', 4, 4, $widthvalue), false); - $sform->addElement(new XoopsFormText(_AM_MARQUEE_HEIGHT, 'height',4, 4, $heightvalue), false); - $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRAMOUNT, 'scrollamount',4, 4, $scrollamountvalue), false); - if(marquee_getmoduleoption('methodtouse') != 'DHTML') { - $sform->addElement(new XoopsFormText(_AM_MARQUEE_HSPACE, 'hspace',4, 4, $hspacevalue), false); - $sform->addElement(new XoopsFormText(_AM_MARQUEE_VSPACE, 'vspace',4, 4, $vspacevalue), false); - } - - $sform->addElement(new XoopsFormText(_AM_MARQUEE_SCRDELAY, 'scrolldelay',6, 6, $scrolldelayvalue), false); - $direction = new XoopsFormSelect(_AM_MARQUEE_DIRECTION, 'direction', $directionvalue); - $direction->addOption('0', _AM_MARQUEE_DIRECTION1); - $direction->addOption('1', _AM_MARQUEE_DIRECTION2); - $direction->addOption('2', _AM_MARQUEE_DIRECTION3); - $direction->addOption('3', _AM_MARQUEE_DIRECTION4); - $sform->addElement($direction,true); - - $behaviour = new XoopsFormSelect(_AM_MARQUEE_BEHAVIOUR, 'behaviour', $behaviourvalue); - $behaviour->addOption('0', _AM_MARQUEE_BEHAVIOUR1); - if(marquee_getmoduleoption('methodtouse') != 'DHTML') { - $behaviour->addOption('1', _AM_MARQUEE_BEHAVIOUR2); - } - $behaviour->addOption('2', _AM_MARQUEE_BEHAVIOUR3); - $sform->addElement($behaviour,true); - - if(marquee_getmoduleoption('methodtouse') != 'DHTML') { - $align = new XoopsFormSelect(_AM_MARQUEE_ALIGN, 'align', $alignvalue); - $align->addOption('0', _AM_MARQUEE_ALIGN1); - $align->addOption('1', _AM_MARQUEE_ALIGN2); - $align->addOption('2', _AM_MARQUEE_ALIGN3); - $sform->addElement($align,true); - } - - $loop = new XoopsFormSelect(_AM_MARQUEE_LOOP, 'loop', $loopvalue); - $loop->addOption('0', _AM_MARQUEE_INFINITELOOP); - for($i=1;$i<=100;$i++) { - $loop->addOption($i, $i); - } - if(marquee_getmoduleoption('methodtouse') != 'DHTML') { - $sform->addElement($loop,true); - $sform->addElement(new XoopsFormRadioYN(_AM_MARQUEE_STOP, 'stoponmouseover', $stopvalue, _YES, _NO)); - } - - $sform->addElement(new XoopsFormHidden('op', $Action), false); - if(!empty($marqueeid)) { - $sform->addElement(new XoopsFormHidden('marqueeid', $marqueeid), false); - } - $button_tray = new XoopsFormElementTray('' ,''); - $submit_btn = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); - $button_tray->addElement($submit_btn); - $cancel_btn = new XoopsFormButton('', 'reset', _AM_MARQUEE_RESETBUTTON, 'reset'); - $button_tray->addElement($cancel_btn); - $sform->addElement($button_tray); - $sform->display(); -} - -// ****************************************************************************************************************************************** -// **** Main ******************************************************************************************************************************** -// ****************************************************************************************************************************************** -switch ($op) -{ - // Verify before to edit an element - case 'verifybeforeedit': - if (isset($_POST['submit']) && $_POST['submit'] != '' ) { - $marquee = $marquee_handler->get(intval($_POST['marqueeid'])); - if(is_object($marquee)) { - $marquee->setVar('marquee_uid', $xoopsUser->getVar('uid')); - $marquee->setVar('marquee_direction', $_POST['direction']); - $marquee->setVar('marquee_scrollamount', $_POST['scrollamount']); - $marquee->setVar('marquee_behaviour', $_POST['behaviour']); - $marquee->setVar('marquee_bgcolor', isset($_POST['bgcolor']) ? $_POST['bgcolor'] : ''); - $marquee->setVar('marquee_align', isset($_POST['align']) ? $_POST['align'] : 0); - $marquee->setVar('marquee_height', $_POST['height']); - $marquee->setVar('marquee_width', $_POST['width']); - $marquee->setVar('marquee_hspace', isset($_POST['hspace']) ? $_POST['hspace'] : 0); - $marquee->setVar('marquee_scrolldelay', $_POST['scrolldelay']); - $marquee->setVar('marquee_stoponmouseover', isset($_POST['stoponmouseover']) ? $_POST['stoponmouseover'] : 0); - $marquee->setVar('marquee_loop', isset($_POST['loop']) ? $_POST['loop'] : 0); - $marquee->setVar('marquee_vspace', isset($_POST['vspace']) ? $_POST['vspace'] : 0); - $marquee->setVar('marquee_content', $_POST['content']); - $marquee->setVar('marquee_source', $_POST['source']); - if(!$marquee_handler->insert($marquee)) { - redirect_header('marquee.php', 1,_AM_MARQUEE_ERROR_MODIFY_DB); - exit(); - } - redirect_header('marquee.php', 1, _AM_MARQUEE_DBUPDATED); - } else { - redirect_header('marquee.php', 3, _ERRORS); - } - } - break; - - // Edit an element - case 'edit': - xoops_cp_header(); - echo $indexAdmin->addNavigation('marquee.php'); - - echo '
'; - if(isset($_GET['marqueeid'])) { - $marqueeid = intval($_GET['marqueeid']); - $marquee = $marquee_handler->get($marqueeid); - AddEditMarqueeForm($marqueeid,'verifybeforeedit', _AM_MARQUEE_CONFIG, $marquee->getVar('marquee_content','e'), $marquee->getVar('marquee_bgcolor','e'), $marquee->getVar('marquee_width','e'), $marquee->getVar('marquee_height','e'), $marquee->getVar('marquee_scrollamount','e'), $marquee->getVar('marquee_hspace','e'), $marquee->getVar('marquee_vspace','e'), $marquee->getVar('marquee_scrolldelay','e'), $marquee->getVar('marquee_direction','e'), $marquee->getVar('marquee_behaviour','e'), $marquee->getVar('marquee_align','e'), $marquee->getVar('marquee_loop','e'), $marquee->getVar('marquee_stoponmouseover','e'),_AM_MARQUEE_UPDATE, $marquee->getVar('marquee_source','e')); - } - break; - - // Delete an element - case 'delete': - if (!isset($_POST['ok'])) { - xoops_cp_header(); - echo $indexAdmin->addNavigation('marquee.php'); - // echo '

' . _AM_MARQUEE_CONFIG . '

'; - xoops_confirm( array( 'op' => 'delete', 'marqueeid' => $_GET['marqueeid'], 'ok' => 1 ), 'marquee.php', _AM_MARQUEE_RUSUREDEL ); - } else { - if ( empty($_POST['marqueeid'])) { - redirect_header( 'marquee.php', 2, _AM_MARQUEE_ERROR_ADD_MARQUEE); - exit(); - } - $marqueeid = intval($_POST['marqueeid']); - $marquee = $marquee_handler->deleteAll(new Criteria('marquee_marqueeid', $marqueeid ,'=')); - redirect_header( 'marquee.php', 1, _AM_MARQUEE_DBUPDATED ); - exit(); - } - break; - - // Verify before to add an element - case 'verifytoadd': - if ( isset($_POST['submit']) && $_POST['submit'] != '' ) { - $vres = $marquee_handler->quickInsert(array( - 'marquee_uid' => $xoopsUser->getVar('uid'), - 'marquee_direction' => $_POST['direction'], - 'marquee_scrollamount' => $_POST['scrollamount'], - 'marquee_behaviour' => $_POST['behaviour'], - 'marquee_bgcolor' => isset($_POST['bgcolor']) ? $_POST['bgcolor'] : '', - 'marquee_align' => isset($_POST['align']) ? $_POST['align'] : 0, - 'marquee_height' => $_POST['height'], - 'marquee_width' => $_POST['width'], - 'marquee_hspace' => isset($_POST['hspace']) ? $_POST['hspace'] : 0, - 'marquee_scrolldelay' => $_POST['scrolldelay'], - 'marquee_stoponmouseover' => isset($_POST['stoponmouseover']) ? $_POST['stoponmouseover'] : 0, - 'marquee_loop' => isset($_POST['loop']) ? $_POST['loop'] : 0, - 'marquee_vspace' => isset($_POST['vspace']) ? $_POST['vspace'] : 0, - 'marquee_content' => $_POST['content'], - 'marquee_source' => $_POST['source'])); - if(!$vres) { - redirect_header('marquee.php', 1,_AM_MARQUEE_ERROR_ADD_MARQUEE); - exit(); - } - redirect_header('marquee.php', 1, _AM_MARQUEE_ADDED_OK); - } - break; - - // Display the form to add an element - case 'addmarquee': - xoops_cp_header(); - echo $indexAdmin->addNavigation('marquee.php'); - - echo '
'; - AddEditMarqueeForm(0, 'verifytoadd', _AM_MARQUEE_CONFIG, '', '','','','',0, 0,'',0,0,0,0,0, _AM_MARQUEE_ADDBUTTON,'fixed'); - break; - - // Default action, list all elements - case 'default': - xoops_cp_header(); - echo $indexAdmin->addNavigation('marquee.php'); - -// echo '

' . _AM_MARQUEE_CONFIG . "


\n"; - echo"\n"; - echo "\n"; - $marqueearray= $marquee_handler->getObjects(); - $class = 'even'; - $baseurl = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/admin/marquee.php'; - $tbldirection = array(_AM_MARQUEE_DIRECTION1,_AM_MARQUEE_DIRECTION2,_AM_MARQUEE_DIRECTION3,_AM_MARQUEE_DIRECTION4); - $tblbehaviour = array(_AM_MARQUEE_BEHAVIOUR1,_AM_MARQUEE_BEHAVIOUR2,_AM_MARQUEE_BEHAVIOUR3); - if ( count($marqueearray) > 0 ) { - foreach($marqueearray as $marquee) { -// $action_edit=""._AM_MARQUEE_EDIT.""; -// $action_delete=""._AM_MARQUEE_DELETE.""; - - $action_edit="getVar('marquee_marqueeid').'>'; - - $bgcolorvalue=$marquee->getVar('marquee_bgcolor'); - $direction=$tbldirection[$marquee->getVar('marquee_direction')]; - $behaviour=$tblbehaviour[$marquee->getVar('marquee_behaviour')]; - $stop = _YES; - if($marquee->getVar('marquee_stoponmouseover')==0) { - $stop= _NO; - } - $source = $marquee->getVar('marquee_source'); - if($marquee->getVar('marquee_source') == 'fixed') { - $source = _AM_MARQUEE_SOURCE_FIXED; - } - echo "\n"; - $class = ($class == 'even') ? 'odd' : 'even'; - } - } - -// echo ""; - $indexAdmin->addItemButton(_AM_MARQUEE_ADDMARQUEE, 'marquee.php?op=addmarquee', 'add' , ''); - echo $indexAdmin->renderButton('right', ''); - echo '
". _AM_MARQUEE_ID . "" . _AM_MARQUEE_CONTENT . "" . _AM_MARQUEE_BGCOLOR_SHORT ."" . _AM_MARQUEE_BEHAVIOUR . "". _AM_MARQUEE_SOURCE . "" . _AM_MARQUEE_STOP . "" . _AM_MARQUEE_DIRECTION . "" . _AM_MARQUEE_ACTION . "
" . $marquee->getVar('marquee_marqueeid') . "" . xoops_substr(strip_tags($marquee->getVar('marquee_content')),0,60) - ."" - ."
" - . $bgcolorvalue - - ."
" . $behaviour . "" . $source . "". $stop . "" . $direction . "" . $action_edit . "  " . $action_delete . "
'; - break; -} - -include "admin_footer.php"; -//xoops_cp_footer(); diff --git a/admin/menu.php b/admin/menu.php index 511f270..92b25a8 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -1,36 +1,47 @@ getByDirname($dirname); -$pathIcon32 = $module->getInfo('icons32'); -$pathModuleAdmin = $module->getInfo('dirmoduleadmin'); -$pathLanguage = $path . $pathModuleAdmin; - -if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { - $fileinc = $pathLanguage . '/language/english/main.php'; +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); + +//$path = dirname(dirname(dirname(__DIR__))); +//include_once $path . '/mainfile.php'; +// +//$dirname = basename(dirname(__DIR__)); +//$module_handler = xoops_getHandler('module'); +//$module = $module_handler->getByDirname($dirname); +//$pathIcon32 = $module->getInfo('icons32'); +//$pathModuleAdmin = $module->getInfo('dirmoduleadmin'); +//$pathLanguage = $path . $pathModuleAdmin; +// +//if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { +// $fileinc = $pathLanguage . '/language/english/main.php'; +//} +// +//include_once $fileinc; + +$module_handler = xoops_getHandler('module'); +$module = $module_handler->getByDirname(basename(dirname(__DIR__))); +$pathIcon32 = '../../' . $module->getInfo('icons32'); +xoops_loadLanguage('modinfo', $module->dirname()); + +$pathModuleAdmin = XOOPS_ROOT_PATH . '/' . $module->getInfo('dirmoduleadmin') . '/moduleadmin'; +if (!file_exists($fileinc = $pathModuleAdmin . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { + $fileinc = $pathModuleAdmin . '/language/english/main.php'; } - include_once $fileinc; -$adminmenu = array(); +//$adminmenu = array(); -$i = 1; -$adminmenu[$i]["title"] = _AM_MODULEADMIN_HOME; -$adminmenu[$i]["link"] = 'admin/index.php'; -$adminmenu[$i]["icon"] = $pathIcon32.'/home.png'; +$adminmenu[] = array( + 'title' => _AM_MODULEADMIN_HOME, + 'link' => 'admin/index.php', + 'icon' => $pathIcon32 . '/home.png'); -$i++; -$adminmenu[$i]["title"] = _MI_MARQUEE_MENU_01; -$adminmenu[$i]["link"] = 'admin/marquee.php'; -$adminmenu[$i]["icon"] = $pathIcon32.'/marquee.png'; +$adminmenu[] = array( + 'title' => _MI_MARQUEE_MENU_01, + 'link' => 'admin/main.php', + 'icon' => $pathIcon32 . '/marquee.png'); -$i++; -$adminmenu[$i]["title"] = _AM_MODULEADMIN_ABOUT; -$adminmenu[$i]["link"] = 'admin/about.php'; -$adminmenu[$i]["icon"] = $pathIcon32.'/about.png'; +$adminmenu[] = array( + 'title' => _AM_MODULEADMIN_ABOUT, + 'link' => 'admin/about.php', + 'icon' => $pathIcon32 . '/about.png'); diff --git a/assets/css/index.html b/assets/css/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/assets/css/index.html @@ -0,0 +1 @@ + diff --git a/images/bg.png b/assets/images/bg.png similarity index 100% rename from images/bg.png rename to assets/images/bg.png diff --git a/assets/images/index.html b/assets/images/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/assets/images/index.html @@ -0,0 +1 @@ + diff --git a/images/left_both.png b/assets/images/left_both.png similarity index 100% rename from images/left_both.png rename to assets/images/left_both.png diff --git a/images/marquee_slogo.png b/assets/images/logo_module.png similarity index 100% rename from images/marquee_slogo.png rename to assets/images/logo_module.png diff --git a/images/right_both.png b/assets/images/right_both.png similarity index 100% rename from images/right_both.png rename to assets/images/right_both.png diff --git a/images/selectedEnd.gif b/assets/images/selectedEnd.gif similarity index 100% rename from images/selectedEnd.gif rename to assets/images/selectedEnd.gif diff --git a/images/selectedStart.gif b/assets/images/selectedStart.gif similarity index 100% rename from images/selectedStart.gif rename to assets/images/selectedStart.gif diff --git a/images/unselectedEnd.gif b/assets/images/unselectedEnd.gif similarity index 100% rename from images/unselectedEnd.gif rename to assets/images/unselectedEnd.gif diff --git a/images/unselected_right.gif b/assets/images/unselected_right.gif similarity index 100% rename from images/unselected_right.gif rename to assets/images/unselected_right.gif diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/assets/index.html @@ -0,0 +1 @@ + diff --git a/assets/js/index.html b/assets/js/index.html new file mode 100644 index 0000000..2c5cdd3 --- /dev/null +++ b/assets/js/index.html @@ -0,0 +1 @@ + diff --git a/assets/js/xbMarquee.js b/assets/js/xbMarquee.js new file mode 100644 index 0000000..f4ae35c --- /dev/null +++ b/assets/js/xbMarquee.js @@ -0,0 +1,426 @@ +/* + * $Id: xbMarquee.js,v 1.21 2003/09/14 21:22:26 bc6ix Exp $ + * + */ + +/* ***** BEGIN LICENSE BLOCK ***** + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Netscape code. + * + * The Initial Developer of the Original Code is + * Netscape Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Doron Rosenberg + * Bob Clary + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + ***** END LICENSE BLOCK ***** */ + +function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) { + this.id = id; + this.scrollAmount = scrollAmount ? scrollAmount : 6; + this.scrollDelay = scrollDelay ? scrollDelay : 85; + this.direction = direction ? direction.toLowerCase() : 'left'; + this.behavior = behavior ? behavior.toLowerCase() : 'scroll'; + this.name = 'XbMarquee_' + (++XbMarquee._name); + this.runId = null; + this.html = html; + this.isHorizontal = ('up,down'.indexOf(this.direction) == -1); + + if (typeof(height) == 'number') { + this.height = height; + this.heightUnit = 'px'; + } + else if (typeof(height) == 'string') { + this.height = parseInt('0' + height, 10); + this.heightUnit = height.toLowerCase().replace(/^[0-9]+/, ''); + } + else { + this.height = 100; + this.heightUnit = 'px'; + } + + if (typeof(width) == 'number') { + this.width = width; + this.widthUnit = 'px'; + } + else if (typeof(width) == 'string') { + this.width = parseInt('0' + width, 10); + this.widthUnit = width.toLowerCase().replace(/^[0-9]+/, ''); + } + else { + this.width = 100; + this.widthUnit = 'px'; + } + + // XbMarquee UI events + this.onmouseover = null; + this.onmouseout = null; + this.onclick = null; + // XbMarquee state events + this.onstart = null; + this.onbounce = null; + + var markup = ''; + + if (document.layers) { + markup = '' + + '<\/ilayer>'; + } + else if (document.body && typeof(document.body.innerHTML) != 'string') { + markup = '
' + + '
' + + (this.isHorizontal ? '' : '') + + this.html + + (this.isHorizontal ? '<\/nobr>' : '') + + '<\/div>' + + '<\/div>'; + } + else { + markup = '
' + + '<\/div>'; + } + document.write(markup); + + window[this.name] = this; + +} + +// Class Properties/Methods + +XbMarquee._name = -1; + +XbMarquee._getInnerSize = function (elm, propName) { + var val = 0; + + if (document.layers) { + // navigator 4 + val = elm.document[propName]; + } + else if (elm.style && typeof(elm.style[propName]) == 'number') { + // opera + // bug in Opera 6 width/offsetWidth. Use clientWidth + if (propName == 'width' && typeof(elm.clientWidth) == 'number') + val = elm.clientWidth; + else + val = elm.style[propName]; + } + else { + //mozilla and IE + switch (propName) { + case 'height': + if (typeof(elm.offsetHeight) == 'number') + val = elm.offsetHeight; + break; + case 'width': + if (typeof(elm.offsetWidth) == 'number') + val = elm.offsetWidth; + break; + } + } + + return val; + +}; + +XbMarquee.getElm = function (id) { + var elm = null; + if (document.getElementById) { + elm = document.getElementById(id); + } + else { + elm = document.all[id]; + } + return elm; +}; + +XbMarquee.dispatchUIEvent = function (event, marqueeName, eventName) { + var marquee = window[marqueeName]; + var eventAttr = 'on' + eventName; + if (!marquee) { + return false; + } + + if (!event && window.event) { + event = window.event; + } + + switch (eventName) { + case 'mouseover': + case 'mouseout': + case 'click': + if (marquee[eventAttr]) + return marquee['on' + eventName](event); + } + + return false; +}; + +XbMarquee.createDispatchEventAttr = function (marqueeName, eventName) { + return 'on' + eventName + '="XbMarquee.dispatchUIEvent(event, \'' + marqueeName + '\', \'' + eventName + '\')" '; +}; + +// Instance properties/methods + +XbMarquee.prototype.start = function () { + var markup = ''; + + this.stop(); + + if (!this.dirsign) { + if (!document.layers) { + this.containerDiv = XbMarquee.getElm(this.id + 'container'); + + if (typeof(this.containerDiv.innerHTML) != 'string') { + return; + } + + // adjust the container size before inner div is filled in + // so IE will not hork the size of percentage units + var parentNode = null; + if (this.containerDiv.parentNode) + parentNode = this.containerDiv.parentNode; + else if (this.containerDiv.parentElement) + parentNode = this.containerDiv.parentElement; + + if (parentNode && + typeof(parentNode.offsetHeight) == 'number' && + typeof(parentNode.offsetWidth) == 'number') { + if (this.heightUnit == '%') { + this.containerDiv.style.height = + parentNode.offsetHeight * (this.height / 100) + 'px'; + } + + if (this.widthUnit == '%') { + this.containerDiv.style.width = + parentNode.offsetWidth * (this.width / 100) + 'px'; + } + } + + markup += '
' + + (this.isHorizontal ? '' : '') + + this.html + + (this.isHorizontal ? '<\/nobr>' : '') + + '<\/div>'; + + this.containerDiv.innerHTML = markup; + this.div = XbMarquee.getElm(this.id); + this.styleObj = this.div.style; + + } + else /* if (document.layers) */ + { + this.containerDiv = document.layers[this.id + 'container']; + markup = + '' + + (this.isHorizontal ? '' : '') + + this.html + + (this.isHorizontal ? '<\/nobr>' : '') + + '<\/layer>'; + + this.containerDiv.document.write(markup); + this.containerDiv.document.close(); + this.div = this.containerDiv.document.layers[this.id]; + this.styleObj = this.div; + } + + // Start must not run until the page load event has fired + // due to Internet Explorer not setting the height and width of + // the dynamically written content until then + switch (this.direction) { + case 'down': + this.dirsign = 1; + this.startAt = -XbMarquee._getInnerSize(this.div, 'height'); + this._setTop(this.startAt); + + if (this.heightUnit == '%') + this.stopAt = this.height * XbMarquee._getInnerSize(this.containerDiv, 'height') / 100; + else + this.stopAt = this.height; + + break; + + case 'up': + this.dirsign = -1; + + if (this.heightUnit == '%') + this.startAt = this.height * XbMarquee._getInnerSize(this.containerDiv, 'height') / 100; + else + this.startAt = this.height; + + this._setTop(this.startAt); + this.stopAt = -XbMarquee._getInnerSize(this.div, 'height'); + + break; + + case 'right': + this.dirsign = 1; + this.startAt = -XbMarquee._getInnerSize(this.div, 'width'); + this._setLeft(this.startAt); + + if (this.widthUnit == '%') + this.stopAt = this.width * XbMarquee._getInnerSize(this.containerDiv, 'width') / 100; + else + this.stopAt = this.width; + + break; + + case 'left': + default: + this.dirsign = -1; + + if (this.widthUnit == '%') + this.startAt = this.width * XbMarquee._getInnerSize(this.containerDiv, 'width') / 100; + else + this.startAt = this.width; + + this._setLeft(this.startAt); + this.stopAt = -XbMarquee._getInnerSize(this.div, 'width'); + + break; + } + this.newPosition = this.startAt; + this.styleObj.visibility = 'visible'; + } + + this.newPosition += this.dirsign * this.scrollAmount; + + if ((this.dirsign == 1 && this.newPosition > this.stopAt) || + (this.dirsign == -1 && this.newPosition < this.stopAt)) { + if (this.behavior == 'alternate') { + if (this.onbounce) { + // fire bounce when alternate changes directions + this.onbounce(); + } + this.dirsign = -this.dirsign; + var temp = this.stopAt; + this.stopAt = this.startAt; + this.startAt = temp; + } + else { + // fire start when position is a start + if (this.onstart) { + this.onstart(); + } + this.newPosition = this.startAt; + } + } + + switch (this.direction) { + case 'up': + case 'down': + this._setTop(this.newPosition); + break; + + case 'left': + case 'right': + default: + this._setLeft(this.newPosition); + break; + } + + this.runId = setTimeout(this.name + '.start()', this.scrollDelay); +}; + +XbMarquee.prototype.stop = function () { + if (this.runId) + clearTimeout(this.runId); + + this.runId = null; +}; + +XbMarquee.prototype.setInnerHTML = function (html) { + if (typeof(this.div.innerHTML) != 'string') { + return; + } + + var running = false; + if (this.runId) { + running = true; + this.stop(); + } + this.html = html; + this.dirsign = null; + if (running) { + this.start(); + } +}; + +// fixes standards mode in gecko +// since units are required + +if (document.layers) { + XbMarquee.prototype._setLeft = function (left) { + this.styleObj.left = left; + }; + + XbMarquee.prototype._setTop = function (top) { + this.styleObj.top = top; + }; +} +else { + XbMarquee.prototype._setLeft = function (left) { + this.styleObj.left = left + 'px'; + }; + + XbMarquee.prototype._setTop = function (top) { + this.styleObj.top = top + 'px'; + }; +} + + diff --git a/blocks/index.html b/blocks/index.html index 990cbd6..2c5cdd3 100644 --- a/blocks/index.html +++ b/blocks/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/blocks/marquee_bloc.php b/blocks/marquee_bloc.php index b7cdb8a..2244d89 100644 --- a/blocks/marquee_bloc.php +++ b/blocks/marquee_bloc.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,38 +11,42 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $options + * + * @return array */ function b_marquee_show($options) { global $xoopsTpl; - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $marquee_handler =& xoops_getmodulehandler('marquee', 'marquee'); - $block = array(); - $marqueeId = intval($options[0]); - if($marqueeId > 0) { + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $marquee_handler = xoops_getModuleHandler('marquee', 'marquee'); + $block = array(); + $marqueeId = (int)$options[0]; + if ($marqueeId > 0) { $marquee = null; $marquee = $marquee_handler->get($marqueeId); - if(is_object($marquee)) { - $uniqid = md5(uniqid(rand(), true)); - if(marquee_getmoduleoption('methodtouse') == 'DHTML') { - $link = ''; + if (is_object($marquee)) { + $uniqid = md5(uniqid(mt_rand(), true)); + if (marquee_getmoduleoption('methodtouse') === 'DHTML') { + $link = ''; $link .= "\n\n"; - $xoopsTpl->assign("xoops_module_header",$link); + $xoopsTpl->assign('xoops_module_header', $link); } $block['marqueecode'] = $marquee->constructmarquee($uniqid); } @@ -51,12 +55,17 @@ function b_marquee_show($options) return $block; } +/** + * @param $options + * + * @return string + */ function b_marquee_edit($options) { - $marquee_handler =& xoops_getmodulehandler('marquee', 'marquee'); - $form = ""; - $form.= ''; - $form.= '
' . _MB_MARQUEE_SELECT . "
'; + $marquee_handler = xoops_getModuleHandler('marquee', 'marquee'); + $form = ""; + $form .= ''; + $form .= '
' . _MB_MARQUEE_SELECT . "
'; return $form; } @@ -64,12 +73,15 @@ function b_marquee_edit($options) /* * Block on the fly */ +/** + * @param $options + */ function b_marquee_custom($options) { - $options = explode('|',$options); - $block = &b_marquee_show($options); + $options = explode('|', $options); + $block = b_marquee_show($options); $tpl = new XoopsTpl(); $tpl->assign('block', $block); - $tpl->display('db:marquee_block.html'); + $tpl->display('db:marquee_block.tpl'); } diff --git a/class/PersistableObjectHandler.php b/class/PersistableObjectHandler.php index 531ad2a..0b6d502 100644 --- a/class/PersistableObjectHandler.php +++ b/class/PersistableObjectHandler.php @@ -1,12 +1,18 @@ vars as $k => $v) { @@ -18,42 +24,44 @@ function toArray($format = 's') } /** -* Persistable Object Handler class. -* This class is responsible for providing data access mechanisms to the data source -* of derived class objects. -* -* @author Jan Keller Pedersen - IDG Danmark A/S -* @modified by Hervé Thouzard (http://www.herve-thouzard.com) -* @copyright copyright (c) 2000-2004 XOOPS.org -* @package Kernel -*/ - -class marquee_XoopsPersistableObjectHandler extends XoopsObjectHandler { - + * Persistable Object Handler class. + * This class is responsible for providing data access mechanisms to the data source + * of derived class objects. + * + * @author Jan Keller Pedersen - IDG Danmark A/S + * @modified by HervĂ© Thouzard (http://www.herve-thouzard.com) + * @copyright copyright (c) 2000-2004 XOOPS.org + * @package Kernel + */ +class MarqueePersistableObjectHandler extends XoopsPersistableObjectHandler//XoopsObjectHandler +{ /**#@+ - * Information about the class, the handler is managing - * - * @var string - */ - var $table; - var $keyName; - var $className; - var $identifierName; + * Information about the class, the handler is managing + * + * @var string + */ +// public $table; +// public $keyName; +// public $className; +// public $identifierName; /**#@-*/ /** - * Constructor - called from child classes - * @param object $db {@link XoopsDatabase} object - * @param string $tablename Name of database table - * @param string $classname Name of Class, this handler is managing - * @param string $keyname Name of the property, holding the key - * - * @return void - */ - function XoopsPersistableObjectHandler(&$db, $tablename, $classname, $keyname, $idenfierName = false) { - $this->XoopsObjectHandler($db); - $this->table = $db->prefix($tablename); - $this->keyName = $keyname; + * Constructor - called from child classes + * + * @param object|XoopsDatabase $db {@link XoopsDatabase} + * @param string $tablename Name of database table + * @param string $classname Name of Class, this handler is managing + * @param string $keyname Name of the property, holding the key + * + * @param bool $idenfierName + * + */ + public function __construct(XoopsDatabase $db, $tablename, $classname, $keyname, $idenfierName = false) + { + parent::__construct($db); + $this->table = $db->prefix($tablename); + $this->keyName = $keyname; $this->className = $classname; if ($idenfierName != false) { $this->identifierName = $idenfierName; @@ -67,7 +75,8 @@ function XoopsPersistableObjectHandler(&$db, $tablename, $classname, $keyname, $ * * @return object */ - function &create($isNew = true) { + public function create($isNew = true) + { $obj = new $this->className(); if ($isNew === true) { $obj->setNew(); @@ -79,27 +88,27 @@ function &create($isNew = true) { /** * retrieve an object * - * @param mixed $id ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor - * @param bool $as_object whether to return an object or an array + * @param mixed $id ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor + * @param null $fields + * @param bool $as_object whether to return an object or an array * @return mixed reference to the object, FALSE if failed */ - function &get($id, $as_object = true) { + public function get($id = null, $fields = null, $as_object = true)//&get($id, $as_object = true) + { if (is_array($this->keyName)) { $criteria = new CriteriaCompo(); - $vnb = count($this->keyName); - for ($i = 0; $i < $vnb; $i++) { - $criteria->add(new Criteria($this->keyName[$i], intval($id[$i]))); + $vnb = count($this->keyName); + for ($i = 0; $i < $vnb; ++$i) { + $criteria->add(new Criteria($this->keyName[$i], (int)$id[$i])); } - } - else { - $criteria = new Criteria($this->keyName, intval($id)); + } else { + $criteria = new Criteria($this->keyName, (int)$id); } $criteria->setLimit(1); - $obj_array = $this->getObjects($criteria, false, $as_object); + $obj_array =& $this->getObjects($criteria, false, $as_object); if (count($obj_array) != 1) { $ret = null; - } - else { + } else { $ret =& $obj_array[0]; } @@ -109,21 +118,21 @@ function &get($id, $as_object = true) { /** * retrieve objects from the database * - * @param object $criteria {@link CriteriaElement} conditions to be met - * @param bool $id_as_key use the ID as key for the array? - * @param bool $as_object return an array of objects? + * @param CriteriaElement $criteria {@link CriteriaElement} conditions to be met + * @param bool $id_as_key use the ID as key for the array? + * @param bool $as_object return an array of objects? * * @return array */ - function &getObjects($criteria = null, $id_as_key = false, $as_object = true) + public function &getObjects(CriteriaElement $criteria = null, $id_as_key = false, $as_object = true) { - $ret = array(); + $ret = array(); $limit = $start = 0; - $sql = 'SELECT * FROM '.$this->table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql = 'SELECT * FROM ' . $this->table; + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); if ($criteria->getSort() != '') { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); @@ -133,7 +142,7 @@ function &getObjects($criteria = null, $id_as_key = false, $as_object = true) return $ret; } - $ret =& $this->convertResultSet($result, $id_as_key, $as_object); + $ret = $this->convertResultSet($result, $id_as_key, $as_object); return $ret; } @@ -147,18 +156,18 @@ function &getObjects($criteria = null, $id_as_key = false, $as_object = true) * * @return array */ - function convertResultSet($result, $id_as_key = false, $as_object = true) { + public function convertResultSet($result, $id_as_key = false, $as_object = true) + { $ret = array(); while ($myrow = $this->db->fetchArray($result)) { - $obj =& $this->create(false); + $obj = $this->create(false); $obj->assignVars($myrow); if (!$id_as_key) { if ($as_object) { $ret[] =& $obj; - } - else { - $row = array(); - $vars = $obj->getVars(); + } else { + $row = array(); + $vars = $obj->getVars(); $tbl_tmp = array_keys($vars); foreach ($tbl_tmp as $i) { $row[$i] = $obj->getVar($i); @@ -168,10 +177,9 @@ function convertResultSet($result, $id_as_key = false, $as_object = true) { } else { if ($as_object) { $ret[$myrow[$this->keyName]] =& $obj; - } - else { - $row = array(); - $vars = $obj->getVars(); + } else { + $row = array(); + $vars = $obj->getVars(); $tbl_tmp = array_keys($vars); foreach ($tbl_tmp as $i) { $row[$i] = $obj->getVar($i); @@ -188,17 +196,18 @@ function convertResultSet($result, $id_as_key = false, $as_object = true) { /** * get IDs of objects matching a condition * - * @param object $criteria {@link CriteriaElement} to match - * @return array of object IDs + * @param CriteriaElement $criteria {@link CriteriaElement} to match + * + * @return array of object IDs */ - function getIds($criteria = null) + public function &getIds(CriteriaElement $criteria = null) //getIds(CriteriaElement $criteria = null) { - $sql = 'SELECT '.$this->keyName.' FROM ' . $this->table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql = 'SELECT ' . $this->keyName . ' FROM ' . $this->table; + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); } $result = $this->db->query($sql); - $ret = array(); + $ret = array(); while ($myrow = $this->db->fetchArray($result)) { $ret[] = $myrow[$this->keyName]; } @@ -206,16 +215,17 @@ function getIds($criteria = null) return $ret; } - /** - * Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS - * - * @param object $criteria {@link CriteriaElement} conditions to be met - * @param int $limit Max number of objects to fetch - * @param int $start Which record to start at - * - * @return array - */ - function getList($criteria = null, $limit = 0, $start = 0) { + /** + * Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS + * + * @param CriteriaElement $criteria {@link CriteriaElement} conditions to be met + * @param int $limit Max number of objects to fetch + * @param int $start Which record to start at + * + * @return array + */ + public function getList(CriteriaElement $criteria = null, $limit = 0, $start = 0) + { $ret = array(); if ($criteria == null) { $criteria = new CriteriaCompo(); @@ -225,15 +235,15 @@ function getList($criteria = null, $limit = 0, $start = 0) { $criteria->setSort($this->identifierName); } - $sql = 'SELECT '.$this->keyName; - if(!empty($this->identifierName)){ - $sql .= ', '.$this->identifierName; + $sql = 'SELECT ' . $this->keyName; + if (!empty($this->identifierName)) { + $sql .= ', ' . $this->identifierName; } - $sql .= ' FROM '.$this->table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' FROM ' . $this->table; + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); if ($criteria->getSort() != '') { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); @@ -243,35 +253,33 @@ function getList($criteria = null, $limit = 0, $start = 0) { return $ret; } - $myts =& MyTextSanitizer::getInstance(); + $myts = MyTextSanitizer::getInstance(); while ($myrow = $this->db->fetchArray($result)) { //identifiers should be textboxes, so sanitize them like that - $ret[$myrow[$this->keyName]] = empty($this->identifierName)?1:$myts->htmlSpecialChars($myrow[$this->identifierName]); + $ret[$myrow[$this->keyName]] = empty($this->identifierName) ? 1 : $myts->htmlSpecialChars($myrow[$this->identifierName]); } return $ret; } /** - * count objects matching a condition * - * @param object $criteria {@link CriteriaElement} to match - * @return int count of objects + * @param CriteriaElement $criteria {@link CriteriaElement} to match + * + * @return int count of objects */ - function getCount($criteria = null) + public function getCount(CriteriaElement $criteria = null) { - $field = ''; + $field = ''; $groupby = false; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - if ($criteria->groupby != '') { + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement') && $criteria->groupby != '') { $groupby = true; - $field = $criteria->groupby.', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used - } + $field = $criteria->groupby . ', '; //Not entirely secure unless you KNOW that no criteria's groupby clause is going to be mis-used } - $sql = 'SELECT '.$field.'COUNT(*) FROM '.$this->table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql = 'SELECT ' . $field . 'COUNT(*) FROM ' . $this->table; + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); if ($criteria->groupby != '') { $sql .= $criteria->getGroupby(); } @@ -284,8 +292,7 @@ function getCount($criteria = null) list($count) = $this->db->fetchRow($result); return $count; - } - else { + } else { $ret = array(); while (list($id, $count) = $this->db->fetchRow($result)) { $ret[$id] = $count; @@ -298,24 +305,24 @@ function getCount($criteria = null) /** * delete an object from the database * - * @param object $obj reference to the object to delete - * @param bool $force - * @return bool FALSE if failed. + * @param XoopsObject $object + * @param bool $force + * @return bool FALSE if failed. + * @internal param CriteriaElement $obj reference to the object to delete */ - function delete(&$obj, $force = false) + public function delete(XoopsObject $object, $force = false)//delete(CriteriaElement $obj, $force = false) { if (is_array($this->keyName)) { $clause = array(); - $vnb = count($this->keyName); - for ($i = 0; $i < $vnb; $i++) { - $clause[] = $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]); + $vnb = count($this->keyName); + for ($i = 0; $i < $vnb; ++$i) { + $clause[] = $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]); } $whereclause = implode(' AND ', $clause); + } else { + $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName); } - else { - $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName); - } - $sql = 'DELETE FROM '.$this->table.' WHERE '.$whereclause; + $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . $whereclause; if (false != $force) { $result = $this->db->queryF($sql); } else { @@ -331,11 +338,12 @@ function delete(&$obj, $force = false) /** * Quickly insert a record like this $myobject_handler->quickInsert('field1' => field1value, 'field2' => $field2value) * - * @param array $vars Array containing the fields name and value - * @param bool $force whether to force the query execution despite security settings - * @return bool @link insert's value + * @param array $vars Array containing the fields name and value + * @param bool $force whether to force the query execution despite security settings + * + * @return bool @link insert's value */ - function quickInsert($vars = null, $force = false) + public function quickInsert($vars = null, $force = false) { $object = $this->create(true); $object->setVars($vars); @@ -348,35 +356,37 @@ function quickInsert($vars = null, $force = false) /** * insert a new object in the database * - * @param object $obj reference to the object - * @param bool $force whether to force the query execution despite security settings - * @param bool $checkObject check if the object is dirty and clean the attributes - * @return bool FALSE if failed, TRUE if already present and unchanged or successful + * @param XoopsObject $obj reference to the object + * @param bool $force whether to force the query execution despite security settings + * @param bool $checkObject check if the object is dirty and clean the attributes + * + * @return bool FALSE if failed, TRUE if already present and unchanged or successful */ - function insert(&$obj, $force = false, $checkObject = true) + public function insert(XoopsObject $obj, $force = false, $checkObject = true)//insert(CriteriaElement $obj, $force = false, $checkObject = true) { if ($checkObject != false) { if (!is_object($obj)) { - trigger_error("Error, not object"); + trigger_error('Error, not object'); return false; } /** - * @TODO: Change to if (!(class_exists($this->className) && $obj instanceof $this->className)) when going fully PHP5 - */ + * @TODO: Change to if (!(class_exists($this->className) && $obj instanceof $this->className)) when going fully PHP5 + */ if (!is_a($obj, $this->className)) { - $obj->setErrors(get_class($obj).' Differs from '.$this->className); + $obj->setErrors(get_class($obj) . ' Differs from ' . $this->className); return false; } if (!$obj->isDirty()) { $obj->setErrors('Not dirty'); //will usually not be outputted as errors are not displayed when the method returns true, but it can be helpful when troubleshooting code - Mith + return true; } } if (!$obj->cleanVars()) { - foreach($obj->getErrors() as $oneerror) { + foreach ($obj->getErrors() as $oneerror) { trigger_error($oneerror); } @@ -384,49 +394,46 @@ function insert(&$obj, $force = false, $checkObject = true) } foreach ($obj->cleanVars as $k => $v) { if ($obj->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { - $cleanvars[$k] = intval($v); - } elseif ( is_array( $v ) ) { - $cleanvars[ $k ] = $this->db->quoteString( implode( ',', $v ) ); + $cleanvars[$k] = (int)$v; + } elseif (is_array($v)) { + $cleanvars[$k] = $this->db->quoteString(implode(',', $v)); } else { $cleanvars[$k] = $this->db->quoteString($v); } } - if(isset($cleanvars['dohtml'])) { // Modification Hervé to be able to use dohtml + if (isset($cleanvars['dohtml'])) { // Modification Hervďż˝ to be able to use dohtml unset($cleanvars['dohtml']); } if ($obj->isNew()) { - if (!is_array($this->keyName)) { - if ($cleanvars[$this->keyName] < 1) { - $cleanvars[$this->keyName] = $this->db->genId($this->table.'_'.$this->keyName.'_seq'); - } + if (!is_array($this->keyName) && $cleanvars[$this->keyName] < 1) { + $cleanvars[$this->keyName] = $this->db->genId($this->table . '_' . $this->keyName . '_seq'); } - $sql = 'INSERT INTO '.$this->table.' ('.implode(',', array_keys($cleanvars)).') VALUES ('.implode(',', array_values($cleanvars)) .')'; + $sql = 'INSERT INTO ' . $this->table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; } else { - $sql = 'UPDATE '.$this->table.' SET'; + $sql = 'UPDATE ' . $this->table . ' SET'; foreach ($cleanvars as $key => $value) { if ((!is_array($this->keyName) && $key == $this->keyName) || (is_array($this->keyName) && in_array($key, $this->keyName))) { continue; } - if (isset($notfirst) ) { + if (null !== $notfirst) { $sql .= ','; } - $sql .= ' '.$key.' = '.$value; + $sql .= ' ' . $key . ' = ' . $value; $notfirst = true; } if (is_array($this->keyName)) { $whereclause = ''; - $vnb = count($this->keyName); - for ($i = 0; $i < $vnb; $i++) { + $vnb = count($this->keyName); + for ($i = 0; $i < $vnb; ++$i) { if ($i > 0) { $whereclause .= ' AND '; } - $whereclause .= $this->keyName[$i].' = '.$obj->getVar($this->keyName[$i]); + $whereclause .= $this->keyName[$i] . ' = ' . $obj->getVar($this->keyName[$i]); } + } else { + $whereclause = $this->keyName . ' = ' . $obj->getVar($this->keyName); } - else { - $whereclause = $this->keyName.' = '.$obj->getVar($this->keyName); - } - $sql .= ' WHERE '.$whereclause; + $sql .= ' WHERE ' . $whereclause; } if (false != $force) { $result = $this->db->queryF($sql); @@ -436,7 +443,7 @@ function insert(&$obj, $force = false, $checkObject = true) if (!$result) { return false; } - if ($obj->isNew() && !is_array($this->keyName)) { + if (!is_array($this->keyName) && $obj->isNew()) { $obj->assignVar($this->keyName, $this->db->getInsertId()); } @@ -446,25 +453,26 @@ function insert(&$obj, $force = false, $checkObject = true) /** * Change a value for objects with a certain criteria * - * @param string $fieldname Name of the field - * @param string $fieldvalue Value to write - * @param object $criteria {@link CriteriaElement} + * @param string $fieldname Name of the field + * @param string|array $fieldvalue Value to write + * @param CriteriaElement|object $criteria {@link CriteriaElement} * + * @param bool $force * @return bool - **/ - function updateAll($fieldname, $fieldvalue, $criteria = null, $force = false) + */ + public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false)//function updateAll($fieldname, $fieldvalue, $criteria = null, $force = false) { $set_clause = $fieldname . ' = '; - if ( is_numeric( $fieldvalue ) ) { - $set_clause .= $fieldvalue; - } elseif ( is_array( $fieldvalue ) ) { - $set_clause .= $this->db->quoteString( implode( ',', $fieldvalue ) ); + if (is_numeric($fieldvalue)) { + $set_clause .= $fieldvalue; + } elseif (is_array($fieldvalue)) { + $set_clause .= $this->db->quoteString(implode(',', $fieldvalue)); } else { - $set_clause .= $this->db->quoteString( $fieldvalue ); + $set_clause .= $this->db->quoteString($fieldvalue); } - $sql = 'UPDATE '.$this->table.' SET '.$set_clause; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql = 'UPDATE ' . $this->table . ' SET ' . $set_clause; + if (null !== $criteria&& is_subclass_of($criteria, 'criteriaelement')) { + $sql .= ' ' . $criteria->renderWhere(); } if (false != $force) { $result = $this->db->queryF($sql); @@ -481,15 +489,19 @@ function updateAll($fieldname, $fieldvalue, $criteria = null, $force = false) /** * delete all objects meeting the conditions * - * @param object $criteria {@link CriteriaElement} with conditions to meet + * @param CriteriaElement|object $criteria {@link CriteriaElement} + * with conditions to meet + * + * @param bool $force + * @param bool $asObject * @return bool */ - function deleteAll($criteria = null) + public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false)//deleteAll($criteria = null) { - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { - $sql = 'DELETE FROM '.$this->table; - $sql .= ' '.$criteria->renderWhere(); + if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { + $sql = 'DELETE FROM ' . $this->table; + $sql .= ' ' . $criteria->renderWhere(); if (!$this->db->queryF($sql)) { return false; } diff --git a/class/marquee.php b/class/marquee.php index 3749b25..16e6f46 100644 --- a/class/marquee.php +++ b/class/marquee.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,102 +11,113 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** */ -if (!defined('XOOPS_ROOT_PATH')) { - die('XOOPS root path not defined'); -} +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); -include_once XOOPS_ROOT_PATH.'/kernel/object.php'; -include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; -if (!class_exists('marquee_XoopsPersistableObjectHandler')) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/class/PersistableObjectHandler.php'; +include_once XOOPS_ROOT_PATH . '/kernel/object.php'; +include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; +if (!class_exists('MarqueePersistableObjectHandler')) { + include_once XOOPS_ROOT_PATH . '/modules/marquee/class/PersistableObjectHandler.php'; } -class marquee extends marquee_Object +//class Marquee extends XoopsObject +/** + * Class Marquee + */ +class Marquee extends XoopsObject { - function marquee() + /** + * marquee constructor. + */ + public function __construct() { - $this->initVar('marquee_marqueeid',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_uid',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_direction',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_scrollamount',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_behaviour',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_bgcolor',XOBJ_DTYPE_TXTBOX, null, false,7); - $this->initVar('marquee_align',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_height',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_width',XOBJ_DTYPE_TXTBOX, null, false,4); - $this->initVar('marquee_hspace',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_scrolldelay',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_stoponmouseover',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_loop',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_vspace',XOBJ_DTYPE_INT,null,false); - $this->initVar('marquee_content',XOBJ_DTYPE_TXTAREA, null, false); - $this->initVar('marquee_source',XOBJ_DTYPE_TXTBOX, null, false,255); + parent::__construct(); + $this->initVar('marquee_marqueeid', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_uid', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_direction', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_scrollamount', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_behaviour', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_bgcolor', XOBJ_DTYPE_TXTBOX, null, false, 7); + $this->initVar('marquee_align', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_height', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_width', XOBJ_DTYPE_TXTBOX, null, false, 4); + $this->initVar('marquee_hspace', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_scrolldelay', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_stoponmouseover', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_loop', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_vspace', XOBJ_DTYPE_INT, null, false); + $this->initVar('marquee_content', XOBJ_DTYPE_TXTAREA, null, false); + $this->initVar('marquee_source', XOBJ_DTYPE_TXTBOX, null, false, 255); // To be able to use html $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); } - function constructmarquee($uniqid='') + /** + * @param string $uniqid + * + * @return mixed|string + */ + public function constructmarquee($uniqid = '') { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $tblalign = array('top','bottom','middle'); - $tblbehaviour = array('scroll','slide','alternate'); - $tbldirection = array('right','left','up','down'); - $stop = $this->getVar('marquee_stoponmouseover') == 1 ? ' onmouseover="this.stop()" onmouseout="this.start()"' : ''; - $bgcolor = trim($this->getVar('marquee_bgcolor')) !='' ? " bgcolor='".$this->getVar('marquee_bgcolor')."'" : ''; - $height = $this->getVar('marquee_height') !=0 ? " height=".$this->getVar('marquee_height') : ''; - $hspace = $this->getVar('marquee_hspace') !=0 ? " hspace=".$this->getVar('marquee_hspace') : ''; - $width = trim($this->getVar('marquee_width')) !='' ? " width='".$this->getVar('marquee_width')."'" : ''; - $scrolldelay = $this->getVar('marquee_scrolldelay') !=0 ? " scrolldelay=".$this->getVar('marquee_scrolldelay') : ''; - $loop= $this->getVar('marquee_loop') !=0 ? " loop=".$this->getVar('marquee_loop') : " loop='infinite'"; - $vspace = $this->getVar('marquee_vspace') !=0 ? " vspace=".$this->getVar('marquee_vspace') : ''; - $scrollamount = $this->getVar('marquee_scrollamount') !=0 ? " scrollamount=". $this->getVar('marquee_scrollamount') : ''; - $br = ' - '; + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $tblalign = array('top', 'bottom', 'middle'); + $tblbehaviour = array('scroll', 'slide', 'alternate'); + $tbldirection = array('right', 'left', 'up', 'down'); + $stop = $this->getVar('marquee_stoponmouseover') == 1 ? ' onmouseover="this.stop()" onmouseout="this.start()"' : ''; + $bgcolor = trim($this->getVar('marquee_bgcolor')) != '' ? " bgcolor='" . $this->getVar('marquee_bgcolor') . "'" : ''; + $height = $this->getVar('marquee_height') != 0 ? ' height=' . $this->getVar('marquee_height') : ''; + $hspace = $this->getVar('marquee_hspace') != 0 ? ' hspace=' . $this->getVar('marquee_hspace') : ''; + $width = trim($this->getVar('marquee_width')) != '' ? " width='" . $this->getVar('marquee_width') . "'" : ''; + $scrolldelay = $this->getVar('marquee_scrolldelay') != 0 ? ' scrolldelay=' . $this->getVar('marquee_scrolldelay') : ''; + $loop = $this->getVar('marquee_loop') != 0 ? ' loop=' . $this->getVar('marquee_loop') : " loop='infinite'"; + $vspace = $this->getVar('marquee_vspace') != 0 ? ' vspace=' . $this->getVar('marquee_vspace') : ''; + $scrollamount = $this->getVar('marquee_scrollamount') != 0 ? ' scrollamount=' . $this->getVar('marquee_scrollamount') : ''; + $br = ' - '; - if($this->getVar('marquee_direction') > 1 ) { + if ($this->getVar('marquee_direction') > 1) { $br = '
'; } - $content=''; - if($this->getVar('marquee_source') != 'fixed') { - include_once XOOPS_ROOT_PATH.'/modules/marquee/plugins/'.$this->getVar('marquee_source').'.php'; - $function_name = 'b_marquee_'.$this->getVar('marquee_source'); // For example b_marquee_comments - if(function_exists($function_name)) { - $limit = marquee_getmoduleoption('itemscount'); + $content = ''; + if ($this->getVar('marquee_source') !== 'fixed') { + include_once XOOPS_ROOT_PATH . '/modules/marquee/plugins/' . $this->getVar('marquee_source') . '.php'; + $function_name = 'b_marquee_' . $this->getVar('marquee_source'); // For example b_marquee_comments + if (function_exists($function_name)) { + $limit = marquee_getmoduleoption('itemscount'); $dateformat = marquee_getmoduleoption('dateformat'); - $itemssize = marquee_getmoduleoption('itemssize'); - $retval = call_user_func($function_name, $limit, $dateformat, $itemssize); - if(is_array($retval) && count($retval)>0) { - foreach($retval as $onevalue) { - if(isset($onevalue['category']) && xoops_trim($onevalue['category'])!= '') { - $onevalue['category'] = ' - '.$onevalue['category']; + $itemssize = marquee_getmoduleoption('itemssize'); + $retval = call_user_func($function_name, $limit, $dateformat, $itemssize); + if (is_array($retval) && count($retval) > 0) { + foreach ($retval as $onevalue) { + if (isset($onevalue['category']) && xoops_trim($onevalue['category']) != '') { + $onevalue['category'] = ' - ' . $onevalue['category']; } - if(isset($onevalue['link']) && xoops_trim($onevalue['link'])!= '') { - $onevalue['link'] = ' - '.$onevalue['link']; + if (isset($onevalue['link']) && xoops_trim($onevalue['link']) != '') { + $onevalue['link'] = ' - ' . $onevalue['link']; } - $content .= $onevalue['date'].$onevalue['category'].$onevalue['link'].$br; + $content .= $onevalue['date'] . $onevalue['category'] . $onevalue['link'] . $br; } } } } else { $content = $this->getVar('marquee_content'); } - if(!marquee_isbot()) { // We are using the microsoft html tag - if(strtolower(marquee_getmoduleoption('methodtouse')) != 'dhtml') { - return "".$content.""; - } else { // We are using the javascript method + if (!marquee_isbot()) { // We are using the microsoft html tag + if (strtolower(marquee_getmoduleoption('methodtouse')) !== 'dhtml') { + return "' . $content . ''; + } else { // We are using the javascript method $jscontent = ''; $jscontent .= "\n"; @@ -118,24 +129,36 @@ function constructmarquee($uniqid='') } } -class MarqueeMarqueeHandler extends marquee_XoopsPersistableObjectHandler +//class MarqueeMarqueeHandler extends MarqueePersistableObjectHandler +/** + * Class MarqueeMarqueeHandler + */ +class MarqueeMarqueeHandler extends MarqueePersistableObjectHandler { - function MarqueeMarqueeHandler($db) + /** + * @param $db + */ + public function __construct($db) { - $this->XoopsPersistableObjectHandler($db, 'marquee', 'marquee', 'marquee_marqueeid'); + parent::__construct($db, 'marquee', 'marquee', 'marquee_marqueeid'); } - function getHtmlMarqueesList($selectedmarquee=0) + /** + * @param int $selectedmarquee + * + * @return string + */ + public function getHtmlMarqueesList($selectedmarquee = 0) { - $ret=''; - $tbl_marquee = $this->getObjects(); - foreach($tbl_marquee as $one_marquee) { + $ret = ''; + $tbl_marquee =& $this->getObjects(); + foreach ($tbl_marquee as $one_marquee) { $selected = ''; - if($one_marquee->getVar('marquee_marqueeid') == $selectedmarquee) { - $selected=' selected'; + if ($one_marquee->getVar('marquee_marqueeid') == $selectedmarquee) { + $selected = ' selected'; } - $content = xoops_trim(strip_tags($one_marquee->getVar('marquee_content'))) != '' ? xoops_substr(strip_tags($one_marquee->getVar('marquee_content')),0,50) : $one_marquee->getVar('marquee_source'); - $ret.=''; + $content = xoops_trim(strip_tags($one_marquee->getVar('marquee_content'))) != '' ? xoops_substr(strip_tags($one_marquee->getVar('marquee_content')), 0, 50) : $one_marquee->getVar('marquee_source'); + $ret .= ''; } return $ret; diff --git a/class/marquee_utils.php b/class/marquee_utils.php index 8b03d4f..194ba5c 100644 --- a/class/marquee_utils.php +++ b/class/marquee_utils.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,10 +11,10 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** @@ -23,20 +23,17 @@ /** * A set of useful and common functions * - * @package references - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @copyright (c) Hervé Thouzard + * @package references + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @copyright (c) HervĂ© Thouzard * * Note: You should be able to use it without the need to instanciate it. * */ -if (!defined('XOOPS_ROOT_PATH')) { - die("XOOPS root path not defined"); -} +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); -class marquee_utils +class MarqueeUtilities { - const MODULE_NAME = 'marquee'; /** @@ -47,11 +44,11 @@ class marquee_utils * @static * @staticvar object */ - function &getInstance() + public function getInstance() { static $instance; - if (!isset($instance)) { - $instance = new references_utils(); + if (null === $instance) { + $instance = new MarqueeUtilities(); } return $instance; @@ -60,32 +57,33 @@ function &getInstance() /** * Returns a module's option (with cache) * - * @param string $option module option's name - * @param boolean $withCache Do we have to use some cache ? - * @return mixed option's value + * @param string $option module option's name + * @param boolean $withCache Do we have to use some cache ? + * + * @return mixed option's value */ - function getModuleOption($option, $withCache = true) + public function getModuleOption($option, $withCache = true) { global $xoopsModuleConfig, $xoopsModule; $repmodule = self::MODULE_NAME; static $options = array(); - if(is_array($options) && array_key_exists($option,$options) && $withCache) { + if (is_array($options) && array_key_exists($option, $options) && $withCache) { return $options[$option]; } $retval = false; - if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { - if(isset($xoopsModuleConfig[$option])) { - $retval= $xoopsModuleConfig[$option]; + if (null !== $xoopsModuleConfig && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { + if (isset($xoopsModuleConfig[$option])) { + $retval = $xoopsModuleConfig[$option]; } } else { - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->getByDirname($repmodule); - $config_handler =& xoops_gethandler('config'); + $module_handler = xoops_getHandler('module'); + $module = $module_handler->getByDirname($repmodule); + $config_handler = xoops_getHandler('config'); if ($module) { $moduleConfig = $config_handler->getConfigsByCat(0, $module->getVar('mid')); - if(isset($moduleConfig[$option])) { - $retval= $moduleConfig[$option]; + if (isset($moduleConfig[$option])) { + $retval = $moduleConfig[$option]; } } } @@ -99,102 +97,61 @@ function getModuleOption($option, $withCache = true) * * @return boolean need to say it ? */ - function isX23() - { - $x23 = false; - $xv = str_replace('XOOPS ','',XOOPS_VERSION); - if(intval(substr($xv,2,1)) >= 3) { - $x23 = true; - } - - return $x23; - } + // function isX23() + // { + // $x23 = false; + // $xv = str_replace('XOOPS ', '', XOOPS_VERSION); + // if ((int)(substr($xv, 2, 1)) >= 3) { + // $x23 = true; + // } + // + // return $x23; + // } /** * Retreive an editor according to the module's option "form_options" * - * @param string $caption Caption to give to the editor - * @param string $name Editor's name - * @param string $value Editor's value - * @param string $width Editor's width - * @param string $height Editor's height + * @param string $caption Caption to give to the editor + * @param string $name Editor's name + * @param string $value Editor's value + * @param string $width Editor's width + * @param string $height Editor's height + * @param string $supplemental + * * @return object The editor to use */ - function &getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental='') + public static function &getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '') { - $editor = false; - $editor_configs=array(); - $editor_configs['name'] =$name; - $editor_configs['value'] = $value; - $editor_configs['rows'] = 35; - $editor_configs['cols'] = 60; - $editor_configs['width'] = '100%'; - $editor_configs['height'] = '400px'; - - $editor_option = strtolower(self::getModuleOption('form_options')); - - if(self::isX23()) { - $editor = new XoopsFormEditor($caption, $editor_option, $editor_configs); - - return $editor; + global $xoopsModuleConfig; + if (class_exists('XoopsFormEditor')) { + $options['name'] = $name; + $options['value'] = $value; + $options['rows'] = 35; + $options['cols'] = '100%'; + $options['width'] = '100%'; + $options['height'] = '400px'; + $editor = new XoopsFormEditor($caption, $xoopsModuleConfig['form_options'], $options, $nohtml = false, $onfailure = 'textarea'); + } else { + $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, '100%', '100%'); } - // Only for Xoops 2.0.x - switch($editor_option) { - case 'fckeditor': - if ( is_readable(XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php')) { - require_once(XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php'); - $editor = new XoopsFormFckeditor($caption, $name, $value); - } - break; - - case 'htmlarea': - if ( is_readable(XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php')) { - require_once(XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php'); - $editor = new XoopsFormHtmlarea($caption, $name, $value); - } - break; - - case 'dhtmltextarea': - $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50, $supplemental); - break; - - case 'textarea': - $editor = new XoopsFormTextArea($caption, $name, $value); - break; - - case 'tinyeditor': - case 'tinymce': - if ( is_readable(XOOPS_ROOT_PATH.'/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) { - require_once XOOPS_ROOT_PATH.'/class/xoopseditor/tinyeditor/formtinyeditortextarea.php'; - $editor = new XoopsFormTinyeditorTextArea(array('caption'=> $caption, 'name'=>$name, 'value'=>$value, 'width'=>'100%', 'height'=>'400px')); - } - break; - - case 'koivi': - if ( is_readable(XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php')) { - require_once(XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php'); - $editor = new XoopsFormWysiwygTextArea($caption, $name, $value, $width, $height, ''); - } - break; - } - - return $editor; + return $editor; } /** * Create (in a link) a javascript confirmation's box * - * @param string $message Message to display - * @param boolean $form Is this a confirmation for a form ? - * @return string the javascript code to insert in the link (or in the form) + * @param string $message Message to display + * @param boolean $form Is this a confirmation for a form ? + * + * @return string the javascript code to insert in the link (or in the form) */ - function javascriptLinkConfirm($message, $form = false) + public function javascriptLinkConfirm($message, $form = false) { - if(!$form) { - return "onclick=\"javascript:return confirm('".str_replace("'"," ",$message)."')\""; + if (!$form) { + return "onclick=\"javascript:return confirm('" . str_replace("'", ' ', $message) . "')\""; } else { - return "onSubmit=\"javascript:return confirm('".str_replace("'"," ",$message)."')\""; + return "onSubmit=\"javascript:return confirm('" . str_replace("'", ' ', $message) . "')\""; } } @@ -203,12 +160,11 @@ function javascriptLinkConfirm($message, $form = false) * * @param string $message message to display * @param string $url The place where to go - * @param integer timeout Time to wait before to redirect + * @param integer timeout Time to wait before to redirect */ - function redirect($message='', $url='index.php', $time=2) + public function redirect($message = '', $url = 'index.php', $time = 2) { redirect_header($url, $time, $message); - exit(); } /** @@ -216,15 +172,15 @@ function redirect($message='', $url='index.php', $time=2) * * @return object The module */ - protected function _getModule() + protected static function getModule() { static $mymodule; - if (!isset($mymodule)) { + if (null === $mymodule) { global $xoopsModule; - if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == REFERENCES_DIRNAME ) { + if (null !== $xoopsModule && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == REFERENCES_DIRNAME) { $mymodule =& $xoopsModule; } else { - $hModule = &xoops_gethandler('module'); + $hModule = xoops_getHandler('module'); $mymodule = $hModule->getByDirname(REFERENCES_DIRNAME); } } @@ -234,13 +190,14 @@ protected function _getModule() /** * Returns the module's name (as defined by the user in the module manager) with cache + * * @return string Module's name */ - function getModuleName() + public function getModuleName() { static $moduleName; - if(!isset($moduleName)) { - $mymodule = self::_getModule(); + if (!isset($moduleName)) { + $mymodule = self::getModule(); $moduleName = $mymodule->getVar('name'); } @@ -252,17 +209,17 @@ function getModuleName() * * @return boolean Yes = we need to add them, false = no */ - function needsAsterisk() + public static function needsAsterisk() { - if(self::isX23()) { + if (self::isX23()) { return false; } - if(strpos(strtolower(XOOPS_VERSION), 'impresscms') !== false) { + if (strpos(strtolower(XOOPS_VERSION), 'impresscms') !== false) { return false; } - if(strpos(strtolower(XOOPS_VERSION), 'legacy') === false) { - $xv = xoops_trim(str_replace('XOOPS ','',XOOPS_VERSION)); - if(intval(substr($xv,4,2)) >= 17) { + if (strpos(strtolower(XOOPS_VERSION), 'legacy') === false) { + $xv = xoops_trim(str_replace('XOOPS ', '', XOOPS_VERSION)); + if ((int)substr($xv, 4, 2) >= 17) { return false; } } @@ -273,25 +230,25 @@ function needsAsterisk() /** * Mark the mandatory fields of a form with a star * - * @param object $sform The form to modify - * @param string $caracter The character to use to mark fields + * @param object $sform The form to modify + * + * @internal param string $caracter The character to use to mark fields * @return object The modified form */ - function &formMarkRequiredFields(&$sform) + public function &formMarkRequiredFields(&$sform) { - if(self::needsAsterisk()) { + if (self::needsAsterisk()) { $required = array(); - foreach($sform->getRequired() as $item) { + foreach ($sform->getRequired() as $item) { $required[] = $item->_name; } $elements = array(); - $elements = & $sform->getElements(); - $cnt = count($elements); - for($i=0; $i<$cnt; $i++) { - if( is_object($elements[$i]) && in_array($elements[$i]->_name, $required) - ) { + $elements = &$sform->getElements(); + $cnt = count($elements); + for ($i = 0; $i < $cnt; ++$i) { + if (is_object($elements[$i]) && in_array($elements[$i]->_name, $required)) { $elements[$i]->_caption .= ' *'; - } + } } } diff --git a/css/index.html b/css/index.html deleted file mode 100644 index 990cbd6..0000000 --- a/css/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/changelog.txt b/docs/changelog.txt index b632503..ff10312 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,77 +1,86 @@ -v2.49 2011/12/12 Final: +2.50 RC 1 2016-03-23 +================================= +- updates for XOOPS 2.5.8 and PHP 7 (mamba) + +2.50 Beta 1 2014-04-23 +================================= +- moved all images, CSS, and JS files to /assets (mamba) +- renamed .html Smarty templates to .tpl (mamba) + +2.49 2011/12/12 Final: ================================= - updated to ModuleClasses 1.1 (mamba) - added ColorPicker to form (mamba) - added update.php to increase background color size in DB -v2.48 2011/02/23: +2.48 2011/02/23: ================================= - updated GUI to XOOPS Standard (mamba) -v2.47 +2.47 ================================= -- You can use different editors (not only kiovi) +- You can use different editors (not only kiovi) -v2.46 +2.46 ================================= - Bugs corrections -v2.42 +2.42 ================================= - I have replaced the PHP glob() function with another one (because of some hosts) - I have corrected a bug in the administration's menu (bad link) -v2.41 +2.41 ================================= - Two new plugins, one for article 0.95 and another one for TplLeagueStats 1 - thank you very much Defkon1 ! -v2.4 +2.4 ================================= - I have added a plugin for catads -v2.0 & 2.2 +2.0 & 2.2 ================================= - You can use kiovi to create, in the module's admin part, kiovi to create your marquees - If the module detects that a web spyder is reading its content then it will replace the marquees with pure text - You can add blocks on-fly as following (so it means that you can create as many marquees as you want, not only 4). - 1 Enter 'Administration Menu'=>"block admin"=>"Add new block" - 2 In the "Add a new block": - 2.1 Block Type: choose anyone as you prefer - 2.2 Weight: input any valid value as you prefer - 2.3 Visible: select any one as you prefer - 2.4 Visible in: set any one as you prefer - 2.5 Title: input any valid text as you prefer - 2.6 Content: + 1 Enter 'Administration Menu'=>"block admin"=>"Add new block" + 2 In the "Add a new block": + 2.1 Block Type: choose anyone as you prefer + 2.2 Weight: input any valid value as you prefer + 2.3 Visible: select any one as you prefer + 2.4 Visible in: set any one as you prefer + 2.5 Title: input any valid text as you prefer + 2.6 Content: - include_once(XOOPS_ROOT_PATH . '/modules/marquee/blocks/marquee_bloc.php'); - b_marquee_custom(1); + include_once(XOOPS_ROOT_PATH . '/modules/marquee/blocks/marquee_bloc.php'); + b_marquee_custom(1); - 2.7 Content Type: MUSTBE "PHP Script" - 2.8 Cache lifetime: choose any one as you prefer - 2.9 Preview, Submit: press any one as you prefer, BE SURE press at least one time "submit" before leaving block admin + 2.7 Content Type: MUSTBE "PHP Script" + 2.8 Cache lifetime: choose any one as you prefer + 2.9 Preview, Submit: press any one as you prefer, BE SURE press at least one time "submit" before leaving block admin - Explanation : the number between parenthesis, in b_marquee_custom(1), is the marquee's ID you want to display. - You can see this ID in the module's admin part (that's the first column in the admin's index) + Explanation : the number between parenthesis, in b_marquee_custom(1), is the marquee's ID you want to display. + You can see this ID in the module's admin part (that's the first column in the admin's index) - You have the choice to use a dhtml marquee or the html marquee's tag - You can show the last informations from the folowing modules : - - Xoops comments - - News (1.2 or greater) - - Newbb & CBB - - Mylinks - - Mydownloads - - XoopsFaq - - XoopsPoll - - Smartclient - - Smartfaq - - Smartmedia - - Smartpartner - - Smartsection - - Wfdownloads 3 - - Wfsection 1 - - Xfsection - - Xoopspartners + - Xoops comments + - News (1.2 or greater) + - Newbb & CBB + - Mylinks + - Mydownloads + - XoopsFaq + - XoopsPoll + - Smartclient + - Smartfaq + - Smartmedia + - Smartpartner + - Smartsection + - Wfdownloads 3 + - Wfsection 1 + - Xfsection + - Xoopspartners - You can select the number of items to display if you have selected to display a content coming from a module -- You can select the date's format \ No newline at end of file +- You can select the date's format diff --git a/docs/credits.txt b/docs/credits.txt index 83981ee..f103606 100644 --- a/docs/credits.txt +++ b/docs/credits.txt @@ -1,6 +1,6 @@ Credits =============== -Originally developed by Hervé Thouzard (hervet), +Originally developed by HervĂ© Thouzard (hervet), Updated to XOOPS 2.5.0 Standard GUI by Michael Beck (Mamba), with contributions by Gregory Mage (Mage) \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 990cbd6..2c5cdd3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/docs/install.txt b/docs/install.txt index af5a22f..0478b6e 100644 --- a/docs/install.txt +++ b/docs/install.txt @@ -1,6 +1,6 @@ INSTALL/UNISTALL ================= -No special measures necessary, follow the standard installation process – extract the /marquee folder into the ../modules directory. Install the module through Admin -> System Module -> Modules. +No special measures necessary, follow the standard installation process – extract the /marquee folder into the ../modules directory. Install the module through Admin -> System Module -> Modules. Detailed instructions on installing modules are available in the XOOPS Operations Manual: http://goo.gl/adT2i \ No newline at end of file diff --git a/docs/readme.txt b/docs/readme.txt index 4630668..a82f90a 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -6,14 +6,14 @@ You can also set the loop, i.e. how many times should the marquee loop (from 1 t Requirements _____________________________________________________________________ - + - XOOPS >= 2.5.0 - PHP version >= 5.2.0 -- ModuleClasses in /Frameworks (download it from here: http://goo.gl/Bmknt) +- ModuleClasses in /Frameworks (download it from here: http://goo.gl/Bmknt) Install/uninstall --------------------- -No special measures necessary, follow the standard installation process – extract the /marquee folder into the ../modules directory. Install the module through Admin -> System Module -> Modules. +No special measures necessary, follow the standard installation process – extract the /marquee folder into the ../modules directory. Install the module through Admin -> System Module -> Modules. Detailed instructions on installing modules are available in the XOOPS Operations Manual: http://goo.gl/adT2i diff --git a/header.php b/header.php index 615e0f9..0090ff7 100644 --- a/header.php +++ b/header.php @@ -9,32 +9,32 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (http://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Marquee - * @since 2.5.0 - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ -**/ + * @package Marquee + * @since 2.5.0 + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ + **/ -include("../../../include/cp_header.php"); +include_once __DIR__ . '/../../include/cp_header.php'; -defined("FRAMEWORKS_ART_FUNCTIONS_INI") || include_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.ini.php'; -load_functions("admin"); +defined('FRAMEWORKS_ART_FUNCTIONS_INI') || include_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.ini.php'; +load_functions('admin'); +global $xoopsModule, $xoopsConfig; -if ( !@include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/" . $xoopsConfig['language'] . "/main.php")) { - include_once(XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/language/english/main.php"); +if (!@include_once(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/main.php')) { + include_once(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/main.php'); } -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once(XOOPS_ROOT_PATH."/class/template.php"); +if (null === $xoopsTpl || !is_object($xoopsTpl)) { + include_once(XOOPS_ROOT_PATH . '/class/template.php'); $xoopsTpl = new XoopsTpl(); } xoops_cp_header(); // Define Stylesheet and JScript -$xoTheme->addStylesheet( XOOPS_URL . "/modules/" . $xoopsModule->getVar("dirname") . "/css/admin.css" ); +$xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/admin.css'); //$xoTheme->addScript("browse.php?Frameworks/jquery/jquery.js"); -//$xoTheme->addScript("browse.php?modules/" . $xoopsModule->getVar("dirname") . "/js/admin.js"); -; +//$xoTheme->addScript("browse.php?modules/" . $xoopsModule->getVar("dirname") . "/assets/js/admin.js"); diff --git a/images/index.html b/images/index.html deleted file mode 100644 index 990cbd6..0000000 --- a/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/include/functions.php b/include/functions.php index af3b592..15608bf 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,49 +11,52 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -if (!defined('XOOPS_ROOT_PATH')) { - die('XOOPS root path not defined'); -} +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); /** * Returns a module's option * * Return's a module's option (for the news module) * - * @package Marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @copyright (c) Hervé Thouzard - * @param string $option module option's name + * @package Marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @copyright (c) HervĂ© Thouzard + * + * @param string $option module option's name + * + * @param string $repmodule + * + * @return bool */ function marquee_getmoduleoption($option, $repmodule = 'marquee') { global $xoopsModuleConfig, $xoopsModule; - static $tbloptions = Array(); - if(is_array($tbloptions) && array_key_exists($option,$tbloptions)) { + static $tbloptions = array(); + if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { return $tbloptions[$option]; } - $retval=false; - if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { - if(isset($xoopsModuleConfig[$option])) { + $retval = false; + if (null !== $xoopsModuleConfig && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { + if (isset($xoopsModuleConfig[$option])) { $retval = $xoopsModuleConfig[$option]; } } else { - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->getByDirname($repmodule); - $config_handler =& xoops_gethandler('config'); + $module_handler = xoops_getHandler('module'); + $module = $module_handler->getByDirname($repmodule); + $config_handler = xoops_getHandler('config'); if ($module) { $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); - if(isset($moduleConfig[$option])) { + if (isset($moduleConfig[$option])) { $retval = $moduleConfig[$option]; } } @@ -66,27 +69,27 @@ function marquee_getmoduleoption($option, $repmodule = 'marquee') /** * Verify if the current "user" is a bot or not * - * If you have a problem with this function, insert the folowing code just before the line if(isset($_SESSION['news_cache_bot'])) { : + * If you have a problem with this function, insert the folowing code just before the line if (isset($_SESSION['news_cache_bot'])) { : * return false; * - * @package Marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @copyright (c) Hervé Thouzard + * @package Marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @copyright (c) HervĂ© Thouzard */ function marquee_isbot() { - if(isset($_SESSION['marquee_cache_bot'])) { + if (isset($_SESSION['marquee_cache_bot'])) { return $_SESSION['marquee_cache_bot']; } else { // Add here every bot you know separated by a pipe | (not matter with the upper or lower cases) // If you want to see the result for yourself, add your navigator's user agent at the end (mozilla for example) - $botlist = 'AbachoBOT|Arachnoidea|ASPSeek|Atomz|cosmos|crawl25-public.alexa.com|CrawlerBoy Pinpoint.com|Crawler|DeepIndex|EchO!|exabot|Excalibur Internet Spider|FAST-WebCrawler|Fluffy the spider|GAIS Robot/1.0B2|GaisLab data gatherer|Google|Googlebot-Image|googlebot|Gulliver|ia_archiver|Infoseek|Links2Go|Lycos_Spider_(modspider)|Lycos_Spider_(T-Rex)|MantraAgent|Mata Hari|Mercator|MicrosoftPrototypeCrawler|Mozilla@somewhere.com|MSNBOT|NEC Research Agent|NetMechanic|Nokia-WAPToolkit|nttdirectory_robot|Openfind|Oracle Ultra Search|PicoSearch|Pompos|Scooter|Slider_Search_v1-de|Slurp|Slurp.so|SlySearch|Spider|Spinne|SurferF3|Surfnomore Spider|suzuran|teomaagent1|TurnitinBot|Ultraseek|VoilaBot|vspider|W3C_Validator|Web Link Validator|WebTrends|WebZIP|whatUseek_winona|WISEbot|Xenu Link Sleuth|ZyBorg'; - $botlist = strtoupper($botlist); + $botlist = 'AbachoBOT|Arachnoidea|ASPSeek|Atomz|cosmos|crawl25-public.alexa.com|CrawlerBoy Pinpoint.com|Crawler|DeepIndex|EchO!|exabot|Excalibur Internet Spider|FAST-WebCrawler|Fluffy the spider|GAIS Robot/1.0B2|GaisLab data gatherer|Google|Googlebot-Image|googlebot|Gulliver|ia_archiver|Infoseek|Links2Go|Lycos_Spider_(modspider)|Lycos_Spider_(T-Rex)|MantraAgent|Mata Hari|Mercator|MicrosoftPrototypeCrawler|Mozilla@somewhere.com|MSNBOT|NEC Research Agent|NetMechanic|Nokia-WAPToolkit|nttdirectory_robot|Openfind|Oracle Ultra Search|PicoSearch|Pompos|Scooter|Slider_Search_v1-de|Slurp|Slurp.so|SlySearch|Spider|Spinne|SurferF3|Surfnomore Spider|suzuran|teomaagent1|TurnitinBot|Ultraseek|VoilaBot|vspider|W3C_Validator|Web Link Validator|WebTrends|WebZIP|whatUseek_winona|WISEbot|Xenu Link Sleuth|ZyBorg'; + $botlist = strtoupper($botlist); $currentagent = strtoupper(xoops_getenv('HTTP_USER_AGENT')); - $retval = false; - $botarray = explode('|',$botlist); - foreach($botarray as $onebot) { - if(strstr($currentagent,$onebot)) { + $retval = false; + $botarray = explode('|', $botlist); + foreach ($botarray as $onebot) { + if (false !== strpos($currentagent, $onebot)) { $retval = true; break; } @@ -99,8 +102,12 @@ function marquee_isbot() /** * Escape a string so that it can be included in a javascript string + * + * @param $string + * + * @return mixed */ function marquee_javascript_escape($string) { - return str_replace("'","\\'",$string); + return str_replace("'", "\\'", $string); } diff --git a/include/index.html b/include/index.html index 990cbd6..2c5cdd3 100644 --- a/include/index.html +++ b/include/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/include/update.php b/include/update.php index 752ab87..99d6102 100644 --- a/include/update.php +++ b/include/update.php @@ -1,16 +1,73 @@ prefix('marquee') . "` MODIFY `marquee_bgcolor` varchar(7) NOT NULL default '';"; +//function xoops_module_update_marquee() +//{ +// $db = XoopsDatabaseFactory::getDatabaseConnection(); +// $sql = "ALTER TABLE `" . $db->prefix('marquee') . "` MODIFY `marquee_bgcolor` varchar(7) NOT NULL default '';"; +// $db->query($sql); +// +// return true; +//} + +function xoops_module_update_marquee($module, $oldversion = null) +{ + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $sql = 'ALTER TABLE `' . $db->prefix('marquee') . "` MODIFY `marquee_bgcolor` varchar(7) NOT NULL default '';"; $db->query($sql); - return true; + if ($oldversion < 250) { + + // delete old block html template files + $templateDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/templates/blocks/'; + $template_list = array_diff(scandir($templateDirectory), array('..', '.')); + foreach ($template_list as $k => $v) { + $fileinfo = new SplFileInfo($templateDirectory . $v); + if ($fileinfo->getExtension() === 'html' && $fileinfo->getFilename() !== 'index.html') { + @unlink($templateDirectory . $v); + } + } + // Load class XoopsFile + xoops_load('xoopsfile'); + //delete /images directory + $imagesDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/images/'; + $folderHandler = XoopsFile::getHandler('folder', $imagesDirectory); + $folderHandler->delete($imagesDirectory); + //delete /js directory + $jsDirectory = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/js/'; + $folderHandler = XoopsFile::getHandler('folder', $jsDirectory); + $folderHandler->delete($jsDirectory); + //delete /templates/style.css file + $deleteFile = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname', 'n') . '/admin/marquee.php'; + $folderHandler = XoopsFile::getHandler('file', $deleteFile); + $folderHandler->delete($deleteFile); + } + + $gperm_handler = xoops_getHandler('groupperm'); + + return $gperm_handler->deleteByModule($module->getVar('mid'), 'item_read'); } diff --git a/index.html b/index.html index 990cbd6..2c5cdd3 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/js/index.html b/js/index.html deleted file mode 100644 index 990cbd6..0000000 --- a/js/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/js/xbMarquee.js b/js/xbMarquee.js deleted file mode 100644 index 86e4ad3..0000000 --- a/js/xbMarquee.js +++ /dev/null @@ -1,474 +0,0 @@ -/* - * $Id: xbMarquee.js,v 1.21 2003/09/14 21:22:26 bc6ix Exp $ - * - */ - -/* ***** BEGIN LICENSE BLOCK ***** - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Netscape code. - * - * The Initial Developer of the Original Code is - * Netscape Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): Doron Rosenberg - * Bob Clary - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - ***** END LICENSE BLOCK ***** */ - -function xbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) -{ - this.id = id; - this.scrollAmount = scrollAmount ? scrollAmount : 6; - this.scrollDelay = scrollDelay ? scrollDelay : 85; - this.direction = direction ? direction.toLowerCase() : 'left'; - this.behavior = behavior ? behavior.toLowerCase() : 'scroll'; - this.name = 'xbMarquee_' + (++xbMarquee._name); - this.runId = null; - this.html = html; - this.isHorizontal = ('up,down'.indexOf(this.direction) == -1); - - if (typeof(height) == 'number') - { - this.height = height; - this.heightUnit = 'px'; - } - else if (typeof(height) == 'string') - { - this.height = parseInt('0' + height, 10); - this.heightUnit = height.toLowerCase().replace(/^[0-9]+/, ''); - } - else - { - this.height = 100; - this.heightUnit = 'px'; - } - - if (typeof(width) == 'number') - { - this.width = width; - this.widthUnit = 'px'; - } - else if (typeof(width) == 'string') - { - this.width = parseInt('0' + width, 10); - this.widthUnit = width.toLowerCase().replace(/^[0-9]+/, ''); - } - else - { - this.width = 100; - this.widthUnit = 'px'; - } - - // xbMarquee UI events - this.onmouseover = null; - this.onmouseout = null; - this.onclick = null; - // xbMarquee state events - this.onstart = null; - this.onbounce = null; - - var markup = ''; - - if (document.layers) - { - markup = '' + - '<\/ilayer>'; - } - else if (document.body && typeof(document.body.innerHTML) != 'string') - { - markup = '
' + - '
' + - (this.isHorizontal ? '' : '') + - this.html + - (this.isHorizontal ? '<\/nobr>' : '') + - '<\/div>' + - '<\/div>'; - } - else - { - markup = '
' + - '<\/div>'; - } - document.write(markup); - - window[this.name] = this; - -} - -// Class Properties/Methods - -xbMarquee._name = -1; - -xbMarquee._getInnerSize = function(elm, propName) -{ - var val = 0; - - if (document.layers) - { - // navigator 4 - val = elm.document[propName]; - } - else if (elm.style && typeof(elm.style[propName]) == 'number') - { - // opera - // bug in Opera 6 width/offsetWidth. Use clientWidth - if (propName == 'width' && typeof(elm.clientWidth) == 'number') - val = elm.clientWidth; - else - val = elm.style[propName]; - } - else - { - //mozilla and IE - switch (propName) - { - case 'height': - if (typeof(elm.offsetHeight) == 'number') - val = elm.offsetHeight; - break; - case 'width': - if (typeof(elm.offsetWidth) == 'number') - val = elm.offsetWidth; - break; - } - } - - return val; - -}; - -xbMarquee.getElm = function(id) -{ - var elm = null; - if (document.getElementById) - { - elm = document.getElementById(id); - } - else - { - elm = document.all[id]; - } - return elm; -} - -xbMarquee.dispatchUIEvent = function (event, marqueeName, eventName) -{ - var marquee = window[marqueeName]; - var eventAttr = 'on' + eventName; - if (!marquee) - { - return false; - } - - if (!event && window.event) - { - event = window.event; - } - - switch (eventName) - { - case 'mouseover': - case 'mouseout': - case 'click': - if (marquee[eventAttr]) - return marquee['on' + eventName](event); - } - - return false; -}; - -xbMarquee.createDispatchEventAttr = function (marqueeName, eventName) -{ - return 'on' + eventName + '="xbMarquee.dispatchUIEvent(event, \'' + marqueeName + '\', \'' + eventName + '\')" '; -}; - -// Instance properties/methods - -xbMarquee.prototype.start = function () -{ - var markup = ''; - - this.stop(); - - if (!this.dirsign) - { - if (!document.layers) - { - this.containerDiv = xbMarquee.getElm(this.id + 'container'); - - if (typeof(this.containerDiv.innerHTML) != 'string') - { - return; - } - - // adjust the container size before inner div is filled in - // so IE will not hork the size of percentage units - var parentNode = null; - if (this.containerDiv.parentNode) - parentNode = this.containerDiv.parentNode; - else if (this.containerDiv.parentElement) - parentNode = this.containerDiv.parentElement; - - if (parentNode && - typeof(parentNode.offsetHeight) == 'number' && - typeof(parentNode.offsetWidth) == 'number') - { - if (this.heightUnit == '%') - { - this.containerDiv.style.height = - parentNode.offsetHeight * (this.height/100) + 'px'; - } - - if (this.widthUnit == '%') - { - this.containerDiv.style.width = - parentNode.offsetWidth * (this.width/100) + 'px'; - } - } - - markup += '
' + - (this.isHorizontal ? '' : '') + - this.html + - (this.isHorizontal ? '<\/nobr>' : '') + - '<\/div>'; - - this.containerDiv.innerHTML = markup; - this.div = xbMarquee.getElm(this.id); - this.styleObj = this.div.style; - - } - else /* if (document.layers) */ - { - this.containerDiv = document.layers[this.id + 'container']; - markup = - '' + - (this.isHorizontal ? '' : '') + - this.html + - (this.isHorizontal ? '<\/nobr>' : '') + - '<\/layer>'; - - this.containerDiv.document.write(markup); - this.containerDiv.document.close(); - this.div = this.containerDiv.document.layers[this.id]; - this.styleObj = this.div; - } - - // Start must not run until the page load event has fired - // due to Internet Explorer not setting the height and width of - // the dynamically written content until then - switch (this.direction) - { - case 'down': - this.dirsign = 1; - this.startAt = -xbMarquee._getInnerSize(this.div, 'height'); - this._setTop(this.startAt); - - if (this.heightUnit == '%') - this.stopAt = this.height * xbMarquee._getInnerSize(this.containerDiv, 'height') / 100; - else - this.stopAt = this.height; - - break; - - case 'up': - this.dirsign = -1; - - if (this.heightUnit == '%') - this.startAt = this.height * xbMarquee._getInnerSize(this.containerDiv, 'height') / 100; - else - this.startAt = this.height; - - this._setTop(this.startAt); - this.stopAt = -xbMarquee._getInnerSize(this.div, 'height'); - - break; - - case 'right': - this.dirsign = 1; - this.startAt = -xbMarquee._getInnerSize(this.div, 'width'); - this._setLeft(this.startAt); - - if (this.widthUnit == '%') - this.stopAt = this.width * xbMarquee._getInnerSize(this.containerDiv, 'width') / 100; - else - this.stopAt = this.width; - - break; - - case 'left': - default: - this.dirsign = -1; - - if (this.widthUnit == '%') - this.startAt = this.width * xbMarquee._getInnerSize(this.containerDiv, 'width') / 100; - else - this.startAt = this.width - - this._setLeft(this.startAt); - this.stopAt = -xbMarquee._getInnerSize(this.div,'width'); - - break; - } - this.newPosition = this.startAt; - this.styleObj.visibility = 'visible'; - } - - this.newPosition += this.dirsign * this.scrollAmount; - - if ( (this.dirsign == 1 && this.newPosition > this.stopAt) || - (this.dirsign == -1 && this.newPosition < this.stopAt) ) - { - if (this.behavior == 'alternate') - { - if (this.onbounce) - { - // fire bounce when alternate changes directions - this.onbounce(); - } - this.dirsign = -this.dirsign; - var temp = this.stopAt; - this.stopAt = this.startAt; - this.startAt = temp; - } - else - { - // fire start when position is a start - if (this.onstart) - { - this.onstart(); - } - this.newPosition = this.startAt; - } - } - - switch(this.direction) - { - case 'up': - case 'down': - this._setTop(this.newPosition); - break; - - case 'left': - case 'right': - default: - this._setLeft(this.newPosition); - break; - } - - this.runId = setTimeout(this.name + '.start()', this.scrollDelay); -}; - -xbMarquee.prototype.stop = function () -{ - if (this.runId) - clearTimeout(this.runId); - - this.runId = null; -}; - -xbMarquee.prototype.setInnerHTML = function (html) -{ - if (typeof(this.div.innerHTML) != 'string') - { - return; - } - - var running = false; - if (this.runId) - { - running = true; - this.stop(); - } - this.html = html; - this.dirsign = null; - if (running) - { - this.start(); - } -}; - -// fixes standards mode in gecko -// since units are required - -if (document.layers) -{ - xbMarquee.prototype._setLeft = function (left) - { - this.styleObj.left = left; - }; - - xbMarquee.prototype._setTop = function (top) - { - this.styleObj.top = top; - }; -} -else -{ - xbMarquee.prototype._setLeft = function (left) - { - this.styleObj.left = left + 'px'; - }; - - xbMarquee.prototype._setTop = function (top) - { - this.styleObj.top = top + 'px'; - }; -} - - diff --git a/language/english/admin.php b/language/english/admin.php index 9bd2ca7..1be87cb 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -11,56 +11,56 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright Hervé Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author Hervé Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -define("_AM_MARQUEE_CONFIG","Marquees Configuration"); -define("_AM_MARQUEE_ID","ID"); -define("_AM_MARQUEE_GENERALSET","Preferences"); -define("_AM_MARQUEE_MODULEADMIN","Module's administration"); -define("_AM_MARQUEE_DIRECTION","Direction"); -define("_AM_MARQUEE_BEHAVIOUR","Behaviour"); -define("_AM_MARQUEE_STOP","Stop when mouse is over"); -define("_AM_MARQUEE_CONTENT","Content"); -define("_AM_MARQUEE_EDIT","Edit"); -define("_AM_MARQUEE_DELETE","Delete"); -define("_AM_MARQUEE_DIRECTION1","left->right"); -define("_AM_MARQUEE_DIRECTION2","right->left"); -define("_AM_MARQUEE_DIRECTION3","bottom->top"); -define("_AM_MARQUEE_DIRECTION4","top->bottom"); -define("_AM_MARQUEE_BEHAVIOUR1","scroll"); -define("_AM_MARQUEE_BEHAVIOUR2","slide"); -define("_AM_MARQUEE_BEHAVIOUR3","alternate"); -define("_AM_MARQUEE_ADDMARQUEE","Add a marquee"); -define("_AM_MARQUEE_ACTION","Action"); -define("_AM_MARQUEE_LOOP","Loop"); -define("_AM_MARQUEE_INFINITELOOP","Infinite"); -define("_AM_MARQUEE_ALIGN","Align"); -define("_AM_MARQUEE_ALIGN1","Top"); -define("_AM_MARQUEE_ALIGN2","Bottom"); -define("_AM_MARQUEE_ALIGN3","Middle"); -define("_AM_MARQUEE_ADDBUTTON","Add"); -define("_AM_MARQUEE_RESETBUTTON","Reset"); -define("_AM_MARQUEE_ERROR_ADD_MARQUEE","Error, the recquired fields have not been typed"); -define("_AM_MARQUEE_ADDED_OK","The marquee has been succesfully added"); -define("_AM_MARQUEE_DBUPDATED","The database has been sucesfully updated"); -define("_AM_MARQUEE_RUSUREDEL","Are you sure you want to delete this item ?"); -define("_AM_MARQUEE_UPDATE","Update"); -define("_AM_MARQUEE_BGCOLOR","Background color
(don't forget to put a #
if you specify a color code)"); -define("_AM_MARQUEE_WIDTH","Width (in pixels or percent)"); -define("_AM_MARQUEE_HEIGHT","Height (in pixels)"); -define("_AM_MARQUEE_SCRAMOUNT","Scroll amount"); -define("_AM_MARQUEE_HSPACE","Horizontal space (in pixels)"); -define("_AM_MARQUEE_VSPACE","Vertical space (in pixels)"); -define("_AM_MARQUEE_SCRDELAY","Delay between
two moves in milliseconds"); -define("_AM_MARQUEE_ERROR_MODIFY_DB","Error while updating the database"); -define("_AM_MARQUEE_SOURCE","Content's source"); -define("_AM_MARQUEE_SOURCE_FIXED","A fixed text"); +define('_AM_MARQUEE_CONFIG', 'Marquees Configuration'); +define('_AM_MARQUEE_ID', 'ID'); +define('_AM_MARQUEE_GENERALSET', 'Preferences'); +define('_AM_MARQUEE_MODULEADMIN', "Module's administration"); +define('_AM_MARQUEE_DIRECTION', 'Direction'); +define('_AM_MARQUEE_BEHAVIOUR', 'Behaviour'); +define('_AM_MARQUEE_STOP', 'Stop when mouse is over'); +define('_AM_MARQUEE_CONTENT', 'Content'); +define('_AM_MARQUEE_EDIT', 'Edit'); +define('_AM_MARQUEE_DELETE', 'Delete'); +define('_AM_MARQUEE_DIRECTION1', 'left->right'); +define('_AM_MARQUEE_DIRECTION2', 'right->left'); +define('_AM_MARQUEE_DIRECTION3', 'bottom->top'); +define('_AM_MARQUEE_DIRECTION4', 'top->bottom'); +define('_AM_MARQUEE_BEHAVIOUR1', 'scroll'); +define('_AM_MARQUEE_BEHAVIOUR2', 'slide'); +define('_AM_MARQUEE_BEHAVIOUR3', 'alternate'); +define('_AM_MARQUEE_ADDMARQUEE', 'Add a marquee'); +define('_AM_MARQUEE_ACTION', 'Action'); +define('_AM_MARQUEE_LOOP', 'Loop'); +define('_AM_MARQUEE_INFINITELOOP', 'Infinite'); +define('_AM_MARQUEE_ALIGN', 'Align'); +define('_AM_MARQUEE_ALIGN1', 'Top'); +define('_AM_MARQUEE_ALIGN2', 'Bottom'); +define('_AM_MARQUEE_ALIGN3', 'Middle'); +define('_AM_MARQUEE_ADDBUTTON', 'Add'); +define('_AM_MARQUEE_RESETBUTTON', 'Reset'); +define('_AM_MARQUEE_ERROR_ADD_MARQUEE', "Error, we couldn't add this Marquee"); +define('_AM_MARQUEE_ADDED_OK', 'The marquee has been successfully added'); +define('_AM_MARQUEE_DBUPDATED', 'The database has been sucesfully updated'); +define('_AM_MARQUEE_RUSUREDEL', 'Are you sure you want to delete this item?'); +define('_AM_MARQUEE_UPDATE', 'Update'); +define('_AM_MARQUEE_BGCOLOR', "Background color
(don't forget to put a #
if you specify a color code)"); +define('_AM_MARQUEE_WIDTH', 'Width (in pixels or percent)'); +define('_AM_MARQUEE_HEIGHT', 'Height (in pixels)'); +define('_AM_MARQUEE_SCRAMOUNT', 'Scroll amount'); +define('_AM_MARQUEE_HSPACE', 'Horizontal space (in pixels)'); +define('_AM_MARQUEE_VSPACE', 'Vertical space (in pixels)'); +define('_AM_MARQUEE_SCRDELAY', 'Delay between
two moves in milliseconds'); +define('_AM_MARQUEE_ERROR_MODIFY_DB', 'Error while updating the database'); +define('_AM_MARQUEE_SOURCE', "Content's source"); +define('_AM_MARQUEE_SOURCE_FIXED', 'A fixed text'); //2.4.8 -define("_AM_MARQUEE_BGCOLOR_SHORT","Background color"); +define('_AM_MARQUEE_BGCOLOR_SHORT', 'Background color'); diff --git a/language/english/blocks.php b/language/english/blocks.php index 2c078de..8165588 100644 --- a/language/english/blocks.php +++ b/language/english/blocks.php @@ -11,12 +11,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright Hervé Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author Hervé Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -define("_MB_MARQUEE_SELECT","Select the marquee to use"); +define('_MB_MARQUEE_SELECT', 'Select the marquee to use'); diff --git a/language/english/extension.php b/language/english/extension.php index 75b0c2b..a99f226 100644 --- a/language/english/extension.php +++ b/language/english/extension.php @@ -11,15 +11,15 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright Hervé Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author Hervé Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -define("_EXT_MARQUEE_ALTWMP","Add a marquee from Marquee module"); -define("_EXT_MARQUEE_TEXTID","Marquee's Id you want to display"); -define("_EXT_MARQUEE_TEXTTITLE","Enter marquee title"); +define('_EXT_MARQUEE_ALTWMP', 'Add a marquee from Marquee module'); +define('_EXT_MARQUEE_TEXTID', "Marquee's Id you want to display"); +define('_EXT_MARQUEE_TEXTTITLE', 'Enter marquee title'); diff --git a/language/english/help/help.html b/language/english/help/help.html index e60e559..be356d4 100644 --- a/language/english/help/help.html +++ b/language/english/help/help.html @@ -21,31 +21,33 @@

Description

Install/uninstall

No special measures necessary, follow the standard installation process – - extract the /marquee folder into the ../modules directory. Install the - module through Admin -> System Module -> Modules.

- Detailed instructions on installing modules are available in the - XOOPS Operations Manual

+ extract the /marquee folder into the ../modules directory. Install the + module through Admin -> System Module -> Modules.

+ Detailed instructions on installing modules are available in the + Chapter 2.12 of our XOOPS Operations Manual

+ -

Operating instructions

- This module and its operations are very simple:

+ This module and its operations are very simple:

    -
  • Configure your preferences (e.g. select the text editor
  • -
  • Add a Marquee
  • +
  • Configure your preferences (e.g. select the text editor
  • +
  • Add a Marquee
  • Select a block you want this Marquee to be visible and set desired - options
  • + options +
  • Check that you have given your user groups the necessary module and - block access rights to use this module. Group permissions are set through - the Administration Menu -> System -> Groups.
  • -
+ block access rights to use this module. Group permissions are set through + the Administration Menu -> System -> Groups. + + Detailed instructions on configuring the access rights for user groups are available in the - XOOPS Operations Manual

+ Chapter 2.8 of our XOOPS Operations Manual

Tutorial

You can find a more detailed Tutorial here

-
\ No newline at end of file +
diff --git a/language/english/help/index.html b/language/english/help/index.html index 990cbd6..2c5cdd3 100644 --- a/language/english/help/index.html +++ b/language/english/help/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/language/english/index.html b/language/english/index.html index 990cbd6..2c5cdd3 100644 --- a/language/english/index.html +++ b/language/english/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 88abecc..1d9100a 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -11,36 +11,36 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright Hervé Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author Hervé Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** */ -define("_MI_MARQUEE_NAME","Marquee"); -define("_MI_MARQUEE_DESC","Enable you to create scrolling texts (marquees)"); -define("_MI_MARQUEE_BNAME_01","Marquee 01"); -define("_MI_MARQUEE_BDESC_01","Display marquee 01"); -define("_MI_MARQUEE_BNAME_02","Marquee 02"); -define("_MI_MARQUEE_BDESC_02","Display marquee 02"); -define("_MI_MARQUEE_BNAME_03","Marquee 03"); -define("_MI_MARQUEE_BDESC_03","Display marquee 03"); -define("_MI_MARQUEE_BNAME_04","Marquee 04"); -define("_MI_MARQUEE_BDESC_04","Display marquee 04"); -define("_MI_MARQUEE_MENU_01","Manage marquees"); -define("_MI_MARQUEE_USE_KIOVI","Use kiovi ?"); -define("_MI_MARQUEE_USE_KIOVI_DESC","If it is detected then Kiovi will be used"); -define("_MI_MARQUEE_METHOD","Method to use"); -define("_MI_MARQUEE_METHOD_DESC","If you select the 'Marquee' method then the module will use the html marquee's tag, this method is not compatible with all navigators but offers many options.
If you select the 'dhtml' method, then the marquee should run with more navigators but it will require more code in your page and you will have less options"); -define("_MI_MARQUEE_MARQUEE","Marquee"); -define("_MI_MARQUEE_DHTML","Javascript"); -define("_MI_MARQUEE_DATEFORMAT","Date's format"); -define("_MI_MARQUEE_DATEFORMAT_DESC","Please refer to the Php documentation (http://fr.php.net/manual/en/function.date.php) for more information on how to select the format. Note, if you don't type anything then the default date's format will be used"); -define("_MI_MARQUE_ITEMSCOUNT","Items count"); -define("_MI_MARQUE_ITEMSCOUNT_DESC","When you select to use the content of another module (and not a fixed text) to create Marquees, this is the number of items to list"); -define("_MI_MARQUE_TITLELENGTH","Titles length"); -define("_MI_MARQUE_TITLELENGTH_DESC","Define the maximum length for the items titles (0=no limit)"); +define('_MI_MARQUEE_NAME', 'Marquee'); +define('_MI_MARQUEE_DESC', 'Enable you to create scrolling texts (marquees)'); +define('_MI_MARQUEE_BNAME_01', 'Marquee 01'); +define('_MI_MARQUEE_BDESC_01', 'Display marquee 01'); +define('_MI_MARQUEE_BNAME_02', 'Marquee 02'); +define('_MI_MARQUEE_BDESC_02', 'Display marquee 02'); +define('_MI_MARQUEE_BNAME_03', 'Marquee 03'); +define('_MI_MARQUEE_BDESC_03', 'Display marquee 03'); +define('_MI_MARQUEE_BNAME_04', 'Marquee 04'); +define('_MI_MARQUEE_BDESC_04', 'Display marquee 04'); +define('_MI_MARQUEE_MENU_01', 'Manage marquees'); +define('_MI_MARQUEE_USE_KIOVI', 'Use kiovi?'); +define('_MI_MARQUEE_USE_KIOVI_DESC', 'If it is detected then Kiovi will be used'); +define('_MI_MARQUEE_METHOD', 'Method to use'); +define('_MI_MARQUEE_METHOD_DESC', "If you select the 'Marquee' method then the module will use the html marquee's tag, this method is not compatible with all navigators but offers many options.
If you select the 'dhtml' method, then the marquee should run with more navigators but it will require more code in your page and you will have less options"); +define('_MI_MARQUEE_MARQUEE', 'Marquee'); +define('_MI_MARQUEE_DHTML', 'Javascript'); +define('_MI_MARQUEE_DATEFORMAT', "Date's format"); +define('_MI_MARQUEE_DATEFORMAT_DESC', "Please refer to the Php documentation (http://fr.php.net/manual/en/function.date.php) for more information on how to select the format. Note, if you don't type anything then the default date's format will be used"); +define('_MI_MARQUE_ITEMSCOUNT', 'Items count'); +define('_MI_MARQUE_ITEMSCOUNT_DESC', 'When you select to use the content of another module (and not a fixed text) to create Marquees, this is the number of items to list'); +define('_MI_MARQUE_TITLELENGTH', 'Titles length'); +define('_MI_MARQUE_TITLELENGTH_DESC', 'Define the maximum length for the items titles (0=no limit)'); -define("_MI_MARQUEE_TEXT_EDITOR","Text editor to use"); +define('_MI_MARQUEE_TEXT_EDITOR', 'Text editor to use'); diff --git a/language/index.html b/language/index.html index 990cbd6..2c5cdd3 100644 --- a/language/index.html +++ b/language/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/plugins/article.php b/plugins/article.php index 55fdc4a..177814f 100644 --- a/plugins/article.php +++ b/plugins/article.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,13 +11,19 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemsize + * + * @return array */ // ------------------------------------------------------------------------ // @@ -25,75 +31,77 @@ // written by Defkon1 [defkon1 at gmail dot com] // // ------------------------------------------------------------------------ // - -function b_marquee_article($limit, $dateformat, $itemsize){ +function b_marquee_article($limit, $dateformat, $itemsize) +{ global $xoopsDB; - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - require_once(XOOPS_ROOT_PATH."/modules/article/include/functions.php"); - $block=array(); - $myts =& MyTextSanitizer::getInstance(); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + require_once(XOOPS_ROOT_PATH . '/modules/article/include/functions.php'); + $block = array(); + $myts = MyTextSanitizer::getInstance(); static $access_cats; $artConfig = art_load_config(); art_define_url_delimiter(); - $select = "art_id"; - $disp_tag = ""; - $from = ""; - $where = ""; - $order = "art_time_publish DESC"; + $select = 'art_id'; + $disp_tag = ''; + $from = ''; + $where = ''; + $order = 'art_time_publish DESC'; - $select .= ", cat_id, art_title, uid, art_time_publish"; + $select .= ', cat_id, art_title, uid, art_time_publish'; - if(!isset($access_cats)){ - $permission_handler =& xoops_getmodulehandler("permission", "article"); - $access_cats =& $permission_handler->getCategories("access"); + if (null === $access_cats) { + $permission_handler = xoops_getModuleHandler('permission', 'article'); + $access_cats =& $permission_handler->getCategories('access'); } $allowed_cats = $access_cats; - $query = "SELECT $select FROM " . art_DB_prefix("article"). $from; - $query .= " WHERE cat_id IN (" . implode(",", $allowed_cats) . ") AND art_time_publish >0 ". $where; - $query .= " ORDER BY " . $order; - $query .= " LIMIT 0, ".$limit; + $query = "SELECT $select FROM " . art_DB_prefix('article') . $from; + $query .= ' WHERE cat_id IN (' . implode(',', $allowed_cats) . ') AND art_time_publish >0 ' . $where; + $query .= ' ORDER BY ' . $order; + $query .= ' LIMIT 0, ' . $limit; if (!$result = $xoopsDB->query($query)) { return false; } - $rows = array(); + $rows = array(); $author = array(); while ($row = $xoopsDB->fetchArray($result)) { - $rows[] = $row; - $author[$row["uid"]] = 1; + $rows[] = $row; + $author[$row['uid']] = 1; + } + if (count($rows) < 1) { + return false; } - if (count($rows) < 1) return false; $author_name = XoopsUser::getUnameFromId(array_keys($author)); - $arts = array(); - $uids = array(); - $cids = array(); - $article_handler =& xoops_getmodulehandler("article", "article"); + $arts = array(); + $uids = array(); + $cids = array(); + $article_handler = xoops_getModuleHandler('article', 'article'); foreach ($rows as $row) { - $article =& $article_handler->create(false); + $article = $article_handler->create(false); $article->assignVars($row); $_art = array(); - foreach($row as $tag=>$val) { + foreach ($row as $tag => $val) { $_art[$tag] = @$article->getVar($tag); } - $_art["author"] = $author_name[$row["uid"]]; + $_art['author'] = $author_name[$row['uid']]; - $_art["date"] = $article->getTime($dateformat); + $_art['date'] = $article->getTime($dateformat); - $titlelength = $itemsize+3; - $_art["title"] = xoops_substr($_art["art_title"], 0, $titlelength); + $titlelength = $itemsize + 3; + $_art['title'] = xoops_substr($_art['art_title'], 0, $titlelength); - $_art["category"] = ''; + $_art['category'] = ''; - $delimiter = "/"; - $_art["link"] = "".$_art["art_title"].""; + $delimiter = '/'; + $_art['link'] = "" . $_art['art_title'] . ''; $arts[] = $_art; unset($article, $_art); - $cids[$row["cat_id"]] = 1; + $cids[$row['cat_id']] = 1; } $block = $arts; diff --git a/plugins/catads.php b/plugins/catads.php index 9ccfafa..5965768 100644 --- a/plugins/catads.php +++ b/plugins/catads.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,67 +11,73 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent ads from the catads module (tested with catads v 1.4) function b_marquee_catads($limit, $dateformat, $itemssize) { global $xoopsModule, $xoopsModuleConfig, $xoopsDB; - include_once XOOPS_ROOT_PATH.'/modules/catads/class/cat.php'; + include_once XOOPS_ROOT_PATH . '/modules/catads/class/cat.php'; $block = array(); - if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'catads') { - $module_handler =& xoops_gethandler('module'); - $module =& $module_handler->getByDirname('catads'); - $config_handler =& xoops_gethandler('config'); - $config =& $config_handler->getConfigsByCat(0,$module->getVar('mid')); + if (empty($xoopsModule) || $xoopsModule->getVar('dirname') !== 'catads') { + $module_handler = xoops_getHandler('module'); + $module = $module_handler->getByDirname('catads'); + $config_handler = xoops_getHandler('config'); + $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); } else { $module =& $xoopsModule; $config =& $xoopsModuleConfig; } //echo '
ok'; - $ads_hnd =& xoops_getmodulehandler('ads', 'catads'); + $ads_hnd = xoops_getModuleHandler('ads', 'catads'); $criteria = new CriteriaCompo(new Criteria('waiting', '0')); $criteria->add(new Criteria('published', time(), '<')); - $criteria->add(new Criteria('expired', time(),'>')); + $criteria->add(new Criteria('expired', time(), '>')); $criteria->setSort('published'); $criteria->setOrder('DESC'); $criteria->setLimit($options[0]); $nbads = $ads_hnd->getCount($criteria); - $a_item = array(); + $a_item = array(); $cat_buffer = array(); if ($nbads > 0) { $ads = $ads_hnd->getObjects($criteria); - $ts =& MyTextSanitizer::getInstance(); - foreach( $ads as $oneads ) { - if($itemssize > 0) { - $title = xoops_substr($oneads->getVar('ads_title'),0,$itemssize); + $ts = MyTextSanitizer::getInstance(); + foreach ($ads as $oneads) { + if ($itemssize > 0) { + $title = xoops_substr($oneads->getVar('ads_title'), 0, $itemssize); } else { $title = $oneads->getVar('ads_title'); } - if(!isset($cat_buffer[$oneads->getVar('cat_id')])) { - $tmpcat = new AdsCategory($oneads->getVar('cat_id')); + if (!isset($cat_buffer[$oneads->getVar('cat_id')])) { + $tmpcat = new AdsCategory($oneads->getVar('cat_id')); $cat_buffer[$oneads->getVar('cat_id')] = $tmpcat->title(); - $cat_title = $tmpcat->title(); + $cat_title = $tmpcat->title(); } else { $cat_title = $cat_buffer[$oneads->getVar('cat_id')]; } - $block[]=array( 'date' => formatTimestamp($oneads->getVar('published'),$dateformat), - 'category' => '', - 'author'=> XoopsUser::getUnameFromId($oneads->getVar('uid')), - 'title'=> $title, - 'link' =>"".$title.'' ); + $block[] = array( + 'date' => formatTimestamp($oneads->getVar('published'), $dateformat), + 'category' => '', + 'author' => XoopsUser::getUnameFromId($oneads->getVar('uid')), + 'title' => $title, + 'link' => "" . $title . ''); unset($a_item); } - } return $block; diff --git a/plugins/comments.php b/plugins/comments.php index 94c9a95..435cbb1 100644 --- a/plugins/comments.php +++ b/plugins/comments.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,26 +11,32 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list system's comments - Tested with Xoops 2.0.9.3 function b_marquee_comments($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $block=array(); - $status = XOOPS_COMMENT_APPROVEUSER; - $module = 0 ; - $module_handler =& xoops_gethandler('module'); - $comment_handler =& xoops_gethandler('comment'); - $criteria = new CriteriaCompo(); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + $block = array(); + $status = XOOPS_COMMENT_APPROVEUSER; + $module = 0; + $module_handler = xoops_getHandler('module'); + $comment_handler = xoops_getHandler('comment'); + $criteria = new CriteriaCompo(); if ($status > 0) { $criteria->add(new Criteria('com_status', $status)); } @@ -40,7 +46,7 @@ function b_marquee_comments($limit, $dateformat, $itemssize) $total = $comment_handler->getCount($criteria); if ($total > 0) { $start = 0; - $sort = 'com_created'; + $sort = 'com_created'; $order = 'DESC'; $criteria->setSort($sort); $criteria->setOrder($order); @@ -48,18 +54,19 @@ function b_marquee_comments($limit, $dateformat, $itemssize) $criteria->setStart($start); $comments =& $comment_handler->getObjects($criteria, true); foreach (array_keys($comments) as $i) { - $module =& $module_handler->get($comments[$i]->getVar('com_modid')); + $module = $module_handler->get($comments[$i]->getVar('com_modid')); $comment_config = $module->getInfo('comments'); - if($itemssize>0) { - $title=xoops_substr($comments[$i]->getVar('com_title'),0,$itemssize+3); + if ($itemssize > 0) { + $title = xoops_substr($comments[$i]->getVar('com_title'), 0, $itemssize + 3); } else { - $title=$comments[$i]->getVar('com_title'); + $title = $comments[$i]->getVar('com_title'); } - $block[]=array( 'date' => formatTimestamp($comments[$i]->getVar('com_created'),$dateformat), - 'category' => '', - 'author'=> $comments[$i]->getVar('com_uid'), - 'title'=> $title, - 'link' =>"getVar('dirname').'/'.$comment_config['pageName'].'?'.$comment_config['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$comments[$i]->getVar('com_id').'&com_rootid='.$comments[$i]->getVar('com_rootid').'&com_mode=thread&'.str_replace('&', '&', $comments[$i]->getVar('com_exparams')).'#comment'.$comments[$i]->getVar('com_id')."'>".$title.''); + $block[] = array( + 'date' => formatTimestamp($comments[$i]->getVar('com_created'), $dateformat), + 'category' => '', + 'author' => $comments[$i]->getVar('com_uid'), + 'title' => $title, + 'link' => "getVar('dirname') . '/' . $comment_config['pageName'] . '?' . $comment_config['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&com_id=' . $comments[$i]->getVar('com_id') . '&com_rootid=' . $comments[$i]->getVar('com_rootid') . '&com_mode=thread&' . str_replace('&', '&', $comments[$i]->getVar('com_exparams')) . '#comment' . $comments[$i]->getVar('com_id') . "'>" . $title . ''); } } diff --git a/plugins/index.html b/plugins/index.html index 990cbd6..2c5cdd3 100644 --- a/plugins/index.html +++ b/plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/plugins/mydownloads.php b/plugins/mydownloads.php index a8e6a3d..55eba71 100644 --- a/plugins/mydownloads.php +++ b/plugins/mydownloads.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,38 +11,45 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list the recent links from the mydownloads module version 1.10 function b_marquee_mydownloads($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $result = $db->query("SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle, u.name, u.uname FROM ".$db->prefix("mydownloads_downloads")." m, ".$db->prefix("mydownloads_cat")." c, ".$db->prefix("users")." u WHERE (c.cid=m.cid) AND (m.submitter=u.uid) AND (m.status>0) ORDER BY m.date DESC",$limit,0); - while($myrow = $db->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["title"]); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $result = $db->query('SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle, u.name, u.uname FROM ' . $db->prefix('mydownloads_downloads') . ' m, ' . $db->prefix('mydownloads_cat') . ' c, ' . $db->prefix('users') . ' u WHERE (c.cid=m.cid) AND (m.submitter=u.uid) AND (m.status>0) ORDER BY m.date DESC', $limit, 0); + while ($myrow = $db->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['title']); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $author=$myts->htmlSpecialChars($myrow["uname"]); - if(xoops_trim($myrow["catitle"])!='') { - $author=$myts->htmlSpecialChars($myrow["name"]); + $author = $myts->htmlSpecialChars($myrow['uname']); + if (xoops_trim($myrow['catitle']) != '') { + $author = $myts->htmlSpecialChars($myrow['name']); } - $category = $myts->htmlSpecialChars($myrow["catitle"]); - $block[]=array( 'date' => formatTimestamp($myrow['date'],$dateformat), - 'category' => $category, - 'author'=> $author , - 'title'=> $title, - 'link' =>"".$title.''); + $category = $myts->htmlSpecialChars($myrow['catitle']); + $block[] = array( + 'date' => formatTimestamp($myrow['date'], $dateformat), + 'category' => $category, + 'author' => $author, + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/plugins/mylinks.php b/plugins/mylinks.php index 463807c..55ec730 100644 --- a/plugins/mylinks.php +++ b/plugins/mylinks.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,33 +11,40 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list the recent links from the mylinks module version 1.10 function b_marquee_mylinks($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $result = $db->query("SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle FROM ".$db->prefix("mylinks_links")." m, ".$db->prefix("mylinks_cat")." c WHERE (c.cid=m.cid) AND (m.status>0) ORDER BY date DESC",$limit,0); - while($myrow = $db->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["title"]); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $result = $db->query('SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle FROM ' . $db->prefix('mylinks_links') . ' m, ' . $db->prefix('mylinks_cat') . ' c WHERE (c.cid=m.cid) AND (m.status>0) ORDER BY date DESC', $limit, 0); + while ($myrow = $db->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['title']); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $block[]=array( 'date' => formatTimestamp($myrow['date'],$dateformat), - 'category' =>$myts->htmlSpecialChars($myrow['catitle']), - 'author'=> $myrow['submitter'] , - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($myrow['date'], $dateformat), + 'category' => $myts->htmlSpecialChars($myrow['catitle']), + 'author' => $myrow['submitter'], + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/plugins/newbb.php b/plugins/newbb.php index 39a0b83..c8351be 100644 --- a/plugins/newbb.php +++ b/plugins/newbb.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,45 +11,51 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent posts from Newbb 1 & 2 function b_marquee_newbb($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $block=array(); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $block = array(); - $module_handler = &xoops_gethandler('module'); - $newbb = $module_handler->getByDirname('newbb'); - $newbb_version = intval($newbb->getInfo('version')); + $module_handler = xoops_getHandler('module'); + $newbb = $module_handler->getByDirname('newbb'); + $newbb_version = (int)$newbb->getInfo('version'); - if($newbb_version>=2) { - $order = 't.topic_time'; - $forum_handler = &xoops_getmodulehandler('forum', 'newbb'); - $module_handler = &xoops_gethandler('module'); - $newbb = $module_handler->getByDirname('newbb'); + if ($newbb_version >= 2) { + $order = 't.topic_time'; + $forum_handler = xoops_getModuleHandler('forum', 'newbb'); + $module_handler = xoops_getHandler('module'); + $newbb = $module_handler->getByDirname('newbb'); - if(!isset($newbbConfig)){ - $config_handler = &xoops_gethandler('config'); - $newbbConfig = &$config_handler->getConfigsByCat(0, $newbb->getVar('mid')); + if (null === $newbbConfig) { + $config_handler = xoops_getHandler('config'); + $newbbConfig = &$config_handler->getConfigsByCat(0, $newbb->getVar('mid')); } - if(!isset($access_forums)){ + if (null === $access_forums) { $access_forums = $forum_handler->getForums(0, 'access'); // get all accessible forums } - $valid_forums = array_keys($access_forums); + $valid_forums = array_keys($access_forums); $forum_criteria = ' AND t.forum_id IN (' . implode(',', $valid_forums) . ')'; unset($access_forums); $approve_criteria = ' AND t.approved = 1 AND p.approved = 1'; - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $query = 'SELECT t.*, f.forum_name, f.allow_subject_prefix, p.post_id, p.icon, p.uid, p.poster_name, u.uname, u.name FROM ' . $db->prefix('bb_topics') . ' t, ' . $db->prefix('bb_forums') . ' f, ' . $db->prefix('bb_posts') . ' p LEFT JOIN ' . $db->prefix("users") . ' u ON u.uid = p.uid WHERE f.forum_id=t.forum_id ' . $forum_criteria . $approve_criteria . ' AND t.topic_last_post_id=p.post_id ORDER BY ' . $order . ' DESC'; - $result = $db->query($query, $limit, 0); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $query = 'SELECT t.*, f.forum_name, f.allow_subject_prefix, p.post_id, p.icon, p.uid, p.poster_name, u.uname, u.name FROM ' . $db->prefix('bb_topics') . ' t, ' . $db->prefix('bb_forums') . ' f, ' . $db->prefix('bb_posts') . ' p LEFT JOIN ' . $db->prefix('users') . ' u ON u.uid = p.uid WHERE f.forum_id=t.forum_id ' . $forum_criteria . $approve_criteria . ' AND t.topic_last_post_id=p.post_id ORDER BY ' . $order . ' DESC'; + $result = $db->query($query, $limit, 0); if (!$result) { return ''; } @@ -57,47 +63,50 @@ function b_marquee_newbb($limit, $dateformat, $itemssize) while ($row = $db->fetchArray($result)) { $rows[] = $row; } - if (count($rows) < 1) return false; - $myts =& MyTextSanitizer::getInstance(); + if (count($rows) < 1) { + return false; + } + $myts = MyTextSanitizer::getInstance(); foreach ($rows as $arr) { $title = $myts->htmlSpecialChars($arr['topic_title']); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $block[]=array( 'date' => formatTimestamp($arr['topic_time'],$dateformat), - 'category' => $arr['forum_name'], - 'author'=> $arr['uid'], - 'title'=> $title, - 'link' => "" . $title . ""); + $block[] = array( + 'date' => formatTimestamp($arr['topic_time'], $dateformat), + 'category' => $arr['forum_name'], + 'author' => $arr['uid'], + 'title' => $title, + 'link' => "" . $title . ''); } - } else { // Newbb 1 - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $myts =& MyTextSanitizer::getInstance(); + } else { // Newbb 1 + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $myts = MyTextSanitizer::getInstance(); $order = 't.topic_time'; - $query='SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_time, t.topic_views, t.topic_replies, t.forum_id, f.forum_name FROM '.$db->prefix('bb_topics').' t, '.$db->prefix('bb_forums').' f WHERE f.forum_id=t.forum_id AND f.forum_type <> 1 ORDER BY '.$order.' DESC'; - if (!$result = $db->query($query,$limit,0)) { + $query = 'SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.topic_time, t.topic_views, t.topic_replies, t.forum_id, f.forum_name FROM ' . $db->prefix('bb_topics') . ' t, ' . $db->prefix('bb_forums') . ' f WHERE f.forum_id=t.forum_id AND f.forum_type <> 1 ORDER BY ' . $order . ' DESC'; + if (!$result = $db->query($query, $limit, 0)) { return ''; } while ($arr = $db->fetchArray($result)) { - $lastpostername = $db->query("SELECT post_id, uid FROM ".$db->prefix("bb_posts")." WHERE post_id = ".$arr['topic_last_post_id']); + $lastpostername = $db->query('SELECT post_id, uid FROM ' . $db->prefix('bb_posts') . ' WHERE post_id = ' . $arr['topic_last_post_id']); while ($tmpdb = $db->fetchArray($lastpostername)) { $tmpuser = XoopsUser::getUnameFromId($tmpdb['uid']); - $time = formatTimestamp($arr['topic_time'],$dateformat); + $time = formatTimestamp($arr['topic_time'], $dateformat); } $title = $myts->htmlSpecialChars($arr['topic_title']); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $block[]=array( 'date' => $time, - 'category' => $arr['forum_name'], - 'author' => $tmpuser, - 'title' => $title, - 'link' => "" . $title . ""); + $block[] = array( + 'date' => $time, + 'category' => $arr['forum_name'], + 'author' => $tmpuser, + 'title' => $title, + 'link' => "" . $title . ''); } - } return $block; diff --git a/plugins/news.php b/plugins/news.php index ec12f18..a7fe4ed 100644 --- a/plugins/news.php +++ b/plugins/news.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,37 +11,44 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent articles from the News module (version >=1.21) function b_marquee_news($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; - $block=$stories=array(); - $story = new NewsStory(); - $restricted=marquee_getmoduleoption('restrictindex','news'); - $stories=$story->getAllPublished($limit,0,$restricted,0,1,true,'published'); - if(count($stories)>0) { - foreach($stories as $onestory) { - if($itemssize>0) { - $title=xoops_substr($onestory->title(),0,$itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; + $block = $stories = array(); + $story = new NewsStory(); + $restricted = marquee_getmoduleoption('restrictindex', 'news'); + $stories = NewsStory::getAllPublished($limit, 0, $restricted, 0, 1, true, 'published'); + if (count($stories) > 0) { + foreach ($stories as $onestory) { + if ($itemssize > 0) { + $title = xoops_substr($onestory->title(), 0, $itemssize + 3); } else { - $title=$onestory->title(); + $title = $onestory->title(); } - $block[]=array( 'date' => formatTimestamp($onestory->published(),$dateformat), - 'category' => $onestory->topic_title(), - 'author'=> $onestory->uid(), - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($onestory->published(), $dateformat), + 'category' => $onestory->topic_title(), + 'author' => $onestory->uid(), + 'title' => $title, + 'link' => "" . $title . ''); } } diff --git a/plugins/smartclient.php b/plugins/smartclient.php index 46647e6..9be3faa 100644 --- a/plugins/smartclient.php +++ b/plugins/smartclient.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,40 +11,47 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent clients from the smartclient module (tested with smartclient 1.02) function b_marquee_smartclient($limit, $dateformat, $itemssize) { $block = array(); - if( !defined("SMARTCLIENT_DIRNAME") ){ - define("SMARTCLIENT_DIRNAME", 'smartclient'); + if (!defined('SMARTCLIENT_DIRNAME')) { + define('SMARTCLIENT_DIRNAME', 'smartclient'); } - include_once(XOOPS_ROOT_PATH."/modules/" . SMARTCLIENT_DIRNAME . "/include/common.php"); + include_once(XOOPS_ROOT_PATH . '/modules/' . SMARTCLIENT_DIRNAME . '/include/common.php'); // Creating the client handler object $client_handler =& smartclient_gethandler('client'); $clientsObj =& $client_handler->getClients($limit, 0, _SCLIENT_STATUS_ACTIVE, 'title', 'ASC'); - If ($clientsObj) { - for ( $i = 0; $i < count($clientsObj); $i++ ) { - if($itemssize > 0) { - $title = xoops_substr($clientsObj[$i]->title(),0,$itemssize); + if ($clientsObj) { + for ($i = 0; $i < count($clientsObj); ++$i) { + if ($itemssize > 0) { + $title = xoops_substr($clientsObj[$i]->title(), 0, $itemssize); } else { $title = $clientsObj[$i]->title(); } - $block[]=array( 'date' => '', - 'category' => '', - 'author'=> '', - 'title'=> $title, - 'link' =>"".$title.'' ); + $block[] = array( + 'date' => '', + 'category' => '', + 'author' => '', + 'title' => $title, + 'link' => "" . $title . ''); } } diff --git a/plugins/smartfaq.php b/plugins/smartfaq.php index 40062cf..3a3b2de 100644 --- a/plugins/smartfaq.php +++ b/plugins/smartfaq.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,30 +11,35 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent FAQ from the smartfaq module (tested with smartfaq 1.04) function b_marquee_smartfaq($limit, $dateformat, $itemssize) { - include_once(XOOPS_ROOT_PATH."/modules/smartfaq/include/functions.php"); + include_once(XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'); $block = array(); - $smartModule =& sf_getModuleInfo(); + $smartModule =& sf_getModuleInfo(); $smartModuleConfig =& sf_getModuleConfig(); - $categoryid = -1; - $sort = 'datesub'; - if($itemssize > 0) { + $categoryid = -1; + $sort = 'datesub'; + $maxQuestionLength = 99999; + if ($itemssize > 0) { $maxQuestionLength = $itemssize; - } else { - $maxQuestionLength = 99999; } // Creating the faq handler object @@ -44,32 +49,32 @@ function b_marquee_smartfaq($limit, $dateformat, $itemssize) $category_handler =& sf_gethandler('category'); // Creating the last FAQs - $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort); + $faqsObj = $faq_handler->getAllPublished($limit, 0, $categoryid, $sort); $allcategories = $category_handler->getObjects(null, true); - If ($faqsObj) { + if ($faqsObj) { $userids = array(); foreach ($faqsObj as $key => $thisfaq) { - $faqids[] = $thisfaq->getVar('faqid'); + $faqids[] = $thisfaq->getVar('faqid'); $userids[$thisfaq->uid()] = 1; } $answer_handler =& sf_gethandler('answer'); - $allanswers = $answer_handler->getLastPublishedByFaq($faqids); + $allanswers = $answer_handler->getLastPublishedByFaq($faqids); foreach ($allanswers as $key => $thisanswer) { $userids[$thisanswer->uid()] = 1; } - $member_handler = &xoops_gethandler('member'); - $users = $member_handler->getUsers(new Criteria('uid', "(".implode(',', array_keys($userids)).")", "IN"), true); - for ( $i = 0; $i < count($faqsObj); $i++ ) { + $member_handler = xoops_getHandler('member'); + $users = $member_handler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); + for ($i = 0; $i < count($faqsObj); ++$i) { $answerObj =& $allanswers[$faqsObj[$i]->faqid()]; - $title= $faqsObj[$i]->question($maxQuestionLength); - $block[]=array( 'date' => $faqsObj[$i]->datesub(), - 'category' => $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'), - 'author'=> sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users), - 'title'=> $title, - 'link' =>"".$title.''); - + $title = $faqsObj[$i]->question($maxQuestionLength); + $block[] = array( + 'date' => $faqsObj[$i]->datesub(), + 'category' => $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'), + 'author' => sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users), + 'title' => $title, + 'link' => "" . $title . ''); } } diff --git a/plugins/smartmedia.php b/plugins/smartmedia.php index db3e3c6..761bbe4 100644 --- a/plugins/smartmedia.php +++ b/plugins/smartmedia.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,42 +11,47 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent clips from the smartmedia module (tested with smartmedia 0.85) function b_marquee_smartmedia($limit, $dateformat, $itemssize) { $block = array(); - if( !defined("SMARTMEDIA_DIRNAME") ){ - define("SMARTMEDIA_DIRNAME", 'smartmedia'); + if (!defined('SMARTMEDIA_DIRNAME')) { + define('SMARTMEDIA_DIRNAME', 'smartmedia'); } - include_once(XOOPS_ROOT_PATH."/modules/" . SMARTMEDIA_DIRNAME . "/include/common.php"); - - if($itemssize > 0) { + include_once(XOOPS_ROOT_PATH . '/modules/' . SMARTMEDIA_DIRNAME . '/include/common.php'); + $title_length = 99999; + if ($itemssize > 0) { $title_length = $itemssize; - } else { - $title_length = 99999; } $max_clips = $limit; $clipsArray =& $smartmedia_clip_handler->getClipsFromAdmin(0, $max_clips, 'clips.created_date', 'DESC', 'all'); - If ($clipsArray) { + if ($clipsArray) { foreach ($clipsArray as $clipArray) { - $clip = array(); - $block[]=array( 'date' => '', - 'category' => '', - 'author'=> '', - 'title'=> $clipArray['title'], - 'link' => '' . $clipArray['title']. '' ); - unset ($clip); + $clip = array(); + $block[] = array( + 'date' => '', + 'category' => '', + 'author' => '', + 'title' => $clipArray['title'], + 'link' => '' . $clipArray['title'] . ''); + unset($clip); } } diff --git a/plugins/smartpartner.php b/plugins/smartpartner.php index 33d42c3..bc2946a 100644 --- a/plugins/smartpartner.php +++ b/plugins/smartpartner.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,62 +11,69 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent partners from the smartpartner module (tested with smartparnter 1.2) function b_marquee_smartpartner($limit, $dateformat, $itemssize) { $block = array(); - if( !defined("SMARTPARTNER_DIRNAME") ){ - define("SMARTPARTNER_DIRNAME", 'smartpartner'); + if (!defined('SMARTPARTNER_DIRNAME')) { + define('SMARTPARTNER_DIRNAME', 'smartpartner'); } - include_once(XOOPS_ROOT_PATH."/modules/" . SMARTPARTNER_DIRNAME . "/include/common.php"); + include_once(XOOPS_ROOT_PATH . '/modules/' . SMARTPARTNER_DIRNAME . '/include/common.php'); // Creating the partner handler object - $smartpartner_partner_handler =& smartpartner_gethandler('partner'); - $smartpartner_category_handler =& smartpartner_gethandler('category'); + $smartpartner_partner_handler = smartpartner_gethandler('partner'); + $smartpartner_category_handler = smartpartner_gethandler('category'); // Randomize $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); - If (count($partnersObj) > 1) { - $key_arr = array_keys($partnersObj); - $key_rand = array_rand($key_arr,count($key_arr)); - for ($i=0 ; (($i 1) { + $key_arr = array_keys($partnersObj); + $key_rand = array_rand($key_arr, count($key_arr)); + for ($i = 0; ($i < count($partnersObj)) && ($i < $limit); ++$i) { + $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } $cat_id = array(); - foreach($partnersObj as $partnerObj){ - if(!in_array($partnerObj->categoryid(),$cat_id)){ + foreach ($partnersObj as $partnerObj) { + if (!in_array($partnerObj->categoryid(), $cat_id)) { $cat_id[] = $partnerObj->categoryid(); } } - If ($partnersObj) { - for ( $j = 0; $j < count($cat_id); $j++ ) { + if ($partnersObj) { + for ($j = 0; $j < count($cat_id); ++$j) { $categoryObj = $smartpartner_category_handler->get($cat_id[$j]); - for ( $i = 0; $i < count($partnersObj); $i++ ) { - if($partnersObj[$i]->categoryid() == $cat_id[$j]){ + for ($i = 0; $i < count($partnersObj); ++$i) { + if ($partnersObj[$i]->categoryid() == $cat_id[$j]) { $smartConfig =& smartpartner_getModuleConfig(); - if($itemssize > 0) { - $title = xoops_substr($partnersObj[$i]->title(),0,$itemssize+3); + if ($itemssize > 0) { + $title = xoops_substr($partnersObj[$i]->title(), 0, $itemssize + 3); } else { $title = $partnersObj[$i]->title(); } - $block[]=array( 'date' => '', - 'category' => '', - 'author'=> '', - 'title'=> $title, - 'link' =>"".$title.'' ); + $block[] = array( + 'date' => '', + 'category' => '', + 'author' => '', + 'title' => $title, + 'link' => "" . $title . ''); } } } diff --git a/plugins/smartsection.php b/plugins/smartsection.php index 61fbf49..5d9507b 100644 --- a/plugins/smartsection.php +++ b/plugins/smartsection.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,42 +11,49 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent articles from the Smartsection module (tested with Smartsection 2.1) function b_marquee_smartsection($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/smartsection/include/common.php'; - xoops_load("xoopsuserutility"); - $myts = &MyTextSanitizer::getInstance(); + include_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; + xoops_load('xoopsuserutility'); + $myts = &MyTextSanitizer::getInstance(); $smartModule =& smartsection_getModuleInfo(); - $block = array(); - $categoryid = -1; - $sort = 'datesub'; - $order = smartsection_getOrderBy($sort); + $block = array(); + $categoryid = -1; + $sort = 'datesub'; + $order = smartsection_getOrderBy($sort); $smartsection_item_handler =& smartsection_gethandler('item'); - $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order); - $totalItems = count($itemsObj); - if($itemsObj) { - for ( $i = 0; $i < $totalItems; $i++ ) { - if($itemssize > 0) { - $title = xoops_substr($itemsObj[$i]->title(),0,$itemssize+3); + $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order); + $totalItems = count($itemsObj); + if ($itemsObj) { + for ($i = 0; $i < $totalItems; ++$i) { + if ($itemssize > 0) { + $title = xoops_substr($itemsObj[$i]->title(), 0, $itemssize + 3); } else { $title = $itemsObj[$i]->title(); } - $block[]=array( 'date' => $itemsObj[$i]->datesub(), - 'category' => $itemsObj[$i]->getCategoryName(), - 'author'=>XoopsUserUtility::getUnameFromId($itemsObj[$i]->uid()), - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => $itemsObj[$i]->datesub(), + 'category' => $itemsObj[$i]->getCategoryName(), + 'author' => XoopsUserUtility::getUnameFromId($itemsObj[$i]->uid()), + 'title' => $title, + 'link' => "" . $title . ''); } } diff --git a/plugins/tplleaguestats.php b/plugins/tplleaguestats.php index 5300dca..4cfdacc 100644 --- a/plugins/tplleaguestats.php +++ b/plugins/tplleaguestats.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,13 +11,19 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // ------------------------------------------------------------------------ // @@ -25,59 +31,63 @@ // written by Defkon1 [defkon1 at gmail dot com] // // ------------------------------------------------------------------------ // - function b_marquee_tplleaguestats($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; //######################## SETTINGS ###################### - $display_season_name= false; // display season name? - $hour=1; // GMT+1 -> var = 1 - $use_itemsize = false; // use marquee $itemsize value? - $overwrite_limit_settings = true; // overwrite marquee's limit settings? - $new_limit = 6; // new limit (valid only if - // overwrite_limit_settings = true) - $overwrite_dateformat_settings=true; // overwrite marquee's dateformat? - $new_dateformat="d/m/Y"; // new dateformat (valid only if - // overwrite_dateformat_settings=true) + $display_season_name = false; // display season name? + $hour = 1; // GMT+1 -> var = 1 + $use_itemsize = false; // use marquee $itemsize value? + $overwrite_limit_settings = true; // overwrite marquee's limit settings? + $new_limit = 6; // new limit (valid only if + // overwrite_limit_settings = true) + $overwrite_dateformat_settings = true; // overwrite marquee's dateformat? + $new_dateformat = 'd/m/Y'; // new dateformat (valid only if + // overwrite_dateformat_settings=true) //######################## SETTINGS ###################### global $xoopsDB; - if ($overwrite_limit_settings){ $limit = $new_limit; } - if ($overwrite_dateformat_settings){ $dateformat=$new_dateformat; } + if ($overwrite_limit_settings) { + $limit = $new_limit; + } + if ($overwrite_dateformat_settings) { + $dateformat = $new_dateformat; + } - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $sql= "SELECT H.OpponentName as home, A.OpponentName as away, M.LeagueMatchHomeGoals as home_p, M.LeagueMatchAwayGoals as away_p, - M.LeagueMatchDate as date, S.SeasonName as season - FROM ".$xoopsDB->prefix("tplls_leaguematches")." M - LEFT JOIN ".$xoopsDB->prefix("tplls_opponents")." AS H ON M.LeagueMatchHomeID = H.OpponentID - LEFT JOIN ".$xoopsDB->prefix("tplls_opponents")." AS A ON M.LeagueMatchAwayID = A.OpponentID - LEFT JOIN ".$xoopsDB->prefix("tplls_seasonnames")." AS S ON M.LeagueMatchSeasonID = S.SeasonID - ORDER BY M.LeagueMatchDate DESC - LIMIT 0,$limit"; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $sql = 'SELECT H.OpponentName as home, A.OpponentName as away, M.LeagueMatchHomeGoals as home_p, M.LeagueMatchAwayGoals as away_p, + M.LeagueMatchDate as date, S.SeasonName as season + FROM ' . $xoopsDB->prefix('tplls_leaguematches') . ' M + LEFT JOIN ' . $xoopsDB->prefix('tplls_opponents') . ' AS H ON M.LeagueMatchHomeID = H.OpponentID + LEFT JOIN ' . $xoopsDB->prefix('tplls_opponents') . ' AS A ON M.LeagueMatchAwayID = A.OpponentID + LEFT JOIN ' . $xoopsDB->prefix('tplls_seasonnames') . " AS S ON M.LeagueMatchSeasonID = S.SeasonID + ORDER BY M.LeagueMatchDate DESC + LIMIT 0,$limit"; $result = $xoopsDB->query($sql); - while($myrow = $xoopsDB->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["home"])." - ".$myts->htmlSpecialChars($myrow["away"])." ".$myts->htmlSpecialChars($myrow["home_p"])."-".$myts->htmlSpecialChars($myrow["away_p"]); + while ($myrow = $xoopsDB->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['home']) . ' - ' . $myts->htmlSpecialChars($myrow['away']) . ' ' . $myts->htmlSpecialChars($myrow['home_p']) . '-' . $myts->htmlSpecialChars($myrow['away_p']); - if($use_itemsize){ - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); - } + if ($use_itemsize && $itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $arr_date = explode("-", $myrow['date']); + $arr_date = explode('-', $myrow['date']); - $season=''; + $season = ''; - if($display_season_name){ $season = $myrow['season']; } + if ($display_season_name) { + $season = $myrow['season']; + } - $block[]=array( 'date' => formatTimestamp(mktime($hour,0,0,$arr_date[1],$arr_date[2], $arr_date[0]), $dateformat), - 'category' => $season, - 'author'=> "" , - 'title'=> $title, - 'link' =>"".$title.""); + $block[] = array( + 'date' => formatTimestamp(mktime($hour, 0, 0, $arr_date[1], $arr_date[2], $arr_date[0]), $dateformat), + 'category' => $season, + 'author' => '', + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/plugins/wfdownloads.php b/plugins/wfdownloads.php index f6fe0d6..ad811d6 100644 --- a/plugins/wfdownloads.php +++ b/plugins/wfdownloads.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,13 +11,19 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent files from the wfdownloads module (tested with wfdownloads 3.1) @@ -26,44 +32,45 @@ function b_marquee_wfdownloads($limit, $dateformat, $itemssize) $block = array(); global $xoopsUser; - $modhandler = xoops_gethandler('module'); - $wfModule = $modhandler->getByDirname("wfdownloads"); - $config_handler = xoops_gethandler('config'); + $modhandler = xoops_getHandler('module'); + $wfModule = $modhandler->getByDirname('wfdownloads'); + $config_handler = xoops_getHandler('config'); $wfModuleConfig = $config_handler->getConfigsByCat(0, $wfModule->getVar('mid')); - $groups = (is_object($xoopsUser)) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $gperm_handler = &xoops_gethandler('groupperm'); - $allowed_cats = $gperm_handler->getItemIds("WFDownCatPerm", $groups, $wfModule->getVar('mid')); + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $gperm_handler = xoops_getHandler('groupperm'); + $allowed_cats = $gperm_handler->getItemIds('WFDownCatPerm', $groups, $wfModule->getVar('mid')); - $criteria = new Criteria("cid", "(".implode(',', $allowed_cats).")", "IN"); + $criteria = new Criteria('cid', '(' . implode(',', $allowed_cats) . ')', 'IN'); $criteria = new CriteriaCompo(new Criteria('offline', 0)); $criteria->setSort('published'); - $criteria->setOrder("DESC"); + $criteria->setOrder('DESC'); $criteria->setLimit($limit); - $download_handler = xoops_getmodulehandler('download', 'wfdownloads'); - $category_handler = xoops_getmodulehandler('category', 'wfdownloads'); - $buffer_category = array(); + $download_handler = xoops_getModuleHandler('download', 'wfdownloads'); + $category_handler = xoops_getModuleHandler('category', 'wfdownloads'); + $buffer_category = array(); $downloads = $download_handler->getObjects($criteria); foreach (array_keys($downloads) as $i) { $download = $downloads[$i]->toArray(); - if($itemssize > 0) { + if ($itemssize > 0) { $title = xoops_substr($download['title'], 0, $itemssize); } else { $title = $download['title']; } - if(isset($buffer_category[$download['cid']])) { + if (isset($buffer_category[$download['cid']])) { $categtitle = $buffer_category[$download['cid']]; } else { - $category = $category_handler->get($download['cid']); + $category = $category_handler->get($download['cid']); $categtitle = $buffer_category[$download['cid']] = $category->getVar('title'); } - $block[]=array( 'date' => formatTimestamp($download['published'], $wfModuleConfig['dateformat']), - 'category' => $categtitle, - 'author'=> $download['publisher'], - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($download['published'], $wfModuleConfig['dateformat']), + 'category' => $categtitle, + 'author' => $download['publisher'], + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/plugins/wfsection.php b/plugins/wfsection.php index b6a72ab..028b1eb 100644 --- a/plugins/wfsection.php +++ b/plugins/wfsection.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * Marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,51 +11,58 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent articles from wfsection 1 & 2 function b_marquee_wfsection($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; $block = array(); - $myts =& MyTextSanitizer::getInstance(); - $module_handler = &xoops_gethandler('module'); - $wfsection = $module_handler->getByDirname('wfsection'); - $wfsection_version = intval($wfsection->getInfo('version')); + $myts = MyTextSanitizer::getInstance(); + $module_handler = xoops_getHandler('module'); + $wfsection = $module_handler->getByDirname('wfsection'); + $wfsection_version = (int)$wfsection->getInfo('version'); - if($wfsection_version >= 2) { - - } else { // wfsection 1 - include_once XOOPS_ROOT_PATH.'/modules/wfsection/include/groupaccess.php'; + if ($wfsection_version >= 2) { + } else { // wfsection 1 + include_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; global $xoopsDB; - $sql = "SELECT articleid, title, published, expired, counter, groupid, uid FROM ".$xoopsDB->prefix("wfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND noshowart = 0 AND offline = 0 ORDER BY published DESC"; - $result = $xoopsDB->query($sql,$limit,0); - while ( $myrow = $xoopsDB->fetchArray($result) ) { - if(checkAccess($myrow["groupid"])) { - $wfs = array(); - $title = $myts->htmlSpecialChars($myrow["title"]); - if ( !XOOPS_USE_MULTIBYTES ) { - if($itemssize > 0) { - $title = $myts->htmlSpecialChars(substr($myrow['title'],0,$itemssize)); + $sql = 'SELECT articleid, title, published, expired, counter, groupid, uid FROM ' . $xoopsDB->prefix('wfs_article') . ' WHERE published < ' . time() . ' AND published > 0 AND (expired = 0 OR expired > ' . time() . ') AND noshowart = 0 AND offline = 0 ORDER BY published DESC'; + $result = $xoopsDB->query($sql, $limit, 0); + while ($myrow = $xoopsDB->fetchArray($result)) { + if (checkAccess($myrow['groupid'])) { + $wfs = array(); + $title = $myts->htmlSpecialChars($myrow['title']); + if (!XOOPS_USE_MULTIBYTES) { + if ($itemssize > 0) { + $title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemssize)); } else { $title = $myts->htmlSpecialChars($myrow['title']); } } - $block[]=array( 'date' => formatTimestamp($myrow['published'], $dateformat), - 'category' => '', - 'author'=> XoopsUser::getUnameFromId($myrow['uid']), - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($myrow['published'], $dateformat), + 'category' => '', + 'author' => XoopsUser::getUnameFromId($myrow['uid']), + 'title' => $title, + 'link' => "" . $title . ''); } } - } // wfsection 1 ou 2 ? + } // wfsection 1 ou 2 ? + return $block; } diff --git a/plugins/xfaq.php b/plugins/xfaq.php index 5215f90..8a18b3e 100644 --- a/plugins/xfaq.php +++ b/plugins/xfaq.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,34 +11,40 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list the recent faqs from the xfaq module version 1.01 function b_marquee_xfaq($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $result = $db->query("SELECT f.*, t.topic_title, t.topic_submitter FROM ".$db->prefix("xfaq_faq")." f, ".$db->prefix("xfaq_topic")." t WHERE f.faq_online>0 AND (f.faq_topic=t.topic_id) ORDER BY faq_date_created DESC",$limit,0); - while($myrow = $db->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["faq_question"]); - if($itemssize>0) { - $title=xoops_substr($title, 0, $itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $result = $db->query('SELECT f.*, t.topic_title, t.topic_submitter FROM ' . $db->prefix('xfaq_faq') . ' f, ' . $db->prefix('xfaq_topic') . ' t WHERE f.faq_online>0 AND (f.faq_topic=t.topic_id) ORDER BY faq_date_created DESC', $limit, 0); + while ($myrow = $db->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['faq_question']); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); + } + $block[] = array( + 'date' => formatTimestamp($myrow['faq_date_created'], $dateformat), + 'category' => $myts->htmlSpecialChars($myrow['topic_title']), + 'author' => XoopsUser::getUnameFromId((int)$myrow['topic_submitter']), + 'title' => $title, + 'link' => "{$title}"); } - $block[]=array( 'date' => formatTimestamp($myrow['faq_date_created'],$dateformat), - 'category' =>$myts->htmlSpecialChars($myrow['topic_title']), - 'author'=> XoopsUser::getUnameFromId(intval($myrow['topic_submitter'])), - 'title'=> $title, - 'link' =>"{$title}" - ); - } return $block; } diff --git a/plugins/xfsection.php b/plugins/xfsection.php index 7c49fd9..2cdc98d 100644 --- a/plugins/xfsection.php +++ b/plugins/xfsection.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * Marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,13 +11,19 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent articles from the xfsection module (tested with xfsection 1.12) @@ -25,29 +31,30 @@ function b_marquee_xfsection($limit, $dateformat, $itemssize) { $block = array(); global $xoopsDB; - if ( !function_exists('xfblock_checkAccess') ) { - include_once XOOPS_ROOT_PATH."/modules/xfsection/include/xfblock_groupaccess.php"; + if (!function_exists('xfblock_checkAccess')) { + include_once XOOPS_ROOT_PATH . '/modules/xfsection/include/xfblock_groupaccess.php'; } - $myts =& MyTextSanitizer::getInstance(); - $sql = "SELECT articleid, title, published, expired, counter, groupid, uid FROM ".$xoopsDB->prefix("xfs_article")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") AND noshowart = 0 AND offline = 0 ORDER BY published DESC"; - $result = $xoopsDB->query($sql,$limit,0); - while ( $myrow = $xoopsDB->fetchArray($result) ) { - if(xfblock_checkAccess($myrow["groupid"])) { - $wfs = array(); - $title = $myts->htmlSpecialChars($myrow["title"]); - if ( !XOOPS_USE_MULTIBYTES ) { - if($itemssize > 0) { - $title = $myts->htmlSpecialChars(substr($myrow['title'],0,($itemssize -1))); + $myts = MyTextSanitizer::getInstance(); + $sql = 'SELECT articleid, title, published, expired, counter, groupid, uid FROM ' . $xoopsDB->prefix('xfs_article') . ' WHERE published < ' . time() . ' AND published > 0 AND (expired = 0 OR expired > ' . time() . ') AND noshowart = 0 AND offline = 0 ORDER BY published DESC'; + $result = $xoopsDB->query($sql, $limit, 0); + while ($myrow = $xoopsDB->fetchArray($result)) { + if (xfblock_checkAccess($myrow['groupid'])) { + $wfs = array(); + $title = $myts->htmlSpecialChars($myrow['title']); + if (!XOOPS_USE_MULTIBYTES) { + if ($itemssize > 0) { + $title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemssize - 1)); } else { $title = $myts->htmlSpecialChars($myrow['title']); } } - $block[]=array( 'date' => formatTimestamp($myrow['published'], $dateformat), - 'category' => '', - 'author'=> XoopsUser::getUnameFromId($myrow['uid']), - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($myrow['published'], $dateformat), + 'category' => '', + 'author' => XoopsUser::getUnameFromId($myrow['uid']), + 'title' => $title, + 'link' => "" . $title . ''); } } diff --git a/plugins/xoopsfaq.php b/plugins/xoopsfaq.php index 9885a36..56391d1 100644 --- a/plugins/xoopsfaq.php +++ b/plugins/xoopsfaq.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,32 +11,39 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list the recent links from the mylinks module version 1.10 function b_marquee_xoopsfaq($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $result = $db->query("SELECT c.*, t.category_title FROM ".$db->prefix("xoopsfaq_contents")." c, ".$db->prefix("xoopsfaq_categories")." t WHERE c.contents_visible>0 AND (c. category_id=t.category_id) ORDER BY contents_time DESC",$limit,0); - while($myrow = $db->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["contents_title"]); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $result = $db->query('SELECT c.*, t.category_title FROM ' . $db->prefix('xoopsfaq_contents') . ' c, ' . $db->prefix('xoopsfaq_categories') . ' t WHERE c.contents_visible>0 AND (c. category_id=t.category_id) ORDER BY contents_time DESC', $limit, 0); + while ($myrow = $db->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['contents_title']); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $block[]=array( 'date' => formatTimestamp($myrow['contents_time'],$dateformat), - 'category' =>$myts->htmlSpecialChars($myrow['category_title']), - 'author'=> 0 , - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($myrow['contents_time'], $dateformat), + 'category' => $myts->htmlSpecialChars($myrow['category_title']), + 'author' => 0, + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/plugins/xoopspartners.php b/plugins/xoopspartners.php index 61093bb..38adcba 100644 --- a/plugins/xoopspartners.php +++ b/plugins/xoopspartners.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * Marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,71 +11,85 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) * * Version : $Id: * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list recent partners from the xoopspartners module (tested with version 1.1) function b_marquee_xoopspartners($limit, $dateformat, $itemssize) { - $block = array(); - $myts =& MyTextSanitizer::getInstance(); + $block = array(); + $myts = MyTextSanitizer::getInstance(); $arrayIds = array(); $arrayIds = xoopspartners_random($limit); global $xoopsDB; - foreach ( $arrayIds as $id ) { - $result = $xoopsDB->query("SELECT id, url, image, title FROM ".$xoopsDB->prefix("partners")." WHERE id=$id"); + foreach ($arrayIds as $id) { + $result = $xoopsDB->query('SELECT id, url, image, title FROM ' . $xoopsDB->prefix('partners') . " WHERE id=$id"); list($id, $url, $image, $title) = $xoopsDB->fetchrow($result); $origtitle = $title; - $title = $myts->htmlSpecialChars($title); - if($itemssize > 0) { - $title = $myts->htmlSpecialChars(substr($origtitle, 0, 19)); + $title = $myts->htmlSpecialChars($title); + if ($itemssize > 0) { + $title = $myts->htmlSpecialChars(substr($origtitle, 0, 19)); } else { $title = $myts->htmlSpecialChars($origtitle); } - $block[]=array( 'date' => '', - 'category' => '', - 'author'=> '', - 'title'=> $title, - 'link' =>"".$title.''); - + $block[] = array( + 'date' => '', + 'category' => '', + 'author' => '', + 'title' => $title, + 'link' => "" . $title . ''); } return $block; } -function xoopspartners_random($NumberPartners,$random=true,$orden="",$desc="") +/** + * @param $NumberPartners + * @param bool $random + * @param string $orden + * @param string $desc + * + * @return array + */ +function xoopspartners_random($NumberPartners, $random = true, $orden = '', $desc = '') { global $xoopsDB; - $PartnersId = array(); + $PartnersId = array(); $ArrayReturn = array(); - if ( $random ) { - $result = $xoopsDB->query("SELECT id FROM " .$xoopsDB->prefix("partners"). " WHERE status = 1"); + if ($random) { + $result = $xoopsDB->query('SELECT id FROM ' . $xoopsDB->prefix('partners') . ' WHERE status = 1'); $numrows = $xoopsDB->getRowsNum($result); } else { - $result = $xoopsDB->query("SELECT id FROM " .$xoopsDB->prefix("partners"). " Where status = 1 ORDER BY ".$orden." ".$desc,$NumberPartners); + $result = $xoopsDB->query('SELECT id FROM ' . $xoopsDB->prefix('partners') . ' Where status = 1 ORDER BY ' . $orden . ' ' . $desc, $NumberPartners); } - while ( $ret = $xoopsDB->fetchArray($result) ) { - $PartnersId[]= $ret['id']; + while ($ret = $xoopsDB->fetchArray($result)) { + $PartnersId[] = $ret['id']; } - if (($numrows <= $NumberPartners) or (!$random) ) { + if (($numrows <= $NumberPartners) || (!$random)) { return $PartnersId; - exit(); + // exit(); } - $NumberTotal = 0; + $NumberTotal = 0; $TotalPartner = count($PartnersId) - 1; while ($NumberPartners > $NumberTotal) { - $RandomPart = mt_rand (0, $TotalPartner); - if ( !in_array($PartnersId[$RandomPart],$ArrayReturn) ) { + $RandomPart = mt_rand(0, $TotalPartner); + if (!in_array($PartnersId[$RandomPart], $ArrayReturn)) { $ArrayReturn[] = $PartnersId[$RandomPart]; - $NumberTotal++; + ++$NumberTotal; } } diff --git a/plugins/xoopspoll.php b/plugins/xoopspoll.php index 375b71b..a887dfc 100644 --- a/plugins/xoopspoll.php +++ b/plugins/xoopspoll.php @@ -2,7 +2,7 @@ /** * **************************************************************************** * Marquee - MODULE FOR XOOPS - * Copyright (c) Hervé Thouzard (http://www.herve-thouzard.com) + * Copyright (c) HervĂ© Thouzard (http://www.herve-thouzard.com) * * 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 @@ -11,32 +11,39 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author Hervé Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** + * + * @param $limit + * @param $dateformat + * @param $itemssize + * + * @return array */ // Script to list the recent polls from the xoopspoll module version 1.0 function b_marquee_xoopspoll($limit, $dateformat, $itemssize) { - include_once XOOPS_ROOT_PATH.'/modules/marquee/include/functions.php'; - $block=array(); - $myts =& MyTextSanitizer::getInstance(); - $db =& XoopsDatabaseFactory::getDatabaseConnection(); - $result = $db->query("SELECT * FROM ".$db->prefix("xoopspoll_desc")." WHERE start_time<=".time()." and end_time>".time()." ORDER BY start_time DESC",$limit,0); - while($myrow = $db->fetchArray($result)) { - $title = $myts->htmlSpecialChars($myrow["question"]); - if($itemssize>0) { - $title=xoops_substr($title,0,$itemssize+3); + include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; + $block = array(); + $myts = MyTextSanitizer::getInstance(); + $db = XoopsDatabaseFactory::getDatabaseConnection(); + $result = $db->query('SELECT * FROM ' . $db->prefix('xoopspoll_desc') . ' WHERE start_time<=' . time() . ' and end_time>' . time() . ' ORDER BY start_time DESC', $limit, 0); + while ($myrow = $db->fetchArray($result)) { + $title = $myts->htmlSpecialChars($myrow['question']); + if ($itemssize > 0) { + $title = xoops_substr($title, 0, $itemssize + 3); } - $block[]=array( 'date' => formatTimestamp($myrow['start_time'],$dateformat), - 'category' => '', - 'author'=> $myrow['user_id'] , - 'title'=> $title, - 'link' =>"".$title.''); + $block[] = array( + 'date' => formatTimestamp($myrow['start_time'], $dateformat), + 'category' => '', + 'author' => $myrow['user_id'], + 'title' => $title, + 'link' => "" . $title . ''); } return $block; diff --git a/sql/index.html b/sql/index.html index 990cbd6..2c5cdd3 100644 --- a/sql/index.html +++ b/sql/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/templates/blocks/index.html b/templates/blocks/index.html index 990cbd6..2c5cdd3 100644 --- a/templates/blocks/index.html +++ b/templates/blocks/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/templates/blocks/marquee_block01.html b/templates/blocks/marquee_block01.tpl similarity index 100% rename from templates/blocks/marquee_block01.html rename to templates/blocks/marquee_block01.tpl diff --git a/templates/blocks/marquee_block02.html b/templates/blocks/marquee_block02.tpl similarity index 100% rename from templates/blocks/marquee_block02.html rename to templates/blocks/marquee_block02.tpl diff --git a/templates/blocks/marquee_block03.html b/templates/blocks/marquee_block03.tpl similarity index 100% rename from templates/blocks/marquee_block03.html rename to templates/blocks/marquee_block03.tpl diff --git a/templates/blocks/marquee_block04.html b/templates/blocks/marquee_block04.tpl similarity index 100% rename from templates/blocks/marquee_block04.html rename to templates/blocks/marquee_block04.tpl diff --git a/templates/index.html b/templates/index.html index 990cbd6..2c5cdd3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/test/AddBlock b/test/AddBlock index 3aacddc..8aca8c5 100644 --- a/test/AddBlock +++ b/test/AddBlock @@ -13,7 +13,7 @@ open - /xtest251/modules/marquee/admin/marquee.php + /xtest251/modules/marquee/admin/main.php diff --git a/test/AddMarquee b/test/AddMarquee index f35bf38..ae23b5b 100644 --- a/test/AddMarquee +++ b/test/AddMarquee @@ -13,7 +13,7 @@ open - /xtest251/modules/marquee/admin/marquee.php + /xtest251/modules/marquee/admin/main.php diff --git a/test/DeleteMarquee b/test/DeleteMarquee index 42f512c..670730c 100644 --- a/test/DeleteMarquee +++ b/test/DeleteMarquee @@ -13,7 +13,7 @@ open - /xtest251/modules/marquee/admin/marquee.php + /xtest251/modules/marquee/admin/main.php diff --git a/test/readme.txt b/test/readme.txt index a9639fa..af7cd7d 100644 --- a/test/readme.txt +++ b/test/readme.txt @@ -1,10 +1,10 @@ -This directory contains tests cases to be used with Selenium IDE, an extension for Firefox: +This directory contains tests cases to be used with Selenium IDE, an extension for Firefox: http://seleniumhq.org/projects/ide/ The tests have been created on XOOPS 2.5.1 on a local host (WAMP Server). -The default test URL is: +The default test URL is: http://localhost/xtest251/ @@ -12,6 +12,6 @@ You should change it to your environment in all the test files. For a tutorial on how to create and run Selenium IDE Tests in XOOPS, plase read: -http://www.xoops.org/modules/news/article.php?storyid=5433 +http://xoops.org/modules/news/article.php?storyid=5433 -Please note: these tests are running on a fresh installation of the module. Sometimes they depend on an ID of an element that could be incremented by XOOPS when you delete one and add another one. Then the test won't work. You can modify the test files accordingly, or reinstall the module and then run the tests. \ No newline at end of file +Please note: these tests are running on a fresh installation of the module. Sometimes they depend on an ID of an element that could be incremented by XOOPS when you delete one and add another one. Then the test won't work. You can modify the test files accordingly, or reinstall the module and then run the tests. diff --git a/xoops_version.php b/xoops_version.php index 22b1fee..afcb787 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -11,95 +11,98 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package marquee - * @author HervĂ© Thouzard (http://www.herve-thouzard.com) - * @version $Id $ + * @copyright HervĂ© Thouzard (http://www.herve-thouzard.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package marquee + * @author HervĂ© Thouzard (http://www.herve-thouzard.com) + * @version $Id $ * **************************************************************************** */ -if (!defined('XOOPS_ROOT_PATH')) { - die('XOOPS root path not defined'); -} - -$moduleDirName = basename( dirname( __FILE__ ) ) ; - -$modversion['name'] = _MI_MARQUEE_NAME; -$modversion['version'] = '2.49'; -$modversion['description'] = _MI_MARQUEE_DESC; -$modversion['credits'] = "Carnuke, defkon1, the Newbb team, Mage, Mamba"; -$modversion['author'] = 'HervĂ© Thouzard'; -$modversion['nickname'] = 'hervet'; -$modversion['help'] = 'page=help'; -$modversion['license'] = 'GNU GPL 2.0'; -$modversion['license_url'] = "www.gnu.org/licenses/gpl-2.0.html/"; -$modversion['official'] = 0; -$modversion['image'] = 'images/marquee_slogo.png'; -$modversion['dirname'] = 'marquee'; -$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin'; -$modversion['icons16'] = '../../Frameworks/moduleclasses/icons/16'; -$modversion['icons32'] = '../../Frameworks/moduleclasses/icons/32'; +// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); + +$moduleDirName = basename(__DIR__); + +$modversion['name'] = _MI_MARQUEE_NAME; +$modversion['version'] = '2.50'; +$modversion['description'] = _MI_MARQUEE_DESC; +$modversion['credits'] = 'Carnuke, defkon1, the Newbb team, Mage, Mamba'; +$modversion['author'] = 'HervĂ© Thouzard'; +$modversion['nickname'] = 'hervet'; +$modversion['help'] = 'page=help'; +$modversion['license'] = 'GNU GPL 2.0'; +$modversion['license_url'] = 'www.gnu.org/licenses/gpl-2.0.html'; +$modversion['official'] = 0; //1 indicates supported by XOOPS Dev Team, 0 means 3rd party supported +$modversion['image'] = 'assets/images/logo_module.png'; +$modversion['dirname'] = basename(__DIR__); +$modversion['dirmoduleadmin'] = 'Frameworks/moduleclasses'; +$modversion['icons16'] = 'Frameworks/moduleclasses/icons/16'; +$modversion['icons32'] = 'Frameworks/moduleclasses/icons/32'; //about -$modversion['release_date'] = '2012/12/17'; -$modversion["module_website_url"] = "www.xoops.org/"; -$modversion["module_website_name"] = "XOOPS"; -$modversion["module_status"] = "Final"; -$modversion["author_website_url"] = "http://xoops.org/"; -$modversion["author_website_name"] = "HervĂ© Thouzard"; -$modversion['min_php']='5.2'; -$modversion['min_xoops']="2.5.5"; -$modversion['min_admin']='1.1'; -$modversion['min_db']= array('mysql'=>'5.0.7', 'mysqli'=>'5.0.7'); +$modversion['module_status'] = 'RC 1'; +$modversion['release_date'] = '2016/03/23'; +$modversion['module_website_url'] = 'www.xoops.org/'; +$modversion['module_website_name'] = 'XOOPS'; +$modversion['author_website_url'] = 'http://xoops.org/'; +$modversion['author_website_name'] = 'HervĂ© Thouzard'; +$modversion['min_php'] = '5.5'; +$modversion['min_xoops'] = '2.5.8'; +$modversion['min_admin'] = '1.1'; +$modversion['min_db'] = array('mysql' => '5.0.7', 'mysqli' => '5.0.7'); //update $modversion['onUpdate'] = 'include/update.php'; // SQL Tables $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; -$modversion['tables'][0] = 'marquee'; +$modversion['tables'][0] = 'marquee'; // Admin menu -$modversion['hasAdmin'] = 1; +$modversion['hasAdmin'] = 1; $modversion['adminindex'] = 'admin/index.php'; -$modversion['adminmenu'] = 'admin/menu.php'; -$modversion['hasMain'] = 0; +$modversion['adminmenu'] = 'admin/menu.php'; +$modversion['hasMain'] = 0; // Set to 1 if you want to display menu generated by system module $modversion['system_menu'] = 1; // Blocks -$modversion['blocks'][1]['file'] = 'marquee_bloc.php'; -$modversion['blocks'][1]['name'] = _MI_MARQUEE_BNAME_01; -$modversion['blocks'][1]['description'] = _MI_MARQUEE_BDESC_01; -$modversion['blocks'][1]['show_func'] = 'b_marquee_show'; -$modversion['blocks'][1]['options'] = '1'; -$modversion['blocks'][1]['edit_func'] = 'b_marquee_edit'; -$modversion['blocks'][1]['template'] = 'marquee_block01.html'; - -$modversion['blocks'][2]['file'] = 'marquee_bloc.php'; -$modversion['blocks'][2]['name'] = _MI_MARQUEE_BNAME_02; -$modversion['blocks'][2]['description'] = _MI_MARQUEE_BDESC_02; -$modversion['blocks'][2]['show_func'] = 'b_marquee_show'; -$modversion['blocks'][2]['options'] = '2'; -$modversion['blocks'][2]['edit_func'] = 'b_marquee_edit'; -$modversion['blocks'][2]['template'] = 'marquee_block02.html'; - -$modversion['blocks'][3]['file'] = 'marquee_bloc.php'; -$modversion['blocks'][3]['name'] = _MI_MARQUEE_BNAME_03; -$modversion['blocks'][3]['description'] = _MI_MARQUEE_BDESC_03; -$modversion['blocks'][3]['show_func'] = 'b_marquee_show'; -$modversion['blocks'][3]['options'] = '3'; -$modversion['blocks'][3]['edit_func'] = 'b_marquee_edit'; -$modversion['blocks'][3]['template'] = 'marquee_block03.html'; - -$modversion['blocks'][4]['file'] = 'marquee_bloc.php'; -$modversion['blocks'][4]['name'] = _MI_MARQUEE_BNAME_04; -$modversion['blocks'][4]['description'] = _MI_MARQUEE_BDESC_04; -$modversion['blocks'][4]['show_func'] = 'b_marquee_show'; -$modversion['blocks'][4]['options'] = '4'; -$modversion['blocks'][4]['edit_func'] = 'b_marquee_edit'; -$modversion['blocks'][4]['template'] = 'marquee_block04.html'; + +$modversion['blocks'][] = array( + 'file' => 'marquee_bloc.php', + 'name' => _MI_MARQUEE_BNAME_01, + 'description' => _MI_MARQUEE_BDESC_01, + 'show_func' => 'b_marquee_show', + 'options' => '1', + 'edit_func' => 'b_marquee_edit', + 'template' => 'marquee_block01.tpl'); + +$modversion['blocks'][] = array( + 'file' => 'marquee_bloc.php', + 'name' => _MI_MARQUEE_BNAME_02, + 'description' => _MI_MARQUEE_BDESC_02, + 'show_func' => 'b_marquee_show', + 'options' => '2', + 'edit_func' => 'b_marquee_edit', + 'template' => 'marquee_block02.tpl'); + +$modversion['blocks'][] = array( + 'file' => 'marquee_bloc.php', + 'name' => _MI_MARQUEE_BNAME_03, + 'description' => _MI_MARQUEE_BDESC_03, + 'show_func' => 'b_marquee_show', + 'options' => '3', + 'edit_func' => 'b_marquee_edit', + 'template' => 'marquee_block03.tpl'); + +$modversion['blocks'][] = array( + 'file' => 'marquee_bloc.php', + 'name' => _MI_MARQUEE_BNAME_04, + 'description' => _MI_MARQUEE_BDESC_04, + 'show_func' => 'b_marquee_show', + 'options' => '4', + 'edit_func' => 'b_marquee_edit', + 'template' => 'marquee_block04.tpl'); // Search $modversion['hasSearch'] = 0; @@ -111,53 +114,59 @@ /** * Editor to use (was usekiovi) */ -$modversion['config'][1]['name'] = 'form_options'; -$modversion['config'][1]['title'] = "_MI_MARQUEE_TEXT_EDITOR"; -$modversion['config'][1]['description'] = ''; -$modversion['config'][1]['formtype'] = 'select'; -$modversion['config'][1]['valuetype'] = 'text'; -$modversion['config'][1]['default'] = 'dhtmltextarea'; xoops_load('xoopseditorhandler'); $editor_handler = XoopsEditorHandler::getInstance(); -$modversion['config'][1]['options'] = array_flip($editor_handler->getList()); + +$modversion['config'][] = array( + 'name' => 'form_options', + 'title' => '_MI_MARQUEE_TEXT_EDITOR', + 'description' => '', + 'formtype' => 'select', + 'valuetype' => 'text', + 'default' => 'dhtmltextarea', + 'options' => array_flip($editor_handler->getList())); /** * Which method to use to create the marquee (The Microsoft marque tag or the Javascript method ?) */ -$modversion['config'][2]['name'] = 'methodtouse'; -$modversion['config'][2]['title'] = '_MI_MARQUEE_METHOD'; -$modversion['config'][2]['description'] = '_MI_MARQUEE_METHOD_DESC'; -$modversion['config'][2]['formtype'] = 'select'; -$modversion['config'][2]['valuetype'] = 'text'; -$modversion['config'][2]['default'] = 'Marquee'; -$modversion['config'][2]['options'] = array('_MI_MARQUEE_MARQUEE' => 'Marquee','_MI_MARQUEE_DHTML' => 'DHTML'); +$modversion['config'][] = array( + 'name' => 'methodtouse', + 'title' => '_MI_MARQUEE_METHOD', + 'description' => '_MI_MARQUEE_METHOD_DESC', + 'formtype' => 'select', + 'valuetype' => 'text', + 'default' => 'Marquee', + 'options' => array('_MI_MARQUEE_MARQUEE' => 'Marquee', '_MI_MARQUEE_DHTML' => 'DHTML')); /** * Date's format (only use with plugins) */ -$modversion['config'][3]['name'] = 'dateformat'; -$modversion['config'][3]['title'] = '_MI_MARQUEE_DATEFORMAT'; -$modversion['config'][3]['description'] = '_MI_MARQUEE_DATEFORMAT_DESC'; -$modversion['config'][3]['formtype'] = 'textbox'; -$modversion['config'][3]['valuetype'] = 'text'; -$modversion['config'][3]['default'] = ''; +$modversion['config'][] = array( + 'name' => 'dateformat', + 'title' => '_MI_MARQUEE_DATEFORMAT', + 'description' => '_MI_MARQUEE_DATEFORMAT_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'text', + 'default' => ''); /** * Count of items taken from other modules (only use with plugins) */ -$modversion['config'][4]['name'] = 'itemscount'; -$modversion['config'][4]['title'] = '_MI_MARQUE_ITEMSCOUNT'; -$modversion['config'][4]['description'] = '_MI_MARQUE_ITEMSCOUNT_DESC'; -$modversion['config'][4]['formtype'] = 'textbox'; -$modversion['config'][4]['valuetype'] = 'int'; -$modversion['config'][4]['default'] = 5; +$modversion['config'][] = array( + 'name' => 'itemscount', + 'title' => '_MI_MARQUE_ITEMSCOUNT', + 'description' => '_MI_MARQUE_ITEMSCOUNT_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0); /** * Titles length (only use with plugins) */ -$modversion['config'][5]['name'] = 'itemssize'; -$modversion['config'][5]['title'] = '_MI_MARQUE_TITLELENGTH'; -$modversion['config'][5]['description'] = '_MI_MARQUE_TITLELENGTH_DESC'; -$modversion['config'][5]['formtype'] = 'textbox'; -$modversion['config'][5]['valuetype'] = 'int'; -$modversion['config'][5]['default'] = 0; +$modversion['config'][] = array( + 'name' => 'itemssize', + 'title' => '_MI_MARQUE_TITLELENGTH', + 'description' => '_MI_MARQUE_TITLELENGTH_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0); From 66479db45c9f6da1b1272cd563c7dd0c6c43919c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 26 Mar 2016 22:10:10 -0400 Subject: [PATCH 3/3] update README.md --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 239a62f..3436300 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ -#Marquee +![alt XOOPS CMS](http://xoops.org/images/logoXoops4GithubRepository.png) +## Marquee module for [XOOPS CMS 2.5.8+](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/mambax7/marquee.svg?style=flat)](https://scrutinizer-ci.com/g/mambax7/marquee/?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/marquee) +[![Code Climate](https://img.shields.io/codeclimate/github/mambax7/marquee.svg?style=flat)](https://codeclimate.com/github/mambax7/marquee) +[![Latest Pre-Resease](https://img.shields.io/github/tag/XoopsModules25x/marquee.svg?style=flat)](https://github.com/XoopsModules25x/marquee/tags/) +[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/marquee.svg?style=flat)](https://github.com/XoopsModules25x/marquee/releases/) -Marquee is a XOOPS module to create scrolling texts (marquees). You can create an unlimited number of marquees and use them in 4 blocks. +Marquee for [XOOPS CMS](http://xoops.org) is a module to create scrolling texts (marquees). You can create an unlimited number of marquees and use them in 4 blocks. + +[![Tutorial Available](http://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/xoops-marquee/) Tutorial: see [here](https://www.gitbook.com/book/xoops/xoops-marquee/). +To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/marquee-tutorial) + +[![Translations on Transifex](http://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) + +Please visit us on http://xoops.org + +The upcoming "next generation" version of XOOPS CMS is being crafted on GitHub at: https://github.com/XOOPS