From: <be...@us...> - 2012-07-22 08:48:03
|
Revision: 9907 http://xoops.svn.sourceforge.net/xoops/?rev=9907&view=rev Author: beckmi Date: 2012-07-22 08:47:54 +0000 (Sun, 22 Jul 2012) Log Message: ----------- Updating to Birthday 2.3 RC3 (removed PEAR and Cache_Lite) Modified Paths: -------------- XoopsModules/birthday/trunk/birthday/admin/about.php XoopsModules/birthday/trunk/birthday/admin/admin_footer.php XoopsModules/birthday/trunk/birthday/admin/admin_header.php XoopsModules/birthday/trunk/birthday/admin/index.php XoopsModules/birthday/trunk/birthday/admin/main.php XoopsModules/birthday/trunk/birthday/admin/menu.php XoopsModules/birthday/trunk/birthday/blocks/b_birthday.php XoopsModules/birthday/trunk/birthday/class/birthday_utils.php XoopsModules/birthday/trunk/birthday/class/formtextdateselect.php XoopsModules/birthday/trunk/birthday/class/users_birthday.php XoopsModules/birthday/trunk/birthday/comment_delete.php XoopsModules/birthday/trunk/birthday/comment_edit.php XoopsModules/birthday/trunk/birthday/comment_new.php XoopsModules/birthday/trunk/birthday/comment_post.php XoopsModules/birthday/trunk/birthday/comment_reply.php XoopsModules/birthday/trunk/birthday/docs/changelog.txt XoopsModules/birthday/trunk/birthday/docs/credits.txt XoopsModules/birthday/trunk/birthday/docs/readme.txt XoopsModules/birthday/trunk/birthday/footer.php XoopsModules/birthday/trunk/birthday/header.php XoopsModules/birthday/trunk/birthday/include/calendarjs.php XoopsModules/birthday/trunk/birthday/include/comment_functions.php XoopsModules/birthday/trunk/birthday/include/common.php XoopsModules/birthday/trunk/birthday/include/function.php XoopsModules/birthday/trunk/birthday/include/search.inc.php XoopsModules/birthday/trunk/birthday/index.php XoopsModules/birthday/trunk/birthday/language/arabic/admin.php XoopsModules/birthday/trunk/birthday/language/english/admin.php XoopsModules/birthday/trunk/birthday/language/english/blocks.php XoopsModules/birthday/trunk/birthday/language/english/main.php XoopsModules/birthday/trunk/birthday/language/english/modinfo.php XoopsModules/birthday/trunk/birthday/language/french/admin.php XoopsModules/birthday/trunk/birthday/language/french/blocks.php XoopsModules/birthday/trunk/birthday/language/french/main.php XoopsModules/birthday/trunk/birthday/language/french/modinfo.php XoopsModules/birthday/trunk/birthday/language/persian/admin.php XoopsModules/birthday/trunk/birthday/language/persian/blocks.php XoopsModules/birthday/trunk/birthday/language/persian/main.php XoopsModules/birthday/trunk/birthday/language/persian/modinfo.php XoopsModules/birthday/trunk/birthday/language/spanish/admin.php XoopsModules/birthday/trunk/birthday/language/spanish/blocks.php XoopsModules/birthday/trunk/birthday/language/spanish/main.php XoopsModules/birthday/trunk/birthday/language/spanish/modinfo.php XoopsModules/birthday/trunk/birthday/user.php XoopsModules/birthday/trunk/birthday/users.php XoopsModules/birthday/trunk/birthday/xoops_version.php Removed Paths: ------------- XoopsModules/birthday/trunk/birthday/admin/functions.php XoopsModules/birthday/trunk/birthday/class/PEAR.php XoopsModules/birthday/trunk/birthday/class/PEAR5.php XoopsModules/birthday/trunk/birthday/class/PersistableObjectHandler.php XoopsModules/birthday/trunk/birthday/class/lite.php Modified: XoopsModules/birthday/trunk/birthday/admin/about.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/about.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/about.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,29 +1,29 @@ -<?php -/** - * Birthday module - * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * @copyright The XOOPS Project (http://www.xoops.org) - * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} - * @package birthday - * @since 2.5.0 - * @author XOOPS Module Team - * @version $Id $ - **/ - -include_once dirname(__FILE__) . '/admin_header.php'; - -xoops_cp_header(); - -$aboutAdmin = new ModuleAdmin(); - -echo $aboutAdmin->addNavigation('about.php'); -echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); - +<?php +/** + * Birthday module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project (http://www.xoops.org) + * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} + * @package birthday + * @since 2.5.0 + * @author XOOPS Module Team + * @version $Id $ + **/ + +include_once dirname(__FILE__) . '/admin_header.php'; + +xoops_cp_header(); + +$aboutAdmin = new ModuleAdmin(); + +echo $aboutAdmin->addNavigation('about.php'); +echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); + include 'admin_footer.php'; \ No newline at end of file Modified: XoopsModules/birthday/trunk/birthday/admin/admin_footer.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/admin_footer.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/admin_footer.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -19,7 +19,7 @@ echo "<div class='adminfooter'>\n" ." <div style='text-align: center;'>\n" - ." <a href='http://www.xoops.org' target='_blank'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" + ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" ." </div>\n" ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" ."</div>"; Modified: XoopsModules/birthday/trunk/birthday/admin/admin_header.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/admin_header.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/admin_header.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,45 +1,45 @@ -<?php -/** - * Birthday module - * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License - * @package birthday - * @since 2.5.0 - * @author XOOPS Module Team - * @version $Id $ -**/ - -$path = dirname(dirname(dirname(dirname(__FILE__)))); -include_once $path . '/mainfile.php'; -include_once $path . '/include/cp_functions.php'; -require_once $path . '/include/cp_header.php'; - -global $xoopsModule; - -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); - -//if functions.php file exist -//require_once dirname(dirname(__FILE__)) . '/include/functions.php'; - -// Load language files -xoops_loadLanguage('admin', $thisModuleDir); -xoops_loadLanguage('modinfo', $thisModuleDir); -xoops_loadLanguage('main', $thisModuleDir); - -$pathIcon16 = '../'.$xoopsModule->getInfo('icons16'); -$pathIcon32 = '../'.$xoopsModule->getInfo('icons32'); -$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); - -if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){ - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); - }else{ - redirect_header("../../../admin.php", 5, _AM_BIRTHDAY_MODULEADMIN_MISSING, false); +<?php +/** + * Birthday module + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License + * @package birthday + * @since 2.5.0 + * @author XOOPS Module Team + * @version $Id $ +**/ + +$path = dirname(dirname(dirname(dirname(__FILE__)))); +include_once $path . '/mainfile.php'; +include_once $path . '/include/cp_functions.php'; +require_once $path . '/include/cp_header.php'; + +global $xoopsModule; + +$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); + +//if functions.php file exist +//require_once dirname(dirname(__FILE__)) . '/include/functions.php'; + +// Load language files +xoops_loadLanguage('admin', $thisModuleDir); +xoops_loadLanguage('modinfo', $thisModuleDir); +xoops_loadLanguage('main', $thisModuleDir); + +$pathIcon16 = '../'.$xoopsModule->getInfo('icons16'); +$pathIcon32 = '../'.$xoopsModule->getInfo('icons32'); +$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); + +if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){ + include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); + }else{ + redirect_header("../../../admin.php", 5, _AM_BIRTHDAY_MODULEADMIN_MISSING, false); } \ No newline at end of file Deleted: XoopsModules/birthday/trunk/birthday/admin/functions.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/functions.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/functions.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,67 +0,0 @@ -<?php -/** - * **************************************************************************** - * birthday - MODULE FOR XOOPS - * Copyright (c) Herv\xE9 Thouzard of Instant Zero (http://www.instant-zero.com) - * Created on 20 oct. 07 at 14:38:20 - * Version : $Id: - * **************************************************************************** - */ - -function birthday_adminMenu($currentoption = 0, $breadcrumb = '') -{ - global $xoopsConfig, $xoopsModule; - if(file_exists(XOOPS_ROOT_PATH.'/modules/birthday/language/'.$xoopsConfig['language'].'/modinfo.php')) { - include_once XOOPS_ROOT_PATH.'/modules/birthday/language/'.$xoopsConfig['language'].'/modinfo.php'; - } else { - include_once XOOPS_ROOT_PATH.'/modules/birthday/language/english/modinfo.php'; - } - global $adminmenu; - include 'menu.php'; - - echo "<style type=\"text/css\">\n"; - echo "#buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; margin: 0; }\n"; - echo "#buttonbar { float:left; width:100%; background: #e7e7e7 url('../images/modadminbg.gif') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 1px solid black; border-right: 1px solid black; margin-bottom: 12px; }\n"; - echo "#buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }\n"; - echo "#buttonbar li { display:inline; margin:0; padding:0; }"; - echo "#buttonbar a { float:left; background:url('../images/left_both.gif') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }\n"; - echo "#buttonbar a span { float:left; display:block; background:url('../images/right_both.gif') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }\n"; - echo "/* Commented Backslash Hack hides rule from IE5-Mac \*/\n"; - echo "#buttonbar a span {float:none;}\n"; - echo "/* End IE5-Mac hack */\n"; - echo "#buttonbar a:hover span { color:#333; }\n"; - echo "#buttonbar .current a { background-position:0 -150px; border-width:0; }\n"; - echo "#buttonbar .current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }\n"; - echo "#buttonbar a:hover { background-position:0% -150px; }\n"; - echo "#buttonbar a:hover span { background-position:100% -150px; }\n"; - echo "</style>\n"; - - echo "<div id=\"buttontop\">\n"; - echo "<table style=\"width: 100%; padding: 0; \" cellspacing=\"0\">\n"; - echo "<tr>\n"; - echo "<td style=\"width: 70%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\">\n"; - echo "<a href=\"../index.php\">"._AM_BIRTHDAY_GO_TO_MODULE."</a> | <a href=\"".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."\">"._AM_BIRTHDAY_PREFERENCES."</a> | <a href='index.php?op=maintain'>"._AM_BIRTHDAY_MAINTAIN."</a>\n"; - echo "</td>\n"; - echo "<td style=\"width: 30%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;\">\n"; - echo "<b>".$xoopsModule->getVar('name')." "._AM_BIRTHDAY_ADMINISTRATION."</b> ".$breadcrumb."\n"; - echo "</td>\n"; - echo "</tr>\n"; - echo "</table>\n"; - echo "</div>\n"; - echo "<div id=\"buttonbar\">\n"; - echo "<ul>\n"; - foreach($GLOBALS['adminmenu'] as $key=>$link) { - if($key == $currentoption) { - echo "<li class=\"current\">\n"; - } else { - echo "<li>\n"; - } - echo "<a href=\"".XOOPS_URL."/modules/birthday/".$link['link']."\"><span>".$link['title']."</span></a>\n"; - echo "</li>\n"; - } - echo "</ul>\n"; - echo "</div>\n"; - echo "<br style=\"clear:both;\" />\n"; - -} -?> \ No newline at end of file Modified: XoopsModules/birthday/trunk/birthday/admin/index.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/index.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/index.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,34 +1,34 @@ -<?php -/** - * **************************************************************************** - * Birthday - MODULE FOR XOOPS - * Copyright (c) Herv\xE9 Thouzard (http://www.herve-thouzard.com) - * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * @copyright Herv\xE9 Thouzard (http://www.herve-thouzard.com) - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License - * @package birthday - * @author Herv\xE9 Thouzard (http://www.herve-thouzard.com) - * - * Version : $Id: - * **************************************************************************** - */ - - -require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; -include_once dirname(__FILE__) . '/admin_header.php'; - -xoops_cp_header(); - - $indexAdmin = new ModuleAdmin(); - - echo $indexAdmin->addNavigation('index.php'); - echo $indexAdmin->renderIndex(); - +<?php +/** + * **************************************************************************** + * Birthday - MODULE FOR XOOPS + * Copyright (c) Herv\xE9 Thouzard (http://www.herve-thouzard.com) + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright Herv\xE9 Thouzard (http://www.herve-thouzard.com) + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License + * @package birthday + * @author Herv\xE9 Thouzard (http://www.herve-thouzard.com) + * + * Version : $Id: + * **************************************************************************** + */ + + +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; +include_once dirname(__FILE__) . '/admin_header.php'; + +xoops_cp_header(); + + $indexAdmin = new ModuleAdmin(); + + echo $indexAdmin->addNavigation('index.php'); + echo $indexAdmin->renderIndex(); + include "admin_footer.php"; \ No newline at end of file Modified: XoopsModules/birthday/trunk/birthday/admin/main.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/main.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/main.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,168 +1,184 @@ -<?php -/** - * **************************************************************************** - * birthday - MODULE FOR XOOPS - * Copyright (c) Herv� Thouzard of Instant Zero (http://www.instant-zero.com) - * Created on 10 juil. 08 at 11:38:52 - * Version : $Id: - * **************************************************************************** - */ -require_once '../../../include/cp_header.php'; -require_once '../include/common.php'; -require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; -require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; -include_once 'admin_header.php'; - -$indexAdmin = new ModuleAdmin(); - -$op = 'default'; -if (isset($_POST['op'])) { - $op = $_POST['op']; -} elseif ( isset($_GET['op'])) { - $op = $_GET['op']; -} - -// Lecture de certains param�tres de l'application ******************************************************************** -$limit = birthday_utils::getModuleOption('perpage'); // Nombre maximum d'�l�ments � afficher -$baseurl = BIRTHDAY_URL.'admin/'.basename(__FILE__); // URL de ce script -$conf_msg = birthday_utils::javascriptLinkConfirm(_AM_BIRTHDAY_CONF_DELITEM); -$images_width = birthday_utils::getModuleOption('images_width'); -$images_height = birthday_utils::getModuleOption('images_height'); -$destname = ''; - -$cacheFolder = XOOPS_UPLOAD_PATH.'/'.BIRTHDAY_DIRNAME; -if(!is_dir($cacheFolder)) { - mkdir($cacheFolder, 0777); - file_put_contents($cacheFolder.'/index.html', '<script>history.go(-1);</script>'); -} - - -switch($op) -{ - // **************************************************************************************************************** - case 'default': // List birthdays and show form to add a someone - // **************************************************************************************************************** - xoops_cp_header(); - //echo '<h1>'.birthday_utils::getModuleName().'</h1>'; - echo $indexAdmin->addNavigation('main.php'); - - - - $start = isset($_GET['start']) ? intval($_GET['start']) : 0; - $itemsCount = $hBdUsersBirthday->getCount(); - if($itemsCount > $limit) { - $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start'); - } - if(isset($pagenav) && is_object($pagenav)) { - echo "<div align='right'>".$pagenav->renderNav()."</div>"; - } - if($itemsCount > 0) { - $class = ''; - $items = $hBdUsersBirthday->getItems($start, $limit, 'birthday_lastname'); - echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; - echo "<tr><th align='center'>"._BIRTHDAY_DATE."</th><th align='center'>"._BIRTHDAY_USERNAME."</th><th align='center'>"._BIRTHDAY_LASTNAME.', '._BIRTHDAY_FIRSTNAME."</th><th align='center'>"._AM_BIRTHDAY_ACTION."</th></tr>"; - foreach ($items as $item) { - $class = ($class == 'even') ? 'odd' : 'even'; - $id = $item->getVar('birthday_id'); - $user = null; - $user = $item->getXoopsUser(); - $uname = ''; - if(is_object($user)) { - $uname = $user->getVar('uname'); - } - $action_edit = "<a href='$baseurl?op=edit&id=".$id."' title='"._EDIT."'>".$birdthday_icones['edit'].'</a>'; - $action_delete = "<a href='$baseurl?op=delete&id=".$id."' title='"._DELETE."'".$conf_msg.">".$birdthday_icones['delete'].'</a>'; - - echo "<tr class='".$class."'>\n"; - echo "<td align='center'>".birthday_utils::SQLDateToHuman($item->getVar('birthday_date'))."</td>"; - echo "<td align='center'>".$uname.'</td>'; - echo "<td align='center'>".$item->getFullName().'</td>'; - echo "<td align='center'>".$action_edit.' '.$action_delete.'</td>'; - echo "</tr>\n"; - } - echo "</table>\n"; - if(isset($pagenav) && is_object($pagenav)) { - echo "<div align='left'>".$pagenav->renderNav()."</div>"; - } - echo "<br /><br />\n"; - } - $item = $hBdUsersBirthday->create(true); - $form = $hBdUsersBirthday->getForm($item, $baseurl); - $form->display(); - break; - - // **************************************************************************************************************** - case 'maintain': // Maintenance des tables et du cache - // **************************************************************************************************************** - xoops_cp_header(); - require_once '../xoops_version.php'; - $tables = array(); - foreach ($modversion['tables'] as $table) { - $tables[] = $xoopsDB->prefix($table); - } - if(count($tables) > 0) { - $list = implode(',', $tables); - $xoopsDB->queryF('CHECK TABLE '.$list); - $xoopsDB->queryF('ANALYZE TABLE '.$list); - $xoopsDB->queryF('OPTIMIZE TABLE '.$list); - } - birthday_utils::updateCache(); - $hBdUsersBirthday->forceCacheClean(); - birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 2); - break; - - // **************************************************************************************************************** - case 'edit': // Edition d'un utilisateur existant - // **************************************************************************************************************** - xoops_cp_header(); - echo $indexAdmin->addNavigation('main.php'); - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; - if(empty($id)) { - birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5); - } - // Item exits ? - $item = null; - $item = $hBdUsersBirthday->get($id); - if(!is_object($item)) { - birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5); - } - $form = $hBdUsersBirthday->getForm($item, $baseurl); - $form->display(); - break; - - // **************************************************************************************************************** - case 'saveedit': // Enregistrement des modifications - // **************************************************************************************************************** - xoops_cp_header(); - echo $indexAdmin->addNavigation('main.php'); - $result = $hBdUsersBirthday->saveUser(); - if($result) { - birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1); - } else { - birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3); - } - break; - - // **************************************************************************************************************** - case 'delete': // Suppression d'un utilisateur - // **************************************************************************************************************** - $id = isset($_GET['id']) ? intval($_GET['id']) : 0; - if(empty($id)) { - birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5); - } - // Item exits ? - $item = null; - $item = $hBdUsersBirthday->get($id); - if(!is_object($item)) { - birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5); - } - $result = $hBdUsersBirthday->deleteUser($item); - if($result) { - birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1); - } else { - birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3); - } - -} -include "admin_footer.php"; +<?php +/** + * **************************************************************************** + * birthday - MODULE FOR XOOPS + * Copyright (c) Herv� Thouzard of Instant Zero (http://www.herve-thouzard.com/) + * Created on 10 juil. 08 at 11:38:52 + * Version : $Id: + * **************************************************************************** + */ +require_once '../../../include/cp_header.php'; +require_once '../include/common.php'; +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; +include_once 'admin_header.php'; + +$indexAdmin = new ModuleAdmin(); + +$op = 'default'; +if (isset($_POST['op'])) { + $op = $_POST['op']; +} elseif ( isset($_GET['op'])) { + $op = $_GET['op']; +} + +// Lecture de certains param�tres de l'application ******************************************************************** +$limit = birthday_utils::getModuleOption('perpage'); // Nombre maximum d'�l�ments � afficher +$baseurl = BIRTHDAY_URL.'admin/'.basename(__FILE__); // URL de ce script +$conf_msg = birthday_utils::javascriptLinkConfirm(_AM_BIRTHDAY_CONF_DELITEM); +$images_width = birthday_utils::getModuleOption('images_width'); +$images_height = birthday_utils::getModuleOption('images_height'); +$destname = ''; + +$cacheFolder = XOOPS_UPLOAD_PATH.'/'.BIRTHDAY_DIRNAME; +if(!is_dir($cacheFolder)) { + mkdir($cacheFolder, 0777); + file_put_contents($cacheFolder.'/index.html', '<script>history.go(-1);</script>'); +} + + +switch($op) +{ + // **************************************************************************************************************** + case 'default': // List birthdays and show form to add a someone + // **************************************************************************************************************** + xoops_cp_header(); + //echo '<h1>'.birthday_utils::getModuleName().'</h1>'; + echo $indexAdmin->addNavigation('main.php'); + + + + $start = isset($_GET['start']) ? intval($_GET['start']) : 0; + $itemsCount = $hBdUsersBirthday->getCount(); + if($itemsCount > $limit) { + $pagenav = new XoopsPageNav($itemsCount, $limit, $start, 'start'); + } + if(isset($pagenav) && is_object($pagenav)) { + echo "<div align='right'>".$pagenav->renderNav()."</div>"; + } + if($itemsCount > 0) { + $class = ''; + //$items = $hBdUsersBirthday->getItems($start, $limit, 'birthday_lastname'); + + $tblItems = array(); + //$critere = new Criteria($this->keyName, 0 ,'<>'); + $critere = new Criteria('birthday_id', 0 ,'<>'); + $critere->setLimit($limit); + $critere->setStart($start); + $critere->setSort('birthday_lastname'); +// $critere->setOrder($order); +// $tblItems = $this->getObjects($critere, $idAsKey); + + + + $items = $hBdUsersBirthday->getObjects($start, $limit, 'birthday_lastname'); + + + + echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; + echo "<tr><th align='center'>"._BIRTHDAY_DATE."</th><th align='center'>"._BIRTHDAY_USERNAME."</th><th align='center'>"._BIRTHDAY_LASTNAME.', '._BIRTHDAY_FIRSTNAME."</th><th align='center'>"._AM_BIRTHDAY_ACTION."</th></tr>"; + foreach ($items as $item) { + $class = ($class == 'even') ? 'odd' : 'even'; + $id = $item->getVar('birthday_id'); + $user = null; + $user = $item->getXoopsUser(); + $uname = ''; + if(is_object($user)) { + $uname = $user->getVar('uname'); + } + $action_edit = "<a href='$baseurl?op=edit&id=".$id."' title='"._EDIT."'>".$birdthday_icones['edit'].'</a>'; + $action_delete = "<a href='$baseurl?op=delete&id=".$id."' title='"._DELETE."'".$conf_msg.">".$birdthday_icones['delete'].'</a>'; + + echo "<tr class='".$class."'>\n"; + echo "<td align='center'>".birthday_utils::SQLDateToHuman($item->getVar('birthday_date'))."</td>"; + echo "<td align='center'>".$uname.'</td>'; + echo "<td align='center'>".$item->getFullName().'</td>'; + echo "<td align='center'>".$action_edit.' '.$action_delete.'</td>'; + echo "</tr>\n"; + } + echo "</table>\n"; + if(isset($pagenav) && is_object($pagenav)) { + echo "<div align='left'>".$pagenav->renderNav()."</div>"; + } + echo "<br /><br />\n"; + } + $item = $hBdUsersBirthday->create(true); + $form = $hBdUsersBirthday->getForm($item, $baseurl); + $form->display(); + break; + + // **************************************************************************************************************** + case 'maintain': // Maintenance des tables et du cache + // **************************************************************************************************************** + xoops_cp_header(); + require_once '../xoops_version.php'; + $tables = array(); + foreach ($modversion['tables'] as $table) { + $tables[] = $xoopsDB->prefix($table); + } + if(count($tables) > 0) { + $list = implode(',', $tables); + $xoopsDB->queryF('CHECK TABLE '.$list); + $xoopsDB->queryF('ANALYZE TABLE '.$list); + $xoopsDB->queryF('OPTIMIZE TABLE '.$list); + } + birthday_utils::updateCache(); + $hBdUsersBirthday->forceCacheClean(); + birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 2); + break; + + // **************************************************************************************************************** + case 'edit': // Edition d'un utilisateur existant + // **************************************************************************************************************** + xoops_cp_header(); + echo $indexAdmin->addNavigation('main.php'); + $id = isset($_GET['id']) ? intval($_GET['id']) : 0; + if(empty($id)) { + birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5); + } + // Item exits ? + $item = null; + $item = $hBdUsersBirthday->get($id); + if(!is_object($item)) { + birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5); + } + $form = $hBdUsersBirthday->getForm($item, $baseurl); + $form->display(); + break; + + // **************************************************************************************************************** + case 'saveedit': // Enregistrement des modifications + // **************************************************************************************************************** + xoops_cp_header(); + echo $indexAdmin->addNavigation('main.php'); + $result = $hBdUsersBirthday->saveUser(); + if($result) { + birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1); + } else { + birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3); + } + break; + + // **************************************************************************************************************** + case 'delete': // Suppression d'un utilisateur + // **************************************************************************************************************** + $id = isset($_GET['id']) ? intval($_GET['id']) : 0; + if(empty($id)) { + birthday_utils::redirect(_AM_BIRTHDAY_ERROR_1, $baseurl, 5); + } + // Item exits ? + $item = null; + $item = $hBdUsersBirthday->get($id); + if(!is_object($item)) { + birthday_utils::redirect(_AM_BIRTHDAY_NOT_FOUND, $baseurl, 5); + } + $result = $hBdUsersBirthday->deleteUser($item); + if($result) { + birthday_utils::redirect(_AM_BIRTHDAY_SAVE_OK, $baseurl, 1); + } else { + birthday_utils::redirect(_AM_BIRTHDAY_SAVE_PB, $baseurl, 3); + } + +} +include "admin_footer.php"; //xoops_cp_footer(); \ No newline at end of file Modified: XoopsModules/birthday/trunk/birthday/admin/menu.php =================================================================== --- XoopsModules/birthday/trunk/birthday/admin/menu.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/admin/menu.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -2,7 +2,7 @@ /** * **************************************************************************** * Birthday - MODULE FOR XOOPS - * Script made by Herv\xE9 Thouzard of Instant Zero (http://www.instant-zero.com) + * Script made by Herv\xE9 Thouzard (http://www.herve-thouzard.com/) * Created on 10 jully. 08 at 11:32:40 * **************************************************************************** */ @@ -23,12 +23,11 @@ $adminmenu[$i]["title"] = _MI_BIRTHDAY_BIRTHDAYS; $adminmenu[$i]["link"] = "admin/main.php"; $adminmenu[$i]["icon"] = './images/cake.png'; +//$i++; +//$adminmenu[$i]["title"] = _MI_BIRTHDAY_MAINTAIN; +//$adminmenu[$i]["link"] = "admin/main.php?op=maintain"; +//$adminmenu[$i]["icon"] = './images/maintenance.png'; $i++; -$adminmenu[$i]["title"] = _MI_BIRTHDAY_MAINTAIN; -$adminmenu[$i]["link"] = "admin/main.php?op=maintain"; -$adminmenu[$i]["icon"] = './images/maintenance.png'; -$i++; - $adminmenu[$i]["title"] =_MI_BIRTHDAY_ABOUT; $adminmenu[$i]["link"] = "admin/about.php"; $adminmenu[$i]["icon"] = $pathIcon32.'/about.png'; \ No newline at end of file Modified: XoopsModules/birthday/trunk/birthday/blocks/b_birthday.php =================================================================== --- XoopsModules/birthday/trunk/birthday/blocks/b_birthday.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/blocks/b_birthday.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,38 +1,38 @@ -<?php -function b_birthday_show($options) { - global $xoopsUser; - $block = array(); - include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php'; - $start = 0; - $limit = intval($options[0]); - $itemsCount = $hBdUsersBirthday->getTodayBirthdaysCount(); - $users = $hBdUsersBirthday->getTodayBirthdays($start, $limit); - if(count($users) > 0) { - foreach($users as $user) { - $block['birthday_today_users'][] = $user->toArray(); - } - } - if($itemsCount > $limit) { - $block['birthday_today_more'] = true; - } else { - $block['birthday_today_more'] = false; - } - - if (is_object($xoopsUser) && birthday_utils::getModuleOption('enable_users')) { - $block['birthday_today_mypage'] = true; - } else { - $block['birthday_today_mypage'] = false; - } - return $block; -} - -function b_birthday_edit($options) -{ - include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php'; - $form = ''; - $form .= "<table border='0'>"; - $form .= '<tr><td>'._MB_BIRTHDAY_MAX_ITEMS."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>\n"; - $form .= "</table>\n"; - return $form; -} -?> +<?php +function b_birthday_show($options) { + global $xoopsUser; + $block = array(); + include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php'; + $start = 0; + $limit = intval($options[0]); + $itemsCount = $hBdUsersBirthday->getTodayBirthdaysCount(); + $users = $hBdUsersBirthday->getTodayBirthdays($start, $limit); + if(count($users) > 0) { + foreach($users as $user) { + $block['birthday_today_users'][] = $user->toArray(); + } + } + if($itemsCount > $limit) { + $block['birthday_today_more'] = true; + } else { + $block['birthday_today_more'] = false; + } + + if (is_object($xoopsUser) && birthday_utils::getModuleOption('enable_users')) { + $block['birthday_today_mypage'] = true; + } else { + $block['birthday_today_mypage'] = false; + } + return $block; +} + +function b_birthday_edit($options) +{ + include XOOPS_ROOT_PATH.'/modules/birthday/include/common.php'; + $form = ''; + $form .= "<table border='0'>"; + $form .= '<tr><td>'._MB_BIRTHDAY_MAX_ITEMS."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>\n"; + $form .= "</table>\n"; + return $form; +} +?> Deleted: XoopsModules/birthday/trunk/birthday/class/PEAR.php =================================================================== --- XoopsModules/birthday/trunk/birthday/class/PEAR.php 2012-07-21 17:14:11 UTC (rev 9906) +++ XoopsModules/birthday/trunk/birthday/class/PEAR.php 2012-07-22 08:47:54 UTC (rev 9907) @@ -1,1064 +0,0 @@ -<?php -/** - * PEAR, the PHP Extension and Application Repository - * - * PEAR class and PEAR_Error class - * - * PHP versions 4 and 5 - * - * @category pear - * @package PEAR - * @author Sterling Hughes <ste...@ph...> - * @author Stig Bakken <ss...@ph...> - * @author Tomas V.V.Cox <co...@id...> - * @author Greg Beaver <ce...@ph...> - * @copyright 1997-2010 The Authors - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id$ - * @link http://pear.php.net/package/PEAR - * @since File available since Release 0.1 - */ - -/**#@+ - * ERROR constants - */ -define('PEAR_ERROR_RETURN', 1); -define('PEAR_ERROR_PRINT', 2); -define('PEAR_ERROR_TRIGGER', 4); -define('PEAR_ERROR_DIE', 8); -define('PEAR_ERROR_CALLBACK', 16); -/** - * WARNING: obsolete - * @deprecated - */ -define('PEAR_ERROR_EXCEPTION', 32); -/**#@-*/ -define('PEAR_ZE2', (function_exists('version_compare') && - version_compare(zend_version(), "2-dev", "ge"))); - -if (substr(PHP_OS, 0, 3) == 'WIN') { - define('OS_WINDOWS', true); - define('OS_UNIX', false); - define('PEAR_OS', 'Windows'); -} else { - define('OS_WINDOWS', false); - define('OS_UNIX', true); - define('PEAR_OS', 'Unix'); // blatant assumption -} - -$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; -$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; -$GLOBALS['_PEAR_destructor_object_list'] = array(); -$GLOBALS['_PEAR_shutdown_funcs'] = array(); -$GLOBALS['_PEAR_error_handler_stack'] = array(); - -@ini_set('track_errors', true); - -/** - * Base class for other PEAR classes. Provides rudimentary - * emulation of destructors. - * - * If you want a destructor in your class, inherit PEAR and make a - * destructor method called _yourclassname (same name as the - * constructor, but with a "_" prefix). Also, in your constructor you - * have to call the PEAR constructor: $this->PEAR();. - * The destructor method will be called without parameters. Note that - * at in some SAPI implementations (such as Apache), any output during - * the request shutdown (in which destructors are called) seems to be - * discarded. If you need to get any debug information from your - * destructor, use error_log(), syslog() or something similar. - * - * IMPORTANT! To use the emulated destructors you need to create the - * objects by reference: $obj =& new PEAR_child; - * - * @category pear - * @package PEAR - * @author Stig Bakken <ss...@ph...> - * @author Tomas V.V. Cox <co...@id...> - * @author Greg Beaver <ce...@ph...> - * @copyright 1997-2006 The PHP Group - * @license http://opensource.org/licenses/bsd-license.php New BSD License - * @version Release: 1.9.4 - * @link http://pear.php.net/package/PEAR - * @see PEAR_Error - * @since Class available since PHP 4.0.2 - * @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear - */ -class PEAR -{ - /** - * Whether to enable internal debug messages. - * - * @var bool - * @access private - */ - var $_debug = false; - - /** - * Default error mode for this object. - * - * @var int - * @access private - */ - var $_default_error_mode = null; - - /** - * Default error options used for this object when error mode - * is PEAR_ERROR_TRIGGER. - * - * @var int - * @access private - */ - var $_default_error_options = null; - - /** - * Default error handler (callback) for this object, if error mode is - * PEAR_ERROR_CALLBACK. - * - * @var string - * @access private - */ - var $_default_error_handler = ''; - - /** - * Which class to use for error objects. - * - * @var string - * @access private - */ - var $_error_class = 'PEAR_Error'; - - /** - * An array of expected errors. - * - * @var array - * @access private - */ - var $_expected_errors = array(); - - /** - * Constructor. Registers this object in - * $_PEAR_destructor_object_list for destructor emulation if a - * destructor object exists. - * - * @param string $error_class (optional) which class to use for - * error objects, defaults to PEAR_Error. - * @access public - * @return void - */ - function PEAR($error_class = null) - { - $classname = strtolower(get_class($this)); - if ($this->_debug) { - print "PEAR constructor called, class=$classname\n"; - } - - if ($error_class !== null) { - $this->_error_class = $error_class; - } - - while ($classname && strcasecmp($classname, "pear")) { - $destructor = "_$classname"; - if (method_exists($this, $destructor)) { - global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; - if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { - register_shutdown_function("_PEAR_call_destructors"); - $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; - } - break; - } else { - $classname = get_parent_class($classname); - } - } - } - - /** - * Destructor (the emulated type of...). Does nothing right now, - * but is included for forward compatibility, so subclass - * destructors should always call it. - * - * See the note in the class desciption about output from - * destructors. - * - * @access public - * @return void - */ - function _PEAR() { - if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); - } - } - - /** - * If you have a class that's mostly/entirely static, and you need static - * properties, you can use this method to simulate them. Eg. in your method(s) - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); - * You MUST use a reference, or they will not persist! - * - * @access public - * @param string $class The calling classname, to prevent clashes - * @param string $var The variable to retrieve. - * @return mixed A reference to the variable. If not set it will be - * auto initialised to NULL. - */ - function &getStaticProperty($class, $var) - { - static $properties; - if (!isset($properties[$class])) { - $properties[$class] = array(); - } - - if (!array_key_exists($var, $properties[$class])) { - $properties[$class][$var] = null; - } - - return $properties[$class][$var]; - } - - /** - * Use this function to register a shutdown method for static - * classes. - * - * @access public - * @param mixed $func The function name (or array of class/method) to call - * @param mixed $args The arguments to pass to the function - * @return void - */ - function registerShutdownFunc($func, $args = array()) - { - // if we are called statically, there is a potential - // that no shutdown func is registered. Bug #6445 - if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { - register_shutdown_function("_PEAR_call_destructors"); - $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; - } - $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args); - } - - /** - * Tell whether a value is a PEAR error. - * - * @param mixed $data the value to test - * @param int $code if $data is an error object, return true - * only if $code is a string and - * $obj->getMessage() == $code or - * $code is an integer and $obj->getCode() == $code - * @access public - * @return bool true if parameter is an error - */ - function isError($data, $code = null) - { - if (!is_a($data, 'PEAR_Error')) { - return false; - } - - if (is_null($code)) { - return true; - } elseif (is_string($code)) { - return $data->getMessage() == $code; - } - - return $data->getCode() == $code; - } - - /** - * Sets how errors generated by this object should be handled. - * Can be invoked both in objects and statically. If called - * statically, setErrorHandling sets the default behaviour for all - * PEAR objects. If called in an object, setErrorHandling sets - * the default behaviour for that object. - * - * @param int $mode - * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. - * - * @param mixed $options - * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one - * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * - * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected - * to be the callback function or method. A callback - * function is a string with the name of the function, a - * callback method is an array of two elements: the element - * at index 0 is the object, and the element at index 1 is - * the name of the method to call in the object. - * - * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is - * a printf format string used when printing the error - * message. - * - * @access public - * @return void - * @see PEAR_ERROR_RETURN - * @see PEAR_ERROR_PRINT - * @see PEAR_ERROR_TRIGGER - * @see PEAR_ERROR_DIE - * @see PEAR_ERROR_CALLBACK - * @see PEAR_ERROR_EXCEPTION - * - * @since PHP 4.0.5 - */ - function setErrorHandling($mode = null, $options = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $setmode = &$this->_default_error_mode; - $setoptions = &$this->_default_error_options; - } else { - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - } - - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - } - - /** - * This method is used to tell which errors you expect to get. - * Expected errors are always returned with error mode - * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, - * and this method pushes a new element onto it. The list of - * expected errors are in effect until they are popped off the - * stack with the popExpect() method. - * - * Note that this method can not be called statically - * - * @param mixed $code a single error code or an array of error codes to expect - * - * @return int the new depth of the "expected errors" stack - * @access public - */ - function expectError($code = '*') - { - if (is_array($code)) { - array_push($this->_expected_errors, $code); - } else { - array_push($this->_expected_errors, array($code)); - } - return count($this->_expected_errors); - } - - /** - * This method pops one element off the expected error codes - * stack. - * - * @return array the list of error codes that were popped - */ - function popExpect() - { - return array_pop($this->_expected_errors); - } - - /** - * This method checks unsets an error code if available - * - * @param mixed error code - * @return bool true if the error code was unset, false otherwise - * @access private - * @since PHP 4.3.0 - */ - function _checkDelExpect($error_code) - { - $deleted = false; - foreach ($this->_expected_errors as $key => $error_array) { - if (in_array($error_code, $error_array)) { - unset($this->_expected_errors[$key][array_search($error_code, $error_array)]); - $deleted = true; - } - - // clean up empty arrays - if (0 == count($this->_expected_errors[$key])) { - unset($this->_expected_errors[$key]); - } - } - - return $deleted; - } - - /** - * This method deletes all occurences of the specified element from - * the expected error codes stack. - * - * @param mixed $error_code error code that should be deleted - * @return mixed list of error codes that were deleted or error - * @access public - * @since PHP 4.3.0 - */ - function delExpect($error_code) - { - $deleted = false; - if ((is_array($error_code) && (0 != count($error_code)))) { - // $error_code is a non-empty array here; we walk through it trying - // to unset all values - foreach ($error_code as $key => $error) { - $deleted = $this->_checkDelExpect($error) ? true : false; - } - - return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } elseif (!empty($error_code)) { - // $error_code comes alone, trying to unset it - if ($this->_checkDelExpect($error_code)) { - return true; - } - - return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME - } - - // $error_code is empty - return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME - } - - /** - * This method is a wrapper that returns an instance of the - * configured error class with this object's default error - * handling applied. If the $mode and $options parameters are not - * specified, the object's defaults are used. - * - * @param mixed $message a text error message or a PEAR error object - * - * @param int $code a numeric error code (it is up to your class - * to define these if you want to use codes) - * - * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, - * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, - * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. - * - * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter - * specifies the PHP-internal error level (one of - * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). - * If $mode is PEAR_ERROR_CALLBACK, this - * parameter specifies the callback function or - * method. In other error modes this parameter - * is ignored. - * - * @param string $userinfo If you need to pass along for example debug - * information, this parameter is meant for that. - * - * @param string $error_class The returned error object will be - * instantiated from this class, if specified. - * - * @param bool $skipmsg If true, raiseError will only pass error codes, - * the error message parameter will be dropped. - * - * @access public - * @return object a PEAR error object - * @see PEAR::setErrorHandling - * @since PHP 4.0.5 - */ - function &raiseError($message = null, - $code = null, - $mode = null, - $options = null, - $userinfo = null, - $error_class = null, - $skipmsg = false) - { - // The error is yet a PEAR error object - if (is_object($message)) { - $code = $message->getCode(); - $userinfo = $message->getUserInfo(); - $error_class = $message->getType(); - $message->error_message_prefix = ''; - $message = $message->getMessage(); - } - - if ( - isset($this) && - isset($this->_expected_errors) && - count($this->_expected_errors) > 0 && - count($exp = end($this->_expected_errors)) - ) { - if ($exp[0] == "*" || - (is_int(reset($exp)) && in_array($code, $exp)) || - (is_string(reset($exp)) && in_array($message, $exp)) - ) { - $mode = PEAR_ERROR_RETURN; - } - } - - // No mode given, try global ones - if ($mode === null) { - // Class error handler - if (isset($this) && isset($this->_default_error_mode)) { - $mode = $this->_default_error_mode; - $options = $this->_default_error_options; - // Global error handler - } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) { - $mode = $GLOBALS['_PEAR_default_error_mode']; - $options = $GLOBALS['_PEAR_default_error_options']; - } - } - - if ($error_class !== null) { - $ec = $error_class; - } elseif (isset($this) && isset($this->_error_class)) { - $ec = $this->_error_class; - } else { - $ec = 'PEAR_Error'; - } - - if (intval(PHP_VERSION) < 5) { - // little non-eval hack to fix bug #12147 - include 'PEAR/FixPHP5PEARWarnings.php'; - return $a; - } - - if ($skipmsg) { - $a = new $ec($code, $mode, $options, $userinfo); - } else { - $a = new $ec($message, $code, $mode, $options, $userinfo); - } - - return $a; - } - - /** - * Simpler form of raiseError with fewer options. In most cases - * message, code and userinfo are enough. - * - * @param mixed $message a text error message or a PEAR error object - * - * @param int $code a numeric error code (it is up to your class - * to define these if you want to use codes) - * - * @param string $userinfo If you need to pass along for example debug - * information, this parameter is meant for that. - * - * @access public - * @return object a PEAR error object - * @see PEAR::raiseError - */ - function &throwError($message = null, $code = null, $userinfo = null) - { - if (isset($this) && is_a($this, 'PEAR')) { - $a = &$this->raiseError($message, $code, null, null, $userinfo); - return $a; - } - - $a = &PEAR::raiseError($message, $code, null, null, $userinfo); - return $a; - } - - function staticPushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - $stack[] = array($def_mode, $def_options); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $def_mode = $mode; - $def_options = $options; - break; - - case PEAR_ERROR_CALLBACK: - $def_mode = $mode; - // class/object method callback - if (is_callable($options)) { - $def_options = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - $stack[] = array($mode, $options); - return true; - } - - function staticPopErrorHandling() - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - $setmode = &$GLOBALS['_PEAR_default_error_mode']; - $setoptions = &$GLOBALS['_PEAR_default_error_options']; - array_pop($stack); - list($mode, $options) = $stack[sizeof($stack) - 1]; - array_pop($stack); - switch ($mode) { - case PEAR_ERROR_EXCEPTION: - case PEAR_ERROR_RETURN: - case PEAR_ERROR_PRINT: - case PEAR_ERROR_TRIGGER: - case PEAR_ERROR_DIE: - case null: - $setmode = $mode; - $setoptions = $options; - break; - - case PEAR_ERROR_CALLBACK: - $setmode = $mode; - // class/object method callback - if (is_callable($options)) { - $setoptions = $options; - } else { - trigger_error("invalid error callback", E_USER_WARNING); - } - break; - - default: - trigger_error("invalid error mode", E_USER_WARNING); - break; - } - return true; - } - - /** - * Push a new error handler on top of the error handler options stack. With this - * you can easily override the actual error handler for some code and restore - * it later with popErrorHandling. - * - * @param mixed $mode (same as setErrorHandling) - * @param mixed $options (same as setErrorHandling) - * - * @return bool Always true - * - * @see PEAR::setErrorHandling - */ - function pushErrorHandling($mode, $options = null) - { - $stack = &$GLOBALS['_PEAR_error_handler_stack']; - if (isset($this) && is_a($this, 'PEAR')) { - $def_mode = &$this->_default_error_mode; - $def_options = &$this->_default_error_options; - } else { - $def_mode = &$GLOBALS['_PEAR_default_error_mode']; - $def_options = &$GLOBALS['_PEAR_default_error_options']; - } - $stack[] = array($def_mode, $def_options); - - if (isset($this) && is_a($this, 'PEAR')) { - $this->setErrorHandling($mode, $options); - } else { - PEAR::setErrorHandling($mode, $options); - } - $stack[] = array($mode, $options); - r... [truncated message content] |