From: <zy...@us...> - 2014-12-08 20:21:41
|
Revision: 12890 http://sourceforge.net/p/xoops/svn/12890 Author: zyspec Date: 2014-12-08 20:21:32 +0000 (Mon, 08 Dec 2014) Log Message: ----------- include files missing in previous commit for v2.1 Beta 1 Added Paths: ----------- XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png XoopsModules/randomquote/branches/zyspec/randomquote/class/constants.php XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php Added: XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png =================================================================== (Binary files differ) Index: XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png 2014-12-08 20:18:04 UTC (rev 12889) +++ XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png 2014-12-08 20:21:32 UTC (rev 12890) Property changes on: XoopsModules/randomquote/branches/zyspec/randomquote/assets/images/icons/quote.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: XoopsModules/randomquote/branches/zyspec/randomquote/class/constants.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/class/constants.php (rev 0) +++ XoopsModules/randomquote/branches/zyspec/randomquote/class/constants.php 2014-12-08 20:21:32 UTC (rev 12890) @@ -0,0 +1,78 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ +/** + * RandomQuote module + * + * Class to define Random Quote module constant values. These constants are + * used to make the code easier to read and to keep values in central + * location if they need to be changed. These should not normally need + * to be modified. If they are to be modified it is recommended to change + * the value(s) before module installation. Additionally the module may not + * work correctly if trying to upgrade if these values have been changed. + * + * @category Module + * @package randomquote + * @copyright:: {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license:: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @author:: zyspec <ow...@zy...> + * @since:: 2.11 + * @version:: $Id: $ + **/ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +interface RandomquoteConstants +{ +/**#@+ + * Constant definition + */ + /** + * indicates a quote is inactive + */ + const STATUS_OFFLINE = 0; + /** + * indicates a quote is active + */ + const STATUS_ONLINE = 1; + /** + * indicates a quote is waiting approval + */ + const STATUS_WAITING = 2; + /** + * indicates default quote ID + */ + const DEFAULT_ID = 0; + /** + * no delay XOOPS redirect delay (in seconds) + */ + const REDIRECT_DELAY_NONE = 0; + /** + * short XOOPS redirect delay (in seconds) + */ + const REDIRECT_DELAY_SHORT = 1; + /** + * medium XOOPS redirect delay (in seconds) + */ + const REDIRECT_DELAY_MEDIUM = 3; + /** + * long XOOPS redirect delay (in seconds) + */ + const REDIRECT_DELAY_LONG = 7; + /** + * confirm not ok to take action + */ + const CONFIRM_NOT_OK = 0; + /** + * confirm ok to take action + */ + const CONFIRM_OK = 1; +/**#@-*/ +} \ No newline at end of file Added: XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php (rev 0) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php 2014-12-08 20:21:32 UTC (rev 12890) @@ -0,0 +1,300 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * XOOPS Randomquote management module + * + * @package randomquote + * @copyright The XOOPS project http://sourceforge.net/projects/xoops/ + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @since 1.00 + * @author Taiwen Jiang <ph...@us...> + * @author ZySpec <ow...@zy...> + * @version $Id: $ + * */ + +/** + * @internal {Make sure you PROTECT THIS FILE + * + * This code has the potential to be extremely dangerous!!} + */ + +if ((!defined('XOOPS_ROOT_PATH')) + || !($GLOBALS['xoopsUser'] instanceof XoopsUser) + || !($GLOBALS['xoopsUser']->IsAdmin())) +{ + exit("Restricted access" . PHP_EOL); +} + +/** + * @param string $tablename + * + * @return bool + */ +function tableExists($tablename) +{ + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false; +} + +/** + * + * Verifies XOOPS version meets minimum requirements for this module + * @param obj $module {@link XoopsModule} + * + * @return bool true if meets requirements, false if not + */ +function randomquoteCheckXoopsVer(&$module) { + //check for minimum XOOPS version + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string + $currArray = explode('.', $currentVer); + $requiredVer = "" . $module->getInfo('min_xoops'); //making sure it's a string + $reqArray = explode('.', $requiredVer); + $success = true; + foreach ($reqArray as $k=>$v) { + if (isset($currArray[$k])) { + if ($currArray[$k] >= $v) { + continue; + } else { + $success = false; + break; + } + } else { + if ($v > 0) { + $success = false; + break; + } + } + } + + if (!$success) { + $module->setErrors(sprintf(_AM_RANDOMQUOTE_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); + } + + return $success; +} + +/** + * + * Verifies PHP version meets minimum requirements for this module + * @param obj $module {@link XoopsModule} + * + * @return bool true if meets requirements, false if not + */ +function randomquoteCheckPHPVer(&$module) { + // check for minimum PHP version + $phpLen = strlen(PHP_VERSION); + $extraLen = strlen(PHP_EXTRA_VERSION); + $verNum = substr(PHP_VERSION, 0, ($phpLen-$extraLen)); + $reqVer = $module->getInfo('min_php'); + + $success = true; + if ($verNum >= $reqVer) { + $module->setErrors(sprintf(_AM_RANDOMQUOTE_ERROR_BAD_PHP, $reqVer, $verNum)); + $success = false; + } + + return $success; +} + +/** + * + * Performs tasks required during installation of the module + * @param obj $module {@link XoopsModule} + * + * @return bool true if installation successful, false if not + */ +function xoops_module_install_randomquote(&$module) { + return true; +} + +/** + * + * Prepares system prior to attempting to install module + * @param obj $module {@link XoopsModule} + * + * @return bool true if ready to install, false if not + */ +function xoops_module_pre_install_randomquote(&$module) +{ + //check for minimum XOOPS version + if (!randomquoteCheckXoopsVer($module)) { + return false; + } + + // check for minimum PHP version + if (!randomquoteCheckPHPVer($module)) { + return false; + } + return true; +} + +/** + * + * Prepares system prior to attempting to update module + * @param obj $module {@link XoopsModule} + */ +function xoops_module_pre_update_randomquote(&$module) +{ + //check for minimum XOOPS version + if (!randomquoteCheckXoopsVer($module)) { + return false; + } + + // check for minimum PHP version + if (!randomquoteCheckPHPVer($module)) { + return false; + } + return true; +} + + +function xoops_module_pre_uninstall_randomquote(&$module) +{ + /* Do some synchronization with tags to remove tags associated with this module + * + * @todo: write this code... + * + * pseudo code + * if (tag module installed) { + * get quote handler + * get all items with tags + * get tag handler + * delete all tags for this module + * } + */ + $success = true; + $tagModule =& XoopsModule::getByDirname('tag'); + if (($tagModule instanceof XoopsModule) && ($tagModule->isactive())) { + // first delete all quotes + $quotes_handler =& xoops_getmodulehandler('quotes', 'randomquote'); + $quoteObjs = $quotes_handler->deleteAll(); + //now 'unlink' the quote tags from Tag modules + include_once $GLOBALS['xoops']->path("/modules/tag/include/functions.recon.php"); + $success = tag_synchronization(); + if (!$success) { + $module->setErrors(_AM_RANDOMQUOTE_ERROR_TAG_REMOVAL); + } + } + + return $success; +} + +function xoops_module_uninstall_randomquote(&$module) +{ + return $success; +} + +/** + * + * Functions to upgrade from previous version of the module + * + * @param obj $module {@link XoopsModule} + * @param int $curr_version version number of module currently installed + * + * @return bool true if successfully updated module, false if not + */ +function xoops_module_update_randomquote(&$module, $curr_version = null) +{ + $errors = 0; + if (tableExists($GLOBALS['xoopsDB']->prefix('citas'))) { + + $sql = sprintf('ALTER TABLE ' + . $GLOBALS['xoopsDB']->prefix('citas') + . ' CHANGE `citas` `quote` TEXT' + ); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED0); + ++$errors; + } + + $sql = sprintf('ALTER TABLE ' + . $GLOBALS['xoopsDB']->prefix('citas') + . " ADD COLUMN `quote_status` int (10) NOT NULL default '0'," + . " ADD COLUMN `quote_waiting` int (10) NOT NULL default '0'," + . " ADD COLUMN `quote_online` int (10) NOT NULL default '0';" + ); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED1); + ++$errors; + } + + $sql = sprintf('ALTER TABLE ' + . $GLOBALS['xoopsDB']->prefix('citas') + . ' RENAME ' + . $GLOBALS['xoopsDB']->prefix('quotes') + ); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED2); + ++$errors; + } + } elseif (tableExists($GLOBALS['xoopsDB']->prefix('randomquote_quotes'))) { + + // change status to indicate quote waiting approval + $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix('randomquote_quotes') . " SET quote_status=2 WHERE `quote_waiting` > 0"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED1); + ++$errors; + } + + // change status to indicate quote online + $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix('randomquote_quotes') . " SET quote_status=1 WHERE `quote_online` > 0"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED1); + ++$errors; + } + + // drop the waiting and online columns + $sql = sprintf('ALTER TABLE ' + . $GLOBALS['xoopsDB']->prefix('randomquote_quotes') + . " DROP COLUMN `quote_waiting`," + . " DROP COLUMN `quote_online`;" + ); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED1); + ++$errors; + } + + // change the table name (drops the module name prefix) + $sql = sprintf('ALTER TABLE ' + . $GLOBALS['xoopsDB']->prefix('randomquote_quotes') + . ' RENAME ' + . $GLOBALS['xoopsDB']->prefix('quotes') + ); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + $module->setErrors(_AM_RANDOMQUOTE_UPGRADEFAILED2); + ++$errors; + } + } + + // add column for randomquote create_date for versions prior to 2.33 + if ($installedVersion < 233) { + $result = $db->queryF("SHOW COLUMNS FROM " . $db->prefix('quotes') . " LIKE 'create_date'"); + $foundColumn = $db->getRowsNum($result); + if (empty($foundColumn)) { + // column doesn't exist, so try and add it + $success = $db->queryF("ALTER TABLE " . $db->prefix('quotes') . " ADD create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP AFTER quote_status"); + if (!$success) { + $module->setErrors(sprintf(_AM_RANDOMQUOTE_ERROR_COLUMN, 'create_date')); + ++$errors; + } + } + } + + return ($errors) ? false : true; +} Added: XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php (rev 0) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php 2014-12-08 20:21:32 UTC (rev 12890) @@ -0,0 +1,112 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * XOOPS tag management module + * + * @package randomquote + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @author Taiwen Jiang <ph...@us...> + * @author ZySpec <ow...@zy...> + * @since 2.11 + * @version $Id: $ + */ + +defined('XOOPS_ROOT_PATH') || exit('Restricted access'); + +XoopsLoad::load('XoopsFilterInput'); + +/** Get item fields: title, content, time, link, uid, tags + * + * Note that $items is "by reference" so modifying it in this + * routine in effect passes it back... + * + * @param array $items + * + * @return bool always returns true + **/ +function randomquote_tag_iteminfo(&$items) +{ + xoops_load('constants', 'randomquote'); + + $items_id = array(); + $cats_id = array(); + + foreach (array_keys($items) as $cat_id) { + $cats_id[] = intval($cat_id); + foreach (array_keys($items[$cat_id]) as $item_id) { + $items_id[] = intval($item_id); + } + } + + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria("id", "(" . implode(",", $items_id) . ")", "IN")); + $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE)); + + $quote_handler =& xoops_getmodulehandler('quotes', 'randomquote'); + $quoteObjs = $quote_handler->getObjects($criteria, true); + + foreach ($cats_id as $cat_id) { + foreach ($items_id as $item_id) { + $quoteObj = $quoteObjs[$item_id]; + $items[$cat_id][$item_id] = array("title" => $quoteObj, +// "uid" => $quoteObj->getVar("uid"), + "link" => "index.php?id={$item_id}", + "time" => strtotime($quoteObj->getVar("create_date")), +// "tags" => tag_parse_tag($quoteObj->getVar("item_tag", "n")), // optional + "content" => "", + ); + } + } + + unset($items_obj); + return true; +} + +/** + * Remove orphan tag-item links + * + * @param int $mid module ID + */ +function mymodule_tag_synchronization($mid) +{ + xoops_load('constants', 'randomquote'); + $item_handler =& xoops_getmodulehandler('quotes', 'randomquote'); + $link_handler =& xoops_getmodulehandler('link', 'tag'); + + if (!$item_handler || !$link_handler) { + $result = false; + } else { + $mid = XoopsFilterInput::clean($mid, 'INT'); + $module_handler =& xoops_gethandler('module'); + $rqModule =& XoopsModule::getByDirname('randomquote'); + + // check to make sure module is active and trying to sync randomquote + if (($rqModule instanceof XoopsModule) && ($rqModule->isactive()) && ($rqModule->mid() == $mid)) { + // clear tag-item links + $sql = "DELETE FROM {$link_handler->table}" + . " WHERE tag_modid = {$mid}" + . " AND " + . " (tag_itemid NOT IN " + . " (SELECT DISTINCT {$item_handler->keyName} " + . " FROM {$item_handler->table} " + . " WHERE {$item_handler->table}.quote_status = " . RandomquoteConstants::STATUS_ONLINE + . " )" + . " )"; + $result = $link_handler->db->queryF($sql); + } else { + $result = false; + } + } + + return ($result) ? true : false; +} Added: XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php (rev 0) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php 2014-12-08 20:21:32 UTC (rev 12890) @@ -0,0 +1,66 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * Module: RandomQuote + * + * @category Module + * @package randomquote + * @author XOOPS Module Development Team + * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} + * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} + * @version $Id: admin_footer.php 12702 2014-07-11 17:18:50Z beckmi $ + * @link http://sourceforge.net/projects/xoops/ + * @since 2.0.0 + */ + +xoops_load('constants', 'randomquote'); + +function randomquote_search($queryarray, $andor, $limit, $offset, $userid) +{ + $ret = array(); + if (0 != (int) $userid) { + return $ret; + } + $quote_handler =& xoops_getmodulehandler('quotes', 'randomquote'); + $entryFields = array('id', 'quote', 'author', 'create_date'); + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE)); + $criteria->setSort('create_date'); + $criteria->setOrder('DESC'); + $criteria->setLimit((int) $limit); + $criteria->setStart((int) $offset); + + if ((is_array($queryarray)) && !empty($queryarray)) { + $criteria->add(new Criteria('quote', "%{$queryarray[0]}%", 'LIKE')); + $criteria->add(new Criteria('author', "%{$queryarray[0]}%", 'LIKE'), 'OR'); + array_shift($queryarray); //get rid of first element + + foreach ($queryarray as $query) { + $criteria->add(new Criteria('quote', "%{$query}%", 'LIKE'), $andor); + $criteria->add(new Criteria('author', "%{$query}%", 'LIKE'), 'OR'); + } + } + $quoteObjs = $quote_handler->getAll($criteria, $entryFields); + foreach ($quoteObjs as $thisQuote) { + $ret[] = array ( + 'image' => 'assets/images/icons/quote.png', + 'link' => "index.php?id=" . $thisQuote->getVar('id'), + 'title' => (string) $thisQuote, //uses magic __toString() + 'time' => strtotime($thisQuote->getVar('create_date')), +// 'uid' => $entry['uid'] + ); + + } + + unset($quoteObjs); + return $ret; +} |
From: <zy...@us...> - 2015-01-29 06:01:20
|
Revision: 12953 http://sourceforge.net/p/xoops/svn/12953 Author: zyspec Date: 2015-01-29 06:01:11 +0000 (Thu, 29 Jan 2015) Log Message: ----------- - added breadcrumb display to top of index page - improved index.tpl rendering - changed to allow HTML in quote entry (XoopsRequest::getText) in admin - moved some hard coded language strings from templates to language files - fixed typo in block text length calculation - fixed bug where 'item_tag' wasn't correctly assigned to template in /class/quotes.php - fixed bug in install script PHP version checking - fixed bug where language file wasn't being loaded in install script Modified Paths: -------------- XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php XoopsModules/randomquote/branches/zyspec/randomquote/index.php XoopsModules/randomquote/branches/zyspec/randomquote/language/english/main.php XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_header.tpl XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_index.tpl XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -114,11 +114,11 @@ $input = new stdClass; // setup input array $input->id = XoopsRequest::getInt('id', RandomquoteConstants::DEFAULT_ID, 'POST'); - $input->quote = XoopsRequest::getString('quote', '', 'POST'); - $input->author = XoopsRequest::getString('author', '', 'POST'); + $input->quote = XoopsRequest::getText('quote', '', 'POST'); + $input->author = XoopsRequest::getText('author', '', 'POST'); $input->item_tag = XoopsRequest::getString('item_tag', '', 'POST'); - $verify_quote_status = XoopsRequest::getInt('quote_status', RandomquoteConstants::STATUS_OFFLINE, 'POST'); + $verify_quote_status = XoopsRequest::getInt('quote_status', RandomquoteConstants::STATUS_OFFLINE, 'POST'); $input->quote_status = (in_array($verify_quote_status, array(RandomquoteConstants::STATUS_ONLINE, RandomquoteConstants::STATUS_OFFLINE, RandomquoteConstants::STATUS_WAITING))) ? $verify_quote_status : RandomquoteConstants::STATUS_OFFLINE; if (!empty($input->id)) { Modified: XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -44,14 +44,12 @@ */ function showRandomquoteBlockViews($options) { -// xoops_load('quotes', 'randomquote'); - xoops_load('constants', 'randomquote'); +// xoops_load('constants', 'randomquote'); - $citas = array(); - $type_block = $options[0]; - $nb_quotes = $options[1]; - $length_title = $options[2]; - + $citas = array(); + $type_block = $options[0]; + $nb_quotes = (int) $options[1]; + $length_title = (int) $options[2]; $quotesHandler =& xoops_getmodulehandler('quotes', 'randomquote'); $criteria = new CriteriaCompo(); @@ -83,10 +81,10 @@ } $quoteObjsArray = $quotesHandler->getAll($criteria); foreach ($quoteObjsArray as $thisQuote) { - if ($options[2] > 0) { - $short_quote = xoops_substr($thisQuote->getVar('quote'), 0, $options[2], $trimmarker = '...'); + if ($length_title > 0) { + $short_quote = xoops_substr($thisQuote->getVar('quote'), 0, $length_title, $trimmarker = '...'); } else { - $shotr_quote = $thisQuote->getVar('quote'); + $short_quote = $thisQuote->getVar('quote'); } $citas[] = array('quote' => $short_quote, 'author' => $thisQuote->getVar('author') @@ -106,8 +104,8 @@ $quotes_arr = array(); $form = "" . _MB_RANDOMQUOTE_QUOTES_DISPLAY . "\n" . "<input type='hidden' name='options[0]' value='" . $options[0] . "' />\n" - . "<input name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' type='text' /> <br />\n" - . "" . _MB_RANDOMQUOTE_QUOTES_SHORTEN . " <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='number' min='0' /> " . _MB_RANDOMQUOTE_QUOTES_CHARACTERS . "<br /><br />"; + . "<input name='options[1]' size='3' maxlength='4' value='" . $options[1] . "' type='text' /> <br />\n" + . "" . _MB_RANDOMQUOTE_QUOTES_SHORTEN . " <input name='options[2]' size='3' maxlength='5' value='" . $options[2] . "' type='number' min='0' step='5' /> " . _MB_RANDOMQUOTE_QUOTES_CHARACTERS . "<br /><br />"; /* array_shift($options); array_shift($options); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -85,8 +85,8 @@ $editorConfigs = array("name" => "quote", "value" => $this->getVar("quote", "e"), - "rows" => 10, - "cols" => 80, + "rows" => 8, + "cols" => 50, "width" => "100%", "height" => "400px", "editor" => $GLOBALS["xoopsModuleConfig"]["randomquote_editor"] @@ -115,7 +115,7 @@ $form->addElement(new TagFormTag('item_tag', 60, 255, $tag_string, 0)); } } else { - $form->XoopsFormHidden('item_tag', ''); + $form->addElement(new XoopsFormHidden('item_tag', '')); } $quote_status = ($this->isNew()) ? RandomquoteConstants::STATUS_OFFLINE : $this->getVar("quote_status"); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt 2015-01-29 06:01:11 UTC (rev 12953) @@ -1,20 +1,28 @@ -Version 2.1 Beta 1 from 2014-12-08 -================================= -- Require PHP 5.3 -- Require XOOPS 2.5.7+ -- Significant security improvements for all vars passed from forms -- Replaced cleanVarsRandomquote with XoopsRequest +<u>Version 2.1 Beta 2 from 2015-1-28</u> +- added breadcrumb display to top of index page +- improved index.tpl rendering +- changed to allow HTML in quote entry (XoopsRequest::getText) in admin +- moved some hard coded language strings from templates to language files +- fixed typo in block text length calculation +- fixed bug where 'item_tag' wasn't correctly assigned to template in /class/quotes.php +- fixed bug in install script PHP version checking +- fixed bug where language file wasn't being loaded in install script + +<u>Version 2.1 Beta 1 from 2014-12-08</u> +- require PHP 5.3 +- require XOOPS 2.5.7+ +- significant security improvements for all vars passed from forms +- replaced cleanVarsRandomquote with XoopsRequest - removed need for ./include/config.php - fixed typo in ./docs/licencs file name to license.txt -- Clean up phpdocumentor comments -- General code cleanup +- clean up phpdocumentor comments +- general code cleanup - added module search capability - added support for XOOPS Tag module - added date quote was created to database - removed "day" block - can be accomplished setting quote cache -Version 2.00 from 2013-06-27 -================================= - - Original release RandomQuote 2.0 Alpha 1. +<u>Version 2.00 from 2013-06-27</u> + - original release RandomQuote 2.0 Alpha 1. This module is developed from scratch using TDMCreate, but it's inspired by the original code from RandomQuote Modified: XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -53,6 +53,7 @@ * @return bool true if meets requirements, false if not */ function randomquoteCheckXoopsVer(&$module) { + xoops_loadLanguage('admin', $module->dirname()); //check for minimum XOOPS version $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string $currArray = explode('.', $currentVer); @@ -90,14 +91,15 @@ * @return bool true if meets requirements, false if not */ function randomquoteCheckPHPVer(&$module) { + xoops_loadLanguage('admin', $module->dirname()); // check for minimum PHP version - $phpLen = strlen(PHP_VERSION); - $extraLen = strlen(PHP_EXTRA_VERSION); - $verNum = substr(PHP_VERSION, 0, ($phpLen-$extraLen)); - $reqVer = $module->getInfo('min_php'); + $phpLen = strlen(PHP_VERSION); + $extraLen = strlen(PHP_EXTRA_VERSION); + $verNum = trim(substr(PHP_VERSION, 0, ($phpLen-$extraLen))); + $reqVer = trim($module->getInfo('min_php') . ""); //make sure it's a string and then trim it - $success = true; - if ($verNum < $reqVer) { + $success = true; + if ($verNum >= $reqVer) { $module->setErrors(sprintf(_AM_RANDOMQUOTE_ERROR_BAD_PHP, $reqVer, $verNum)); $success = false; } @@ -190,6 +192,7 @@ function xoops_module_uninstall_randomquote(&$module) { + $success = true; return $success; } Modified: XoopsModules/randomquote/branches/zyspec/randomquote/index.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/index.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/index.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -39,7 +39,8 @@ 'fbcomments' => $GLOBALS['xoopsModuleConfig']['fbcomments'], 'admin' => $GLOBALS['xoops']->url("www/modules/randomquote/admin/index.php"), 'copyright' => "<a href='http://xoops.org' title='XOOPS Project' target='_blank'> - <img src='" . $GLOBALS['xoops']->url("www/modules/randomquote/assets/images/randomquote_logo.png") . "' alt='XOOPS Project' /></a>" + <img src='" . $GLOBALS['xoops']->url("www/modules/randomquote/assets/images/randomquote_logo.png") . "' alt='XOOPS Project' /></a>", + 'breadcrumb' => '<a href="' . $GLOBALS['xoops']->url('www') . '">' . _YOURHOME . '</a> » ' . $GLOBALS['xoopsModule']->name(), ) ); @@ -77,7 +78,7 @@ . " <td class='txtcenter'>" . $thisQuote->getVar("author") . "</td>\n" . " </tr>\n"; $GLOBALS['xoopsTpl']->append('sets', array('quote' => $thisQuote->getVar("quote"), - 'author' => $thisQuote->getVar("author")) + 'author' => $thisQuote->getVar("author")) ); // } } Modified: XoopsModules/randomquote/branches/zyspec/randomquote/language/english/main.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/language/english/main.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/language/english/main.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -23,8 +23,9 @@ // Main define('_MA_RANDOMQUOTE_INDEX', "Home"); -define('_MA_RANDOMQUOTE_TITLE', "randomquote"); +define('_MA_RANDOMQUOTE_TITLE', "Random Quote Module"); define('_MA_RANDOMQUOTE_DESC', "This module is for collecting and showing Random Quotes"); +define('_MA_RANDOMQUOTE_NO_QUOTES', "There are no quotes that match your request."); define('_MA_RANDOMQUOTE_QUOTES', "Quotes"); //define('_MA_RANDOMQUOTE_QUOTES', "quotes"); define('_MA_RANDOMQUOTE_ADMIN', "Admin"); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_header.tpl =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_header.tpl 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_header.tpl 2015-01-29 06:01:11 UTC (rev 12953) @@ -1,5 +1,5 @@ -<span class='txtleft bold'><{$smarty.const._MA_RANDOMQUOTE_TITLE}>: </span> -<span class='txtleft'><{$smarty.const._MA_RANDOMQUOTE_DESC}></span><br/> -<{if $adv != ''}> +<div class="breadcrumb"><{$breadcrumb}></div> +<div class='txtleft marg5'><strong></b><{$smarty.const._MA_RANDOMQUOTE_TITLE}>:</strong> <{$smarty.const._MA_RANDOMQUOTE_DESC}></div> +<{if '' != $adv}> <div class="center"><{$adv}></div> <{/if}> Modified: XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_index.tpl =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_index.tpl 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/templates/randomquote_index.tpl 2015-01-29 06:01:11 UTC (rev 12953) @@ -1,8 +1,8 @@ -<{include file="db:randomquote_header.tpl"}> +<{include file="db:randomquote_header.tpl" breadcrumb = $breadcrumb}> <{* <link rel="stylesheet" href="assets/css/table.css" type="text/css"/> *}> <{* <div class="outer"> - <div class="center">Randomquote</div> + <div class="center"><{$smarty.const._MA_RANDOMQUOTE_TITLE}></div> <br /> </div> *}> @@ -11,6 +11,7 @@ <{if !empty($sets)}> <div class="head border marg10"> <div class="outer"> +<{* <div class="breadcrumb"><{$breadcrumb}></div> *}> <div class="width80 floatleft center bold big"><{$smarty.const._MA_RANDOMQUOTE_QUOTES_QUOTE}></div> <div class="width10 floatleft center bold big"><{$smarty.const._MA_RANDOMQUOTE_QUOTES_AUTHOR}></div> <div class="clear"></div> @@ -25,9 +26,7 @@ <{* $pagenav *}> </div> <{else}> -<div class='txtcenter bold italic marg3'> - There are no quotes that match your request. -</div> +<div class='txtcenter bold italic marg3'><{$smarty.const._MA_RANDOMQUOTE_NO_QUOTES}></div> <{/if}> <{include file="db:randomquote_footer.tpl"}> Modified: XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php 2015-01-28 21:33:49 UTC (rev 12952) +++ XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php 2015-01-29 06:01:11 UTC (rev 12953) @@ -32,7 +32,7 @@ 'version' => 2.10, 'module_status' => "Beta 1", 'official' => 0, //1 if supported by XOOPS CORE Dev Team, 0 otherwise - 'release_date' => "2014/12/06", + 'release_date' => "2015/1/28", 'author' => "XOOPS Module Development Team", 'author_mail' => "na...@si...", 'author_website_url' => "http://xoops.org", |
From: <zy...@us...> - 2015-02-20 05:05:20
|
Revision: 13004 http://sourceforge.net/p/xoops/svn/13004 Author: zyspec Date: 2015-02-20 05:05:11 +0000 (Fri, 20 Feb 2015) Log Message: ----------- * minor PSRx naming convention updates * minor XOOPS variable name updates for consistency * minor template CSS changes Modified Paths: -------------- XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt XoopsModules/randomquote/branches/zyspec/randomquote/header.php XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php XoopsModules/randomquote/branches/zyspec/randomquote/include/functions.php XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php XoopsModules/randomquote/branches/zyspec/randomquote/index.php XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -24,10 +24,10 @@ */ echo "<div class='adminfooter'>\n" - . " <div class='center'>\n" + . " <div class='txtcenter'>\n" . " <a href='" . $GLOBALS['xoopsModule']->getInfo('author_website_url') . "' target='_blank'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' title='" . $GLOBALS['xoopsModule']->getInfo('author_website_name') . "' /></a>\n" . " </div>\n" - . " <div class='center smallsmall italic pad5'>\n" + . " <div class='txtcenter smallsmall italic pad5'>\n" . " " . _AM_RANDOMQUOTE_MAINTAINED_BY . " <a class='tooltip' rel='external' href='http://" . $GLOBALS['xoopsModule']->getInfo('module_website_url') . "' " . "title='" . _AM_RANDOMQUOTE_MAINTAINED_TITLE . "'>" . _AM_RANDOMQUOTE_MAINTAINED_TEXT . "</a>\n" Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -23,21 +23,21 @@ * @since 2.0.0 */ -$thisDirname = basename(dirname(__DIR__)); +$moduleDirname = basename(dirname(__DIR__)); include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; include_once $GLOBALS['xoops']->path('/include/cp_header.php'); -//include_once $GLOBALS['xoops']->path("modules/{$thisDirname}/include/config.php"); -include_once $GLOBALS['xoops']->path("modules/{$thisDirname}/include/functions.php"); +//include_once $GLOBALS['xoops']->path("modules/{$moduleDirname}/include/config.php"); +include_once $GLOBALS['xoops']->path("modules/{$moduleDirname}/include/functions.php"); -XoopsLoad::load('xoopsrequest'); -XoopsLoad::load('quotes', $thisDirname); -XoopsLoad::load('constants', $thisDirname); +XoopsLoad::load('XoopsRequest'); +XoopsLoad::load('quotes', $moduleDirname); +XoopsLoad::load('constants', $moduleDirname); $pathIcon16 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons16')); $pathIcon32 = $GLOBALS['xoops']->url('www/' . $GLOBALS['xoopsModule']->getInfo('icons32')); $pathModuleAdmin = $GLOBALS['xoops']->path('www/' . $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin')); -$quotesHandler =& xoops_getModuleHandler('quotes', $thisDirname); +$quotesHandler =& xoops_getModuleHandler('quotes', $moduleDirname); $myts =& MyTextSanitizer::getInstance(); if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { @@ -48,9 +48,9 @@ $GLOBALS['xoopsTpl']->assign('pathIcon16', $pathIcon16); $GLOBALS['xoopsTpl']->assign('pathIcon32', $pathIcon32); //Load languages -xoops_loadLanguage('admin', $thisDirname); -xoops_loadLanguage('modinfo', $thisDirname); -xoops_loadLanguage('main', $thisDirname); +xoops_loadLanguage('admin', $moduleDirname); +xoops_loadLanguage('modinfo', $moduleDirname); +xoops_loadLanguage('main', $moduleDirname); require_once "{$pathModuleAdmin}/moduleadmin/moduleadmin.php"; xoops_cp_header(); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -25,10 +25,8 @@ include_once __DIR__ . '/admin_header.php'; -//xoops_load('xoopsrequest'); +$op = XoopsRequest::getCmd('op', ''); -$op = XoopsRequest::getCmd('op', ''); -//$op = cleanVarsRandomquote($_REQUEST, 'op', '', 'string'); switch ($op) { case "list": default: @@ -45,20 +43,20 @@ $criteria->setOrder('ASC'); $quotesObjArray = $quotesHandler->getAll($criteria); $quoteCount = (!empty($quotesObjArray) ? count($quotesObjArray) : 0); -// $quoteCount = $quotesHandler->getCount(); //Table view if ($quoteCount) { - echo "<table class='width100 outer' cellspacing='1'>\n" - . " <thead>\n" + echo "\n" + . "<table class='outer width100 bspacing1'>\n" + . "<thead>\n" . " <tr>\n" . " <th class='txtcenter'>" . _AM_RANDOMQUOTE_QUOTES_QUOTE . "</th>\n" . " <th class='txtcenter'>" . _AM_RANDOMQUOTE_QUOTES_AUTHOR . "</th>\n" . " <th class='txtcenter'>" . _AM_RANDOMQUOTE_QUOTES_STATUS . "</th>\n" . " <th class='txtcenter width10'>" . _AM_RANDOMQUOTE_FORMACTION . "</th>\n" . " </tr>\n" - . " </thead>\n" - . " <tbody>\n"; + . "</thead>\n" + . "<tbody>\n"; $class = 'even'; @@ -83,7 +81,7 @@ . " </td>\n" . " </tr>\n"; } - echo " </tbody>\n" + echo "</tbody>\n" . "</table><br /><br />\n"; } @@ -135,11 +133,11 @@ ); if ($objId = $quotesHandler->insert($obj)) { -// $module_handler =& xoops_gethandler('module'); +// $moduleHandler =& xoops_gethandler('module'); $tagModule =& XoopsModule::getByDirname('tag'); if (($tagModule instanceof XoopsModule) && ($tagModule->isactive())) { - $tag_handler =& xoops_getmodulehandler('tag', 'tag'); - $tag_handler->updateByItem($input->item_tag, $objId, $thisDirname, 0); + $tagHandler =& xoops_getmodulehandler('tag', 'tag'); + $tagHandler->updateByItem($input->item_tag, $objId, $thisDirname, 0); } redirect_header("main.php?op=list", RandomquoteConstants::REDIRECT_DELAY_MEDIUM, $add_msg); } @@ -185,11 +183,11 @@ $item_id = $obj->getVar('id'); if ($quotesHandler->delete($obj)) { // now clear out items in tag module for this item - $module_handler =& xoops_gethandler('module'); + $moduleHandler =& xoops_gethandler('module'); $tagModule =& XoopsModule::getByDirname('tag'); if (($tagModule instanceof XoopsModule) && ($tagModule->isactive())) { - $tag_handler =& xoops_getmodulehandler('tag', 'tag'); - $tag_handler->updateByItem(array(), $item_id, $thisDirname); //clear all tags for this item + $tagHandler =& xoops_getmodulehandler('tag', 'tag'); + $tagHandler->updateByItem(array(), $item_id, $thisDirname); //clear all tags for this item } redirect_header($_SERVER['PHP_SELF'], RandomquoteConstants::REDIRECT_DELAY_MEDIUM, _AM_RANDOMQUOTE_FORMDELOK); } else { Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -23,21 +23,21 @@ * @since 2.0.0 */ -$dirname = basename(dirname(__DIR__)); -$module_handler =& xoops_gethandler("module"); -$xoopsModule =& XoopsModule::getByDirname($dirname); -$moduleInfo =& $module_handler->get($xoopsModule->getVar("mid")); -$pathIcon32 = '../../' . $moduleInfo->getInfo('icons32'); +$moduleDirname = basename(dirname(__DIR__)); +$moduleHandler =& xoops_gethandler("module"); +$xoopsModule =& XoopsModule::getByDirname($moduleDirname); +$moduleInfo =& $moduleHandler->get($xoopsModule->getVar("mid")); +$pathIcon32 = '../../' . $moduleInfo->getInfo('icons32'); -$adminmenu = array(array("title" => _MI_RANDOMQUOTE_ADMENU1, - "link" => 'admin/index.php', - "icon" => "{$pathIcon32}/home.png"), +$adminmenu = array(array('title' => _MI_RANDOMQUOTE_ADMENU1, + 'link' => 'admin/index.php', + 'icon' => "{$pathIcon32}/home.png"), - array("title" => _MI_RANDOMQUOTE_ADMENU2, - "link" => 'admin/main.php', - "icon" => "{$pathIcon32}/content.png"), + array('title' => _MI_RANDOMQUOTE_ADMENU2, + 'link' => 'admin/main.php', + 'icon' => "{$pathIcon32}/content.png"), - array("title" => _MI_RANDOMQUOTE_ADMENU3, - "link" => 'admin/about.php', - "icon" => "{$pathIcon32}/about.png") + array('title' => _MI_RANDOMQUOTE_ADMENU3, + 'link' => 'admin/about.php', + 'icon' => "{$pathIcon32}/about.png") ); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -99,17 +99,17 @@ * load the formtag class * display the tag form element to collect the tag item */ - $module_handler =& xoops_gethandler('module'); - $tagModule =& XoopsModule::getByDirname('tag'); + $moduleHandler =& xoops_gethandler('module'); + $tagModule =& XoopsModule::getByDirname('tag'); if (($tagModule instanceof XoopsModule) && ($tagModule->isactive())) { $tagClassExists = XoopsLoad::load('formtag', 'tag'); // get the TagFormTag class if ($tagClassExists) { if ($this->isNew()) { $tag_items = array(); } else { - $moduleMid = $GLOBALS['xoopsModule']->mid(); - $tag_handler =& xoops_getmodulehandler('tag', 'tag'); - $tag_items = $tag_handler->getByItem($id, $moduleMid, 0); + $moduleMid = $GLOBALS['xoopsModule']->mid(); + $tagHandler =& xoops_getmodulehandler('tag', 'tag'); + $tag_items = $tagHandler->getByItem($id, $moduleMid, 0); } $tag_string = implode('|', $tag_items); $form->addElement(new TagFormTag('item_tag', 60, 255, $tag_string, 0)); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt 2015-02-20 05:05:11 UTC (rev 13004) @@ -1,4 +1,4 @@ -<u>Version 2.1 Beta 2 from 2015-1-28</u> +<u>Version 2.1 Beta 2 from 2015-2-10</u> - added breadcrumb display to top of index page - improved index.tpl rendering - changed to allow HTML in quote entry (XoopsRequest::getText) in admin @@ -7,6 +7,8 @@ - fixed bug where 'item_tag' wasn't correctly assigned to template in /class/quotes.php - fixed bug in install script PHP version checking - fixed bug where language file wasn't being loaded in install script +- improved PSRx naming nomenclature +- removed cleanVarsRandomquote function since it was deprecated in Beta 1 <u>Version 2.1 Beta 1 from 2014-12-08</u> - require PHP 5.3 Modified: XoopsModules/randomquote/branches/zyspec/randomquote/header.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/header.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/header.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -20,14 +20,14 @@ */ include dirname(dirname(__DIR__)) . '/mainfile.php'; -$dirname = $GLOBALS['xoopsModule']->getVar('dirname'); -//include $GLOBALS['xoops']->path("/modules/{$dirname}/include/config.php"); -include $GLOBALS['xoops']->path("/modules/{$dirname}/include/functions.php"); +$moduleDirname = $GLOBALS['xoopsModule']->getVar('dirname'); +//include $GLOBALS['xoops']->path("/modules/{$moduleDirname}/include/config.php"); +include $GLOBALS['xoops']->path("/modules/{$moduleDirname}/include/functions.php"); //$myts =& MyTextSanitizer::getInstance(); -$style = "modules/{$dirname}/include/style.css"; +$style = "modules/{$moduleDirname}/include/style.css"; if (file_exists($GLOBALS['xoops']->path($style))) { $GLOBALS['xoTheme']->addStylesheet($GLOBALS['xoops']->url("www/{$stylesheet}")); } -$quotesHandler =& xoops_getModuleHandler('quotes', $dirname); -xoops_loadLanguage('modinfo', $dirname); -xoops_loadLanguage('main', $dirname); +$quotesHandler =& xoops_getModuleHandler('quotes', $moduleDirname); +xoops_loadLanguage('modinfo', $moduleDirname); +xoops_loadLanguage('main', $moduleDirname); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/action.module.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -29,7 +29,7 @@ if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof XoopsUser) - || !($GLOBALS['xoopsUser']->IsAdmin())) + || !($GLOBALS['xoopsUser']->isAdmin())) { exit("Restricted access" . PHP_EOL); } @@ -163,7 +163,7 @@ { /* Do some synchronization with tags to remove tags associated with this module * - * @todo: write this code... + * @TODO: write this code... * * pseudo code * if (tag module installed) { @@ -177,8 +177,8 @@ $tagModule =& XoopsModule::getByDirname('tag'); if (($tagModule instanceof XoopsModule) && ($tagModule->isactive())) { // first delete all quotes - $quotes_handler =& xoops_getmodulehandler('quotes', 'randomquote'); - $quoteObjs = $quotes_handler->deleteAll(); + $quotesHandler =& xoops_getmodulehandler('quotes', 'randomquote'); + $quoteObjs = $quotesHandler->deleteAll(); //now 'unlink' the quote tags from Tag modules include_once $GLOBALS['xoops']->path("/modules/tag/include/functions.recon.php"); $success = tag_synchronization(); Modified: XoopsModules/randomquote/branches/zyspec/randomquote/include/functions.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/functions.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/functions.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -44,36 +44,6 @@ /** * - * Enter description here ... - * - * @deprecated Replaced by XoopsRequest - * @param string $global ($_POST, $_GET, $_REQUEST, etc) - * @param string $key input var - * @param unknown_type $default set $key to this if invalid input - * @param string $type types are 'int' or 'string' - * - * @return unknown_type cleaned input value contained in $global[$key] - */ -function cleanVarsRandomquote(&$global, $key, $default = '', $type = 'int') -{ - switch ($type) { - case 'string': - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_MAGIC_QUOTES) : $default; - break; - case 'int': - default: - $ret = (isset($global[$key])) ? filter_var($global[$key], FILTER_SANITIZE_NUMBER_INT) : $default; - break; - } - if ($ret === false) { - return $default; - } - - return $ret; -} - -/** - * * Assign the xoops_meta_keywords in the template * * @param string $content a string of keywords for HTML meta tag Modified: XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/plugin.tag.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -52,8 +52,8 @@ $criteria->add(new Criteria("id", "(" . implode(",", $items_id) . ")", "IN")); $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE)); - $quote_handler =& xoops_getmodulehandler('quotes', 'randomquote'); - $quoteObjs = $quote_handler->getObjects($criteria, true); + $quoteHandler =& xoops_getmodulehandler('quotes', 'randomquote'); + $quoteObjs = $quoteHandler->getObjects($criteria, true); foreach ($cats_id as $cat_id) { foreach ($items_id as $item_id) { @@ -80,29 +80,29 @@ function mymodule_tag_synchronization($mid) { xoops_load('constants', 'randomquote'); - $item_handler =& xoops_getmodulehandler('quotes', 'randomquote'); - $link_handler =& xoops_getmodulehandler('link', 'tag'); + $itemHandler =& xoops_getmodulehandler('quotes', 'randomquote'); + $linkHandler =& xoops_getmodulehandler('link', 'tag'); - if (!$item_handler || !$link_handler) { + if (!$itemHandler || !$linkHandler) { $result = false; } else { $mid = XoopsFilterInput::clean($mid, 'INT'); - $module_handler =& xoops_gethandler('module'); - $rqModule =& XoopsModule::getByDirname('randomquote'); + $moduleHandler =& xoops_gethandler('module'); + $rqModule =& XoopsModule::getByDirname('randomquote'); // check to make sure module is active and trying to sync randomquote if (($rqModule instanceof XoopsModule) && ($rqModule->isactive()) && ($rqModule->mid() == $mid)) { // clear tag-item links - $sql = "DELETE FROM {$link_handler->table}" + $sql = "DELETE FROM {$linkHandler->table}" . " WHERE tag_modid = {$mid}" . " AND " . " (tag_itemid NOT IN " - . " (SELECT DISTINCT {$item_handler->keyName} " - . " FROM {$item_handler->table} " - . " WHERE {$item_handler->table}.quote_status = " . RandomquoteConstants::STATUS_ONLINE + . " (SELECT DISTINCT {$itemHandler->keyName} " + . " FROM {$itemHandler->table} " + . " WHERE {$itemHandler->table}.quote_status = " . RandomquoteConstants::STATUS_ONLINE . " )" . " )"; - $result = $link_handler->db->queryF($sql); + $result = $linkHandler->db->queryF($sql); } else { $result = false; } Modified: XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/include/search.inc.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -30,7 +30,7 @@ if (0 != (int) $userid) { return $ret; } - $quote_handler =& xoops_getmodulehandler('quotes', 'randomquote'); + $quoteHandler =& xoops_getmodulehandler('quotes', 'randomquote'); $entryFields = array('id', 'quote', 'author', 'create_date'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE)); @@ -49,7 +49,7 @@ $criteria->add(new Criteria('author', "%{$query}%", 'LIKE'), 'OR'); } } - $quoteObjs = $quote_handler->getAll($criteria, $entryFields); + $quoteObjs = $quoteHandler->getAll($criteria, $entryFields); foreach ($quoteObjs as $thisQuote) { $ret[] = array ( 'image' => 'assets/images/icons/quote.png', Modified: XoopsModules/randomquote/branches/zyspec/randomquote/index.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/index.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/index.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -59,7 +59,7 @@ //$numrows = $quotesHandler->getCount(); //Table view if ($numrows) { - $bodyTxt = "<table class='width100 outer' cellspacing='1'>\n" + $bodyTxt = "<table class='outer width100 outer bspacing1'>\n" . " <thead>\n" . " <tr>\n" . " <th class='txtcenter'>" . _MA_RANDOMQUOTE_QUOTES_QUOTE . "</th>\n" Modified: XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php =================================================================== --- XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php 2015-02-20 04:45:42 UTC (rev 13003) +++ XoopsModules/randomquote/branches/zyspec/randomquote/xoops_version.php 2015-02-20 05:05:11 UTC (rev 13004) @@ -6,8 +6,6 @@ * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * - * PHP version 5 - * * @category Module * @package randomquote * @author XOOPS Development Team @@ -21,11 +19,11 @@ // defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); -$dirname = basename(__DIR__); +$moduleDirname = basename(__DIR__); xoops_load('XoopsLists'); xoops_load('xoopseditorhandler'); -$editor_handler = XoopsEditorHandler::getInstance(); +$editorHandler = XoopsEditorHandler::getInstance(); $modversion = array('name' => _MI_RANDOMQUOTE_ADMIN_NAME, 'description' => _MI_RANDOMQUOTE_ADMIN_DESC, @@ -47,13 +45,13 @@ 'link' => 'page=module_index')), 'manual' => "Install.txt", - 'manual_file' => XOOPS_URL . "/modules/{$dirname}/docs/link to manual file", + 'manual_file' => XOOPS_URL . "/modules/{$moduleDirname}/docs/link to manual file", 'min_php' => "5.3.7", 'min_xoops' => "2.5.7", 'min_admin' => "1.2", 'min_db' => array('mysql' => '5.0.7', 'mysqli' => '5.0.7'), 'image' => "assets/images/randomquote_logo.png", - 'dirname' => "{$dirname}", + 'dirname' => "{$moduleDirname}", 'dirmoduleadmin' => 'Frameworks/moduleclasses', 'icons16' => 'Frameworks/moduleclasses/icons/16', @@ -61,7 +59,7 @@ //About 'release_info' => "module_release_info", - 'release_file' => XOOPS_URL . "/modules/{$dirname}/docs/module_release_info file", + 'release_file' => XOOPS_URL . "/modules/{$moduleDirname}/docs/module_release_info file", 'demo_site_url' => "http://xoops.org", 'demo_site_name' => "XOOPS Demo Site", 'forum_site_url' => "http://xoops.org", @@ -138,7 +136,7 @@ 'formtype' => "select", 'valuetype' => "text", 'default' => "dhtml", - 'options' => array_flip($editor_handler->getList())), + 'options' => array_flip($editorHandler->getList())), array('name' => "keywords", 'title' => "_MI_RANDOMQUOTE_KEYWORDS", |