// Error handler function
function __errorHandler ($errno, $errstr, $errfile, $errline) {
// Construct message
- $msg = sprintf("errno=%s,errstr=%s,errfile=%s,errline=%s",
- $errno,
- $errstr,
- basename($errfile),
- $errline
+ $message = sprintf("errno=%s,errstr=%s,errfile=%s,errline=%s",
+ $errno,
+ $errstr,
+ basename($errfile),
+ $errline
);
// Write debug log message
- DEBUG_LOG(__FUNCTION__, __LINE__, "".$msg, true);
+ DEBUG_LOG($errfile, $errline, $message, true);
// Output message to user and die
if (EXT_IS_ACTIVE('debug')) {
// Debug extension found! So Output a small message
- app_die(__FUNCTION__, __LINE__, "Error message written to debug.log. Please try to call <a href=\"{!URL!}\">the main page</a> to continue.");
- } else {
+ app_die($errfile, $errline, "Error message written to debug.log. Please try to call <a href=\"{!URL!}\">the main page</a> to continue.");
+ } elseif ($GLOBALS['error_handler']['exit_on_error'] === true) {
// No debug extension found, so regular output
- debug_report_bug($msg);
+ debug_report_bug($message);
}
}
+// Init error handler
+function initErrorHandler () {
+ enableExitOnError(false);
+}
+
+// Enable exit on error
+function enableExitOnError ($enable=true) {
+ $GLOBALS['error_handler']['exit_on_error'] = $enable;
+}
+
// [EOF]
?>
$content['mode'] = generateOptionList('/ARRAY/', array("allow", "deny"), array(constant('ADMINS_ALLOW_MODE'), constant('ADMINS_DENY_MODE')), $content['mode']);
} else {
// Don't allow it
- $content['mode'] = " ";
+ $content['mode'] = ' ';
}
$content['la_mode'] = generateOptionList('/ARRAY/', array("global", "OLD", "NEW"), array(ADMINS_GLOBAL_LA_SETTING, ADMINS_OLD_LA_SETTING, ADMINS_NEW_LA_SETTING), $content['la_mode']);
}
// Fix empty elements for constant (fixes display bugs in Firefox)
- if (empty($content['action'])) $content['action'] = " ";
- if (empty($content['what'])) $content['what'] = " ";
- if (empty($content['title'])) $content['title'] = " ";
+ if (empty($content['action'])) $content['action'] = ' ';
+ if (empty($content['what'])) $content['what'] = ' ';
+ if (empty($content['title'])) $content['title'] = ' ';
// Add more data to $content
$content['sw'] = $SW;
$content['mode'] = 'admin';
// Load row template and switch colors
- $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
$SW = 3 - $SW;
} // END - switch
define('__MENU_ROWS', $OUT);
// Load template
- LOAD_TEMPLATE("admin_amenu_edit");
+ LOAD_TEMPLATE('admin_amenu_edit');
} else {
// Menu entries are missing... (???)
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
'menu' => $menu,
'sel' => $sel,
'sw' => $SW,
- 'visible' => ADD_SELECTION('yn', $vis , "visible", $sel),
- 'locked' => ADD_SELECTION('yn', $locked, "locked" , $sel),
+ 'visible' => ADD_SELECTION('yn', $vis , 'visible', $sel),
+ 'locked' => ADD_SELECTION('yn', $locked, 'locked' , $sel),
);
// Load template
- $OUT .= LOAD_TEMPLATE("admin_menu_status_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content);
}
else
{
'sw' => $SW,
'sel' => $sel
);
- $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
}
$SW = 3 - $SW;
}
define('__MENU_ROWS', $OUT);
// Load template
- LOAD_TEMPLATE("admin_gmenu_status");
+ LOAD_TEMPLATE('admin_gmenu_status');
} else {
if ((REQUEST_ISSET_GET(('act'))) && (REQUEST_ISSET_GET(('tid'))) && (REQUEST_ISSET_GET(('fid')))) {
// Get IDs
$NAVI = "<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']-1)."&fid=".$content['sort']."\">{--HIGHER--}</a>/<a href=\"{!URL!}/modules.php?module=admin&what=guestedit&sub={!__SUB_VALUE!}&act=".$content['action']."&w=".$content['what']."&tid=".($content['sort']+1)."&fid=".$content['sort']."\">{--LOWER--}</a>";
}
- if (empty($content['action'])) $content['action'] = " ";
- if (empty($content['what'])) $content['what'] = " ";
- if (empty($content['title'])) $content['title'] = " ";
+ if (empty($content['action'])) $content['action'] = ' ';
+ if (empty($content['what'])) $content['what'] = ' ';
+ if (empty($content['title'])) $content['title'] = ' ';
$content = array(
'sw' => $SW,
'navi' => $NAVI,
'mode' => 'guest'
);
- $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
$SW = 3 - $SW;
}
define('__MENU_ROWS', $OUT);
// Load template
- LOAD_TEMPLATE("admin_gmenu_edit");
+ LOAD_TEMPLATE('admin_gmenu_edit');
} else {
// Menu entries are missing... (???)
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
// We only need outgoing transfers
$result = SQL_QUERY("SELECT userid, to_uid, trans_id, points, reason, time_trans FROM `{!_MYSQL_PREFIX!}_user_transfers_out` ORDER BY trans_id", __FILE__, __LINE__);
$total = 0;
-if (SQL_NUMROWS($result) > 0)
-{
+if (SQL_NUMROWS($result) > 0) {
// Output rows
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result)) {
);
// Load row template add points and switch color
- $OUT .= LOAD_TEMPLATE("admin_list_transfer_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_list_transfer_row', true, $content);
$total += $content['points']; $SW = 3 - $SW;
}
// Free memory
SQL_FREERESULT($result);
-}
-else
-{
+} else {
// Nothing for in and out
$OUT = "<tr>
<td colspan=\"6\" align=\"center\" class=\"bottom2\" height=\"70\">
define('__TRANSFER_SUM', getMessage('TRANSFER_TOTAL_BALANCE'));
// Don't show a delete button
-define('__TRANSFER_DELETE', " ");
+define('__TRANSFER_DELETE', ' ');
// Load final template
-LOAD_TEMPLATE("admin_list_transfer");
+LOAD_TEMPLATE('admin_list_transfer');
//
?>
'menu' => $menu,
'sel' => $sel,
'sw' => $SW,
- 'visible' => ADD_SELECTION('yn', $vis , "visible", $sel),
- 'locked' => ADD_SELECTION('yn', $locked, "locked" , $sel),
+ 'visible' => ADD_SELECTION('yn', $vis , 'visible', $sel),
+ 'locked' => ADD_SELECTION('yn', $locked, 'locked' , $sel),
);
// Load template
- $OUT .= LOAD_TEMPLATE("admin_menu_status_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_status_row', true, $content);
}
else
{
'sw' => $SW,
'sel' => $sel
);
- $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_404_row', true, $content);
}
$SW = 3 - $SW;
}
define('__MENU_ROWS', $OUT);
define('__CNT_VALUE', $cnt);
//
- LOAD_TEMPLATE("admin_mmenu_status");
+ LOAD_TEMPLATE('admin_mmenu_status');
} elseif ((isFormSent()) && (!IS_DEMO())) {
// An act is done...
foreach (REQUEST_POST('sel') as $sel => $menu) {
}
// Fix empty values for Firefox
- if (empty($content['action'])) $content['action'] = " ";
- if (empty($content['what'])) $content['what'] = " ";
- if (empty($content['title'])) $content['title'] = " ";
+ if (empty($content['action'])) $content['action'] = ' ';
+ if (empty($content['what'])) $content['what'] = ' ';
+ if (empty($content['title'])) $content['title'] = ' ';
// Add more entries
$content['sw'] = $SW;
- $content['mode'] = "mem";
+ $content['mode'] = 'mem';
// Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_menu_overview_row', true, $content);
$SW = 3 - $SW;
}
define('__MENU_ROWS', $OUT);
// Load main template
- LOAD_TEMPLATE("admin_mmenu_overview");
+ LOAD_TEMPLATE('admin_mmenu_overview');
} else {
// Menu entries are missing... (???)
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
'id' => $id,
'url' => $url,
'alt' => $alt,
- 'vis' => ADD_SELECTION('yn', $vis , "visible"),
+ 'vis' => ADD_SELECTION('yn', $vis , 'visible'),
);
// Load row template and switch color
- $OUT .= LOAD_TEMPLATE("admin_refbanner_edit_row", true, $content);
+ $OUT .= LOAD_TEMPLATE('admin_refbanner_edit_row', true, $content);
$SW = 3 - $SW;
}
define('__BANNER_ROWS', $OUT);
// Load main template
- LOAD_TEMPLATE("admin_refbanner_edit");
+ LOAD_TEMPLATE('admin_refbanner_edit');
} else {
if (($SEL > 0) && (REQUEST_ISSET_POST('del'))) {
// Delete banner
foreach (REQUEST_POST('sel') as $id => $sel) {
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_refbanner` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
- }
- }
+ } // END - foreach
+ } // END - if
// Referal levels
- $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url",
- __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, url, alternate, visible, counter, clicks FROM `{!_MYSQL_PREFIX!}_refbanner` ORDER BY url", __FILE__, __LINE__);
+
+ // Entries found?
if (SQL_NUMROWS($result) > 0) {
// Make referal banner editable and deletable
$OUT = ''; $SW = 2;
define('__BANNER_ROWS', $OUT);
// Load main template
- LOAD_TEMPLATE("admin_refbanner");
+ LOAD_TEMPLATE('admin_refbanner');
}
// Form for adding new referal levels
- LOAD_TEMPLATE("admin_add_banner");
+ LOAD_TEMPLATE('admin_add_banner');
}
//
// Set error handler
set_error_handler('__errorHandler');
+// Init error handler
+initErrorHandler();
+
// Init request
initRequest();
// Is the link valid?
if (SQL_IS_LINK_UP()) {
+ // Enable exit on error
+ enableExitOnError();
+
// Is it a valid resource?
if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === true) {
// This is required for extension 'optimize' to work
} // END - if
// Major error in module registry is the default
- $ret = "major";
+ $ret = 'major';
// Check if script is installed if not return a 'done' to prevent some errors
if ((!isInstalled()) || (isInstalling()) || (!isAdminRegistered())) {
if (GET_EXT_VERSION('cache') >= '0.1.2') {
// Is the cache there?
if (!isset($GLOBALS['cache_array']['modules'])) {
- // This should normally not happen...
- debug_report_bug("Cache 'modules' is gone.");
+ // This happens when a new extension is registered while ext-cache is installed
+ $ret = 'cache_miss';
} // END - if
// Is the module cached?
$found = true;
} else {
// No, then we have to update it!
- $ret = "cache_miss";
+ $ret = 'cache_miss';
}
} elseif (!EXT_IS_ACTIVE('cache')) {
// Check for module in database
$ret = 'done';
} elseif ($locked == 'Y') {
// Module is locked
- $ret = "locked";
+ $ret = 'locked';
} elseif (($mem == 'Y') && (!IS_MEMBER())) {
// You have to login first!
- $ret = "mem_only";
+ $ret = 'mem_only';
} elseif (($admin == 'Y') && (!IS_ADMIN())) {
// Only the Admin is allowed to enter this module!
- $ret = "admin_only";
+ $ret = 'admin_only';
} else {
// @TODO Nothing helped???
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s",
} // END - if
// Still no luck or not found?
- if (($ret == "cache_miss") || (!$found)) {
+ if (($ret == 'cache_miss') || (!$found)) {
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
if ((isFileReadable(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s.php", constant('PATH'), $mod))) || (isFileReadable(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
// Data is missing so we add it
// Everthing is fine?
if (SQL_AFFECTEDROWS() < 1) {
// Something bad happend!
- return "major";
+ return 'major';
} // END - if
// Destroy cache here
- rebuildCacheFiles("modreg", "modreg");
+ rebuildCacheFiles('modreg', 'modreg');
// And reload data
$ret = checkModulePermissions($mod_chk);
$AND = '';
// First we have to do some analysis...
- if (substr($file, 0, 7) == "action-") {
+ if (substr($file, 0, 7) == 'action-') {
// This is an action file!
$type = 'action';
$search = substr($file, 7);
break;
}
$AND = " AND (`what`='' OR `what` IS NULL)";
- } elseif (substr($file, 0, 5) == "what-") {
+ } elseif (substr($file, 0, 5) == 'what-') {
// This is an admin what file!
$type = 'what';
$search = substr($file, 5);
<div align="center">
<div class="admin_table dashed" style="width:400px;margin-bottom:5px">
<ul style="padding:0px;margin:0px">
- <li class="menu_blur bottom2"><a href="{!URL!}/$content['url']" title="$content['title']">$content['title']</a></li>
+ <li class="menu_blur bottom2"><a href="{!URL!}/$content[url]" title="$content[title]">$content[title]</a></li>
</ul>
</div>
</div>
<li class="show_timings_column" style="margin-left: 2px"><span class="show_timings_column">
{--SHOW_TIMINGS_RUNTIME--} <span class="show_timings_data">$content[runtime]</span> {--SHOW_TIMINGS_SECS--}
</span></li>
- <li class="show_timings_column"" style="margin-left: 2px"><span class="show_timings_column">
+ <li class="show_timings_column" style="margin-left: 2px"><span class="show_timings_column">
{--SHOW_TIMINGS_SQL_QUERIES--} <span class="show_timings_data">$content[numSQLs]</span>
</span></li>
- <li class="show_timings_column"" style="margin-right: 2px"><span class="show_timings_column">
+ <li class="show_timings_column" style="margin-right: 2px"><span class="show_timings_column">
{--SHOW_TIMINGS_NUM_TEMPLATES--} <span class="show_timings_data">$content[numTemplates]</span>
</span></li>
</ul>