|
From: <be...@us...> - 2014-03-09 09:53:24
|
Revision: 12368
http://sourceforge.net/p/xoops/svn/12368
Author: beckmi
Date: 2014-03-09 09:53:17 +0000 (Sun, 09 Mar 2014)
Log Message:
-----------
Cosmetic code changes related to PSR-2
Modified Paths:
--------------
XoopsModules/lexikon/trunk/lexikon/admin/about.php
XoopsModules/lexikon/trunk/lexikon/admin/admin.php
XoopsModules/lexikon/trunk/lexikon/admin/admin_footer.php
XoopsModules/lexikon/trunk/lexikon/admin/category.php
XoopsModules/lexikon/trunk/lexikon/admin/entry.php
XoopsModules/lexikon/trunk/lexikon/admin/functions.php
XoopsModules/lexikon/trunk/lexikon/admin/importdictionary.php
XoopsModules/lexikon/trunk/lexikon/admin/importglossaire.php
XoopsModules/lexikon/trunk/lexikon/admin/importwiwimod.php
XoopsModules/lexikon/trunk/lexikon/admin/importwordbook.php
XoopsModules/lexikon/trunk/lexikon/admin/importxwords.php
XoopsModules/lexikon/trunk/lexikon/admin/index.php
XoopsModules/lexikon/trunk/lexikon/admin/main.php
XoopsModules/lexikon/trunk/lexikon/admin/menu.php
XoopsModules/lexikon/trunk/lexikon/admin/myblockform.php
XoopsModules/lexikon/trunk/lexikon/admin/myblocksadmin.php
XoopsModules/lexikon/trunk/lexikon/admin/myblocksadmin2.php
XoopsModules/lexikon/trunk/lexikon/admin/mygroupperm.php
XoopsModules/lexikon/trunk/lexikon/admin/mygrouppermform.php
XoopsModules/lexikon/trunk/lexikon/admin/permissions.php
XoopsModules/lexikon/trunk/lexikon/admin/preferences.php
XoopsModules/lexikon/trunk/lexikon/admin/statistics.php
XoopsModules/lexikon/trunk/lexikon/admin/submissions.php
XoopsModules/lexikon/trunk/lexikon/admin/upgrade.php
XoopsModules/lexikon/trunk/lexikon/authorlist.php
XoopsModules/lexikon/trunk/lexikon/blocks/categories_block.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_authors.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_initial.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_new.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_scrolling.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_spot.php
XoopsModules/lexikon/trunk/lexikon/blocks/entries_top.php
XoopsModules/lexikon/trunk/lexikon/blocks/random_term.php
XoopsModules/lexikon/trunk/lexikon/category.php
XoopsModules/lexikon/trunk/lexikon/class/keyhighlighter.class.php
XoopsModules/lexikon/trunk/lexikon/comment_delete.php
XoopsModules/lexikon/trunk/lexikon/comment_edit.php
XoopsModules/lexikon/trunk/lexikon/comment_new.php
XoopsModules/lexikon/trunk/lexikon/comment_post.php
XoopsModules/lexikon/trunk/lexikon/comment_reply.php
XoopsModules/lexikon/trunk/lexikon/content.php
XoopsModules/lexikon/trunk/lexikon/entry.php
XoopsModules/lexikon/trunk/lexikon/header.php
XoopsModules/lexikon/trunk/lexikon/include/blocksadmin.inc.php
XoopsModules/lexikon/trunk/lexikon/include/comment_functions.php
XoopsModules/lexikon/trunk/lexikon/include/common.inc.php
XoopsModules/lexikon/trunk/lexikon/include/functions.php
XoopsModules/lexikon/trunk/lexikon/include/gtickets.php
XoopsModules/lexikon/trunk/lexikon/include/install_function.php
XoopsModules/lexikon/trunk/lexikon/include/notification.inc.php
XoopsModules/lexikon/trunk/lexikon/include/onupdate.inc.php
XoopsModules/lexikon/trunk/lexikon/include/plugin.tag.php
XoopsModules/lexikon/trunk/lexikon/include/requestform.php
XoopsModules/lexikon/trunk/lexikon/include/search.inc.php
XoopsModules/lexikon/trunk/lexikon/include/sitemap.plugin.php
XoopsModules/lexikon/trunk/lexikon/include/storyform.inc.php
XoopsModules/lexikon/trunk/lexikon/include/syndication.inc.php
XoopsModules/lexikon/trunk/lexikon/include/updateblock.inc.php
XoopsModules/lexikon/trunk/lexikon/include/waiting.plugin.php
XoopsModules/lexikon/trunk/lexikon/index.php
XoopsModules/lexikon/trunk/lexikon/language/english/admin.php
XoopsModules/lexikon/trunk/lexikon/language/english/blocks.php
XoopsModules/lexikon/trunk/lexikon/language/english/main.php
XoopsModules/lexikon/trunk/lexikon/language/english/modinfo.php
XoopsModules/lexikon/trunk/lexikon/letter.php
XoopsModules/lexikon/trunk/lexikon/list.tag.php
XoopsModules/lexikon/trunk/lexikon/notification_update.php
XoopsModules/lexikon/trunk/lexikon/popup.php
XoopsModules/lexikon/trunk/lexikon/print.php
XoopsModules/lexikon/trunk/lexikon/profile.php
XoopsModules/lexikon/trunk/lexikon/request.php
XoopsModules/lexikon/trunk/lexikon/rss.php
XoopsModules/lexikon/trunk/lexikon/search.php
XoopsModules/lexikon/trunk/lexikon/submit.php
XoopsModules/lexikon/trunk/lexikon/syndication.php
XoopsModules/lexikon/trunk/lexikon/templates/blocks/entries_scrolling.html
XoopsModules/lexikon/trunk/lexikon/templates/lx_rss.xml
XoopsModules/lexikon/trunk/lexikon/view.tag.php
XoopsModules/lexikon/trunk/lexikon/xoops_version.php
Modified: XoopsModules/lexikon/trunk/lexikon/admin/about.php
===================================================================
--- XoopsModules/lexikon/trunk/lexikon/admin/about.php 2014-03-08 23:43:58 UTC (rev 12367)
+++ XoopsModules/lexikon/trunk/lexikon/admin/about.php 2014-03-09 09:53:17 UTC (rev 12368)
@@ -27,4 +27,4 @@
echo $aboutAdmin->addNavigation('about.php');
echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false);
-include 'admin_footer.php';
\ No newline at end of file
+include 'admin_footer.php';
Modified: XoopsModules/lexikon/trunk/lexikon/admin/admin.php
===================================================================
--- XoopsModules/lexikon/trunk/lexikon/admin/admin.php 2014-03-08 23:43:58 UTC (rev 12367)
+++ XoopsModules/lexikon/trunk/lexikon/admin/admin.php 2014-03-09 09:53:17 UTC (rev 12368)
@@ -1,160 +1,158 @@
-<?php
-// $Id: admin.php,v 1.7 2003/04/11 13:00:53 okazu Exp $
-// ------------------------------------------------------------------------ //
-// XOOPS - PHP Content Management System //
-// Copyright (c) 2000 XOOPS.org //
-// <http://www.xoops.org/> //
-// ------------------------------------------------------------------------ //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// 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. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
-// Author: Kazumi Ono (AKA onokazu) //
-// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
-// Project: The XOOPS Project //
-// ------------------------------------------------------------------------- //
-
-$admin_mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
-
-$fct = empty( $_POST['fct'] ) ? '' : trim( $_POST['fct'] ) ;
-$fct = empty( $_GET['fct'] ) ? $fct : trim( $_GET['fct'] ) ;
-if( empty( $fct ) ) $fct = 'preferences' ;
-//if (isset($fct) && $fct == "users") {
-// $xoopsOption['pagetype'] = "user";
-//}
-include "../../../mainfile.php";
-// include "../../mainfile.php"; GIJ
-include XOOPS_ROOT_PATH."/include/cp_functions.php";
-
-include_once XOOPS_ROOT_PATH."/kernel/module.php";
-include_once "../include/gtickets.php" ;// GIJ
-
-$admintest = 0;
-
-if (is_object($xoopsUser)) {
- $xoopsModule =& XoopsModule::getByDirname("system");
- if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
- redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
- exit();
- }
- $admintest=1;
-} else {
- redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
- exit();
-}
-
-// include system category definitions
-include_once XOOPS_ROOT_PATH."/modules/system/constants.php";
-$error = false;
-if ($admintest != 0) {
- if (isset($fct) && $fct != '') {
- if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php")) {
-
- if ( file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php") ) {
- include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php";
- } else {
- include XOOPS_ROOT_PATH."/modules/system/language/english/admin.php";
- }
-
- if (file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php")) {
- include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php";
- } elseif (file_exists(XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php")) {
- include XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php";
- }
- include XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php";
- $sysperm_handler =& xoops_gethandler('groupperm');
- $category = !empty($modversion['category']) ? intval($modversion['category']) : 0;
- unset($modversion);
- if ($category > 0) {
- $groups = $xoopsUser->getGroups();
- if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))){
-// if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) {
-// include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php"; GIJ
- if (file_exists("../include/{$fct}.inc.php")) {
- include_once "../include/{$fct}.inc.php" ;
- } else {
- $error = true;
- }
- } else {
- $error = true;
- }
- } elseif ($fct == 'version') {
- if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/version/main.php")) {
- include_once XOOPS_ROOT_PATH."/modules/system/admin/version/main.php";
- } else {
- $error = true;
- }
- } else {
- $error = true;
- }
- } else {
- $error = true;
- }
- } else {
- $error = true;
- }
-}
-
-if (false != $error) {
- xoops_cp_header();
- echo "<h4>System Configuration</h4>";
- echo '<table class="outer" cellpadding="4" cellspacing="1">';
- echo '<tr>';
- $groups = $xoopsUser->getGroups();
- $all_ok = false;
- if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
- $sysperm_handler =& xoops_gethandler('groupperm');
- $ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups);
- } else {
- $all_ok = true;
- }
- $admin_dir = XOOPS_ROOT_PATH."/modules/system/admin";
- $handle = opendir($admin_dir);
- $counter = 0;
- $class = 'even';
- while ($file = readdir($handle)) {
- if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir.'/'.$file)) {
- include $admin_dir.'/'.$file.'/xoops_version.php';
- if ($modversion['hasAdmin']) {
- $category = isset($modversion['category']) ? intval($modversion['category']) : 0;
- if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) {
- echo "<td class='$class' align='center' valign='bottom' width='19%'>";
- echo "<a href='".XOOPS_URL."/modules/system/admin.php?fct=".$file."'><b>" .trim($modversion['name'])."</b></a>\n";
- echo "</td>";
- $counter++;
- $class = ($class == 'even') ? 'odd' : 'even';
- }
- if ( $counter > 4 ) {
- $counter = 0;
- echo "</tr>";
- echo "<tr>";
- }
- }
- unset($modversion);
- }
- }
- while ($counter < 5) {
- echo '<td class="'.$class.'"> </td>';
- $class = ($class == 'even') ? 'odd' : 'even';
- $counter++;
- }
- echo '</tr></table>';
- xoops_cp_footer();
-}
-
-?>
\ No newline at end of file
+<?php
+// $Id: admin.php,v 1.7 2003/04/11 13:00:53 okazu Exp $
+// ------------------------------------------------------------------------ //
+// XOOPS - PHP Content Management System //
+// Copyright (c) 2000 XOOPS.org //
+// <http://www.xoops.org/> //
+// ------------------------------------------------------------------------ //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation; either version 2 of the License, or //
+// (at your option) any later version. //
+// //
+// 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. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program; if not, write to the Free Software //
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
+// ------------------------------------------------------------------------ //
+// Author: Kazumi Ono (AKA onokazu) //
+// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
+// Project: The XOOPS Project //
+// ------------------------------------------------------------------------- //
+
+$admin_mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
+
+$fct = empty( $_POST['fct'] ) ? '' : trim( $_POST['fct'] ) ;
+$fct = empty( $_GET['fct'] ) ? $fct : trim( $_GET['fct'] ) ;
+if( empty( $fct ) ) $fct = 'preferences' ;
+//if (isset($fct) && $fct == "users") {
+// $xoopsOption['pagetype'] = "user";
+//}
+include '../../../mainfile.php';
+// include "../../mainfile.php"; GIJ
+include XOOPS_ROOT_PATH."/include/cp_functions.php";
+
+include_once XOOPS_ROOT_PATH."/kernel/module.php";
+include_once '../include/gtickets.php';// GIJ
+
+$admintest = 0;
+
+if (is_object($xoopsUser)) {
+ $xoopsModule =& XoopsModule::getByDirname("system");
+ if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
+ redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
+ exit();
+ }
+ $admintest=1;
+} else {
+ redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
+ exit();
+}
+
+// include system category definitions
+include_once XOOPS_ROOT_PATH."/modules/system/constants.php";
+$error = false;
+if ($admintest != 0) {
+ if (isset($fct) && $fct != '') {
+ if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php")) {
+
+ if ( file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php") ) {
+ include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php";
+ } else {
+ include XOOPS_ROOT_PATH."/modules/system/language/english/admin.php";
+ }
+
+ if (file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php")) {
+ include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php";
+ } elseif (file_exists(XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php")) {
+ include XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php";
+ }
+ include XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php";
+ $sysperm_handler =& xoops_gethandler('groupperm');
+ $category = !empty($modversion['category']) ? intval($modversion['category']) : 0;
+ unset($modversion);
+ if ($category > 0) {
+ $groups = $xoopsUser->getGroups();
+ if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))) {
+// if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) {
+// include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php"; GIJ
+ if (file_exists("../include/{$fct}.inc.php")) {
+ include_once "../include/{$fct}.inc.php" ;
+ } else {
+ $error = true;
+ }
+ } else {
+ $error = true;
+ }
+ } elseif ($fct == 'version') {
+ if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/version/main.php")) {
+ include_once XOOPS_ROOT_PATH."/modules/system/admin/version/main.php";
+ } else {
+ $error = true;
+ }
+ } else {
+ $error = true;
+ }
+ } else {
+ $error = true;
+ }
+ } else {
+ $error = true;
+ }
+}
+
+if (false != $error) {
+ xoops_cp_header();
+ echo "<h4>System Configuration</h4>";
+ echo '<table class="outer" cellpadding="4" cellspacing="1">';
+ echo '<tr>';
+ $groups = $xoopsUser->getGroups();
+ $all_ok = false;
+ if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
+ $sysperm_handler =& xoops_gethandler('groupperm');
+ $ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups);
+ } else {
+ $all_ok = true;
+ }
+ $admin_dir = XOOPS_ROOT_PATH."/modules/system/admin";
+ $handle = opendir($admin_dir);
+ $counter = 0;
+ $class = 'even';
+ while ($file = readdir($handle)) {
+ if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir.'/'.$file)) {
+ include $admin_dir.'/'.$file.'/xoops_version.php';
+ if ($modversion['hasAdmin']) {
+ $category = isset($modversion['category']) ? intval($modversion['category']) : 0;
+ if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) {
+ echo "<td class='$class' align='center' valign='bottom' width='19%'>";
+ echo "<a href='".XOOPS_URL."/modules/system/admin.php?fct=".$file."'><b>" .trim($modversion['name'])."</b></a>\n";
+ echo "</td>";
+ $counter++;
+ $class = ($class == 'even') ? 'odd' : 'even';
+ }
+ if ($counter > 4) {
+ $counter = 0;
+ echo "</tr>";
+ echo "<tr>";
+ }
+ }
+ unset($modversion);
+ }
+ }
+ while ($counter < 5) {
+ echo '<td class="'.$class.'"> </td>';
+ $class = ($class == 'even') ? 'odd' : 'even';
+ $counter++;
+ }
+ echo '</tr></table>';
+ xoops_cp_footer();
+}
Modified: XoopsModules/lexikon/trunk/lexikon/admin/admin_footer.php
===================================================================
--- XoopsModules/lexikon/trunk/lexikon/admin/admin_footer.php 2014-03-08 23:43:58 UTC (rev 12367)
+++ XoopsModules/lexikon/trunk/lexikon/admin/admin_footer.php 2014-03-09 09:53:17 UTC (rev 12368)
@@ -25,4 +25,4 @@
." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
."</div>";
-xoops_cp_footer();
\ No newline at end of file
+xoops_cp_footer();
Modified: XoopsModules/lexikon/trunk/lexikon/admin/category.php
===================================================================
--- XoopsModules/lexikon/trunk/lexikon/admin/category.php 2014-03-08 23:43:58 UTC (rev 12367)
+++ XoopsModules/lexikon/trunk/lexikon/admin/category.php 2014-03-09 09:53:17 UTC (rev 12368)
@@ -1,434 +1,430 @@
-<?php
-/**
- * $Id: category.php v 1.0 8 May 2004 hsalazar Exp $
- * Module: Lexikon - glossary module
- * Version: v 1.00
- * Release Date: 8 May 2004
- * Author: hsalazar
- * Licence: GNU
- */
-
-// -- General Stuff -- //
-include( "admin_header.php" );
-$myts =& MyTextSanitizer::getInstance();
-xoops_cp_header();
-xoops_load('XoopsUserUtility');
-$indexAdmin = new ModuleAdmin();
-echo $indexAdmin->addNavigation('category.php');
-$indexAdmin->addItemButton(_AM_LEXIKON_CREATECAT, 'category.php?op=addcat', 'add');
-echo $indexAdmin->renderButton('left');
-$op = '';
-
-/* -- Available operations -- */
-
-function categoryDefault() {
- $op = 'default';
- include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
- include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
-
- $startentry = isset( $_GET['startentry'] ) ? intval( $_GET['startentry'] ) : 0;
- $startcat = isset( $_GET['startcat'] ) ? intval( $_GET['startcat'] ) : 0;
- $startsub = isset( $_GET['startsub'] ) ? intval( $_GET['startsub'] ) : 0;
- $datesub = isset( $_GET['datesub'] ) ? intval( $_GET['datesub'] ) : 0;
-
- global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $entryID, $pathIcon16;
-
- $myts =& MyTextSanitizer::getInstance();
-// lx_adminMenu(1, _AM_LEXIKON_CATS);
- $result01 = $xoopsDB -> query( "SELECT COUNT(*)
- FROM " . $xoopsDB -> prefix( "lxcategories" ) . " " );
- list( $totalcategories ) = $xoopsDB -> fetchRow( $result01 );
-
- $result02 = $xoopsDB -> query( "SELECT COUNT(*)
- FROM " . $xoopsDB -> prefix( "lxentries" ) . "
- WHERE submit = 0" );
- list( $totalpublished ) = $xoopsDB -> fetchRow( $result02 );
-
- $result03 = $xoopsDB -> query( "SELECT COUNT(*)
- FROM " . $xoopsDB -> prefix( "lxentries" ) . "
- WHERE submit = '1' AND request = '0' " );
- list( $totalsubmitted ) = $xoopsDB -> fetchRow( $result03 );
-
- $result04 = $xoopsDB -> query( "SELECT COUNT(*)
- FROM " . $xoopsDB -> prefix( "lxentries" ) . "
- WHERE submit = '1' AND request = '1' " );
- list( $totalrequested ) = $xoopsDB -> fetchRow( $result04 );
-
-// echo "<table width='100%' class='outer' style=\"margin-top: 6px; clear:both;\" cellspacing='2' cellpadding='3' border='0' ><tr>";
-// echo "<td class='odd'>" . _AM_LEXIKON_TOTALENTRIES . "</td><td align='center' class='even'>" . $totalpublished . "</td>";
-// if ($xoopsModuleConfig['multicats'] == 1) {
-// echo "<td class='odd'>" . _AM_LEXIKON_TOTALCATS . "</td><td align='center' class='even'>" . $totalcategories . "</td>";
-// }
-// echo "<td class='odd'>" . _AM_LEXIKON_TOTALSUBM . "</td><td align='center' class='even'>" . $totalsubmitted . "</td>
-// <td class='odd'>" . _AM_LEXIKON_TOTALREQ . "</td><td align='center' class='even'>" . $totalrequested . "</td>
-// </tr></table>
-// <br /><br />";
-
- if ($xoopsModuleConfig['multicats'] == 1) {
- /**
- * Code to show existing categories
- **/
-
- echo" <table class='outer' width='100%' border='0'>
- <tr>
- <td colspan='7' class='odd'>
- <strong>". _AM_LEXIKON_SHOWCATS . ' (' . $totalcategories . ')'. "</strong></td></TR>";
- echo "<tr>";
- // create existing columns table //doppio
- $resultC1 = $xoopsDB -> query( "SELECT COUNT(*)
- FROM " . $xoopsDB -> prefix( "lxcategories" ) . " " );
- list( $numrows ) = $xoopsDB -> fetchRow( $resultC1 );
-
- $sql = "SELECT *
- FROM " . $xoopsDB -> prefix( "lxcategories" ) . "
- ORDER BY weight";
- $resultC2 = $xoopsDB -> query( $sql, $xoopsModuleConfig['perpage'], $startcat );
-
- echo "<th width='40' align='center'><b>" . _AM_LEXIKON_ID . "</b></td>
- <th align='center'><b>" . _AM_LEXIKON_WEIGHT . "</b></td>
- <th width='30%' align='center'><b>" . _AM_LEXIKON_CATNAME . "</b></td>
- <th width='10' align='center'><b>" . _AM_LEXIKON_ENTRIES . "</b></td>
- <th width='*' align='center'><b>" . _AM_LEXIKON_DESCRIP . "</b></td>
- <th width='60' align='center'><b>" . _AM_LEXIKON_ACTION . "</b></td>
- </tr>";
-
-
- $class = "odd";
- if ( $numrows > 0 ) // That is, if there ARE columns in the system
- {
- while ( list( $categoryID, $name, $description, $total, $weight ) = $xoopsDB -> fetchrow( $resultC2 ) )
- //while ( list( $categoryID, $name, $description, $total, $weight, ) = $xoopsDB -> fetchrow( $resultC2 ) )
- {
- $name = $myts -> htmlSpecialChars( $name );
-// $description = $myts -> htmlSpecialChars(xoops_substr( strip_tags( $description ),0,60));
- $description = strip_tags(htmlspecialchars_decode($description));
- $modify = "<a href='category.php?op=mod&categoryID=" . $categoryID . "'><img src=" . $pathIcon16."/edit.png width='16' height='16' ALT='"._AM_LEXIKON_EDITCAT."'></a>";
- $delete = "<a href='category.php?op=del&categoryID=" . $categoryID . "'><img src=" . $pathIcon16."/delete.png width='16' height='16' ALT='"._AM_LEXIKON_DELETECAT."'></a>";
-
- echo "<tr class='" . $class . "'>";
- $class = ($class == "even") ? "odd" : "even";
-
- echo "
- <td align='center'>" . $categoryID . "</td>
- <td width='10' align='center'>" . $weight . "</td>
- <td align='left'><a href='../category.php?categoryID=" . $categoryID . "'>" . $name . "</td>
- <td align='left'>" . $total . "</td>
- <td align='left'>" . $description . "</td>
- <td align='center'> $modify $delete </td>
- </tr></DIV>";
- }
- }
- else // that is, $numrows = 0, there's no columns yet
- {
- echo "<tr>";
- echo "<td class='odd' align='center' colspan= '7'>"._AM_LEXIKON_NOCATS."</td>";
- echo "</tr></DIV>";
- $categoryID = '0';
- }
- echo "</table>\n";
- $pagenav = new XoopsPageNav( $numrows, $xoopsModuleConfig['perpage'], $startcat, 'startcat' );
- echo '<div style="text-align:right;">' . $pagenav -> renderNav(8) . '</div>';
- echo "<br /><br />\n";
- echo "</div>";
- } else {
- redirect_header( "index.php", 1, sprintf( _AM_LEXIKON_SINGLECAT, '' ) );
- }
-}
-
-/**
- * Code to edit categories
- **/
-function categoryEdit( $categoryID = '' ) {
- include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
- include_once XOOPS_ROOT_PATH."/class/uploader.php";
- include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
-
- $weight = 1;
- $name = '';
- $description = '';
- $logourl = '';
-
- Global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule;
-
- // If there is a parameter, and the id exists, retrieve data: we're editing a column
- if ( $categoryID ) {
- $result = $xoopsDB -> query( "
- SELECT categoryID, name, description, total, weight,logourl
- FROM " . $xoopsDB -> prefix( "lxcategories" ) . "
- WHERE categoryID = '$categoryID'" );
-
- list( $categoryID, $name, $description, $total, $weight, $logourl ) = $xoopsDB -> fetchrow( $result );
- $myts =& MyTextSanitizer::getInstance();
- $name = $myts->htmlSpecialChars($name);
- //permissions
- $member_handler = & xoops_gethandler('member');
- $group_list = & $member_handler -> getGroupList();
- $gperm_handler = & xoops_gethandler('groupperm');
-
- $groups = $gperm_handler -> getGroupIds("lexikon_view", $categoryID, $xoopsModule -> getVar('mid'));
- $groups = $groups;
- if ( $xoopsDB -> getRowsNum( $result ) == 0 ) {
- redirect_header( "index.php", 1, _AM_LEXIKON_NOCATTOEDIT );
- exit();
- }
- if ( $xoopsDB -> getRowsNum( $result ) == 0 ) {
- redirect_header( "index.php", 1, _AM_LEXIKON_NOCATTOEDIT );
- exit();
- }
- //$myts =& MyTextSanitizer::getInstance();
-// lx_adminMenu(1, _AM_LEXIKON_CATS);
-
- echo "<h3 style=\"color: #2F5376; margin-top: 6px; \">" . _AM_LEXIKON_CATSHEADER . "</h3>";
- $sform = new XoopsThemeForm( _AM_LEXIKON_MODCAT . ": $name" , "op", xoops_getenv( 'PHP_SELF' ) );
- } else {
- //$myts =& MyTextSanitizer::getInstance();
-// lx_adminMenu(1, _AM_LEXIKON_CATS);
- $groups = true;
- echo "<h3 style=\"color: #2F5376; margin-top: 6px; \">" . _AM_LEXIKON_CATSHEADER . "</h3>";
- $sform = new XoopsThemeForm( _AM_LEXIKON_NEWCAT, "op", xoops_getenv( 'PHP_SELF' ) );
- }
-
- $sform -> setExtra( 'enctype="multipart/form-data"' );
- $sform -> addElement( new XoopsFormText( _AM_LEXIKON_CATNAME, 'name', 50, 80, $name ), true );
-
- $editor = lx_getWysiwygForm( _AM_LEXIKON_CATDESCRIPT, 'description', $description, 7, 60 );
- $sform -> addElement( $editor,true );
- unset($editor);
-
- $sform -> addElement( new XoopsFormText( _AM_LEXIKON_CATPOSIT, 'weight', 4, 4, $weight ), true );
- $sform -> addElement( new XoopsFormHidden( 'categoryID', $categoryID ) );
- //CategoryImage
- if ($xoopsModuleConfig['useshots'] == 1) {
- //CategoryImage :: Common querys from Article module by phppp
- $image_option_tray = new XoopsFormElementTray("<b>"._AM_LEXIKON_CATIMGUPLOAD."</b>", "<br />");
- $image_option_tray->addElement(new XoopsFormFile("", "userfile",""));
- $sform->addElement($image_option_tray);
- unset($image_tray);
- unset($image_option_tray);
-
- $path_catimg = "modules/".$xoopsModule->getVar('dirname')."/images/uploads";
- $image_option_tray = new XoopsFormElementTray(_AM_LEXIKON_CATIMAGE."<br />"._AM_LEXIKON_CATIMG_DSC."<br />".$path_catimg, "<br />");
- //$image_option_tray = new XoopsFormElementTray(_AM_LEXIKON_CATIMAGE.'');
- $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/".$path_catimg."/");
- array_unshift($image_array, _NONE);
-
- $image_select = new XoopsFormSelect("", "logourl", $logourl);
- $image_select->addOptionArray($image_array);
- $image_select->setExtra("onchange=\"showImgSelected('img', 'logourl', '/".$path_catimg."/', '', '" . XOOPS_URL . "')\"");
- $image_tray = new XoopsFormElementTray("", " ");
- $image_tray->addElement($image_select);
- if (!empty($logourl) && file_exists(XOOPS_ROOT_PATH . "/" .$path_catimg."/" . $logourl)){
- $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 4px;\"><img src=\"" . XOOPS_URL . "/" .$path_catimg."/" . $logourl . "\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
- } else {
- $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 4px;\"><img src=\"" . XOOPS_URL . "/" .$path_catimg."/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
- }
- $image_option_tray->addElement($image_tray);
- $sform->addElement($image_option_tray);
- }
- $sform -> addElement(new XoopsFormSelectGroup(_AM_LEXIKON_CAT_GROUPSVIEW, "groups", true, $groups, 5, true));
-
- $button_tray = new XoopsFormElementTray( '', '' );
- $hidden = new XoopsFormHidden( 'op', 'addcategory' );
- $button_tray -> addElement( $hidden );
-
- // No ID for column -- then it's new column, button says 'Create'
- if ( !$categoryID ) {
- $butt_create = new XoopsFormButton( '', '', _AM_LEXIKON_CREATE, 'submit' );
- $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
- $button_tray->addElement( $butt_create );
-
- $butt_clear = new XoopsFormButton( '', '', _AM_LEXIKON_CLEAR, 'reset' );
- $button_tray->addElement( $butt_clear );
-
- $butt_cancel = new XoopsFormButton( '', '', _AM_LEXIKON_CANCEL, 'button' );
- $butt_cancel->setExtra('onclick="history.go(-1)"');
- $button_tray->addElement( $butt_cancel );
- } else // button says 'Update'
- {
- $butt_create = new XoopsFormButton( '', '', _AM_LEXIKON_MODIFY, 'submit' );
- $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
- $button_tray->addElement( $butt_create );
-
- $butt_cancel = new XoopsFormButton( '', '', _AM_LEXIKON_CANCEL, 'button' );
- $butt_cancel->setExtra('onclick="history.go(-1)"');
- $button_tray->addElement( $butt_cancel );
- }
-
- $sform -> addElement( $button_tray );
- $sform -> display();
- unset( $hidden );
-// xoops_cp_footer();
-// break;
-}
-
-/**
- * Code to delete existing categories
- **/
-function categoryDelete($categoryID = '') {
- //global $xoopsDB, $xoopsConfig;
- global $xoopsConfig, $xoopsDB, $xoopsModule;
- $idc = isset($_POST['categoryID']) ? intval($_POST['categoryID']) : intval($_GET['categoryID']);
- if ($idc == '') $idc = $_GET['categoryID'];
- if ($idc <= 0) {
- header('location: category.php');
- die();
- }
-
- $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0;
- $result = $xoopsDB -> query( "SELECT categoryID, name FROM " . $xoopsDB -> prefix( "lxcategories" ) . " WHERE categoryID = $idc" );
- list( $categoryID, $name ) = $xoopsDB -> fetchrow( $result );
- // confirmed, so delete
- if ( $ok == 1 ) {
- //get all entries in the category
- $result3=$xoopsDB->query("SELECT entryID from ".$xoopsDB->prefix("lxentries")." where categoryID = $idc");
- //now for each entry, delete the coments
- while ( list($entryID)=$xoopsDB->fetchRow($result3) ) {
- xoops_comment_delete($xoopsModule->getVar('mid'), $entryID);
- xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'term', $entryID);
- }
- $xoopsDB->query("DELETE FROM ".$xoopsDB->prefix('lxcategories')." WHERE categoryID='$idc'");
- $result2 = $xoopsDB -> query( "DELETE FROM " .$xoopsDB -> prefix("lxentries")." WHERE categoryID = $idc");
- // remove permissions
- xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_view', $categoryID);
- xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_submit', $categoryID);
- xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_approve', $categoryID);
- xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_request', $categoryID);
- // delete notifications
- xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'global', $categoryID);
- xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $categoryID);
-
- redirect_header("category.php",1,sprintf( _AM_LEXIKON_CATISDELETED, $name ) );
- exit();
- } else {
- //xoops_cp_header();
- xoops_confirm(array('op' => 'del', 'categoryID' => $categoryID, 'ok' => 1, 'name' => $name ), 'category.php', _AM_LEXIKON_DELETETHISCAT . "<br /><br>" . $name, _AM_LEXIKON_DELETE );
- }
-}
-
-
-
-function categorySave ($categoryID = '') {
- include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
- include_once XOOPS_ROOT_PATH."/class/uploader.php";
- Global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule, $xoopsDB, $myts, $categoryID;
- //print_r ($_POST);
- $categoryID = isset( $_POST['categoryID'] ) ? intval( $_POST['categoryID'] ) : intval( $_GET['categoryID'] );
- $weight = isset($_POST['weight'] ) ? intval($_POST['weight']) : intval($_GET['weight']);
- $name = isset($_POST['name'] ) ? htmlSpecialChars($_POST['name']) : htmlSpecialChars($_GET['name']);
- $description = isset($_POST['description'] ) ? htmlSpecialChars($_POST['description']) : htmlSpecialChars($_GET['description']);
- //$description = $myts->xoopsCodeDecode($description, $allowimage = 0);
- $description = $myts -> xoopsCodeDecode($myts->censorString($description), $allowimage = 1);
- $name = $myts->addSlashes($_POST['name']);
- $logourl = $myts->addSlashes($_POST["logourl"]);
- $groups = isset($_POST['groups']) ? $_POST['groups'] : array();
- // image upload
- $logourl = "";
- $maxfilesize = 30000;
- $maxfilewidth = 128;
- $maxfileheight = 128;
- if (!empty($_FILES['userfile']['name'])) {
- $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
- $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH ."/modules/".$xoopsModule->getVar('dirname')."/images/uploads/", $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
- if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
- if (!$uploader->upload()) {
- echo $uploader->getErrors();
- } else {
- echo '<h4>'._AM_LEXIKON_FILESUCCESS.'</h4>';
- $logourl = $uploader->getSavedFileName();
- }
- } else {
- echo $uploader->getErrors();
- }
- }
- $logourl = empty($logourl)?(empty($_POST['logourl'])?"":$_POST['logourl']):$logourl;
-
- // Run the query and update the data
- if ( !$_POST['categoryID'] ) {
- if ( $xoopsDB -> query( "INSERT INTO " . $xoopsDB -> prefix( "lxcategories" ) . " (categoryID, name, description, weight, logourl)
- VALUES ('', '$name', '$description', '$weight', '$logourl')" ) ) {
- $newid = $xoopsDB->getInsertId();
- // Increment author's posts count (only if it's a new definition)
- if (is_object($xoopsUser) && empty($categoryID)) {
- $member_handler = &xoops_gethandler('member');
- $submitter =& $member_handler -> getUser($uid);
- if (is_object($submitter) ) {
- $submitter -> setVar('posts',$submitter -> getVar('posts') + 1);
- $res=$member_handler -> insertUser($submitter, true);
- unset($submitter);
- }
- }
- //notification
- if(!empty($xoopsModuleConfig['notification_enabled']) ){
- if ($newid == 0) {
- $newid = $xoopsDB -> getInsertId();
- }
- global $xoopsModule;
- $notification_handler =& xoops_gethandler('notification');
- $tags = array();
- $tags['ITEM_NAME'] = $name;
- $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/category.php?categoryID=' . $newid;
- $notification_handler->triggerEvent( 'global', 0, 'new_category', $tags);
- }
- lx_save_Permissions($groups, $categoryID, "lexikon_view");
- redirect_header( "category.php", 1, _AM_LEXIKON_CATCREATED );
- exit();
- } else {
- redirect_header( "index.php", 1, _AM_LEXIKON_NOTUPDATED );
- exit();
- }
- } else {
- if ( $xoopsDB -> queryF( "
- UPDATE " . $xoopsDB -> prefix( "lxcategories" ) . "
- SET name = '$name', description = '$description', weight = '$weight' , logourl = '$logourl'
- WHERE categoryID = '$categoryID'" ) ) {
- lx_save_Permissions($groups, $categoryID, "lexikon_view");
- redirect_header( "category.php", 1, _AM_LEXIKON_CATMODIFIED );
- exit();
- } else {
- redirect_header( "index.php", 1, _AM_LEXIKON_NOTUPDATED );
- exit();
- }
- }
-}
-
-
-/**
- * Available operations
- **/
-
-$op = 'default';
-if (isset($_POST['op'])) {
- $op=$_POST['op'];
-} else {
- if (isset($_GET['op'])) {
- $op=$_GET['op'];
- }
-}
-
-
-switch ( $op ) {
-case "mod":
- $categoryID = isset( $_POST['categoryID'] ) ? intval( $_POST['categoryID'] ) : intval( $_GET['categoryID'] );
- categoryEdit( $categoryID );
- break;
-
-case "addcat":
- categoryEdit();
- break;
-
-case "addcategory":
- categorySave();
- break;
-
-case "del":
- categoryDelete();
- break;
-
-
-case "default":
-default:
- categoryDefault();
- break;
-}
-xoops_cp_footer();
-?>
\ No newline at end of file
+<?php
+/**
+ * $Id: category.php v 1.0 8 May 2004 hsalazar Exp $
+ * Module: Lexikon - glossary module
+ * Version: v 1.00
+ * Release Date: 8 May 2004
+ * Author: hsalazar
+ * Licence: GNU
+ */
+
+// -- General Stuff -- //
+include 'admin_header.php';
+$myts =& MyTextSanitizer::getInstance();
+xoops_cp_header();
+xoops_load('XoopsUserUtility');
+$indexAdmin = new ModuleAdmin();
+echo $indexAdmin->addNavigation('category.php');
+$indexAdmin->addItemButton(_AM_LEXIKON_CREATECAT, 'category.php?op=addcat', 'add');
+echo $indexAdmin->renderButton('left');
+$op = '';
+
+/* -- Available operations -- */
+
+function categoryDefault()
+{
+ $op = 'default';
+ include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
+ include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
+
+ $startentry = isset( $_GET['startentry'] ) ? intval( $_GET['startentry'] ) : 0;
+ $startcat = isset( $_GET['startcat'] ) ? intval( $_GET['startcat'] ) : 0;
+ $startsub = isset( $_GET['startsub'] ) ? intval( $_GET['startsub'] ) : 0;
+ $datesub = isset( $_GET['datesub'] ) ? intval( $_GET['datesub'] ) : 0;
+
+ global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $entryID, $pathIcon16;
+
+ $myts =& MyTextSanitizer::getInstance();
+// lx_adminMenu(1, _AM_LEXIKON_CATS);
+ $result01 = $xoopsDB -> query( "SELECT COUNT(*)
+ FROM " . $xoopsDB -> prefix( "lxcategories" ) . " " );
+ list( $totalcategories ) = $xoopsDB -> fetchRow( $result01 );
+
+ $result02 = $xoopsDB -> query( "SELECT COUNT(*)
+ FROM " . $xoopsDB -> prefix( "lxentries" ) . "
+ WHERE submit = 0" );
+ list( $totalpublished ) = $xoopsDB -> fetchRow( $result02 );
+
+ $result03 = $xoopsDB -> query( "SELECT COUNT(*)
+ FROM " . $xoopsDB -> prefix( "lxentries" ) . "
+ WHERE submit = '1' AND request = '0' " );
+ list( $totalsubmitted ) = $xoopsDB -> fetchRow( $result03 );
+
+ $result04 = $xoopsDB -> query( "SELECT COUNT(*)
+ FROM " . $xoopsDB -> prefix( "lxentries" ) . "
+ WHERE submit = '1' AND request = '1' " );
+ list( $totalrequested ) = $xoopsDB -> fetchRow( $result04 );
+
+// echo "<table width='100%' class='outer' style=\"margin-top: 6px; clear:both;\" cellspacing='2' cellpadding='3' border='0' ><tr>";
+// echo "<td class='odd'>" . _AM_LEXIKON_TOTALENTRIES . "</td><td align='center' class='even'>" . $totalpublished . "</td>";
+// if ($xoopsModuleConfig['multicats'] == 1) {
+// echo "<td class='odd'>" . _AM_LEXIKON_TOTALCATS . "</td><td align='center' class='even'>" . $totalcategories . "</td>";
+// }
+// echo "<td class='odd'>" . _AM_LEXIKON_TOTALSUBM . "</td><td align='center' class='even'>" . $totalsubmitted . "</td>
+// <td class='odd'>" . _AM_LEXIKON_TOTALREQ . "</td><td align='center' class='even'>" . $totalrequested . "</td>
+// </tr></table>
+// <br /><br />";
+
+ if ($xoopsModuleConfig['multicats'] == 1) {
+ /**
+ * Code to show existing categories
+ **/
+
+ echo" <table class='outer' width='100%' border='0'>
+ <tr>
+ <td colspan='7' class='odd'>
+ <strong>". _AM_LEXIKON_SHOWCATS . ' (' . $totalcategories . ')'. "</strong></td></TR>";
+ echo "<tr>";
+ // create existing columns table //doppio
+ $resultC1 = $xoopsDB -> query( "SELECT COUNT(*)
+ FROM " . $xoopsDB -> prefix( "lxcategories" ) . " " );
+ list( $numrows ) = $xoopsDB -> fetchRow( $resultC1 );
+
+ $sql = "SELECT *
+ FROM " . $xoopsDB -> prefix( "lxcategories" ) . "
+ ORDER BY weight";
+ $resultC2 = $xoopsDB -> query( $sql, $xoopsModuleConfig['perpage'], $startcat );
+
+ echo "<th width='40' align='center'><b>" . _AM_LEXIKON_ID . "</b></td>
+ <th align='center'><b>" . _AM_LEXIKON_WEIGHT . "</b></td>
+ <th width='30%' align='center'><b>" . _AM_LEXIKON_CATNAME . "</b></td>
+ <th width='10' align='center'><b>" . _AM_LEXIKON_ENTRIES . "</b></td>
+ <th width='*' align='center'><b>" . _AM_LEXIKON_DESCRIP . "</b></td>
+ <th width='60' align='center'><b>" . _AM_LEXIKON_ACTION . "</b></td>
+ </tr>";
+
+ $class = "odd";
+ if ($numrows > 0) { // That is, if there ARE columns in the system
+ while ( list( $categoryID, $name, $description, $total, $weight ) = $xoopsDB -> fetchrow( $resultC2 ) )
+ //while ( list( $categoryID, $name, $description, $total, $weight, ) = $xoopsDB -> fetchrow( $resultC2 ) ) {
+ $name = $myts -> htmlSpecialChars( $name );
+// $description = $myts -> htmlSpecialChars(xoops_substr( strip_tags( $description ),0,60));
+ $description = strip_tags(htmlspecialchars_decode($description));
+ $modify = "<a href='category.php?op=mod&categoryID=" . $categoryID . "'><img src=" . $pathIcon16."/edit.png width='16' height='16' ALT='"._AM_LEXIKON_EDITCAT."'></a>";
+ $delete = "<a href='category.php?op=del&categoryID=" . $categoryID . "'><img src=" . $pathIcon16."/delete.png width='16' height='16' ALT='"._AM_LEXIKON_DELETECAT."'></a>";
+
+ echo "<tr class='" . $class . "'>";
+ $class = ($class == "even") ? "odd" : "even";
+
+ echo "
+ <td align='center'>" . $categoryID . "</td>
+ <td width='10' align='center'>" . $weight . "</td>
+ <td align='left'><a href='../category.php?categoryID=" . $categoryID . "'>" . $name . "</td>
+ <td align='left'>" . $total . "</td>
+ <td align='left'>" . $description . "</td>
+ <td align='center'> $modify $delete </td>
+ </tr></DIV>";
+
+ } else { // that is, $numrows = 0, there's no columns yet
+ echo "<tr>";
+ echo "<td class='odd' align='center' colspan= '7'>"._AM_LEXIKON_NOCATS."</td>";
+ echo "</tr></DIV>";
+ $categoryID = '0';
+ }
+ echo "</table>\n";
+ $pagenav = new XoopsPageNav( $numrows, $xoopsModuleConfig['perpage'], $startcat, 'startcat' );
+ echo '<div style="text-align:right;">' . $pagenav -> renderNav(8) . '</div>';
+ echo "<br /><br />\n";
+ echo "</div>";
+ } else {
+ redirect_header( "index.php", 1, sprintf( _AM_LEXIKON_SINGLECAT, '' ) );
+ }
+}
+
+/**
+ * Code to edit categories
+ **/
+function categoryEdit( $categoryID = '' )
+{
+ include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
+ include_once XOOPS_ROOT_PATH."/class/uploader.php";
+ include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
+
+ $weight = 1;
+ $name = '';
+ $description = '';
+ $logourl = '';
+
+ Global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule;
+
+ // If there is a parameter, and the id exists, retrieve data: we're editing a column
+ if ($categoryID) {
+ $result = $xoopsDB -> query( "
+ SELECT categoryID, name, description, total, weight,logourl
+ FROM " . $xoopsDB -> prefix( "lxcategories" ) . "
+ WHERE categoryID = '$categoryID'" );
+
+ list( $categoryID, $name, $description, $total, $weight, $logourl ) = $xoopsDB -> fetchrow( $result );
+ $myts =& MyTextSanitizer::getInstance();
+ $name = $myts->htmlSpecialChars($name);
+ //permissions
+ $member_handler = & xoops_gethandler('member');
+ $group_list = & $member_handler -> getGroupList();
+ $gperm_handler = & xoops_gethandler('groupperm');
+
+ $groups = $gperm_handler -> getGroupIds("lexikon_view", $categoryID, $xoopsModule -> getVar('mid'));
+// $groups = $groups;
+ if ( $xoopsDB -> getRowsNum( $result ) == 0 ) {
+ redirect_header( "index.php", 1, _AM_LEXIKON_NOCATTOEDIT );
+ exit();
+ }
+ if ( $xoopsDB -> getRowsNum( $result ) == 0 ) {
+ redirect_header( "index.php", 1, _AM_LEXIKON_NOCATTOEDIT );
+ exit();
+ }
+ //$myts =& MyTextSanitizer::getInstance();
+// lx_adminMenu(1, _AM_LEXIKON_CATS);
+
+ echo "<h3 style=\"color: #2F5376; margin-top: 6px; \">" . _AM_LEXIKON_CATSHEADER . "</h3>";
+ $sform = new XoopsThemeForm( _AM_LEXIKON_MODCAT . ": $name" , "op", xoops_getenv( 'PHP_SELF' ) );
+ } else {
+ //$myts =& MyTextSanitizer::getInstance();
+// lx_adminMenu(1, _AM_LEXIKON_CATS);
+ $groups = true;
+ echo "<h3 style=\"color: #2F5376; margin-top: 6px; \">" . _AM_LEXIKON_CATSHEADER . "</h3>";
+ $sform = new XoopsThemeForm( _AM_LEXIKON_NEWCAT, "op", xoops_getenv( 'PHP_SELF' ) );
+ }
+
+ $sform -> setExtra( 'enctype="multipart/form-data"' );
+ $sform -> addElement( new XoopsFormText( _AM_LEXIKON_CATNAME, 'name', 50, 80, $name ), true );
+
+ $editor = lx_getWysiwygForm( _AM_LEXIKON_CATDESCRIPT, 'description', $description, 7, 60 );
+ $sform -> addElement( $editor,true );
+ unset($editor);
+
+ $sform -> addElement( new XoopsFormText( _AM_LEXIKON_CATPOSIT, 'weight', 4, 4, $weight ), true );
+ $sform -> addElement( new XoopsFormHidden( 'categoryID', $categoryID ) );
+ //CategoryImage
+ if ($xoopsModuleConfig['useshots'] == 1) {
+ //CategoryImage :: Common querys from Article module by phppp
+ $image_option_tray = new XoopsFormElementTray("<b>"._AM_LEXIKON_CATIMGUPLOAD."</b>", "<br />");
+ $image_option_tray->addElement(new XoopsFormFile("", "userfile",""));
+ $sform->addElement($image_option_tray);
+ unset($image_tray);
+ unset($image_option_tray);
+
+ $path_catimg = "modules/".$xoopsModule->getVar('dirname')."/images/uploads";
+ $image_option_tray = new XoopsFormElementTray(_AM_LEXIKON_CATIMAGE."<br />"._AM_LEXIKON_CATIMG_DSC."<br />".$path_catimg, "<br />");
+ //$image_option_tray = new XoopsFormElementTray(_AM_LEXIKON_CATIMAGE.'');
+ $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/".$path_catimg."/");
+ array_unshift($image_array, _NONE);
+
+ $image_select = new XoopsFormSelect("", "logourl", $logourl);
+ $image_select->addOptionArray($image_array);
+ $image_select->setExtra("onchange=\"showImgSelected('img', 'logourl', '/".$path_catimg."/', '', '" . XOOPS_URL . "')\"");
+ $image_tray = new XoopsFormElementTray("", " ");
+ $image_tray->addElement($image_select);
+ if (!empty($logourl) && file_exists(XOOPS_ROOT_PATH . "/" .$path_catimg."/" . $logourl)) {
+ $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 4px;\"><img src=\"" . XOOPS_URL . "/" .$path_catimg."/" . $logourl . "\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
+ } else {
+ $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 4px;\"><img src=\"" . XOOPS_URL . "/" .$path_catimg."/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>"));
+ }
+ $image_option_tray->addElement($image_tray);
+ $sform->addElement($image_option_tray);
+ }
+ $sform -> addElement(new XoopsFormSelectGroup(_AM_LEXIKON_CAT_GROUPSVIEW, "groups", true, $groups, 5, true));
+
+ $button_tray = new XoopsFormElementTray( '', '' );
+ $hidden = new XoopsFormHidden( 'op', 'addcategory' );
+ $button_tray -> addElement( $hidden );
+
+ // No ID for column -- then it's new column, button says 'Create'
+ if (!$categoryID) {
+ $butt_create = new XoopsFormButton( '', '', _AM_LEXIKON_CREATE, 'submit' );
+ $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
+ $button_tray->addElement( $butt_create );
+
+ $butt_clear = new XoopsFormButton( '', '', _AM_LEXIKON_CLEAR, 'reset' );
+ $button_tray->addElement( $butt_clear );
+
+ $butt_cancel = new XoopsFormButton( '', '', _AM_LEXIKON_CANCEL, 'button' );
+ $butt_cancel->setExtra('onclick="history.go(-1)"');
+ $button_tray->addElement( $butt_cancel );
+ } else { // button says 'Update'
+ $butt_create = new XoopsFormButton( '', '', _AM_LEXIKON_MODIFY, 'submit' );
+ $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
+ $button_tray->addElement( $butt_create );
+
+ $butt_cancel = new XoopsFormButton( '', '', _AM_LEXIKON_CANCEL, 'button' );
+ $butt_cancel->setExtra('onclick="history.go(-1)"');
+ $button_tray->addElement( $butt_cancel );
+ }
+
+ $sform -> addElement( $button_tray );
+ $sform -> display();
+ unset( $hidden );
+// xoops_cp_footer();
+// break;
+}
+
+/**
+ * Code to delete existing categories
+ **/
+function categoryDelete($categoryID = '')
+{
+ //global $xoopsDB, $xoopsConfig;
+ global $xoopsConfig, $xoopsDB, $xoopsModule;
+ $idc = isset($_POST['categoryID']) ? intval($_POST['categoryID']) : intval($_GET['categoryID']);
+ if ($idc == '') $idc = $_GET['categoryID'];
+ if ($idc <= 0) {
+ header('location: category.php');
+ die();
+ }
+
+ $ok = isset($_POST['ok']) ? intval($_POST['ok']) : 0;
+ $result = $xoopsDB -> query( "SELECT categoryID, name FROM " . $xoopsDB -> prefix( "lxcategories" ) . " WHERE categoryID = $idc" );
+ list( $categoryID, $name ) = $xoopsDB -> fetchrow( $result );
+ // confirmed, so delete
+ if ($ok == 1) {
+ //get all entries in the category
+ $result3=$xoopsDB->query("SELECT entryID from ".$xoopsDB->prefix("lxentries")." where categoryID = $idc");
+ //now for each entry, delete the coments
+ while ( list($entryID)=$xoopsDB->fetchRow($result3) ) {
+ xoops_comment_delete($xoopsModule->getVar('mid'), $entryID);
+ xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'term', $entryID);
+ }
+ $xoopsDB->query("DELETE FROM ".$xoopsDB->prefix('lxcategories')." WHERE categoryID='$idc'");
+ $result2 = $xoopsDB -> query( "DELETE FROM " .$xoopsDB -> prefix("lxentries")." WHERE categoryID = $idc");
+ // remove permissions
+ xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_view', $categoryID);
+ xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_submit', $categoryID);
+ xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_approve', $categoryID);
+ xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_request', $categoryID);
+ // delete notifications
+ xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'global', $categoryID);
+ xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $categoryID);
+
+ redirect_header("category.php",1,sprintf( _AM_LEXIKON_CATISDELETED, $name ) );
+ exit();
+ } else {
+ //xoops_cp_header();
+ xoops_confirm(array('op' => 'del', 'categoryID' => $categoryID, 'ok' => 1, 'name' => $name ), 'category.php', _AM_LEXIKON_DELETETHISCAT . "<br /><br>" . $name, _AM_LEXIKON_DELETE );
+ }
+}
+
+
+
+function categorySave ($categoryID = '')
+{
+ include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
+ include_once XOOPS_ROOT_PATH."/class/uploader.php";
+ Global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule, $xoopsDB, $myts, $categoryID;
+ //print_r ($_POST);
+ $categoryID = isset( $_POST['categoryID'] ) ? intval( $_POST['categoryID'] ) : intval( $_GET['categoryID'] );
+ $weight = isset($_POST['weight'] ) ? intval($_POST['weight']) : intval($_GET['weight']);
+ $name = isset($_POST['name'] ) ? htmlSpecialChars($_POST['name']) : htmlSpecialChars($_GET['name']);
+ $description = isset($_POST['description'] ) ? htmlSpecialChars($_POST['description']) : htmlSpecialChars($_GET['description']);
+ //$description = $myts->xoopsCodeDecode($description, $allowimage = 0);
+ $description = $myts -> xoopsCodeDecode($myts->censorString($description), $allowimage = 1);
+ $name = $myts->addSlashes($_POST['name']);
+ $logourl = $myts->addSlashes($_POST["logourl"]);
+ $groups = isset($_POST['groups']) ? $_POST['groups'] : array();
+ // image upload
+ $logourl = "";
+ $maxfilesize = 30000;
+ $maxfilewidth = 128;
+ $maxfileheight = 128;
+ if (!empty($_FILES['userfile']['name'])) {
+ $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
+ $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH ."/modules/".$xoopsModule->getVar('dirname')."/images/uploads/", $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
+ if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
+ if (!$uploader->upload()) {
+ echo $uploader->getErrors();
+ } else {
+ echo '<h4>'._AM_LEXIKON_FILESUCCESS.'</h4>';
+ $logourl = $uploader->getSavedFileName();
+ }
+ } else {
+ echo $uploader->getErrors();
+ }
+ }
+ $logourl = empty($logourl)?(empty($_POST['logourl'])?"":$_POST['logourl']):$logourl;
+
+ // Run the query and update the data
+ if (!$_POST['categoryID']) {
+ if ( $xoopsDB -> query( "INSERT INTO " . $xoopsDB -> prefix( "lxcategories" ) . " (categoryID, name, description, weight, logourl)
+ VALUES ('', '$name', '$description', '$weight', '$logourl')" ) ) {
+ $newid = $xoopsDB->getInsertId();
+ // Increment author's posts count (only if it's a new definition)
+ if (is_object($xoopsUser) && empty($categoryID)) {
+ $member_handler = &xoops_gethandler('member');
+ $submitter =& $member_handler -> getUser($uid);
+ if (is_object($submitter) ) {
+ $submitter -> setVar('posts',$submitter -> getVar('posts') + 1);
+ $res=$member_handler -> insertUser($submitter, true);
+ unset($submitter);
+ }
+ }
+ //notification
+ if (!empty($xoopsModuleConfig['notification_enabled']) ) {
+ if ($newid == 0) {
+ $newid = $xoopsDB -> getInsertId();
+ }
+ global $xoopsModule;
+ $notification_handler =& xoops_gethandler('notification');
+ $tags = array();
+ $tags['ITEM_NAME'] = $name;
+ $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/category.php?categoryID=' . $newid;
+ $notification_handler->triggerEvent( 'global', 0, 'new_category', $tags);
+ }
+ lx_save_Permissions($groups, $categoryID, "lexikon_view");
+ redirect_header( "category.php", 1, _AM_LEXIKON_CATCREATED );
+ exit();
+ } else {
+ redirect_header( "index.php", 1, _AM_LEXIKON_NOTUPDATED );
+ exit();
+ }
+ } else {
+ if ( $xoopsDB -> queryF( "
+ ...
[truncated message content] |