Skip to content

Commit 831cd5d

Browse files
committed
Merge pull request #2 from mambax7/master
2.33 RC 1
2 parents 636732c + 7c39851 commit 831cd5d

86 files changed

Lines changed: 3202 additions & 2118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tag/admin/about.php

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
212
/**
3-
* Tag module
13+
* XOOPS tag management module
414
*
5-
* You may not change or alter any portion of this comment or credits
6-
* of supporting developers from this source code or any supporting source code
7-
* which is considered copyrighted (c) material of the original comment or credit authors.
8-
* This program is distributed in the hope that it will be useful,
9-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11-
*
12-
* @copyright The XOOPS Project (http://www.xoops.org)
13-
* @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html)
14-
* @package Tag
15-
* @since 2.5.0
16-
* @author Mage, Mamba
17-
* @version $Id $
18-
**/
19-
include_once dirname(__FILE__) . '/admin_header.php';
15+
* @package tag
16+
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17+
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
18+
* @author Mage
19+
* @author Mamba
20+
* @since 2.31
21+
* @version $Id: about.php 12898 2014-12-08 22:05:21Z zyspec $
22+
*/
23+
24+
include_once __DIR__ . '/admin_header.php';
2025

2126
xoops_cp_header();
2227

@@ -25,4 +30,4 @@
2530
echo $aboutAdmin->addNavigation('about.php');
2631
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
2732

28-
include 'admin_footer.php';
33+
include __DIR__ . '/admin_footer.php';

tag/admin/admin.tag.php

Lines changed: 79 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
/*
33
You may not change or alter any portion of this comment or credits
4-
of supporting developers from this source code or any supporting source code
4+
of supporting developers from this source code or any supporting source code
55
which is considered copyrighted (c) material of the original comment or credit authors.
6-
6+
77
This program is distributed in the hope that it will be useful,
88
but WITHOUT ANY WARRANTY; without even the implied warranty of
99
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -12,62 +12,60 @@
1212
/**
1313
* XOOPS tag management module
1414
*
15-
* @copyright The XOOPS project http://sourceforge.net/projects/xoops/
16-
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
17-
* @since 1.0.0
15+
* @package tag
16+
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17+
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
1818
* @author Taiwen Jiang <phppp@users.sourceforge.net>
19-
* @version $Id: admin.tag.php 11906 2013-08-14 05:54:12Z beckmi $
20-
* @package tag
19+
* @since 1.00
20+
* @version $Id: admin.tag.php 12898 2014-12-08 22:05:21Z zyspec $
2121
*/
22-
23-
include_once 'admin_header.php';
24-
require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
25-
$indexAdmin = new ModuleAdmin();
26-
27-
xoops_cp_header();
2822

29-
include XOOPS_ROOT_PATH . "/modules/tag/include/vars.php";
30-
//echo function_exists("loadModuleAdminMenu") ? loadModuleAdminMenu(1) : "";
31-
echo $indexAdmin->addNavigation('admin.tag.php');
23+
require_once __DIR__ . '/admin_header.php';
24+
require_once $GLOBALS['xoops']->path("/class/xoopsformloader.php");
25+
xoops_load('xoopsrequest');
3226

33-
global $xoopsModuleConfig;
27+
$indexAdmin = new ModuleAdmin();
3428

35-
$limit = $xoopsModuleConfig['items_perpage'];
36-
$modid = intval( empty($_GET['modid']) ? @$_POST['modid'] : $_GET['modid'] );
37-
$start = intval( empty($_GET['start']) ? @$_POST['start'] : $_GET['start'] );
38-
//$status = intval( empty($_GET['status']) ? @$_POST['status'] : $_GET['status']);
29+
xoops_cp_header();
3930

40-
$status = intval( (isset($_GET['status']) && $_GET['status'] >-1) ? $_GET['status'] : -1);
31+
include $GLOBALS['xoops']->path("/modules/tag/include/vars.php");
32+
echo $indexAdmin->addNavigation('admin.tag.php');
4133

34+
$limit = $GLOBALS['xoopsModuleConfig']['items_perpage'];
35+
$modid = XoopsRequest::getInt('modid', TagConstants::DEFAULT_ID);
36+
$start = XoopsRequest::getInt('start', TagConstants::BEGINNING);
37+
$status = XoopsRequest::getInt('status', TagConstants::STATUS_ALL, 'GET');
4238

43-
$tag_handler =& xoops_getmodulehandler("tag", $xoopsModule->getVar("dirname"));
39+
$tag_handler =& xoops_getmodulehandler('tag', $thisModuleDir);
40+
$link_handler =& xoops_getmodulehandler('link', $thisModuleDir);
4441

45-
if (!empty($_POST['tags'])) {
42+
$postTags = XoopsRequest::getArray('tags', array(), 'POST');
43+
if (!empty($postTags)) {
4644
$msgDBUpdated='';
47-
foreach ($_POST['tags'] as $tag => $tag_status) {
45+
foreach ($postTags as $tag => $tag_status) {
4846
$tag_obj =& $tag_handler->get($tag);
49-
if (!is_object($tag_obj) || !$tag_obj->getVar("tag_id")) continue;
50-
if ($tag_status < 0) {
47+
if (!($tag_obj instanceof TagTag) || !$tag_obj->getVar("tag_id")) continue;
48+
if ($tag_status < TagConstants::STATUS_ACTIVE) {
5149
$tag_handler->delete($tag_obj);
5250
} elseif ($tag_status != $tag_obj->getVar("tag_status")) {
5351
$tag_obj->setVar("tag_status", $tag_status);
5452
$tag_handler->insert($tag_obj);
5553
$msgDBUpdated = _AM_TAG_DB_UPDATED;
5654
}
5755
}
58-
redirect_header("admin.tag.php?modid={$modid}&amp;start={$start}&amp;status={$status}", 2, $msgDBUpdated);
59-
exit();
56+
redirect_header("admin.tag.php?modid={$modid}&amp;start={$start}&amp;status={$status}", TagConstants::REDIRECT_DELAY_MEDIUM, $msgDBUpdated);
6057
}
6158

62-
$sql = " SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
63-
$sql .= " FROM " . $xoopsDB->prefix("tag_link");
64-
$sql .= " GROUP BY tag_modid";
59+
$sql = "SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag";
60+
$sql .= " FROM " . $GLOBALS['xoopsDB']->prefix("tag_link");
61+
$sql .= " GROUP BY tag_modid";
6562
$counts_module = array();
6663
$module_list = array();
67-
if ( ($result = $xoopsDB->query($sql)) == false) {
68-
xoops_error($xoopsDB->error());
64+
$result = $GLOBALS['xoopsDB']->query($sql);
65+
if (false === $result) {
66+
xoops_error($GLOBALS['xoopsDB']->error());
6967
} else {
70-
while ($myrow = $xoopsDB->fetchArray($result)) {
68+
while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
7169
$counts_module[$myrow["tag_modid"]] = $myrow["count_tag"];
7270
}
7371
if (!empty($counts_module)) {
@@ -85,9 +83,9 @@
8583
}
8684
$tray->addElement($mod_select);
8785
$status_select = new XoopsFormRadio("", 'status', $status);
88-
$status_select->addOption(-1, _ALL);
89-
$status_select->addOption(1, TAG_AM_ACTIVE);
90-
$status_select->addOption(0, TAG_AM_INACTIVE);
86+
$status_select->addOption(TagConstants::STATUS_ALL, _ALL);
87+
$status_select->addOption(TagConstants::STATUS_ACTIVE, _AM_TAG_ACTIVE);
88+
$status_select->addOption(TagConstants::STATUS_INACTIVE, _AM_TAG_INACTIVE);
9189
$tray->addElement($status_select);
9290
$tray->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
9391
$opform->addElement($tray);
@@ -98,52 +96,62 @@
9896
$criteria->setOrder("ASC");
9997
$criteria->setStart($start);
10098
$criteria->setLimit($limit);
101-
if ($status >= 0) {
102-
$criteria->add( new Criteria("o.tag_status", $status) );
99+
if ($status >= TagConstants::STATUS_ACTIVE) {
100+
$criteria->add(new Criteria("o.tag_status", $status));
103101
}
104102
if (!empty($modid)) {
105-
$criteria->add( new Criteria("l.tag_modid", $modid) );
103+
$criteria->add(new Criteria("l.tag_modid", $modid));
106104
}
107105
$tags = $tag_handler->getByLimit($criteria, false);
108106

109-
$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>";
110-
$form_tags .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
111-
$form_tags .= "<tr align='center'>";
112-
$form_tags .= "<th class='bg3'>" . TAG_AM_TERM . "</td>";
113-
$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_ACTIVE . "</td>";
114-
$form_tags .= "<th class='bg3' width='10%'>" . TAG_AM_INACTIVE . "</td>";
115-
$form_tags .= "<th class='bg3' width='10%'>" . _DELETE . "</td>";
116-
$form_tags .= "</tr>";
107+
$form_tags = "<form name='tags' method='post' action='" . xoops_getenv("PHP_SELF") . "'>\n"
108+
. "<table style='border-width: 0px; margin: 1px; padding: 4px;' cellspacing='1' class='outer width100'>\n"
109+
. " <thead>\n"
110+
. " <tr class='txtcenter'>\n"
111+
. " <th class='bg3'>" . _AM_TAG_TERM . "</th>\n"
112+
. " <th class='bg3 width10'>" . _AM_TAG_INACTIVE . "</th>\n"
113+
. " <th class='bg3 width10'>" . _AM_TAG_ACTIVE . "</th>\n"
114+
. " <th class='bg3 width10'>" . _DELETE . "</th>\n"
115+
. " </tr>\n"
116+
. " </thead>\n"
117+
. " <tbody>\n";
117118
if (empty($tags)) {
118-
$form_tags .= "<tr><td colspan='4'>" . _NONE . "</td></tr>";
119+
$form_tags .= " <tr><td colspan='4'>" . _NONE . "</td></tr>\n";
119120
} else {
120-
$class_tr = array("odd", "even");
121+
$class_tr = 'odd';
121122
$i = 0;
122123
foreach (array_keys($tags) as $key) {
123-
$form_tags .= "<tr class='" . $class_tr[(++$i) % 2] . "'>";
124-
$form_tags .= "<td>" . $tags[$key]["term"] . "</td>";
125-
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='1' " . ( $tags[$key]["status"] ? "checked" : " '' ") . "></td>";
126-
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='0' " . ( $tags[$key]["status"] ? " '' " : "checked") . "></td>";
127-
$form_tags .= "<td align='center'><input type='radio' name='tags[{$key}]' value='-1'></td>";
128-
$form_tags .= "</tr>";
124+
$form_tags .= " <tr class='{$class_tr}'>\n"
125+
. " <td>" . $tags[$key]["term"] . "</td>\n"
126+
. " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_INACTIVE . "'" . ( $tags[$key]["status"] ? " checked" : " '' ") . "></td>\n"
127+
. " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_ACTIVE . "'" . ( $tags[$key]["status"] ? " '' " : " checked") . "></td>\n"
128+
. " <td class='txtcenter'><input type='radio' name='tags[{$key}]' value='" . TagConstants::STATUS_DELETE . "'></td>\n"
129+
. " </tr>\n";
130+
$class_tr = ('even' == $class_tr) ? 'odd' : 'even';
129131
}
130-
if ( !empty($start) || count($tags) >= $limit ) {
132+
if (!empty($start) || (count($tags) >= $limit)) {
131133
$count_tag = $tag_handler->getCount($criteria);
132-
133-
include XOOPS_ROOT_PATH . "/class/pagenav.php";
134+
135+
include $GLOBALS['xoops']->path("/class/pagenav.php");
134136
$nav = new XoopsPageNav($count_tag, $limit, $start, "start", "modid={$modid}&amp;status={$status}");
135-
$form_tags .= "<tr><td colspan='4' align='right'>" . $nav->renderNav(4) . "</td></tr>";
137+
$form_tags .= " <tr><td colspan='4' class='txtright'>" . $nav->renderNav(4) . "</td></tr>\n";
136138
}
137-
$form_tags .= "<tr><td colspan='4' align='center'>";
138-
$form_tags .= "<input type='hidden' name='status' value='{$status}'> ";
139-
$form_tags .= "<input type='hidden' name='start' value='{$start}'> ";
140-
$form_tags .= "<input type='hidden' name='modid' value='{$modid}'> ";
141-
$form_tags .= "<input type='submit' name='submit' value='" . _SUBMIT . "'> ";
142-
$form_tags .= "<input type='reset' name='submit' value='" . _CANCEL . "'>";
143-
$form_tags .= "</td></tr>";
139+
$form_tags .= " </tbody>\n"
140+
. " <tfoot>\n"
141+
. " <tr>\n"
142+
. " <td class='txtcenter' colspan='4'>\n"
143+
. " <input type='hidden' name='status' value='{$status}' /> \n"
144+
. " <input type='hidden' name='start' value='{$start}' /> \n"
145+
. " <input type='hidden' name='modid' value='{$modid}' /> \n"
146+
. " <input type='submit' name='submit' value='" . _SUBMIT . "' /> \n"
147+
. " <input type='reset' name='submit' value='" . _CANCEL . "' />\n"
148+
. " </td>\n"
149+
. " </tr>\n"
150+
. " </tfoot>\n";
144151
}
145-
$form_tags .= "</table>";
146-
$form_tags .= "</form>";
152+
$form_tags .= " </tbody>\n"
153+
. "</table>\n"
154+
. "</form>\n";
147155

148156
echo $form_tags;
149-
include "admin_footer.php";
157+
include __DIR__ . '/admin_footer.php';

tag/admin/admin_footer.php

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
<?php
2+
/*
3+
You may not change or alter any portion of this comment or credits
4+
of supporting developers from this source code or any supporting source code
5+
which is considered copyrighted (c) material of the original comment or credit authors.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
*/
11+
212
/**
3-
* Tag module
4-
*
5-
* You may not change or alter any portion of this comment or credits
6-
* of supporting developers from this source code or any supporting source code
7-
* which is considered copyrighted (c) material of the original comment or credit authors.
8-
* This program is distributed in the hope that it will be useful,
9-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
* XOOPS tag management module
1114
*
12-
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
13-
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
14-
* @package XOOPS Tag
15-
* @since 2.5.0
16-
* @author Mamba (www.xoops.org)
17-
* @version $Id $
18-
**/
19-
15+
* @package tag
16+
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17+
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
18+
* @author Mamba {@link http://www.xoops.org}
19+
* @since 2.31
20+
* @version $Id: admin_footer.php 12898 2014-12-08 22:05:21Z zyspec $
21+
*/
22+
/*
2023
echo "<div class='adminfooter'>\n"
21-
." <div style='text-align: center;'>\n"
24+
." <div class='txtcenter'>\n"
2225
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
2326
." </div>\n"
2427
." " . _AM_TAG_FOOTER . "\n"
2528
."</div>";
29+
*/
30+
echo "<div class='adminfooter'>\n"
31+
. " <div class='center'>\n"
32+
. " <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"
33+
. " </div>\n"
34+
. " <div class='center smallsmall italic pad5'>\n"
35+
. " " . _AM_TAG_MAINTAINED_BY
36+
. " <a class='tooltip' rel='external' href='http://" . $GLOBALS['xoopsModule']->getInfo('module_website_url') . "' "
37+
. "title='" . _AM_TAG_MAINTAINED_TITLE . "'>" . _AM_TAG_MAINTAINED_TEXT . "</a>\n"
38+
. " </div>\n"
39+
. "</div>";
2640

27-
xoops_cp_footer();
41+
xoops_cp_footer();

0 commit comments

Comments
 (0)