From: <luc...@us...> - 2014-11-03 18:36:57
|
Revision: 12829 http://sourceforge.net/p/xoops/svn/12829 Author: luciorota Date: 2014-11-03 18:36:48 +0000 (Mon, 03 Nov 2014) Log Message: ----------- rename error.php to index.php for compatibility in case of module upgrade Modified Paths: -------------- XoopsModules/xhttperror/branches/luciorota/xhttperror/admin/index.php XoopsModules/xhttperror/branches/luciorota/xhttperror/language/english/help/help.html XoopsModules/xhttperror/branches/luciorota/xhttperror/xoops_version.php Added Paths: ----------- XoopsModules/xhttperror/branches/luciorota/xhttperror/index.php XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_index.tpl Removed Paths: ------------- XoopsModules/xhttperror/branches/luciorota/xhttperror/error.php XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_error.tpl Modified: XoopsModules/xhttperror/branches/luciorota/xhttperror/admin/index.php =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/admin/index.php 2014-10-31 07:13:53 UTC (rev 12828) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/admin/index.php 2014-11-03 18:36:48 UTC (rev 12829) @@ -50,7 +50,7 @@ foreach ($errorObjs as $errorObj) { $error_id = $errorObj->getVar('error_id'); $error_statuscode = $errorObj->getVar('error_statuscode'); - $hmtl = "ErrorDocument " . $error_statuscode . " " . XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/error.php?error=" . $error_statuscode . ""; + $hmtl = "ErrorDocument " . $error_statuscode . " " . XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/index.php?error=" . $error_statuscode . ""; $indexAdmin->addInfoBoxLine(_AM_XHTTPERROR_INTRO, $hmtl); } } Deleted: XoopsModules/xhttperror/branches/luciorota/xhttperror/error.php =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/error.php 2014-10-31 07:13:53 UTC (rev 12828) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/error.php 2014-11-03 18:36:48 UTC (rev 12829) @@ -1,103 +0,0 @@ -<?php -/* - You may not change or alter any portion of this comment or credits - of supporting developers from this source code or any supporting source code - which is considered copyrighted (c) material of the original comment or credit authors. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ -/** - * Xhttperror module - * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @package xhttperror - * @since 1.00 - * @author Xoops Development Team - * @version svn:$id$ - */ - -$currentFile = basename(__FILE__); -include __DIR__ . '/header.php'; - -$myts = MyTextSanitizer::getInstance(); - -$xoopsOption['template_main'] = "{$xhttperror->getModule()->dirname()}_error.tpl"; -include_once XOOPS_ROOT_PATH . '/header.php'; - -$uid = (is_object($xoopsUser) && isset($xoopsUser)) ? $xoopsUser->uid() : 0; -$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); - -if (!isset($_GET['error'])) { - $xoopsTpl->assign('message', "No error defined."); -} else { - // Save error info to database - // We may want to turn this off on busy sites. - if ($xhttperror->getConfig('error_reporting') == false) { - if (!(is_object($xoopsUser) && isset($xoopsUser)) || ($xoopsUser->isAdmin($xhttperror->getModule()->mid()) && $xhttperror->getConfig('ignore_admin') != true)) { - // create report - $serverVars = array(); - $serverVars['HTTP_REFERER'] = xoops_getenv('HTTP_REFERER'); - $serverVars['REMOTE_ADDR'] = xoops_getenv('REMOTE_ADDR'); - //$serverVars[''] = - $referer = xoops_getenv('HTTP_REFERER'); - $userAgent = xoops_getenv('HTTP_USER_AGENT'); - $remoteAddr = xoops_getenv('REMOTE_ADDR'); - $requestedUri = ''; - if (isset($_SERVER['REDIRECT_URL'])) { - $requestedUri .= $_SERVER['REDIRECT_URL']; - } - if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { - $requestedUri .= '?' . $_SERVER['REDIRECT_QUERY_STRING']; - } - // create error object - $reportObj = $xhttperror->getHandler('report')->create(); - // - $reportObj->setVar('report_uid', $uid); - $reportObj->setVar('report_statuscode', $_GET['error']); - $reportObj->setVar('report_date', time()); - $reportObj->setVar('report_referer', $referer); - $reportObj->setVar('report_useragent', $userAgent); - $reportObj->setVar('report_remoteaddr', $remoteAddr); - $reportObj->setVar('report_requesteduri', $requestedUri); - // store error object - if($xhttperror->getHandler('report')->insert($reportObj)) { - // NOP - } else { - // ERROR - xoops_cp_header(); - echo $reportObj->getHtmlErrors(); - xoops_cp_footer(); - exit(); - } - } - } - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('error_statuscode', $_GET['error'])); - $criteria->add(new Criteria('error_showme', true)); - if ($errorObjs = $xhttperror->getHandler('error')->getObjects($criteria)) { - $errorObj = $errorObjs[0]; - $id = $errorObj->getVar('error_id'); - $title = $myts->displayTarea($errorObj->getVar('error_title')); - //$text = $errorObj->getVar('error_text', 'n'); - // displayTarea ($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1) - $text = $myts->displayTarea($errorObj->getVar('error_text', 'n'), $errorObj->getVar('error_text_html'), $errorObj->getVar('error_text_smiley'), 1, 1, $errorObj->getVar('error_text_breaks')); - - // Add custom title to page title - "<{$xoops_pagetitle}>" - titleaspagetitle - if ($xhttperror->getConfig('title_as_page_title') == 1) { - $xoopsTpl->assign('xoops_pagetitle', $xhttperror->getModule()->getVar('name').' - '. $title); // module name - article title - } - if ($xhttperror->getConfig('title_as_page_title') == 2) { - $xoopsTpl->assign('xoops_pagetitle', $title.' - '. $xhttperror->getModule()->getVar('name')); // article title - module name - } - $xoopsTpl->assign('title', $title); - $xoopsTpl->assign('text', $text); - $xoopsTpl->assign('showsearch', true); // IN PROGRESS: True if show search form in error page - $xoopsTpl->assign('redirect', $errorObj->getVar('error_redirect')); - $xoopsTpl->assign('redirect_time', (int) $errorObj->getVar('error_redirect_time') * 1000); - $xoopsTpl->assign('redirect_uri', $errorObj->getVar('error_redirect_uri')); - } -} -include XOOPS_ROOT_PATH . '/footer.php'; Copied: XoopsModules/xhttperror/branches/luciorota/xhttperror/index.php (from rev 12821, XoopsModules/xhttperror/branches/luciorota/xhttperror/error.php) =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/index.php (rev 0) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/index.php 2014-11-03 18:36:48 UTC (rev 12829) @@ -0,0 +1,103 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * Xhttperror module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xhttperror + * @since 1.00 + * @author Xoops Development Team + * @version svn:$id$ + */ + +$currentFile = basename(__FILE__); +include __DIR__ . '/header.php'; + +$myts = MyTextSanitizer::getInstance(); + +$xoopsOption['template_main'] = "{$xhttperror->getModule()->dirname()}_index.tpl"; +include_once XOOPS_ROOT_PATH . '/header.php'; + +$uid = (is_object($xoopsUser) && isset($xoopsUser)) ? $xoopsUser->uid() : 0; +$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); + +if (!isset($_GET['error'])) { + $xoopsTpl->assign('message', "No error defined."); +} else { + // Save error info to database + // We may want to turn this off on busy sites. + if ($xhttperror->getConfig('error_reporting') == false) { + if (!(is_object($xoopsUser) && isset($xoopsUser)) || ($xoopsUser->isAdmin($xhttperror->getModule()->mid()) && $xhttperror->getConfig('ignore_admin') != true)) { + // create report + $serverVars = array(); + $serverVars['HTTP_REFERER'] = xoops_getenv('HTTP_REFERER'); + $serverVars['REMOTE_ADDR'] = xoops_getenv('REMOTE_ADDR'); + //$serverVars[''] = + $referer = xoops_getenv('HTTP_REFERER'); + $userAgent = xoops_getenv('HTTP_USER_AGENT'); + $remoteAddr = xoops_getenv('REMOTE_ADDR'); + $requestedUri = ''; + if (isset($_SERVER['REDIRECT_URL'])) { + $requestedUri .= $_SERVER['REDIRECT_URL']; + } + if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { + $requestedUri .= '?' . $_SERVER['REDIRECT_QUERY_STRING']; + } + // create error object + $reportObj = $xhttperror->getHandler('report')->create(); + // + $reportObj->setVar('report_uid', $uid); + $reportObj->setVar('report_statuscode', $_GET['error']); + $reportObj->setVar('report_date', time()); + $reportObj->setVar('report_referer', $referer); + $reportObj->setVar('report_useragent', $userAgent); + $reportObj->setVar('report_remoteaddr', $remoteAddr); + $reportObj->setVar('report_requesteduri', $requestedUri); + // store error object + if($xhttperror->getHandler('report')->insert($reportObj)) { + // NOP + } else { + // ERROR + xoops_cp_header(); + echo $reportObj->getHtmlErrors(); + xoops_cp_footer(); + exit(); + } + } + } + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('error_statuscode', $_GET['error'])); + $criteria->add(new Criteria('error_showme', true)); + if ($errorObjs = $xhttperror->getHandler('error')->getObjects($criteria)) { + $errorObj = $errorObjs[0]; + $id = $errorObj->getVar('error_id'); + $title = $myts->displayTarea($errorObj->getVar('error_title')); + //$text = $errorObj->getVar('error_text', 'n'); + // displayTarea ($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1) + $text = $myts->displayTarea($errorObj->getVar('error_text', 'n'), $errorObj->getVar('error_text_html'), $errorObj->getVar('error_text_smiley'), 1, 1, $errorObj->getVar('error_text_breaks')); + + // Add custom title to page title - "<{$xoops_pagetitle}>" - titleaspagetitle + if ($xhttperror->getConfig('title_as_page_title') == 1) { + $xoopsTpl->assign('xoops_pagetitle', $xhttperror->getModule()->getVar('name').' - '. $title); // module name - article title + } + if ($xhttperror->getConfig('title_as_page_title') == 2) { + $xoopsTpl->assign('xoops_pagetitle', $title.' - '. $xhttperror->getModule()->getVar('name')); // article title - module name + } + $xoopsTpl->assign('title', $title); + $xoopsTpl->assign('text', $text); + $xoopsTpl->assign('showsearch', true); // IN PROGRESS: True if show search form in error page + $xoopsTpl->assign('redirect', $errorObj->getVar('error_redirect')); + $xoopsTpl->assign('redirect_time', (int) $errorObj->getVar('error_redirect_time') * 1000); + $xoopsTpl->assign('redirect_uri', $errorObj->getVar('error_redirect_uri')); + } +} +include XOOPS_ROOT_PATH . '/footer.php'; Modified: XoopsModules/xhttperror/branches/luciorota/xhttperror/language/english/help/help.html =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/language/english/help/help.html 2014-10-31 07:13:53 UTC (rev 12828) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/language/english/help/help.html 2014-11-03 18:36:48 UTC (rev 12829) @@ -8,13 +8,13 @@ <p>This module requires that the server supports <b>.htaccess</b> files (and that .htaccess files are allowed for your account), or some way for you to add custom error message redirects.</p> <p>You will need to manually add the following lines to the <b>.htaccess</b> file in your XOOPS root directory for the error codes to work.</p> <div class="xoopsCode"> - ErrorDocument 404 [xoops_url]/modules/xhttperror/error.php?error=404 + ErrorDocument 404 [xoops_url]/modules/xhttperror/index.php?error=404 <br /> - ErrorDocument 500 [xoops_url]/modules/xhttperror/error.php?error=500 + ErrorDocument 500 [xoops_url]/modules/xhttperror/index.php?error=500 <br /> - ErrorDocument 403 [xoops_url]/modules/xhttperror/error.php?error=403 + ErrorDocument 403 [xoops_url]/modules/xhttperror/index.php?error=403 <br /> - ErrorDocument 403 [xoops_url]/modules/xhttperror/error.php?error=[status code] + ErrorDocument 403 [xoops_url]/modules/xhttperror/index.php?error=[status code] </div> <p>Where [status_code] is the status code for server errors and [xoops_url] is the URL to your main XOOPS directory WITHOUT trailing slash (<{$xoops_url}>)</p> <br /> Deleted: XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_error.tpl =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_error.tpl 2014-10-31 07:13:53 UTC (rev 12828) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_error.tpl 2014-11-03 18:36:48 UTC (rev 12829) @@ -1,46 +0,0 @@ -<{* -SMARTY VARS -$title text Error title -$text text/html Error description -$showsearch boolean True if show search form in error page -$redirect int $smarty.const.XHTTPERROR_REDIRECT_no: no redirect; - $smarty.const.XHTTPERROR_REDIRECT_URI: redirect tu url...; - $smarty.const.XHTTPERROR_REDIRECT_PREVIOUS: redirect to previous page; -$redirect_time int Milliseconds to redirect -$redirect_uri text Redirect to -*}> -<{if ($redirect == $smarty.const.XHTTPERROR_REDIRECT_URI)}> -<script type="text/JavaScript"> - <!-- - setTimeout("location.href = '<{$redirect_uri}>';", <{$redirect_time}>); - --> -</script> -<{/if}> -<{if ($redirect == $smarty.const.XHTTPERROR_REDIRECT_PREVIOUS)}> -<script type="text/JavaScript"> - <!-- - setTimeout("history.go(-1);", <{$redirect_time}>); - --> -</script> -<{/if}> - -<h1 style="text-align: center;"><{$title}></h1> - -<{$text}> - -<{if ($showsearch)}> -<!-- search --> -<br /> -<br /> -<br /> -<div align="center"> - <form method="get" action="/search.php"> - <div style="width: 50%;"> - <{$smarty.const._MA_XHTTPERROR_SEARCH}> - <input type="text" name="query" size="30" /> - <input type="hidden" name="action" value="results" /> - <input type="submit" value="Search" /> - </div> - </form> -</div> -<{/if}> Copied: XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_index.tpl (from rev 12821, XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_error.tpl) =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_index.tpl (rev 0) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/templates/xhttperror_index.tpl 2014-11-03 18:36:48 UTC (rev 12829) @@ -0,0 +1,46 @@ +<{* +SMARTY VARS +$title text Error title +$text text/html Error description +$showsearch boolean True if show search form in error page +$redirect int $smarty.const.XHTTPERROR_REDIRECT_no: no redirect; + $smarty.const.XHTTPERROR_REDIRECT_URI: redirect tu url...; + $smarty.const.XHTTPERROR_REDIRECT_PREVIOUS: redirect to previous page; +$redirect_time int Milliseconds to redirect +$redirect_uri text Redirect to +*}> +<{if ($redirect == $smarty.const.XHTTPERROR_REDIRECT_URI)}> +<script type="text/JavaScript"> + <!-- + setTimeout("location.href = '<{$redirect_uri}>';", <{$redirect_time}>); + --> +</script> +<{/if}> +<{if ($redirect == $smarty.const.XHTTPERROR_REDIRECT_PREVIOUS)}> +<script type="text/JavaScript"> + <!-- + setTimeout("history.go(-1);", <{$redirect_time}>); + --> +</script> +<{/if}> + +<h1 style="text-align: center;"><{$title}></h1> + +<{$text}> + +<{if ($showsearch)}> +<!-- search --> +<br /> +<br /> +<br /> +<div align="center"> + <form method="get" action="/search.php"> + <div style="width: 50%;"> + <{$smarty.const._MA_XHTTPERROR_SEARCH}> + <input type="text" name="query" size="30" /> + <input type="hidden" name="action" value="results" /> + <input type="submit" value="Search" /> + </div> + </form> +</div> +<{/if}> Modified: XoopsModules/xhttperror/branches/luciorota/xhttperror/xoops_version.php =================================================================== --- XoopsModules/xhttperror/branches/luciorota/xhttperror/xoops_version.php 2014-10-31 07:13:53 UTC (rev 12828) +++ XoopsModules/xhttperror/branches/luciorota/xhttperror/xoops_version.php 2014-11-03 18:36:48 UTC (rev 12829) @@ -113,7 +113,7 @@ // Templates $i = 0; ++$i; -$modversion['templates'][$i]['file'] = $modversion['dirname'] . '_error.tpl'; +$modversion['templates'][$i]['file'] = $modversion['dirname'] . '_index.tpl'; $modversion['templates'][$i]['description'] = ''; // Admin templates ++$i; |