|
From: <zy...@us...> - 2014-12-08 22:05:26
|
Revision: 12898
http://sourceforge.net/p/xoops/svn/12898
Author: zyspec
Date: 2014-12-08 22:05:21 +0000 (Mon, 08 Dec 2014)
Log Message:
-----------
+ minor code cleanup
* moved some hardcoded language strings to language files
* file formatting (tabs-> 4 spaces)
* improved PSRx coding compliance - cannot completely comply without
breaking plugins distributed with other modules
* replaced dirname(__FILE__) with __DIR__
+ eliminated /Frameworks/art/functions.admin.php alternative since should be present in all versions of XOOPS >= 2.5.7
+ utilize XoopsRequest for input vars
+ normalized Frameworks icons directory to be similar to other XOOPS modules
+ deprecated XoopsFormTag (modules should not create classes beginning with 'Xoops'). Created class TagFormTag to replace it.
+ merged Cumulus module for flash cloud block - Cumulus module no longer needed
+ fixed bug in display limit in .list.tag.php for both list and cloud
+ removed support for MySQL < 4.1.0
+ added TagConstant class to improve code maintainability
+ improved HTML rendering (admin side)
+ modified module defines naming to standardize with other XOOPS modules
+ added randomquote ./plugin
Modified Paths:
--------------
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/about.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin.tag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_footer.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_header.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/index.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/menu.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/syn.tag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/css/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/images/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/js/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/blocks/block.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/blocks/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/link.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/tag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/docs/changelog.txt
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/docs/credits.txt
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/docs/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/docs/install.txt
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/docs/readme.txt
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/footer.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/header.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/action.module.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/formtag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/functions.ini.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/functions.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/functions.recon.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/plugin.dist.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/plugin.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/search.inc.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/tagbar.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/include/vars.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/index.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/admin.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/blocks.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/config.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/help/help.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/help/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/main.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/english/modinfo.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/language/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/list.tag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/TDMDownloads.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/article.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/extgallery.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/myalbum.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/myalbum0.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/myalbum1.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/myalbum2.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/newbb.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/publisher.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/smartfaq.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/xfaq.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/xforum.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/sample.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/sql/mysql.150.sql
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/sql/mysql.sql
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/templates/index.html
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/templates/tag_view.tpl
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/view.tag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/xoops_version.php
Added Paths:
-----------
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/blockform.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/constants.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/formtag.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/class/formvalidatedinput.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/plugin/randomquote.php
XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/templates/blocks/tag_block_cumulus.tpl
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/about.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/about.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/about.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1,23 +1,28 @@
<?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.
+*/
+
/**
- * Tag module
+ * XOOPS tag management module
*
- * You may not change or alter any portion of this comment or credits
- * of supporting developers from this source code or any supporting source code
- * which is considered copyrighted (c) material of the original comment or credit authors.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @copyright The XOOPS Project (http://www.xoops.org)
- * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html)
- * @package Tag
- * @since 2.5.0
- * @author Mage, Mamba
- * @version $Id $
- **/
-include_once dirname(__FILE__) . '/admin_header.php';
+ * @package tag
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @author Mage
+ * @author Mamba
+ * @since 2.31
+ * @version $Id$
+ */
+include_once __DIR__ . '/admin_header.php';
+
xoops_cp_header();
$aboutAdmin = new ModuleAdmin();
@@ -25,4 +30,4 @@
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
-include 'admin_footer.php';
+include __DIR__ . '/admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin.tag.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/admin.tag.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin.tag.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -12,41 +12,40 @@
/**
* XOOPS tag management module
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
+ * @package tag
+ * @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...>
+ * @since 1.00
* @version $Id$
- * @package tag
*/
-include_once 'admin_header.php';
-require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
+require_once __DIR__ . '/admin_header.php';
+require_once $GLOBALS['xoops']->path("/class/xoopsformloader.php");
+xoops_load('xoopsrequest');
+
$indexAdmin = new ModuleAdmin();
xoops_cp_header();
-include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
-//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(1) : "";
- echo $indexAdmin->addNavigation('admin.tag.php');
+include $GLOBALS['xoops']->path("/modules/tag/include/vars.php");
+echo $indexAdmin->addNavigation('admin.tag.php');
-global $xoopsModuleConfig;
+$limit = $GLOBALS['xoopsModuleConfig']['items_perpage'];
+$modid = XoopsRequest::getInt('modid', TagConstants::DEFAULT_ID);
+$start = XoopsRequest::getInt('start', TagConstants::BEGINNING);
+$status = XoopsRequest::getInt('status', TagConstants::STATUS_ALL, 'GET');
-$limit = $xoopsModuleConfig['items_perpage'];
-$modid = intval( empty($_GET['modid']) ? @$_POST['modid'] : $_GET['modid'] );
-$start = intval( empty($_GET['start']) ? @$_POST['start'] : $_GET['start'] );
-//$status = intval( empty($_GET['status']) ? @$_POST['status'] : $_GET['status']);
+$tag_handler =& xoops_getmodulehandler('tag', $thisModuleDir);
+$link_handler =& xoops_getmodulehandler('link', $thisModuleDir);
-$status = intval( (isset($_GET['status']) && $_GET['status'] >-1) ? $_GET['status'] : -1);
-
-$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
-
-if (!empty($_POST['tags'])) {
+$postTags = XoopsRequest::getArray('tags', array(), 'POST');
+if (!empty($postTags)) {
$msgDBUpdated='';
- foreach ($_POST['tags'] as $tag => $tag_status) {
+ foreach ($postTags as $tag => $tag_status) {
$tag_obj =& $tag_handler->get($tag);
- if (!is_object($tag_obj) || !$tag_obj->getVar("tag_id")) continue;
- if ($tag_status < 0) {
+ if (!($tag_obj instanceof TagTag) || !$tag_obj->getVar("tag_id")) continue;
+ if ($tag_status < TagConstants::STATUS_ACTIVE) {
$tag_handler->delete($tag_obj);
} elseif ($tag_status != $tag_obj->getVar("tag_status")) {
$tag_obj->setVar("tag_status", $tag_status);
@@ -54,19 +53,20 @@
$msgDBUpdated = _AM_TAG_DB_UPDATED;
}
}
- redirect_header("admin.tag.php?modid={$modid}&start={$start}&status={$status}", 2, $msgDBUpdated);
+ redirect_header("admin.tag.php?modid={$modid}&start={$start}&status={$status}", TagConstants::REDIRECT_DELAY_MEDIUM, $msgDBUpdated);
exit();
}
-$sql = " SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
-$sql .= " FROM " . $xoopsDB->prefix("tag_link");
-$sql .= " GROUP BY tag_modid";
+$sql = "SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
+$sql .= " FROM " . $GLOBALS['xoopsDB']->prefix("tag_link");
+$sql .= " GROUP BY tag_modid";
$counts_module = array();
$module_list = array();
-if ( ($result = $xoopsDB->query($sql)) == false) {
- xoops_error($xoopsDB->error());
+$result = $GLOBALS['xoopsDB']->query($sql);
+if (false === $result) {
+ xoops_error($GLOBALS['xoopsDB']->error());
} else {
- while ($myrow = $xoopsDB->fetchArray($result)) {
+ while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$counts_module[$myrow["tag_modid"]] = $myrow["count_tag"];
}
if (!empty($counts_module)) {
@@ -84,9 +84,9 @@
}
$tray->addElement($mod_select);
$status_select = new XoopsFormRadio("", 'status', $status);
-$status_select->addOption(-1, _ALL);
-$status_select->addOption(1, TAG_AM_ACTIVE);
-$status_select->addOption(0, TAG_AM_INACTIVE);
+$status_select->addOption(TagConstants::STATUS_ALL, _ALL);
+$status_select->addOption(TagConstants::STATUS_ACTIVE, _AM_TAG_ACTIVE);
+$status_select->addOption(TagConstants::STATUS_INACTIVE, _AM_TAG_INACTIVE);
$tray->addElement($status_select);
$tray->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$opform->addElement($tray);
@@ -97,52 +97,62 @@
$criteria->setOrder("ASC");
$criteria->setStart($start);
$criteria->setLimit($limit);
-if ($status >= 0) {
- $criteria->add( new Criteria("o.tag_status", $status) );
+if ($status >= TagConstants::STATUS_ACTIVE) {
+ $criteria->add(new Criteria("o.tag_status", $status));
}
if (!empty($modid)) {
- $criteria->add( new Criteria("l.tag_modid", $modid) );
+ $criteria->add(new Criteria("l.tag_modid", $modid));
}
$tags = $tag_handler->getByLimit($criteria, false);
-$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>";
-$form_tags .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
-$form_tags .= "<tr align='center'>";
-$form_tags .= "<th class='bg3'>" . TAG_AM_TERM . "</td>";
-$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_ACTIVE . "</td>";
-$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_INACTIVE . "</td>";
-$form_tags .= "<th class='bg3' width='10%'>" . _DELETE . "</td>";
-$form_tags .= "</tr>";
+$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>\n"
+ . "<table style='border-width: 0px; margin: 1px; padding: 4px;' cellspacing='1' class='outer width100'>\n"
+ . " <thead>\n"
+ . " <tr class='txtcenter'>\n"
+ . " <th class='bg3'>" . _AM_TAG_TERM . "</th>\n"
+ . " <th class='bg3 width10'>" . _AM_TAG_INACTIVE . "</th>\n"
+ . " <th class='bg3 width10'>" . _AM_TAG_ACTIVE . "</th>\n"
+ . " <th class='bg3 width10'>" . _DELETE . "</th>\n"
+ . " </tr>\n"
+ . " </thead>\n"
+ . " <tbody>\n";
if (empty($tags)) {
- $form_tags .= "<tr><td colspan='4'>" . _NONE . "</td></tr>";
+ $form_tags .= " <tr><td colspan='4'>" . _NONE . "</td></tr>\n";
} else {
- $class_tr = array("odd", "even");
+ $class_tr = 'odd';
$i = 0;
foreach (array_keys($tags) as $key) {
- $form_tags .= "<tr class='" . $class_tr[(++$i) % 2] . "'>";
- $form_tags .= "<td>" . $tags[$key]["term"] . "</td>";
- $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='1' " . ( $tags[$key]["status"] ? "checked" : " '' ") . "></td>";
- $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='0' " . ( $tags[$key]["status"] ? " '' " : "checked") . "></td>";
- $form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='-1'></td>";
- $form_tags .= "</tr>";
+ $form_tags .= " <tr class='{$class_tr}'>\n"
+ . " <td>" . $tags[$key]["term"] . "</td>\n"
+ . " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_INACTIVE . "'" . ( $tags[$key]["status"] ? " checked" : " '' ") . "></td>\n"
+ . " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_ACTIVE . "'" . ( $tags[$key]["status"] ? " '' " : " checked") . "></td>\n"
+ . " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_DELETE . "'></td>\n"
+ . " </tr>\n";
+ $class_tr = ('even' == $class_tr) ? 'odd' : 'even';
}
- if ( !empty($start) || count($tags) >= $limit ) {
+ if (!empty($start) || (count($tags) >= $limit)) {
$count_tag = $tag_handler->getCount($criteria);
- include XOOPS_ROOT_PATH . "/class/pagenav.php";
+ include $GLOBALS['xoops']->path("/class/pagenav.php");
$nav = new XoopsPageNav($count_tag, $limit, $start, "start", "modid={$modid}&status={$status}");
- $form_tags .= "<tr><td colspan='4' align='right'>" . $nav->renderNav(4) . "</td></tr>";
+ $form_tags .= " <tr><td colspan='4' class='txtright'>" . $nav->renderNav(4) . "</td></tr>\n";
}
- $form_tags .= "<tr><td colspan='4' align='center'>";
- $form_tags .= "<input type='hidden' name='status' value='{$status}'> ";
- $form_tags .= "<input type='hidden' name='start' value='{$start}'> ";
- $form_tags .= "<input type='hidden' name='modid' value='{$modid}'> ";
- $form_tags .= "<input type='submit' name='submit' value='" . _SUBMIT . "'> ";
- $form_tags .= "<input type='reset' name='submit' value='" . _CANCEL . "'>";
- $form_tags .= "</td></tr>";
+ $form_tags .= " </tbody>\n"
+ . " <tfoot>\n"
+ . " <tr>\n"
+ . " <td class='txtcenter' colspan='4'>\n"
+ . " <input type='hidden' name='status' value='{$status}' /> \n"
+ . " <input type='hidden' name='start' value='{$start}' /> \n"
+ . " <input type='hidden' name='modid' value='{$modid}' /> \n"
+ . " <input type='submit' name='submit' value='" . _SUBMIT . "' /> \n"
+ . " <input type='reset' name='submit' value='" . _CANCEL . "' />\n"
+ . " </td>\n"
+ . " </tr>\n"
+ . " </tfoot>\n";
}
-$form_tags .= "</table>";
-$form_tags .= "</form>";
+$form_tags .= " </tbody>\n"
+ . "</table>\n"
+ . "</form>\n";
echo $form_tags;
-include 'admin_footer.php';
+include __DIR__ . '/admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_footer.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/admin_footer.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_footer.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1,27 +1,41 @@
<?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.
+*/
+
/**
- * Tag module
+ * XOOPS tag management module
*
- * You may not change or alter any portion of this comment or credits
- * of supporting developers from this source code or any supporting source code
- * which is considered copyrighted (c) material of the original comment or credit authors.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package XOOPS Tag
- * @since 2.5.0
- * @author Mamba (www.xoops.org)
- * @version $Id $
-**/
-
+ * @package tag
+ * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
+ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
+ * @author Mamba {@link http://www.xoops.org}
+ * @since 2.31
+ * @version $Id$
+ */
+/*
echo "<div class='adminfooter'>\n"
- ." <div style='text-align: center;'>\n"
+ ." <div class='txtcenter'>\n"
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
." </div>\n"
." " . _AM_TAG_FOOTER . "\n"
."</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_TAG_MAINTAINED_BY
+ . " <a class='tooltip' rel='external' href='http://" . $GLOBALS['xoopsModule']->getInfo('module_website_url') . "' "
+ . "title='" . _AM_TAG_MAINTAINED_TITLE . "'>" . _AM_TAG_MAINTAINED_TEXT . "</a>\n"
+ . " </div>\n"
+ . "</div>";
xoops_cp_footer();
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_header.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/admin_header.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/admin_header.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -14,91 +14,32 @@
*
* @copyright The XOOPS project http://sourceforge.net/projects/xoops/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
+ * @since 1.00
* @author Taiwen Jiang <ph...@us...>
* @version $Id$
- * @package tag
- */
+ * */
-$path = dirname(dirname(dirname(dirname(__FILE__))));
+$path = dirname(dirname(dirname(__DIR__)));
require_once $path . '/include/cp_header.php';
-require_once dirname(dirname(__FILE__)) . '/include/vars.php';
-require_once dirname(dirname(__FILE__)) . '/include/functions.php';
+require_once dirname(__DIR__) . '/include/vars.php';
+require_once dirname(__DIR__) . '/include/functions.php';
+xoops_load('constants', 'tag');
$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname');
-
// Load language files
xoops_loadLanguage('admin', $thisModuleDir);
xoops_loadLanguage('modinfo', $thisModuleDir);
xoops_loadLanguage('main', $thisModuleDir);
-$pathIcon16 = '../'.$xoopsModule->getInfo('icons16');
-$pathIcon32 = '../'.$xoopsModule->getInfo('icons32');
-$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin');
+$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'));
-if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))) {
- include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php');
- } else {
- redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false);
- }
-
-IF (!@ include_once XOOPS_ROOT_PATH . "/Frameworks/art/functions.admin.php"):
-
-function loadModuleAdminMenu($currentoption, $breadcrumb = "")
-{
- if (!$adminmenu = $GLOBALS["xoopsModule"]->getAdminMenu()) {
- return false;
- }
-
- $breadcrumb = empty($breadcrumb) ? $adminmenu[$currentoption]["title"] : $breadcrumb;
- $module_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/";
- $image_link = XOOPS_URL . "/modules/" . $GLOBALS["xoopsModule"]->getVar("dirname") . "/images";
-
- $adminmenu_text ='
- <style type="text/css">
- <!--
- #buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0;}
- #buttonbar { float:left; width:100%; background: #e7e7e7 url("'.$image_link.'/modadminbg.gif") repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px;}
- #buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }
- #buttonbar li { display:inline; margin:0; padding:0; }
- #buttonbar a { float:left; background:url("'.$image_link.'/left_both.gif") no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }
- #buttonbar a span { float:left; display:block; background:url("'.$image_link.'/right_both.gif") no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }
- /* Commented Backslash Hack hides rule from IE5-Mac \*/
- #buttonbar a span {float:none;}
- /* End IE5-Mac hack */
- #buttonbar a:hover span { color:#333; }
- #buttonbar .current a { background-position:0 -150px; border-width:0; }
- #buttonbar .current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }
- #buttonbar a:hover { background-position:0% -150px; }
- #buttonbar a:hover span { background-position:100% -150px; }
- //-->
- </style>
- <div id="buttontop">
- <table style="width: 100%; padding: 0; " cellspacing="0">
- <tr>
- <td style="width: 70%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;">
- <a href="../index.php">' . $GLOBALS["xoopsModule"]->getVar("name") . '</a>
- </td>
- <td style="width: 30%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;">
- <strong>' . $GLOBALS["xoopsModule"]->getVar("name") . '</strong> ' . $breadcrumb . '
- </td>
- </tr>
- </table>
- </div>
- <div id="buttonbar">
- <ul>
- ';
- foreach (array_keys($adminmenu) as $key) {
- $adminmenu_text .= (($currentoption == $key) ? '<li class="current">' : '<li>') . '<a href="' . $module_link . $adminmenu[$key]["link"] . '"><span>' . $adminmenu[$key]["title"] . '</span></a></li>';
- }
- $adminmenu_text .= '<li><a href="' . XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $GLOBALS["xoopsModule"]->getVar("mid") . '"><span>' . _PREFERENCES . '</span></a></li>';
- $adminmenu_text .= '
- </ul>
- </div>
- <br style="clear:both;" />';
-
- echo $adminmenu_text;
+if ( file_exists("{$pathModuleAdmin}/moduleadmin/moduleadmin.php")) {
+ include_once "{$pathModuleAdmin}/moduleadmin/moduleadmin.php";
+} else {
+ redirect_header("{$path}/admin.php", TagConstants::REDIRECT_DELAY_LONG, _AM_MODULEADMIN_MISSING, false);
}
-ENDIF;
+include_once $GLOBALS['xoops']->path("/Frameworks/art/functions.admin.php");
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/index.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/index.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/index.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -12,59 +12,71 @@
/**
* XOOPS tag management module
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
- * @author Taiwen Jiang <ph...@us...>
- * @version $Id$
- * @package tag
+ * @package tag
+ * @subpackage admin
+ * @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...>
+ * @since 1.00
+ * @version $Id$
*/
-include_once 'admin_header.php';
+
+require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
+include $GLOBALS['xoops']->path("/modules/tag/include/vars.php");
-include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
-//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(0) : "";
-
$indexAdmin = new ModuleAdmin();
-$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
+$tag_handler =& xoops_getmodulehandler("tag", $thisModuleDir);
$count_tag = $tag_handler->getCount();
$count_item = 0;
-$sql = " SELECT COUNT(DISTINCT tl_id) FROM " . $xoopsDB->prefix("tag_link");
-if ( ($result = $xoopsDB->query($sql)) == false) {
- xoops_error($xoopsDB->error());
+$sql = "SELECT COUNT(DISTINCT tl_id) FROM " . $GLOBALS['xoopsDB']->prefix("tag_link");
+if (false === ($result = $GLOBALS['xoopsDB']->query($sql))) {
+ xoops_error($GLOBALS['xoopsDB']->error());
} else {
- list($count_item) = $xoopsDB->fetchRow($result);
+ list($count_item) = $GLOBALS['xoopsDB']->fetchRow($result);
}
-$sql = " SELECT tag_modid, SUM(tag_count) AS count_item, COUNT(DISTINCT tag_id) AS count_tag";
-$sql .= " FROM " . $xoopsDB->prefix("tag_stats");
-$sql .= " GROUP BY tag_modid";
+$sql = "SELECT tag_modid, SUM(tag_count) AS count_item, COUNT(DISTINCT tag_id) AS count_tag";
+$sql .= " FROM " . $GLOBALS['xoopsDB']->prefix("tag_stats");
+$sql .= " GROUP BY tag_modid";
$counts_module = array();
-if ( ($result = $xoopsDB->query($sql)) == false) {
- xoops_error($xoopsDB->error());
+if (false === ($result = $GLOBALS['xoopsDB']->query($sql))) {
+ xoops_error($GLOBALS['xoopsDB']->error());
} else {
- while ($myrow = $xoopsDB->fetchArray($result)) {
+ while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$counts_module[$myrow["tag_modid"]] = array("count_item" => $myrow["count_item"], "count_tag" => $myrow["count_tag"]);
}
if (!empty($counts_module)) {
$module_handler =& xoops_gethandler("module");
$module_list = $module_handler->getList(new Criteria("mid", "(" . implode(", ", array_keys($counts_module)) . ")", "IN"));
+ } else {
+
}
}
-$indexAdmin->addInfoBox(TAG_AM_STATS) ;
-$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" .TAG_AM_COUNT_TAG. "</infolabel>" , $count_tag) ;
-$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" .TAG_AM_COUNT_ITEM. "</infolabel>" , $count_item ."<br /><br />") ;
-$indexAdmin->addInfoBoxLine(TAG_AM_STATS, "<infolabel>" . TAG_AM_COUNT_MODULE. "</infolabel><infotext>" .TAG_AM_COUNT_MODULE_TITLE."</infotext>") ;
+$indexAdmin->addInfoBox(_AM_TAG_STATS) ;
+$indexAdmin->addInfoBoxLine(_AM_TAG_STATS, "<infolabel>" . _AM_TAG_COUNT_TAG . "</infolabel>" , $count_tag) ;
+$indexAdmin->addInfoBoxLine(_AM_TAG_STATS, "<infolabel>" . _AM_TAG_COUNT_ITEM . "</infolabel>" , $count_item ."<br /><br />") ;
+$indexAdmin->addInfoBoxLine(_AM_TAG_STATS, "<infolabel>" . _AM_TAG_COUNT_MODULE . "</infolabel>" . "<infotext>" . _AM_TAG_COUNT_MODULE_TITLE . "</infotext>") ;
foreach ($counts_module as $module => $count) {
- $indexAdmin->addInfoBoxLine( TAG_AM_STATS,("<infolabel>" . $module_list[$module] . ":</infolabel><infotext>" . $count["count_tag"] . " / " . $count["count_item"] . " [<a href=\"" . XOOPS_URL . "/modules/tag/admin/admin.tag.php?modid={$module}\">" . TAG_AM_EDIT . "</a>] [<a href=\"" . XOOPS_URL . "/modules/tag/admin/syn.tag.php?modid={$module}\">" . TAG_AM_SYNCHRONIZATION . "</a>]</infotext> "));
+ $moduleStat = "<infolabel>" . $module_list[$module] . ":</infolabel>\n"
+ . "<infotext>" . $count["count_tag"] . " / " . $count["count_item"] . "\n"
+ . " [<a href='" . $GLOBALS['xoops']->url("www/modules/tag/admin/admin.tag.php?modid={$module}") . "'>" . _AM_TAG_EDIT . "</a>]\n"
+ . " [<a href='" . $GLOBALS['xoops']->url("www/modules/tag/admin/syn.tag.php?modid={$module}") . "'>" . _AM_TAG_SYNCHRONIZATION . "</a>]\n"
+ . "</infotext> \n";
+ $indexAdmin->addInfoBoxLine( _AM_TAG_STATS, $moduleStat);
}
+if (empty($counts_module)) { // there aren't any so just display "none"
+ $moduleStat = "<infolabel>%s</infolabel><infotext>0 / 0</infotext> \n";
+ $indexAdmin->addInfoBoxLine( _AM_TAG_STATS, $moduleStat, _NONE);
+}
+
echo $indexAdmin->addNavigation('index.php');
echo $indexAdmin->renderIndex();
-include 'admin_footer.php';
+include __DIR__ . '/admin_footer.php';
//xoops_cp_footer();
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/menu.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/menu.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/menu.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -12,40 +12,38 @@
/**
* XOOPS tag management module
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
+ * @package tag
+ * @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...>
+ * @since 1.00
* @version $Id$
- * @package tag
*/
-defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
+defined('XOOPS_ROOT_PATH') || exit('Restricted access');
$module_handler =& xoops_gethandler('module');
-$xoopsModule =& XoopsModule::getByDirname('tag');
-$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid'));
-$pathIcon32 = $moduleInfo->getInfo('icons32');
+$module =& XoopsModule::getByDirname('tag');
+$moduleInfo =& $module_handler->get($module->getVar('mid'));
+$pathIcon32 = '../../' . $module->getInfo('icons32');
-$adminmenu = array();
+$adminmenu = array(array("title" => _MI_TAG_ADMENU_INDEX,
+ "link" => "admin/index.php",
+ "desc" => _MI_TAG_ADMIN_HOME_DESC,
+ "icon" => "{$pathIcon32}/home.png"),
-$i = 1;
-$adminmenu[$i]["title"] = TAG_MI_ADMENU_INDEX;
-$adminmenu[$i]["link"] = "admin/index.php";
-$adminmenu[$i]["desc"] = _TAG_ADMIN_HOME_DESC;
-$adminmenu[$i]["icon"] = $pathIcon32.'/home.png';
-++$i;
-$adminmenu[$i]["title"] = TAG_MI_ADMENU_EDIT;
-$adminmenu[$i]["link"] = "admin/admin.tag.php";
-$adminmenu[$i]["desc"] = _TAG_ADMIN_ABOUT_DESC;
-$adminmenu[$i]["icon"] = $pathIcon32.'/administration.png';
-++$i;
-$adminmenu[$i]["title"] = TAG_MI_ADMENU_SYNCHRONIZATION;
-$adminmenu[$i]["link"] = "admin/syn.tag.php";
-$adminmenu[$i]["desc"] = _TAG_ADMIN_HELP_DESC;
-$adminmenu[$i]["icon"] = $pathIcon32.'/synchronized.png';
-++$i;
-$adminmenu[$i]["title"] = _TAG_ADMIN_ABOUT;
-$adminmenu[$i]["link"] = "admin/about.php";
-$adminmenu[$i]["desc"] = _TAG_ADMIN_ABOUT_DESC;
-$adminmenu[$i]["icon"] = $pathIcon32.'/about.png';
+ array("title" => _MI_TAG_ADMENU_EDIT,
+ "link" => "admin/admin.tag.php",
+ "desc" => _MI_TAG_ADMENU_EDIT_DESC,
+ "icon" => "{$pathIcon32}/administration.png"),
+
+ array("title" => _MI_TAG_ADMENU_SYNCHRONIZATION,
+ "link" => "admin/syn.tag.php",
+ "desc" => _MI_TAG_HELP_DESC,
+ "icon" => "{$pathIcon32}/synchronized.png"),
+
+ array("title" => _MI_TAG_ADMIN_ABOUT,
+ "link" => "admin/about.php",
+ "desc" => _MI_TAG_ADMIN_HELP_DESC,
+ "icon" => "{$pathIcon32}/about.png")
+);
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/syn.tag.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/admin/syn.tag.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/admin/syn.tag.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -12,36 +12,37 @@
/**
* XOOPS tag management module
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
+ * @package tag
+ * @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...>
+ * @since 1.00
* @version $Id$
- * @package tag
*/
-include_once 'admin_header.php';
-require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
-//include_once XOOPS_ROOT_PATH."/modules/" . $xoopsModule->getVar("dirname") . "/class/admin.php";
-$index_admin = new ModuleAdmin();
+require_once __DIR__ . '/admin_header.php';
+require_once $GLOBALS['xoops']->path("/class/xoopsformloader.php");
+xoops_load('xoopsrequest');
+//include_once $GLOBALS['xoops']->path("/modules/" . $GLOBALS['xoopsModule']->getVar("dirname") . "/class/admin.php");
+
+include $GLOBALS['xoops']->path("/modules/tag/include/vars.php");
+
xoops_cp_header();
-include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
-//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(2) : "";
- echo $index_admin->addNavigation('syn.tag.php');
+$index_admin = new ModuleAdmin();
+echo $index_admin->addNavigation('syn.tag.php');
-$limit = 10;
-$modid = intval( @$_GET['modid'] );
-$start = intval( @$_GET['start'] );
-$limit = isset($_GET['limit']) ? intval( $_GET['limit'] ) : 100;
+$modid = XoopsRequest::getInt('modid', TagConstants::DEFAULT_ID);
+$start = XoopsRequest::getInt('start', TagConstants::BEGINNING);
+$limit = XoopsRequest::getInt('limit', TagConstants::DEFAULT_LIMIT);
-$sql = " SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
-$sql .= " FROM " . $xoopsDB->prefix("tag_link");
-$sql .= " GROUP BY tag_modid";
+$sql = "SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
+$sql .= " FROM " . $GLOBALS['xoopsDB']->prefix("tag_link");
+$sql .= " GROUP BY tag_modid";
$counts_module = array();
$module_list = array();
-if ( $result = $xoopsDB->query($sql)) {
- while ($myrow = $xoopsDB->fetchArray($result)) {
+if ( $result = $GLOBALS['xoopsDB']->query($sql)) {
+ while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$counts_module[$myrow["tag_modid"]] = $myrow["count_tag"];
}
if (!empty($counts_module)) {
@@ -53,43 +54,37 @@
$opform = new XoopsSimpleForm('', 'moduleform', xoops_getenv("PHP_SELF"), "get");
$tray = new XoopsFormElementTray('');
$mod_select = new XoopsFormSelect(_SELECT, 'modid', $modid);
-$mod_select->addOption(-1, TAG_AM_GLOBAL);
-$mod_select->addOption(0, TAG_AM_ALL);
+$mod_select->addOption(-1, _AM_TAG_GLOBAL);
+$mod_select->addOption(0, _AM_TAG_ALL);
foreach ($module_list as $module => $module_name) {
$mod_select->addOption($module, $module_name . " (" . $counts_module[$module] . ")");
}
$tray->addElement($mod_select);
-$num_select = new XoopsFormSelect(TAG_AM_NUM, 'limit', $limit);
-foreach (array(10, 50, 100, 500) as $_num) {
- $num_select->addOption($_num);
-}
-$num_select->addOption(0, _ALL);
+$num_select = new XoopsFormSelect(_AM_TAG_NUM, 'limit', $limit);
+$num_select->addOptionArray(array(0 => _ALL, 10 => 10, 50 => 50, 100 => 100, 500 => 500));
$tray->addElement($num_select);
$tray->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$tray->addElement(new XoopsFormHidden("start", $start));
$opform->addElement($tray);
$opform->display();
-if ( isset($_GET['start']) ) {
+if (isset($_GET['start'])) {
+ $tag_handler =& xoops_getmodulehandler("tag", $thisModuleDir);
- $tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
-
$criteria = new CriteriaCompo();
$criteria->setStart($start);
$criteria->setLimit($limit);
- if ($modid > 0) {
- $criteria->add( new Criteria("l.tag_modid", $modid) );
+ if ($modid > TagConstants::DEFAULT_ID) {
+ $criteria->add(new Criteria("l.tag_modid", $modid));
}
$tags = $tag_handler->getByLimit($criteria, false);
if (empty($tags)) {
- echo "<h2>" . TAG_AM_FINISHED . "</h2>";
+ echo "<h2>" . _AM_TAG_FINISHED . "</h2>\n";
} else {
-
foreach (array_keys($tags) as $tag_id) {
- $tag_handler->update_stats($tag_id, ( $modid == -1 ) ? 0 : $tags[$tag_id]["modid"]);
+ $tag_handler->update_stats($tag_id, (-1 == $modid) ? TagConstants::DEFAULT_ID : $tags[$tag_id]["modid"]);
}
- redirect_header("syn.tag.php?modid={$modid}&start=" . ($start + $limit) . "&limit={$limit}", 2, TAG_AM_IN_PROCESS);
+ redirect_header("syn.tag.php?modid={$modid}&start=" . ($start + $limit) . "&limit={$limit}", TagConstants::REDIRECT_DELAY_SHORT, _AM_TAG_IN_PROCESS);
}
}
-include 'admin_footer.php';
-//xoops_cp_footer();
+include __DIR__ . '/admin_footer.php';
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/css/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/assets/css/index.html 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/css/index.html 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1 +1 @@
- <script>history.go(-1);</script>
\ No newline at end of file
+<script>history.go(-1);</script>
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/images/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/assets/images/index.html 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/images/index.html 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1 +1 @@
- <script>history.go(-1);</script>
\ No newline at end of file
+<script>history.go(-1);</script>
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/assets/index.html 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/index.html 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1 +1 @@
- <script>history.go(-1);</script>
\ No newline at end of file
+<script>history.go(-1);</script>
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/js/index.html
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/assets/js/index.html 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/assets/js/index.html 2014-12-08 22:05:21 UTC (rev 12898)
@@ -1 +1 @@
- <script>history.go(-1);</script>
\ No newline at end of file
+<script>history.go(-1);</script>
Modified: XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/blocks/block.php
===================================================================
--- XoopsModules/modulepacks/x257basicmodulepack/trunk/modules/tag/blocks/block.php 2014-11-30 21:34:06 UTC (rev 12881)
+++ XoopsModules/modulepacks/x257basicmodulepack/branches/zyspec/tag/blocks/block.php 2014-12-08 22:05:21 UTC (rev 12898)
@@ -12,19 +12,21 @@
/**
* XOOPS tag management module
*
- * @copyright The XOOPS project http://sourceforge.net/projects/xoops/
- * @license http://www.fsf.org/copyleft/gpl.html GNU public license
- * @since 1.0.0
+ * @package tag
+ * @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...>
+ * @since 1.00
* @version $Id$
- * @package tag
*/
-defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
-include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
-include_once XOOPS_ROOT_PATH . "/modules/tag/include/functions.php";
+defined('XOOPS_ROOT_PATH') || exit('Restricted access');
+include $GLOBALS['xoops']->path("/modules/tag/include/vars.php");
+include_once $GLOBALS['xoops']->path("/modules/tag/include/functions.php");
+
xoops_loadLanguage("blocks", "tag");
+xoops_load('constants', 'tag');
/**#@+
* Function to display tag cloud
@@ -36,7 +38,7 @@
* <code>
* function newbb_block_tag_cloud_show($options) {
* $catid = $options[4]; // Not used by newbb, Only for demonstration
- * if (!@include_once XOOPS_ROOT_PATH."/modules/tag/blocks/block.php") {
+ * if (!@include_once $GLOBALS['xoops']->path("/modules/tag/blocks/block.php")) {
* return null;
* }
* $block_content = tag_block_cloud_show($options, "newbb", $catid);
@@ -48,7 +50,7 @@
* <li>Call the tag_block_cloud_edit in your defined block function:<br />
* <code>
* function newbb_block_tag_cloud_edit($options) {
- * if (!@include_once XOOPS_ROOT_PATH."/modules/tag/blocks/block.php") {
+ * if (!@include_once $GLOBALS['xoops']->path("/modules/tag/blocks/block.php")) {
* return null;
* }
* $form = tag_block_cloud_edit($options);
@@ -73,14 +75,17 @@
* $options[2] - max font size (px or %)
* $options[3] - min font size (px or %)
*/
-function tag_block_cloud_show( $options, $dirname = "", $catid = 0 )
+function tag_block_cloud_show($options, $dirname = "", $catid = 0)
{
- global $xoTheme, $xoopsDB;
- $xoTheme->addStylesheet(XOOPS_URL . '/modules/tag/assets/css/style.css');
+ global $xoTheme;
+ $xoTheme->addStylesheet($GLOBALS['xoops']->url('www/modules/tag/assets/css/style.css'));
if (empty($dirname)) {
$modid = 0;
- } elseif (isset($GLOBALS["xoopsModule"]) && is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname") == $dirname) {
+ } elseif (isset($GLOBALS["xoopsModule"])
+ && ($GLOBALS["xoopsModule"] instanceof XoopsModule)
+ && ($GLOBALS["xoopsModule"]->getVar("dirname") == $dirname))
+ {
$modid = $GLOBALS["xoopsModule"]->getVar("mid");
} else {
$module_handler =& xoops_gethandler("module");
@@ -96,11 +101,11 @@
$criteria->setSort("count");
$criteria->setOrder("DESC");
$criteria->setLimit($options[0]);
- $criteria->add( new Criteria("o.tag_status", 0) );
+ $criteria->add(new Criteria("o.tag_status", TagConstants::STATUS_ACTIVE));
if (!empty($modid)) {
- $criteria->add( new Criteria("l.tag_modid", $modid) );
- if ($catid >= 0) {
- $criteria->add( new Criteria("l.tag_catid", $catid) );
+ $criteria->add(new Criteria("l.tag_modid", $modid));
+ if ($catid >= TagConstants::DEFAULT_ID) {
+ $criteria->add(new Criteria("l.tag_catid", $catid));
}
}
if (!$tags = $tag_handler->getByLimit($criteria, empty($options[1]))) {
@@ -111,11 +116,13 @@
$count_min = 0;
$tags_term = array();
foreach (array_keys($tags) as $key) {
- if ($tags[$key]["count"] > $count_max) $count_max = $tags[$key]["count"];
- if ($tags[$key]["count"] < $count_min || $count_min == 0) $count_min = $tags[$key]["count"];
- $tags_term[] = strtolower($tags[$key]["term"]);
+ $count_max = max($count_max, $tags[$key]["count"]); // set counter to the max tag count
+ $count_min = min(0, $count_min, $tags[$key]["count"]); //set counter to the minimum for tag count
+ $tags_term[] = mb_strtolower($tags[$key]["term"]);
}
- array_multisort($tags_term, SORT_ASC, $tags);
+ if (!empty($tags_term)) {
+ array_multisort($tags_term, SORT_ASC, $tags);
+ }
$count_interval = $count_max - $count_min;
$level_limit = 5;
@@ -125,14 +132,13 @@
$tags_data = array();
foreach (array_keys($tags) as $key) {
- $tags_data[] = array(
- "id" => $tags[$key]["id"],
- "font" => ($count_interval) ? floor( ($tags[$key]["count"] - $count_min) * $font_ratio + $font_min ) : 100,
- "level" => empty($count_max) ? 0 : floor( ($tags[$key]["count"] - $count_min) * $level_limit / $count_max ),
- "term" => urlencode($tags[$key]["term"]),
- "title" => htmlspecialchars($tags[$key]["term"]),
- "count" => $tags[$key]["count"],
- );
+ $tags_data[] = array("id" => $tags[$key]["id"],
+ "font" => ($count_interval) ? floor(($tags[$key]["count"] - $count_min) * $font_ratio + $font_min) : 100,
+ "level" => empty($count_max) ? 0 : floor(($tags[$key]["count"] - $count_min) * $level_limit / $count_max),
+ "term" => urlencode($tags[$key]["term"]),
+ "title" => htmlspecialchars($tags[$key]["term"]),
+ "count" => $tags[$key]["count"],
+ );
}
unset($tags, $tags_term);
@@ -150,10 +156,10 @@
function tag_block_cloud_edit($options)
{
- $form = TAG_MB_ITEMS . ": <input type=\"text\" name=\"options[0]\" value=\"" . $options[0] . "\" /><br />";
- $form .= TAG_MB_TIME_DURATION . ": <input type=\"text\" name=\"options[1]\" value=\"" . $options[1] . "\" /><br />";
- $form .= TAG_MB_FONTSIZE_MAX . ": <input type=\"text\" name=\"options[2]\" value=\"" . $options[2] . "\" /><br />";
- $form .= TAG_MB_FONTSIZE_MIN . ": <input type=\"text\" name=\"options[3]\" value=\"" . $options[3] . "\" /><br />";
+ $form = _MB_TAG_ITEMS . ": <input type='number' name='options[0]' value='{$options[0]}' min='0' /><br />\n";
+ $form .= _MB_TAG_TIME_DURATION . ": <input type='number' name='options[1]' value='{$options[1]}' min='0' /><br />\n";
+ $form .= _MB_TAG_FONTSIZE_MAX . ": <input type='number' name='options[2]' value='{$options[2]}' min='0' /><br />\n";
+ $form .= _MB_TAG_FONTSIZE_MIN . ": <input type='number' name='options[3]' value='{$options[3]}' min='0' /><br />\n";
return $form;
}
@@ -168,7 +174,7 @@
* <code>
* function newbb_block_tag_top_show($options) {
* $catid = $options[3]; // Not used by newbb, Only for demonstration
- * if (!@include_once XOOPS_ROOT_PATH."/modules/tag/blocks/block.php") {
+ * if (!@include_once $GLOBALS['xoops']->path("/modules/tag/blocks/block.php")) {
* return null;
* }
* $block_content = tag_block_top_show($options, "newbb", $catid);
@@ -180,7 +186,7 @@
* <li>Call the tag_block_top_edit in your defined block function:<br />
* <code>
* function newbb_block_tag_top_edit($options) {
- * if (!@include_once XOOPS_ROOT_PATH."/modules/tag/blocks/block.php") {
+ * if (!@include_once $GLOBALS['xoops']->path("/modules/tag/blocks/block.php")) {
* return null;
* }
* $form = tag_block_cloud_edit($options);
@@ -204,13 +210,14 @@
* $options[1] - time duration, in days, 0 for all the time
* $options[2] - sort: a - alphabet; c - count; t - time
*/
-function tag_block_top_show( $options, $dirname = "", $catid = 0 )
+function tag_block_top_show($options, $dirname = "", $catid = 0)
{
- global $xoopsDB;
-
if (empty($dirname)) {
$modid = 0;
- } elseif (isset($GLOBALS["xoopsModule"]) && is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname") == $dirname) {
+ } elseif (isset($GLOBALS["xoopsModule"])
+ && ($GLOBALS["xoopsModule"] instanceof XoopsModule)
+ && $GLOBALS["xoopsModule"]->getVar("dirname") == $dirname)
+ {
$modid = $GLOBALS["xoopsModule"]->getVar("mid");
} else {
$module_handler =& xoops_gethandler("module");
@@ -223,18 +230,20 @@
tag_define_url_delimiter();
$criteria = new CriteriaCompo();
- $sort = ($options[2] == "a" || $options[2] == "alphabet") ? "count" : $options[2];
- $criteria->setSort("count");
+ $sort = (("a" == $options[2]) || ("alphabet" == $options[2])) ? "count" : $options[2];
+// $criteria->setSort("count");
+ $criteria->setSort($sort);
$criteria->setOrder("DESC");
- $criteria->setLimit($options[0]);
- $criteria->add( new Criteria("o.tag_status", 0) );
+ $criteria->setLimit((int) $options[0]);
+ $criteria->add(new Criteria("o.tag_status", TagConstants::STATUS_ACTIVE));
if (!empty($options[1])) {
- $criteria->add( new Criteria("l.tag_time", time() - $options[1] * 24 * 3600, ">") );
+ $criteria->add(new Criteria("l.tag_time", time() - floatval($options[1]) * 24 * 3600, ">"));
}
if (!empty($modid)) {
- $criteria->add( new Criteria("l.tag_modid", $modid) );
+ $criteria->add(new Criteria("l.tag_modid", $modid));
+ $catid = (int) $catid;
if ($catid >= 0) {
- $criteria->add( new Criteria("l.tag_catid", $catid) );
+ $criteria->add(new Criteria("l.tag_catid", $catid));
}
}
if (!$tags = $tag_handler->getByLimit($criteria, empty($options[1]))) {
@@ -245,10 +254,10 @@
$count_min = 0;
$tags_sort = array();
foreach (array_keys($tags) as $key) {
- if ($tags[$key]["count"] > $count_max) $count_max = $tags[$key]["count"];
- if ($tags[$key]["count"] < $count_min) $count_min = $tags[$key]["count"];
- if ($options[2] == "a" || $options[2] == "alphabet") {
- $tags_sort[] = strtolower($tags[$key]["term"]);
+ $count_max = max($count_max, $tags[$key]["count"]); // set counter to the max tag count
+ $count_min = min(0, $count_min, $tags[$key]["count"]); //set counter to the minimum for tag count
+ if (("a" == $options[2]) || ("alphabet" == $options[2])) {
+ $tags_sort[] = mb_strtolower($tags[$key]["term"]);
}
}
$count_interval = $count_max - $count_min;
@@ -264,16 +273,15 @@
$tags_data = array();
foreach (array_keys($tags) as $key) {
- $tags_data[] = array(
- "id" => $tags[$key]["id"],
- //"level" => ($tags[$key]["count"] - $count_min) * $font_ratio + $font_min,
- "term" => $tags[$key]["term"],
- "count" => $tags[$key]["count"],
- );
+ $tags_data[] = array("id" => $tags[$key]["id"],
+ "term" => $tags[$key]["term"],
+ "count" => $tags[$key]["count"],
+// "level" => ($tags[$key]["count"] - $count_min) * $font_ratio + $font_min,
+ );
}
unset($tags, $tags_term);
- $block["tags"] =& $tags_data;
+ $block["tags"] =& $tags_data;
$block["tag_dirname"] = "tag";
if (!empty($modid)) {
$module_handler =& xoops_gethandler('module');
@@ -287,19 +295,196 @@
function tag_block_top_edit($options)
{
- $form = TAG_MB_ITEMS . ": <input type=\"text\" name=\"options[0]\" value=\"" . $options[0] . "\" /><br />";
- $form .= TAG_MB_TIME_DURATION . ": <input type=\"text\" name=\"options[1]\" value=\"" . $options[1] . "\" /><br />";
- $form .= TAG_MB_SORT . ": <select name='options[2]'>";
+ $form = _MB_TAG_ITEMS . ": <input type='number' name='options[0]' value='{$options[0]}' min='0' /><br />\n";
+ $form .= _MB_TAG_TIME_DURATION . ": <input type='number' name='options[1]' value=\"{$options[1]}' min='0' /><br />\n";
+ $form .= _MB_TAG_SORT . ": <select name='options[2]'>\n";
$form .= "<option value='a'";
- if ($options[2] == "a") $form .= " selected='selected' ";
- $form .= ">" . TAG_MB_ALPHABET . "</option>";
+ if ("a" == $options[2]) {
+ $form .= " selected='selected' ";
+ }
+ $form .= ">" . _MB_TAG_ALPHABET . "</option>\n";
$form .= "<option value='c'";
- if ($options[2] == "c") $form .= " selected='selected' ";
- $form .= ">" . TAG_MB_COUNT . "</option>";
+ if ("c" == $options[2]) {
+ $form .= " selected='selected' ";
+ }
+ $form .= ">" . _MB_TAG_COUNT . "</option>\n";
$form .= "<option value='t'";
- if ($options[2] == "t") $form .= " selected='selected' ";
- $form .= ">" . TAG_MB_TIME . "</option>";
- $form .= "</select>";
+ if ("t" == $options[2]) {
+ $form .= " selected='selected' ";
+ }
+ $form .= ">" . _MB_TAG_TIME . "</option>\n";
+ $form .= "</select>\n";
return $form;
}
+
+/*
+ * $options for cumulus:
+ * $options[0] - number of tags to display
+ * $options[1] - time duration
+ * $options[2] - max font size (px or %)
+ * $options[3] - min font size (px or %)
+ * $options[4] - cumulus_flash_width
+ * $options[5] - cumulus_flash_height
+ * $options[6] - cumulus_flash_background
+ * $options[7] - cumulus_flash_transparency
+ * $options[8] - cumulus_flash_min_font_color
+ * $options[9] - cumulus_flash_max_font_color
+ * $options[10] - cumulus_flash_hicolor
+ * $options[11] - cumulus_flash_speed
+ */
+/**
+ *
+ * Prepare output for Cumulus block display
+ *
+ * @param array {
+ * @type int - 0 number of tags to display
+ * @type int - 1 time duration
+ * @type int - 2 max font size (px or %)
+ * @type int - 3 min font size (px or %)
+ * @type int - 4 cumulus_flash_width
+ * @type int - 5 cumulus_flash_height
+ * @type st...
[truncated message content] |