[xoops-cvslog 396] CVS update: xoops2jp/html

Back to archive index

onokazu onoka****@users*****
2005年 9月 5日 (月) 05:46:09 JST


Index: xoops2jp/html/footer.php
diff -u xoops2jp/html/footer.php:1.4 xoops2jp/html/footer.php:1.5
--- xoops2jp/html/footer.php:1.4	Wed Aug  3 21:39:11 2005
+++ xoops2jp/html/footer.php	Mon Sep  5 05:46:08 2005
@@ -1,88 +1,91 @@
-<?php
-// $Id: footer.php,v 1.4 2005/08/03 12:39:11 onokazu 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 //
-//  ------------------------------------------------------------------------ //
-
-if ( !defined("XOOPS_FOOTER_INCLUDED") ) {
-    define("XOOPS_FOOTER_INCLUDED",1);
-    $xoopsLogger->stopTime();
-    if ($xoopsOption['theme_use_smarty'] == 0) {
-        // the old way
-        $footer = htmlspecialchars($xoopsConfigMetaFooter['footer']).'<br /><div style="text-align:center">Powered by XOOPS &copy; 2001-2005 <a href="http://jp.xoops.org/" target="_blank">The XOOPS Project</a></div>';
-        if (isset($xoopsOption['template_main'])) {
-            $xoopsTpl->xoops_setCaching(0);
-            $xoopsTpl->display('db:'.$xoopsOption['template_main']);
-        }
-        if (!isset($xoopsOption['show_rblock'])) {
-            $xoopsOption['show_rblock'] = 0;
-        }
-        themefooter($xoopsOption['show_rblock'], $footer);
-        xoops_footer();
-    } else {
-        // RMV-NOTIFY
-        include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
-        if (isset($xoopsOption['template_main'])) {
-            if (isset($xoopsCachedTemplateId)) {
-                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId));
-            } else {
-                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main']));
-            }
-        } else {
-            if (isset($xoopsCachedTemplate)) {
-                $xoopsTpl->assign('dummy_content', ob_get_contents());
-                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId));
-            } else {
-                $xoopsTpl->assign('xoops_contents', ob_get_contents());
-            }
-            ob_end_clean();
-        }
-        if (!headers_sent()) {
+<?php
+// $Id: footer.php,v 1.5 2005/09/04 20:46:08 onokazu 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 //
+//  ------------------------------------------------------------------------ //
+
+if (!defined('XOOPS_ROOT_PATH')) {
+    exit();
+}
+if ( !defined("XOOPS_FOOTER_INCLUDED") ) {
+    define("XOOPS_FOOTER_INCLUDED",1);
+    $xoopsLogger->stopTime();
+    if ($xoopsOption['theme_use_smarty'] == 0) {
+        // the old way
+        $footer = htmlspecialchars($xoopsConfigMetaFooter['footer']).'<br /><div style="text-align:center">Powered by XOOPS &copy; 2001-2005 <a href="http://jp.xoops.org/" target="_blank">The XOOPS Project</a></div>';
+        if (isset($xoopsOption['template_main'])) {
+            $xoopsTpl->xoops_setCaching(0);
+            $xoopsTpl->display('db:'.$xoopsOption['template_main']);
+        }
+        if (!isset($xoopsOption['show_rblock'])) {
+            $xoopsOption['show_rblock'] = 0;
+        }
+        themefooter($xoopsOption['show_rblock'], $footer);
+        xoops_footer();
+    } else {
+        // RMV-NOTIFY
+        include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
+        if (isset($xoopsOption['template_main'])) {
+            if (isset($xoopsCachedTemplateId)) {
+                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId));
+            } else {
+                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main']));
+            }
+        } else {
+            if (isset($xoopsCachedTemplate)) {
+                $xoopsTpl->assign('dummy_content', ob_get_contents());
+                $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId));
+            } else {
+                $xoopsTpl->assign('xoops_contents', ob_get_contents());
+            }
+            ob_end_clean();
+        }
+        if (!headers_sent()) {
             header('Content-Type:text/html; charset='._CHARSET);
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
             header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
             header('Cache-Control: no-store, no-cache, must-revalidate');
             header('Cache-Control: post-check=0, pre-check=0', false);
             header('Pragma: no-cache');
-        }
-        $xoopsTpl->xoops_setCaching(0);
-        $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
-    }
-    if ($xoopsConfig['debug_mode'] == 2 && $xoopsUserIsAdmin) {
-        echo '<script type="text/javascript">
-        <!--//
-        debug_window = openWithSelfMain("", "xoops_debug", 680, 600, true);
-        ';
-        $content = '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /><meta http-equiv="content-language" content="'._LANGCODE.'" /><title>'.htmlspecialchars($xoopsConfig['sitename']).'</title><link rel="stylesheet" type="text/css" media="all" href="'.getcss($xoopsConfig['theme_set']).'" /></head><body>'.$xoopsLogger->dumpAll().'<div style="text-align:center;"><input class="formButton" value="'._CLOSE.'" type="button" onclick="javascript:window.close();" /></div></body></html>';
-        $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
-        foreach ($lines as $line) {
-            echo 'debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
-        }
-        echo '
-        debug_window.document.close();
-        //-->
-        </script>';
-    }
-}
-?>
+        }
+        $xoopsTpl->xoops_setCaching(0);
+        $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
+    }
+    if ($xoopsConfig['debug_mode'] == 2 && $xoopsUserIsAdmin) {
+        echo '<script type="text/javascript">
+        <!--//
+        debug_window = openWithSelfMain("", "xoops_debug", 680, 600, true);
+        ';
+        $content = '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /><meta http-equiv="content-language" content="'._LANGCODE.'" /><title>'.htmlspecialchars($xoopsConfig['sitename']).'</title><link rel="stylesheet" type="text/css" media="all" href="'.getcss($xoopsConfig['theme_set']).'" /></head><body>'.$xoopsLogger->dumpAll().'<div style="text-align:center;"><input class="formButton" value="'._CLOSE.'" type="button" onclick="javascript:window.close();" /></div></body></html>';
+        $lines = preg_split("/(\r\n|\r|\n)( *)/", $content);
+        foreach ($lines as $line) {
+            echo 'debug_window.document.writeln("'.str_replace('"', '\"', $line).'");';
+        }
+        echo '
+        debug_window.document.close();
+        //-->
+        </script>';
+    }
+}
+?>
Index: xoops2jp/html/header.php
diff -u xoops2jp/html/header.php:1.4 xoops2jp/html/header.php:1.5
--- xoops2jp/html/header.php:1.4	Wed Aug  3 21:39:11 2005
+++ xoops2jp/html/header.php	Mon Sep  5 05:46:08 2005
@@ -1,5 +1,5 @@
 <?php
-// $Id: header.php,v 1.4 2005/08/03 12:39:11 onokazu Exp $
+// $Id: header.php,v 1.5 2005/09/04 20:46:08 onokazu Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -25,6 +25,9 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
 //  ------------------------------------------------------------------------ //
 
+if (!defined('XOOPS_ROOT_PATH')) {
+    exit();
+}
 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
 if ($xoopsConfig['theme_set'] != 'default' && file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/theme.php')) {
     // the old way..
Index: xoops2jp/html/imagemanager.php
diff -u xoops2jp/html/imagemanager.php:1.4 xoops2jp/html/imagemanager.php:1.5
--- xoops2jp/html/imagemanager.php:1.4	Wed Aug  3 21:39:11 2005
+++ xoops2jp/html/imagemanager.php	Mon Sep  5 05:46:08 2005
@@ -1,5 +1,5 @@
 <?php
-// $Id: imagemanager.php,v 1.4 2005/08/03 12:39:11 onokazu Exp $
+// $Id: imagemanager.php,v 1.5 2005/09/04 20:46:08 onokazu Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -232,7 +232,7 @@
                 $fp = @fopen($uploader->getSavedDestination(), 'rb');
                 $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                 @fclose($fp);
-                $image->setVar('image_body', addslashes($fbinary));
+                $image->setVar('image_body', $fbinary, true);
                 @unlink($uploader->getSavedDestination());
             }
             if (!$image_handler->insert($image)) {
Index: xoops2jp/html/misc.php
diff -u xoops2jp/html/misc.php:1.4 xoops2jp/html/misc.php:1.5
--- xoops2jp/html/misc.php:1.4	Wed Aug  3 21:39:11 2005
+++ xoops2jp/html/misc.php	Mon Sep  5 05:46:08 2005
@@ -1,5 +1,5 @@
 <?php
-// $Id: misc.php,v 1.4 2005/08/03 12:39:11 onokazu Exp $
+// $Id: misc.php,v 1.5 2005/09/04 20:46:08 onokazu Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -83,7 +83,7 @@
         </script>
         </head><body>
         <h4><?php echo _MSC_AVAVATARS;?></h4>
-        <form name='avatars' action='<?php echo $_SERVER['PHP_SELF'];?>'>
+        <form name='avatars' action='<?php echo xoops_getenv('PHP_SELF');?>'>
         <table width='100%'><tr>
         <?php
         $avatar_handler =& xoops_gethandler('avatar');
@@ -102,19 +102,15 @@
         echo '</tr></table></form></div>';
         break;
     case "friend":
+        if (!is_object($xoopsUser)) {
+            break;
+        }
         if ( !isset($_POST['op']) || $_POST['op'] == "sendform" ) {
             $token=&XoopsMultiTokenHandler::quickCreate('misc_sendform');
-            if (is_object($xoopsUser)) {
-                $yname = $xoopsUser->getVar("uname", 'e');
-                $ymail = $xoopsUser->getVar("email", 'e');
-                $fname = "";
-                $fmail = "";
-            } else {
-                $yname = "";
-                $ymail = "";
-                $fname = "";
-                $fmail = "";
-            }
+            $yname = $xoopsUser->getVar("uname", 'e');
+            $ymail = $xoopsUser->getVar("email", 'e');
+            $fname = "";
+            $fmail = "";
             printCheckForm();
             echo '</head><body>
             <form action="'.XOOPS_URL.'/misc.php" method="post" onsubmit="return checkForm();"><table  width="100%" class="outer" cellspacing="1"><tr><th colspan="2">'._MSC_RECOMMENDSITE.'</th></tr>';
@@ -135,11 +131,7 @@
                 exit();
             }
             $myts =& MyTextsanitizer::getInstance();
-            if (is_object($xoopsUser)) {
-                $ymail = $xoopsUser->getVar("email");
-            } else {
-                $ymail = isset($_POST['ymail']) ? $myts->stripSlashesGPC(trim($_POST['ymail'])) : '';
-            }
+            $ymail = $xoopsUser->getVar("email");
             if ( !isset($_POST['yname']) || trim($_POST['yname']) == "" || $ymail == '' || !isset($_POST['fname']) || trim($_POST['fname']) == ""  || !isset($_POST['fmail']) || trim($_POST['fmail']) == '' ) {
                 redirect_header(XOOPS_URL."/misc.php?action=showpopups&amp;type=friend&amp;op=sendform",2,_MSC_NEEDINFO);
                 exit();
Index: xoops2jp/html/notifications.php
diff -u xoops2jp/html/notifications.php:1.2 xoops2jp/html/notifications.php:1.3
--- xoops2jp/html/notifications.php:1.2	Fri Mar 18 21:51:55 2005
+++ xoops2jp/html/notifications.php	Mon Sep  5 05:46:08 2005
@@ -1,5 +1,5 @@
 <?php
-// $Id: notifications.php,v 1.2 2005/03/18 12:51:55 onokazu Exp $
+// $Id: notifications.php,v 1.3 2005/09/04 20:46:08 onokazu Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -29,8 +29,8 @@
 include 'mainfile.php';
 
 if (empty($xoopsUser)) {
-	redirect_header('index.php', 3, _NOT_NOACCESS);
-	exit();
+    redirect_header('index.php', 3, _NOT_NOACCESS);
+    exit();
 }
 
 $uid = $xoopsUser->getVar('uid');
@@ -38,29 +38,29 @@
 $op = 'list';
 
 if (isset($_POST['op'])) {
-	$op = trim($_POST['op']);
+    $op = trim($_POST['op']);
 } elseif (isset($_GET['op'])) {
-	$op = trim($_GET['op']);
+    $op = trim($_GET['op']);
 }
 if (isset($_POST['delete'])) {
-	$op = 'delete';
+    $op = 'delete';
 } elseif (isset($_GET['delete'])) {
-	$op = 'delete';
+    $op = 'delete';
 }
 if (isset($_POST['delete_ok'])) {
-	$op = 'delete_ok';
+    $op = 'delete_ok';
 }
 if (isset($_POST['delete_cancel'])) {
-	$op = 'cancel';
+    $op = 'cancel';
 }
 
 switch ($op) {
 
 case 'cancel':
 
-	// FIXME: does this always go back to correct location??
-	redirect_header ('index.php');
-	break;
+    // FIXME: does this always go back to correct location??
+    redirect_header ('index.php');
+    break;
 
 case 'list':
 
@@ -70,89 +70,89 @@
 
 // TODO: need to span over multiple pages...???
 
-	// Get an array of all notifications for the selected user
+    // Get an array of all notifications for the selected user
 
-	$criteria = new Criteria ('not_uid', $uid);
-	$criteria->setSort ('not_modid,not_category,not_itemid');
-	$notification_handler =& xoops_gethandler('notification');
-	$notifications =& $notification_handler->getObjects($criteria);
-
-	// Generate the info for the template
-
-	$module_handler =& xoops_gethandler('module');
-	include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
-
-	$modules = array();
-	$prev_modid = -1;
-	$prev_category = -1;
-	$prev_item = -1;
-	foreach ($notifications as $n) {
-		$modid = $n->getVar('not_modid');
-		if ($modid != $prev_modid) {
-			$prev_modid = $modid;
-			$prev_category = -1;
-			$prev_item = -1;
-			$module =& $module_handler->get($modid);
-			$modules[$modid] = array ('id'=>$modid, 'name'=>$module->getVar('name'), 'categories'=>array());
-			// TODO: note, we could auto-generate the url from the id
-			// and category info... (except when category has multiple
-			// subscription scripts defined...)
-			// OR, add one more option to xoops_version 'view_from'
-			// which tells us where to redirect... BUT, e.g. forums, it
-			// still wouldn't give us all the required info... e.g. the
-			// topic ID doesn't give us the ID of the forum which is
-			// a required argument...
-
-			// Get the lookup function, if exists
-			$not_config = $module->getInfo('notification');
-			$lookup_func = '';
-			if (!empty($not_config['lookup_file'])) {
-				$lookup_file = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
-				if (file_exists($lookup_file)) {
-					include_once $lookup_file;
-					if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
-						$lookup_func = $not_config['lookup_func'];
-					}
-				}
-			}
-		}
-		$category = $n->getVar('not_category');
-		if ($category != $prev_category) {
-			$prev_category = $category;
-			$prev_item = -1;
-			$category_info =& notificationCategoryInfo($category, $modid);
-			$modules[$modid]['categories'][$category] = array ('name'=>$category, 'title'=>$category_info['title'], 'items'=>array());
-		}
-		$item = $n->getVar('not_itemid');
-		if ($item != $prev_item) {
-			$prev_item = $item;
-			if (!empty($lookup_func)) {
-				$item_info = $lookup_func($category, $item);
-			} else {
-				$item_info = array ('name'=>'['._NOT_NAMENOTAVAILABLE.']', 'url'=>'');
-			}
-			$modules[$modid]['categories'][$category]['items'][$item] = array ('id'=>$item, 'name'=>$item_info['name'], 'url'=>$item_info['url'], 'notifications'=>array());
-		}
-		$event_info =& notificationEventInfo($category, $n->getVar('not_event'), $n->getVar('not_modid'));
-		$modules[$modid]['categories'][$category]['items'][$item]['notifications'][] = array ('id'=>$n->getVar('not_id'), 'module_id'=>$n->getVar('not_modid'), 'category'=>$n->getVar('not_category'), 'category_title'=>$category_info['title'], 'item_id'=>$n->getVar('not_itemid'), 'event'=>$n->getVar('not_event'), 'event_title'=>$event_info['title'], 'user_id'=>$n->getVar('not_uid'));
-	}
-	$xoopsOption['template_main'] = 'system_notification_list.html';
-	include XOOPS_ROOT_PATH.'/header.php';
-	$xoopsTpl->assign ('modules', $modules);	
-	$user_info = array ('uid' => $xoopsUser->getVar('uid'));
-	$xoopsTpl->assign ('user', $user_info);
-	$xoopsTpl->assign ('lang_cancel', _CANCEL);
-	$xoopsTpl->assign ('lang_clear', _NOT_CLEAR);
-	$xoopsTpl->assign ('lang_delete', _DELETE);
-	$xoopsTpl->assign ('lang_checkall', _NOT_CHECKALL);
-	$xoopsTpl->assign ('lang_module', _NOT_MODULE);
-	$xoopsTpl->assign ('lang_event', _NOT_EVENT);
-	$xoopsTpl->assign ('lang_events', _NOT_EVENTS);
-	$xoopsTpl->assign ('lang_category', _NOT_CATEGORY);
-	$xoopsTpl->assign ('lang_itemid', _NOT_ITEMID);
-	$xoopsTpl->assign ('lang_itemname', _NOT_ITEMNAME);
-	$xoopsTpl->assign ('lang_activenotifications', _NOT_ACTIVENOTIFICATIONS);
-	include XOOPS_ROOT_PATH.'/footer.php';
+    $criteria = new Criteria ('not_uid', $uid);
+    $criteria->setSort ('not_modid,not_category,not_itemid');
+    $notification_handler =& xoops_gethandler('notification');
+    $notifications =& $notification_handler->getObjects($criteria);
+
+    // Generate the info for the template
+
+    $module_handler =& xoops_gethandler('module');
+    include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
+
+    $modules = array();
+    $prev_modid = -1;
+    $prev_category = -1;
+    $prev_item = -1;
+    foreach ($notifications as $n) {
+        $modid = $n->getVar('not_modid');
+        if ($modid != $prev_modid) {
+            $prev_modid = $modid;
+            $prev_category = -1;
+            $prev_item = -1;
+            $module =& $module_handler->get($modid);
+            $modules[$modid] = array ('id'=>$modid, 'name'=>$module->getVar('name'), 'categories'=>array());
+            // TODO: note, we could auto-generate the url from the id
+            // and category info... (except when category has multiple
+            // subscription scripts defined...)
+            // OR, add one more option to xoops_version 'view_from'
+            // which tells us where to redirect... BUT, e.g. forums, it
+            // still wouldn't give us all the required info... e.g. the
+            // topic ID doesn't give us the ID of the forum which is
+            // a required argument...
+
+            // Get the lookup function, if exists
+            $not_config = $module->getInfo('notification');
+            $lookup_func = '';
+            if (!empty($not_config['lookup_file'])) {
+                $lookup_file = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
+                if (file_exists($lookup_file)) {
+                    include_once $lookup_file;
+                    if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
+                        $lookup_func = $not_config['lookup_func'];
+                    }
+                }
+            }
+        }
+        $category = $n->getVar('not_category');
+        if ($category != $prev_category) {
+            $prev_category = $category;
+            $prev_item = -1;
+            $category_info =& notificationCategoryInfo($category, $modid);
+            $modules[$modid]['categories'][$category] = array ('name'=>$category, 'title'=>$category_info['title'], 'items'=>array());
+        }
+        $item = $n->getVar('not_itemid');
+        if ($item != $prev_item) {
+            $prev_item = $item;
+            if (!empty($lookup_func)) {
+                $item_info = $lookup_func($category, $item);
+            } else {
+                $item_info = array ('name'=>'['._NOT_NAMENOTAVAILABLE.']', 'url'=>'');
+            }
+            $modules[$modid]['categories'][$category]['items'][$item] = array ('id'=>$item, 'name'=>$item_info['name'], 'url'=>$item_info['url'], 'notifications'=>array());
+        }
+        $event_info =& notificationEventInfo($category, $n->getVar('not_event'), $n->getVar('not_modid'));
+        $modules[$modid]['categories'][$category]['items'][$item]['notifications'][] = array ('id'=>$n->getVar('not_id'), 'module_id'=>$n->getVar('not_modid'), 'category'=>$n->getVar('not_category'), 'category_title'=>$category_info['title'], 'item_id'=>$n->getVar('not_itemid'), 'event'=>$n->getVar('not_event'), 'event_title'=>$event_info['title'], 'user_id'=>$n->getVar('not_uid'));
+    }
+    $xoopsOption['template_main'] = 'system_notification_list.html';
+    include XOOPS_ROOT_PATH.'/header.php';
+    $xoopsTpl->assign ('modules', $modules);    
+    $user_info = array ('uid' => $xoopsUser->getVar('uid'));
+    $xoopsTpl->assign ('user', $user_info);
+    $xoopsTpl->assign ('lang_cancel', _CANCEL);
+    $xoopsTpl->assign ('lang_clear', _NOT_CLEAR);
+    $xoopsTpl->assign ('lang_delete', _DELETE);
+    $xoopsTpl->assign ('lang_checkall', _NOT_CHECKALL);
+    $xoopsTpl->assign ('lang_module', _NOT_MODULE);
+    $xoopsTpl->assign ('lang_event', _NOT_EVENT);
+    $xoopsTpl->assign ('lang_events', _NOT_EVENTS);
+    $xoopsTpl->assign ('lang_category', _NOT_CATEGORY);
+    $xoopsTpl->assign ('lang_itemid', _NOT_ITEMID);
+    $xoopsTpl->assign ('lang_itemname', _NOT_ITEMNAME);
+    $xoopsTpl->assign ('lang_activenotifications', _NOT_ACTIVENOTIFICATIONS);
+    include XOOPS_ROOT_PATH.'/footer.php';
 
 // TODO: another display mode... instead of one notification per line,
 // show one line per item_id, with checkboxes for the available options...
@@ -171,42 +171,52 @@
 
     break;
 
-//case 'delete':
-case 'delete_ok':
-
-	if (empty($_POST['del_not'])) {
-		redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
-	}
-	include XOOPS_ROOT_PATH.'/header.php';
-	$hidden_vars = array('uid'=>$uid, 'delete_ok'=>1, 'del_not'=>$_POST['del_not']);
-	print '<h4>'._NOT_DELETINGNOTIFICATIONS.'</h4>';
-	xoops_confirm($hidden_vars, xoops_getenv('PHP_SELF'), _NOT_RUSUREDEL);
-	include XOOPS_ROOT_PATH.'/footer.php';
-
-// FIXME: There is a problem here... in xoops_confirm it treats arrays as
-// optional radio arguments on the confirmation page... change this or
-// write new function...
-
-	break;
-
-//case 'delete_ok':
 case 'delete':
-	if (empty($_POST['del_not'])) {
-		redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
-	}
-	$notification_handler =& xoops_gethandler('notification');
-	foreach ($_POST['del_not'] as $n_array) {
-		foreach ($n_array as $n) {
-			$notification =& $notification_handler->get($n);
-			if ($notification->getVar('not_uid') == $uid) {
-				$notification_handler->delete($notification);
-			}
-		}
-	}
-	redirect_header('notifications.php', 2, _NOT_DELETESUCCESS);
-	break;
+    if (empty($_POST['del_not'])||!is_array($_POST['del_not'])) {
+        redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
+    }
+    $del_notifications = array();
+    foreach($_POST['del_not'] as $not_modid => $not_ids) {
+        if (!is_array($not_ids)) {
+            redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
+        }
+        foreach ($not_ids as $not_id) {
+            $del_notifications[] = intval($not_modid).'|'.intval($not_id);
+        }
+    }
+    $del_not = implode(',', $del_notifications);
+    include XOOPS_ROOT_PATH.'/header.php';
+    $hidden_vars = array('delete_ok'=>1, 'del_not'=>$del_not);
+    print '<h4>'._NOT_DELETINGNOTIFICATIONS.'</h4>';
+    xoops_confirm($hidden_vars, xoops_getenv('PHP_SELF'), _NOT_RUSUREDEL);
+    include XOOPS_ROOT_PATH.'/footer.php';
+    break;
+
+case 'delete_ok':
+    if(!xoops_confirm_validate()) {
+        redirect_header('notifications.php',2,'Ticket Error');
+    }
+    if (empty($_POST['del_not'])) {
+        redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
+    }
+    $del_notifications = explode(',', $_POST['del_not']);
+    if (!is_array($del_notifications) || count($del_notifications)==0) {
+        redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
+    }
+    $notification_handler =& xoops_gethandler('notification');
+    foreach ($del_notifications as $del_notification) {
+        $del_notification_items = explode('|',$del_notification);
+        if (is_array($del_notification_items) && (count($del_notification_items)==2) && !empty($del_notification_items[0]) && !empty($del_notification_items[1])) {
+            $notification =& $notification_handler->get(intval($del_notification_items[1]));
+            if (!empty($notification) && ($notification->getVar('not_uid') == $uid) && ($notification->getVar('not_modid') == intval($del_notification_items[0]))) {
+                $notification_handler->delete($notification);
+            }
+        }
+    }
+    redirect_header('notifications.php', 2, _NOT_DELETESUCCESS);
+    break;
 default:
-	break;
+    break;
 }
 
 ?>


xoops-cvslog メーリングリストの案内
Back to archive index