|
From: <zy...@us...> - 2014-12-08 20:18:19
|
Revision: 12889
http://sourceforge.net/p/xoops/svn/12889
Author: zyspec
Date: 2014-12-08 20:18:04 +0000 (Mon, 08 Dec 2014)
Log Message:
-----------
- Require PHP 5.3 & 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
- General code (& comment) 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
Modified Paths:
--------------
XoopsModules/randomquote/branches/zyspec/randomquote/admin/about.php
XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php
XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php
XoopsModules/randomquote/branches/zyspec/randomquote/admin/index.php
XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php
XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.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/docs/install.txt
XoopsModules/randomquote/branches/zyspec/randomquote/header.php
XoopsModules/randomquote/branches/zyspec/randomquote/include/config.php
XoopsModules/randomquote/branches/zyspec/randomquote/include/functions.php
XoopsModules/randomquote/branches/zyspec/randomquote/include/install.php
XoopsModules/randomquote/branches/zyspec/randomquote/include/update.php
XoopsModules/randomquote/branches/zyspec/randomquote/include/waiting.plugin.php
XoopsModules/randomquote/branches/zyspec/randomquote/index.php
XoopsModules/randomquote/branches/zyspec/randomquote/language/english/admin.php
XoopsModules/randomquote/branches/zyspec/randomquote/language/english/blocks.php
XoopsModules/randomquote/branches/zyspec/randomquote/language/english/help/help.html
XoopsModules/randomquote/branches/zyspec/randomquote/language/english/main.php
XoopsModules/randomquote/branches/zyspec/randomquote/language/english/modinfo.php
XoopsModules/randomquote/branches/zyspec/randomquote/sql/mysql.sql
XoopsModules/randomquote/branches/zyspec/randomquote/templates/admin/randomquote_admin_help.tpl
XoopsModules/randomquote/branches/zyspec/randomquote/templates/blocks/randomquote_quotes_block_day.tpl
XoopsModules/randomquote/branches/zyspec/randomquote/templates/blocks/randomquote_quotes_block_random.tpl
XoopsModules/randomquote/branches/zyspec/randomquote/templates/blocks/randomquote_quotes_block_recent.tpl
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
Added Paths:
-----------
XoopsModules/randomquote/branches/zyspec/
XoopsModules/randomquote/branches/zyspec/randomquote/
XoopsModules/randomquote/branches/zyspec/randomquote/docs/license.txt
Removed Paths:
-------------
XoopsModules/randomquote/branches/zyspec/randomquote/class/forms/
XoopsModules/randomquote/branches/zyspec/randomquote/docs/licencs.txt
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/about.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/about.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/about.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,18 +1,23 @@
<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
/**
* Module: RandomQuote
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/admin_footer.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_footer.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,26 +1,36 @@
<?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
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
*/
-echo "<div align='center'><a href='http://www.xoops.org' target='_blank'>
- <img src='" . $pathIcon32 . "/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a></div>";
-echo "<div class='center smallsmall italic pad5'>
- <strong>" . $xoopsModule->getVar('name') . "</strong> " . _AM_RANDOMQUOTE_MAINTAINEDBY . "
- <a href='http://xoops.org' title='Visit Support Forum' class='tooltip' rel='external'>Support Forum</a></div>";
+echo "<div class='adminfooter'>\n"
+ . " <div class='center'>\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"
+ . " " . _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"
+ . " </div>\n"
+ . "</div>";
xoops_cp_footer();
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/admin_header.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/admin_header.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,53 +1,57 @@
<?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
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
*/
+$thisDirname = basename(dirname(__DIR__));
+
include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
-include_once XOOPS_ROOT_PATH . '/include/cp_header.php';
-include_once '../include/config.php';
-include_once '../include/functions.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");
-$thisDirname = $GLOBALS['xoopsModule']->getVar('dirname');
+XoopsLoad::load('xoopsrequest');
+XoopsLoad::load('quotes', $thisDirname);
+XoopsLoad::load('constants', $thisDirname);
-$pathIcon16 = '../' . $xoopsModule->getInfo('icons16');
-$pathIcon32 = '../' . $xoopsModule->getInfo('icons32');
-$pathModuleAdmin = $GLOBALS['xoopsModule']->getInfo('dirmoduleadmin');
-//load handlers
-$quotesHandler =& xoops_getModuleHandler('quotes', $thisDirname);
+$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);
$myts =& MyTextSanitizer::getInstance();
-if (!isset($xoopsTpl) || !is_object($xoopsTpl)) {
- include_once(XOOPS_ROOT_PATH . "/class/template.php");
+if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
+ include_once $GLOBALS['xoops']->path("/class/template.php");
$xoopsTpl = new XoopsTpl();
}
-$xoopsTpl->assign('pathIcon16', $pathIcon16);
-$xoopsTpl->assign('pathIcon32', $pathIcon32);
+$GLOBALS['xoopsTpl']->assign('pathIcon16', $pathIcon16);
+$GLOBALS['xoopsTpl']->assign('pathIcon32', $pathIcon32);
//Load languages
xoops_loadLanguage('admin', $thisDirname);
xoops_loadLanguage('modinfo', $thisDirname);
xoops_loadLanguage('main', $thisDirname);
-// Locad admin menu class
-if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'))) {
- require_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php');
-} else {
- redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false);
-}
+require_once "{$pathModuleAdmin}/moduleadmin/moduleadmin.php";
+
xoops_cp_header();
$adminMenu = new ModuleAdmin();
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/index.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/index.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/index.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,18 +1,23 @@
<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
/**
* Module: RandomQuote
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
@@ -26,6 +31,6 @@
// InfoBox citas
$adminMenu->addInfoBoxLine(_AM_RANDOMQUOTE_STATISTICS, _AM_RANDOMQUOTE_THEREARE_CITAS, $count_quotes);
// Render Index
-echo $adminMenu->addNavigation("index.php");
+echo $adminMenu->addNavigation('index.php');
echo $adminMenu->renderIndex();
include_once __DIR__ . '/admin_footer.php';
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/main.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/main.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,82 +1,96 @@
<?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
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
*/
include_once __DIR__ . '/admin_header.php';
-//It recovered the value of argument op in URL$
-$op = cleanVarsRandomquote($_REQUEST, 'op', 'list', 'string');
+
+//xoops_load('xoopsrequest');
+
+$op = XoopsRequest::getCmd('op', '');
+//$op = cleanVarsRandomquote($_REQUEST, 'op', '', 'string');
switch ($op) {
case "list":
default:
echo $adminMenu->addNavigation('main.php');
$adminMenu->addItemButton(_AM_RANDOMQUOTE_NEWCITAS, 'main.php?op=new_quote', 'add');
- echo $adminMenu->renderButton('left');
+ echo $adminMenu->renderButton('right');
$criteria = new CriteriaCompo();
- $criteria->setSort("id");
- $criteria->setOrder("ASC");
- $numrows = $quotesHandler->getCount();
- $quotes_arr = $quotesHandler->getall($criteria);
+ if (isset($_REQUEST['status'])) {
+ $status = XoopsRequest::getInt('status', RandomquoteConstants::STATUS_ONLINE);
+ $criteria->add(new Criteria('status', $status));
+ } else {
+ $criteria->setSort('id');
+ }
+ $criteria->setOrder('ASC');
+ $quotesObjArray = $quotesHandler->getAll($criteria);
+ $quoteCount = (!empty($quotesObjArray) ? count($quotesObjArray) : 0);
+// $quoteCount = $quotesHandler->getCount();
//Table view
- if ($numrows > 0) {
- echo "<table width='100%' cellspacing='1' class='outer'>
- <tr>
- <th align=\"center\">" . _AM_RANDOMQUOTE_QUOTES_QUOTE . "</th>
- <th align=\"center\">" . _AM_RANDOMQUOTE_QUOTES_AUTHOR . "</th>
- <th align=\"center\">" . _AM_RANDOMQUOTE_QUOTES_STATUS . "</th>
- <th align=\"center\">" . _AM_RANDOMQUOTE_QUOTES_WAITING . "</th>
- <th align=\"center\">" . _AM_RANDOMQUOTE_QUOTES_ONLINE . "</th>
+ if ($quoteCount) {
+ echo "<table class='width100 outer' cellspacing='1'>\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";
- <th align='center' width='10%'>" . _AM_RANDOMQUOTE_FORMACTION . "</th>
- </tr>";
+ $class = 'even';
- $class = "odd";
-
- foreach (array_keys($quotes_arr) as $i) {
- if ($quotes_arr[$i]->getVar("quotes_pid") == 0) {
- echo "<tr class='" . $class . "'>";
- $class = ($class == "even") ? "odd" : "even";
- echo "<td>" . $quotes_arr[$i]->getVar("quote") . "</td>";
- echo "<td align=\"center\">" . $quotes_arr[$i]->getVar("author") . "</td>";
-
- $verif_quote_status = ($quotes_arr[$i]->getVar("quote_status") == 1) ? _YES : _NO;
- echo "<td align=\"center\">" . $verif_quote_status . "</td>";
-
- $verif_quote_waiting = ($quotes_arr[$i]->getVar("quote_waiting") == 1) ? _YES : _NO;
- echo "<td align=\"center\">" . $verif_quote_waiting . "</td>";
-
- $verif_quote_online = ($quotes_arr[$i]->getVar("quote_online") == 1) ? _YES : _NO;
- echo "<td align=\"center\">" . $verif_quote_online . "</td>";
-
- echo "<td align='center' width='10%'>
- <a href='main.php?op=edit_quote&id=" . $quotes_arr[$i]->getVar("id") . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
- <a href='main.php?op=delete_quote&id=" . $quotes_arr[$i]->getVar("id") . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
- </td>";
- echo "</tr>";
- }
+ $statusIcons = array(RandomquoteConstants::STATUS_OFFLINE => array('image' => 'off.png', 'text' => _AM_RANDOMQUOTE_QUOTES_OFFLINE),
+ RandomquoteConstants::STATUS_ONLINE => array('image' => 'on.png', 'text' => _AM_RANDOMQUOTE_QUOTES_ONLINE),
+ RandomquoteConstants::STATUS_WAITING => array('image' => 'warning.png', 'text' => _AM_RANDOMQUOTE_QUOTES_WAITING)
+ );
+ foreach($quotesObjArray as $quoteObj) {
+// foreach (array_keys($quotes_arr) as $i) {
+ $class = ('even' == $class) ? 'odd' : 'even';
+ $thisStatus = $quoteObj->getVar('quote_status');
+ $quote_status_link = "<img src='{$pathIcon16}/{$statusIcons[$thisStatus]['image']}'"
+ . " alt='{$statusIcons[$thisStatus]['text']}'"
+ . " title='{$statusIcons[$thisStatus]['text']}' />";
+ echo " <tr class='{$class}'>\n"
+ . " <td>" . $quoteObj->getVar('quote') . "</td>\n"
+ . " <td class='txtcenter width20'>" . $quoteObj->getVar('author') . "</td>\n"
+ . " <td class='txtcenter width10'>" . $quote_status_link . "</td>\n"
+ . " <td class='txtcenter width10'>\n"
+ . " <a href='main.php?op=edit_quote&id=" . $quoteObj->getVar('id') . "'><img src='{$pathIcon16}/edit.png' alt='" . _EDIT . "' title='" . _EDIT . "' /></a>\n"
+ . " <a href='main.php?op=delete_quote&id=" . $quoteObj->getVar('id') . "'><img src='{$pathIcon16}/delete.png' alt='" . _DELETE . "' title='" . _DELETE . "' /></a>\n"
+ . " </td>\n"
+ . " </tr>\n";
}
- echo "</table><br /><br />";
+ echo " </tbody>\n"
+ . "</table><br /><br />\n";
}
break;
- case "new_quote":
- echo $adminMenu->addNavigation("main.php");
+
+ case 'new_quote':
+ echo $adminMenu->addNavigation('main.php');
$adminMenu->addItemButton(_AM_RANDOMQUOTE_QUOTESLIST, 'main.php?op=list', 'list');
echo $adminMenu->renderButton('left');
@@ -84,63 +98,112 @@
$form = $obj->getForm();
$form->display();
break;
- case "save_quote":
- if (!$GLOBALS["xoopsSecurity"]->check()) {
- redirect_header("main.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors()));
+
+ case 'save_quote':
+ // check to make sure this passes form submission security
+ if (($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity)) {
+ if ( !$GLOBALS['xoopsSecurity']->check()) {
+ // failed xoops security check
+ redirect_header($_SERVER['PHP_SELF'], RandomquoteConstants::REDIRECT_DELAY_MEDIUM, $GLOBALS['xoopsSecurity']->getErrors(true));
+ exit();
+ }
+ } else {
+ redirect_header('index.php', RandomquoteConstants::REDIRECT_DELAY_MEDIUM, _MD_RANDOMQUOTE_INVALID_SECURITY_TOKEN);
}
- if (isset($_REQUEST["id"])) {
- $obj =& $quotesHandler->get($_REQUEST["id"]);
+
+ $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->item_tag = XoopsRequest::getString('item_tag', '', '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)) {
+ $obj = $quotesHandler->get($input->id);
+ $add_msg = _AM_RANDOMQUOTE_FORM_UPDATE_OK;
} else {
- $obj =& $quotesHandler->create();
+ $obj = $quotesHandler->create();
+ $add_msg = _AM_RANDOMQUOTE_FORM_ADD_OK;
}
- //Form texto
- $obj->setVar("quote", $_REQUEST["quote"]);
- //Form autor
- $obj->setVar("author", $_REQUEST["author"]);
- //Form quote_status
- $verif_quote_status = ($_REQUEST["quote_status"] == 1) ? "1" : "0";
- $obj->setVar("quote_status", $verif_quote_status);
- //Form quote_waiting
- $verif_quote_waiting = ($_REQUEST["quote_waiting"] == 1) ? "1" : "0";
- $obj->setVar("quote_waiting", $verif_quote_waiting);
- //Form quote_online
- $verif_quote_online = ($_REQUEST["quote_online"] == 1) ? "1" : "0";
- $obj->setVar("quote_online", $verif_quote_online);
+ $obj->setVars(array('quote' => $input->quote,
+ 'author' => $input->author,
+ 'quote_status' => $input->quote_status)
+ );
- if ($quotesHandler->insert($obj)) {
- redirect_header("main.php?op=list", 2, _AM_RANDOMQUOTE_FORMOK);
+ if ($objId = $quotesHandler->insert($obj)) {
+// $module_handler =& 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);
+ }
+ redirect_header("main.php?op=list", RandomquoteConstants::REDIRECT_DELAY_MEDIUM, $add_msg);
}
echo $obj->getHtmlErrors();
$form =& $obj->getForm();
$form->display();
break;
- case "edit_quote":
- echo $adminMenu->addNavigation("main.php");
+
+ case 'edit_quote':
+ echo $adminMenu->addNavigation('main.php');
$adminMenu->addItemButton(_AM_RANDOMQUOTE_NEWCITAS, 'main.php?op=new_quote', 'add');
$adminMenu->addItemButton(_AM_RANDOMQUOTE_QUOTESLIST, 'main.php?op=list', 'list');
echo $adminMenu->renderButton('left');
- $obj = $quotesHandler->get($_REQUEST["id"]);
+ $id = XoopsRequest::getInt('id', RandomquoteConstants::DEFAULT_ID);
+// $id = cleanVarsRandomquote($_POST, 'id', RandomquoteConstants::DEFAULT_ID, 'int');
+ if (empty($id)) {
+ redirect_header($_SERVER['PHP_SELF'] . "&op=new_quote");
+ }
+ $obj = $quotesHandler->get($id);
$form = $obj->getForm();
$form->display();
break;
- case "delete_quote":
- $obj =& $quotesHandler->get($_REQUEST["id"]);
- if (isset($_REQUEST["ok"]) && $_REQUEST["ok"] == 1) {
- if (!$GLOBALS["xoopsSecurity"]->check()) {
- redirect_header("main.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors()));
+
+ case 'delete_quote':
+ $request_ok = XoopsRequest::getInt('ok', RandomquoteConstants::CONFIRM_NOT_OK, 'POST');
+ $id = XoopsRequest::getInt('id', RandomquoteConstants::DEFAULT_ID);
+// $request_ok = cleanVarsRandomquote($_POST, 'ok', RandomquoteConstants::CONFIRM_NOT_OK, 'int');
+// $id = cleanVarsRandomquote($_REQUEST, 'id', RandomquoteConstants::DEFAULT_ID, 'int');
+ if ($request_ok) {
+ // check to make sure this passes form submission security
+ if (($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity)) {
+ if ( !$GLOBALS['xoopsSecurity']->check()) {
+ // failed xoops security check
+ redirect_header($_SERVER['PHP_SELF'], RandomquoteConstants::REDIRECT_DELAY_MEDIUM, $GLOBALS['xoopsSecurity']->getErrors(true));
+ exit();
+ }
+ } else {
+ redirect_header('index.php', RandomquoteConstants::REDIRECT_DELAY_MEDIUM, _MD_RANDOMQUOTE_INVALID_SECURITY_TOKEN);
}
- if ($quotesHandler->delete($obj)) {
- redirect_header("main.php", 3, _AM_RANDOMQUOTE_FORMDELOK);
+ $obj =& $quotesHandler->get($id);
+ if (($obj instanceof RandomquoteQuotes)) {
+ $item_id = $obj->getVar('id');
+ if ($quotesHandler->delete($obj)) {
+ // now clear out items in tag module for this item
+ $module_handler =& 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
+ }
+ redirect_header($_SERVER['PHP_SELF'], RandomquoteConstants::REDIRECT_DELAY_MEDIUM, _AM_RANDOMQUOTE_FORMDELOK);
+ } else {
+ echo $obj->getHtmlErrors();
+ }
} else {
- echo $obj->getHtmlErrors();
+ redirect_header($_SERVER['PHP_SELF'], RandomquoteConstants::REDIRECT_DELAY_MEDIUM, _AM_RANDOMQUOTE_INVALID_QUOTE_ID);
}
} else {
+ $obj = $quotesHandler->get($id);
xoops_confirm(
- array("ok" => 1, "id" => $_REQUEST["id"], "op" => "delete_quote"),
- $_SERVER["REQUEST_URI"],
- sprintf(_AM_RANDOMQUOTE_FORMSUREDEL, $obj->getVar("quote"))
+ array('ok' => RandomquoteConstants::CONFIRM_OK, 'id' => $id, 'op' => 'delete_quote'),
+ $_SERVER['REQUEST_URI'],
+ sprintf(_AM_RANDOMQUOTE_FORMSUREDEL, $obj)
);
}
break;
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/admin/menu.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/admin/menu.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,18 +1,23 @@
<?php
+/*
+ You may not change or alter any portion of this comment or credits
+ of supporting developers from this source code or any supporting source code
+ which is considered copyrighted (c) material of the original comment or credit authors.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
/**
* Module: RandomQuote
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
@@ -22,18 +27,17 @@
$module_handler =& xoops_gethandler("module");
$xoopsModule =& XoopsModule::getByDirname($dirname);
$moduleInfo =& $module_handler->get($xoopsModule->getVar("mid"));
-$pathIcon32 = $moduleInfo->getInfo("icons32");
-$adminmenu = array();
-$i = 1;
-$adminmenu[$i]["title"] = _MI_RANDOMQUOTE_ADMENU1;
-$adminmenu[$i]["link"] = "admin/index.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . "/home.png";
-++$i;
-$adminmenu[$i]["title"] = _MI_RANDOMQUOTE_ADMENU2;
-$adminmenu[$i]["link"] = "admin/main.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . "/content.png";
-++$i;
-$adminmenu[$i]["title"] = _MI_RANDOMQUOTE_ADMENU3;
-$adminmenu[$i]["link"] = "admin/about.php";
-$adminmenu[$i]["icon"] = $pathIcon32 . "/about.png";
-unset($i);
+$pathIcon32 = '../../' . $moduleInfo->getInfo('icons32');
+
+$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_ADMENU3,
+ "link" => 'admin/about.php',
+ "icon" => "{$pathIcon32}/about.png")
+);
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/blocks/views.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/blocks/views.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,102 +1,125 @@
<?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
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
* @since 2.0.0
*/
-include_once XOOPS_ROOT_PATH . "/modules/randomquote/include/functions.php";
+include_once $GLOBALS['xoops']->path("/modules/randomquote/include/functions.php");
+xoops_load('constants', 'randomquote');
/**
- * @param $options
*
- * @return array
+ * Show a random quote in a block
+ *
+ * @param array {
+ * @param string [0] block type
+ * @param int [1] number of quotes to display
+ * }
+ *
+ * @return array {
+ * array {
+ * @param string [quote]
+ * @param string [author]
+ * }
+ * }
*/
function showRandomquoteBlockViews($options)
{
- include_once XOOPS_ROOT_PATH . "/modules/randomquote/class/quotes.php";
-// $myts =& MyTextSanitizer::getInstance();
+// xoops_load('quotes', 'randomquote');
+ xoops_load('constants', 'randomquote');
$citas = array();
$type_block = $options[0];
$nb_quotes = $options[1];
-// $lenght_title = $options[2];
+ $length_title = $options[2];
- $quotesHandler =& xoops_getModuleHandler("quotes", "randomquote");
+ $quotesHandler =& xoops_getmodulehandler('quotes', 'randomquote');
$criteria = new CriteriaCompo();
- array_shift($options);
- array_shift($options);
- array_shift($options);
switch ($type_block) {
- // for block: citas recent
- case "recent":
- $criteria->add(new Criteria("quote_online", 1));
-// $criteria->setSort("quotes_date_created");
- $criteria->setSort("id");
- $criteria->setOrder("DESC");
+ case 'recent':
+ $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE));
+ $criteria->setSort('create_date');
+ $criteria->setOrder('DESC');
break;
- // for block: citas today's
- case "day":
- $criteria->add(new Criteria("quote_online", 1));
-// $criteria->add(new Criteria("quotes_date_created", strtotime(date("Y/m/d")), ">="));
-// $criteria->add(new Criteria("quotes_date_created", strtotime(date("Y/m/d")) + 86400, "<="));
-// $criteria->setSort("quotes_date_created");
- $criteria->setOrder("ASC");
- $criteria->setSort("RAND()");
+/*
+ case 'day':
+ $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE));
+// $criteria->add(new Criteria('quotes_date_created', strtotime(date('Y/m/d')), '>='));
+// $criteria->add(new Criteria('quotes_date_created', strtotime(date('Y/m/d')) + 86400, '<='));
+// $criteria->setSort('quotes_date_created');
+ $criteria->setOrder('ASC');
+ $criteria->setSort('RAND()');
break;
- // for block: citas random
- case "random":
- $criteria->add(new Criteria("quote_online", 1));
- $criteria->setSort("RAND()");
+*/
+ case 'random':
+ default:
+ $criteria->add(new Criteria('quote_status', RandomquoteConstants::STATUS_ONLINE));
+ $criteria->setSort('RAND()');
break;
}
- $criteria->setLimit($nb_quotes);
- $quotes_arr = $quotesHandler->getall($criteria);
- foreach (array_keys($quotes_arr) as $i) {
- $citas[$i]["quote"] = $quotes_arr[$i]->getVar("quote");
- $citas[$i]["author"] = $quotes_arr[$i]->getVar("author");
+ if (intval($nb_quotes) > 0) {
+ $criteria->setLimit($nb_quotes);
}
+ $quoteObjsArray = $quotesHandler->getAll($criteria);
+ foreach ($quoteObjsArray as $thisQuote) {
+ if ($options[2] > 0) {
+ $short_quote = xoops_substr($thisQuote->getVar('quote'), 0, $options[2], $trimmarker = '...');
+ } else {
+ $shotr_quote = $thisQuote->getVar('quote');
+ }
+ $citas[] = array('quote' => $short_quote,
+ 'author' => $thisQuote->getVar('author')
+ );
+ }
return $citas;
}
/**
- * @param $options
+ * @param array $options Preferences config array
*
- * @return string
+ * @return string HTML form to edit module options
*/
function editRandomquoteBlockViews($options)
{
$quotes_arr = array();
- $form = "" . _MB_RANDOMQUOTE_QUOTES_DISPLAY . "\n";
- $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />";
- $form .= "<input name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" /> <br />";
- $form .= "" . _MB_RANDOMQUOTE_QUOTES_TITLELENGTH . " : <input name=\"options[2]\" size=\"5\" maxlength=\"255\" value=\"" . $options[2] . "\" type=\"text\" /><br /><br />";
+ $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 />";
+/*
array_shift($options);
array_shift($options);
array_shift($options);
- $form .= "" . _MB_RANDOMQUOTE_QUOTES_CATTODISPLAY . "<br /><select name=\"options[]\" multiple=\"multiple\" size=\"5\">";
- $form .= "<option value=\"0\" " . (array_search(0, $options) === false ? "" : "selected=\"selected\"") . ">" . _MB_RANDOMQUOTE_QUOTES_ALLCAT . "</option>";
+ $form .= "" . _MB_RANDOMQUOTE_QUOTES_CATTODISPLAY . "<br />\n"
+ . "<select name='options[]' multiple='multiple' size='5'>\n"
+ . "<option value='0'" . (false === array_search(0, $options) ? "" : " selected='selected'") . ">" . _MB_RANDOMQUOTE_QUOTES_ALLCAT . "</option>\n";
foreach (array_keys($quotes_arr) as $i) {
- $form .= "<option value=\"" . $quotes_arr[$i]->getVar("quotes_id") . "\" " . (array_search($quotes_arr[$i]->getVar("quotes_id"), $options) === false ? "" : "selected=\"selected\"") . ">"
- . $quotes_arr[$i]->getVar("quotes_title") . "</option>";
+ $form .= "<option value='" . $quotes_arr[$i]->getVar('quotes_id') . "'" . (false === array_search($quotes_arr[$i]->getVar('quotes_id'), $options) ? '' : " selected='selected'") . ">"
+ . $quotes_arr[$i]->getVar('quotes_title') . "</option>\n";
}
- $form .= "</select>";
-
+ $form .= "</select>\n";
+*/
return $form;
}
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/class/quotes.php 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/class/quotes.php 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,26 +1,29 @@
<?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
*
- * 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.
- *
- * PHP version 5
- *
* @category Module
- * @package Randomquote
- * @author XOOPS Development Team, Mamba
- * @copyright 2001-2013 The XOOPS Project
- * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
+ * @package randomquote
+ * @author XOOPS Module Development Team
+ * @author Mamba
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
* @version $Id$
* @link http://sourceforge.net/projects/xoops/
- * @since 2.0.0
+ * @since 2.00
*/
-if (!defined("XOOPS_ROOT_PATH")) {
- die("XOOPS root path not defined");
-}
+defined('XOOPS_ROOT_PATH') or die('Restricted access');
/**
* Class RandomquoteQuotes
@@ -34,90 +37,99 @@
function __construct()
{
$this->XoopsObject();
- $this->initVar("id", XOBJ_DTYPE_INT, null, false, 11);
- $this->initVar("quote", XOBJ_DTYPE_TXTAREA, null, false);
- $this->initVar("author", XOBJ_DTYPE_TXTAREA, null, false);
- $this->initVar("quote_status", XOBJ_DTYPE_INT, null, false, 10);
- $this->initVar("quote_waiting", XOBJ_DTYPE_INT, null, false, 10);
- $this->initVar("quote_online", XOBJ_DTYPE_INT, null, false, 1);
-
+ $this->initVar('id', XOBJ_DTYPE_INT, null, false, 11);
+ $this->initVar('quote', XOBJ_DTYPE_TXTAREA, null, true);
+ $this->initVar('author', XOBJ_DTYPE_TXTAREA, null, false);
+ $this->initVar('quote_status', XOBJ_DTYPE_INT, null, false, 10);
+ $this->initVar('create_date', XOBJ_DTYPE_TIMESTAMP, time(), false);
$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
$this->initVar('dosmiley', XOBJ_DTYPE_INT, 1, false);
$this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false);
$this->initVar('doimage', XOBJ_DTYPE_INT, 1, false);
$this->initVar('dobr', XOBJ_DTYPE_INT, 1, false);
-
}
/**
- * @param bool $action
*
- * @return XoopsThemeForm
+ * Magic function to display obj as string
*/
- function getForm($action = false)
+ function __toString()
{
- // global $xoopsDB, $xoopsModuleConfig;
-
- if ($action === false) {
+ return $this->getVar('quote') . " - " . $this->getVar('author');
+ }
+ /**
+ * Displays the Edit (Create) quote form
+ *
+ * @param mixed $action
+ *
+ * @return object {@see XoopsThemeForm)
+ */
+ public function getForm($action = false)
+ {
+ if (false === $action) {
$action = $_SERVER["REQUEST_URI"];
}
$title = $this->isNew() ? sprintf(_AM_RANDOMQUOTE_QUOTES_ADD) : sprintf(_AM_RANDOMQUOTE_QUOTES_EDIT);
- include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
+ xoops_load('constants', 'randomquote');
+ include_once $GLOBALS['xoops']->path("/class/xoopsformloader.php");
$form = new XoopsThemeForm($title, "form", $action, "post", true);
$form->setExtra('enctype="multipart/form-data"');
- $author = $this->isNew() ? '' : $this->getVar("author");
- $textAuthor = new XoopsFormText(_AM_RANDOMQUOTE_QUOTES_AUTHOR, "author", 50, 255, $author);
+ $author = $this->isNew() ? '' : $this->getVar('author');
+ $id = ($this->getVar('id')) ? $this->getVar('id') : RandomquoteConstants::DEFAULT_ID;
+ $textAuthor = new XoopsFormText(_AM_RANDOMQUOTE_QUOTES_AUTHOR, 'author', 50, 255, $author);
$form->addElement($textAuthor);
- $editorConfigs = array();
- $editorConfigs["name"] = "quote";
- $editorConfigs["value"] = $this->getVar("quote", "e");
- $editorConfigs["rows"] = 10;
- $editorConfigs["cols"] = 80;
- $editorConfigs["width"] = "100%";
- $editorConfigs["height"] = "400px";
- $editorConfigs["editor"] = $GLOBALS["xoopsModuleConfig"]["randomquote_editor"];
- $form->addElement(new XoopsFormEditor(_AM_RANDOMQUOTE_QUOTES_QUOTE, "quote", $editorConfigs), true);
+ $editorConfigs = array("name" => "quote",
+ "value" => $this->getVar("quote", "e"),
+ "rows" => 10,
+ "cols" => 80,
+ "width" => "100%",
+ "height" => "400px",
+ "editor" => $GLOBALS["xoopsModuleConfig"]["randomquote_editor"]
+ );
+ $form->addElement(new XoopsFormEditor(_AM_RANDOMQUOTE_QUOTES_QUOTE, 'quote', $editorConfigs), true);
-// $editorConfigs = array();
-// $editorConfigs["name"] = "author";
-// $editorConfigs["value"] = $this->getVar("author", "e");
-// $editorConfigs["rows"] = 10;
-// $editorConfigs["cols"] = 80;
-// $editorConfigs["width"] = "100%";
-// $editorConfigs["height"] = "400px";
-// $editorConfigs["editor"] = $GLOBALS["xoopsModuleConfig"]["randomquote_editor"];
-// $form->addElement(new XoopsFormEditor(_AM_RANDOMQUOTE_QUOTES_AUTHOR, "author", $editorConfigs), true);
+ /*
+ * pseudo code
+ * see if tag module is present & active
+ * load the formtag class
+ * display the tag form element to collect the tag item
+ */
+ $module_handler =& 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);
+ }
+ $tag_string = implode('|', $tag_items);
+ $form->addElement(new TagFormTag('item_tag', 60, 255, $tag_string, 0));
+ }
+ } else {
+ $form->XoopsFormHidden('item_tag', '');
+ }
- $quote_status = $this->isNew() ? 0 : $this->getVar("quote_status");
- $check_quote_status = new XoopsFormCheckBox(_AM_RANDOMQUOTE_QUOTES_STATUS, "quote_status", $quote_status);
- $check_quote_status->addOption(1, " ");
+ $quote_status = ($this->isNew()) ? RandomquoteConstants::STATUS_OFFLINE : $this->getVar("quote_status");
+ $check_quote_status = new XoopsFormRadio(_AM_RANDOMQUOTE_QUOTES_STATUS, "quote_status", $quote_status);
+ $check_quote_status->addOption(RandomquoteConstants::STATUS_OFFLINE, _AM_RANDOMQUOTE_QUOTES_OFFLINE);
+ $check_quote_status->addOption(RandomquoteConstants::STATUS_ONLINE, _AM_RANDOMQUOTE_QUOTES_ONLINE);
+ $check_quote_status->addOption(RandomquoteConstants::STATUS_WAITING, _AM_RANDOMQUOTE_QUOTES_WAITING);
$form->addElement($check_quote_status);
- $quote_waiting = $this->isNew() ? 0 : $this->getVar("quote_waiting");
- $check_quote_waiting
- = new XoopsFormCheckBox(_AM_RANDOMQUOTE_QUOTES_WAITING, "quote_waiting", $quote_waiting);
- $check_quote_waiting->addOption(1, " ");
- $form->addElement($check_quote_waiting);
- $quote_online = $this->isNew() ? 0 : $this->getVar("quote_online");
- $check_quote_online = new XoopsFormCheckBox(_AM_RANDOMQUOTE_QUOTES_ONLINE, "quote_online", $quote_online);
- $check_quote_online->addOption(1, " ");
- $form->addElement($check_quote_online);
- $form->addElement(new XoopsFormHidden("op", "save_quote"));
+ $form->addElement(new XoopsFormHidden('op', 'save_quote'));
+ $form->addElement(new XoopsFormHidden('id', $id));
//Submit buttons
- $button_tray = new XoopsFormElementTray("", "");
- $submit_button = new XoopsFormButton("", "submit", _SUBMIT, "submit");
- $button_tray->addElement($submit_button);
-
- $cancel_button = new XoopsFormButton("", "", _CANCEL, "cancel");
- $cancel_button->setExtra('onclick="history.go(-1)"');
- $button_tray->addElement($cancel_button);
-
+ $button_tray = new XoopsFormButtonTray('submit', _SUBMIT);
$form->addElement($button_tray);
return $form;
@@ -134,6 +146,6 @@
*/
function __construct(&$db)
{
- parent::__construct($db, "randomquote_quotes", "RandomquoteQuotes", "id", "quote");
+ parent::__construct($db, 'quotes', 'RandomquoteQuotes', 'id', 'quote');
}
}
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/docs/changelog.txt 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/docs/changelog.txt 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,7 +1,20 @@
+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
+- removed need for ./include/config.php
+- fixed typo in ./docs/licencs file name to license.txt
+- 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
-------------------------------------
- 2.00 Alpha 1 2013/06/27
-------------------------------------
-
+Version 2.00 from 2013-06-27
+=================================
- 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
+ This module is developed from scratch using TDMCreate, but it's inspired by
+ the original code from RandomQuote
Modified: XoopsModules/randomquote/branches/zyspec/randomquote/docs/install.txt
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/docs/install.txt 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/docs/install.txt 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,4 +1,10 @@
-Read Me First
-=============
+INSTALL/UNISTALL
+=================
-Install just like another XOOPS module
\ No newline at end of file
+No special measures necessary, follow the standard installation process
+1. Extract the /randomquote folder into the ./modules directory.
+2. Install the module through Admin -> System Module -> Modules
+3. Configure module settings in the Admin -> Preferences -> Random Quotes
+
+Detailed instructions on installing modules are available in the XOOPS
+Operations Manual (http://goo.gl/adT2i)
\ No newline at end of file
Deleted: XoopsModules/randomquote/branches/zyspec/randomquote/docs/licencs.txt
===================================================================
--- XoopsModules/randomquote/branches/mamba/randomquote/docs/licencs.txt 2014-11-26 07:33:36 UTC (rev 12873)
+++ XoopsModules/randomquote/branches/zyspec/randomquote/docs/licencs.txt 2014-12-08 20:18:04 UTC (rev 12889)
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. ...
[truncated message content] |