/** * cpg_debug_output() * * defined new debug_output function here in functions.inc.php instead of theme.php with different function names to avoid incompatibilities with users not updating their themes as required. Advanced info is only output if (GALLERY_ADMIN_MODE == TRUE) * **/ function cpg_debug_output() { global $USER, $USER_DATA, $META_ALBUM_SET, $ALBUM_SET, $CONFIG, $cpg_time_start, $query_stats, $queries, $lang_cpg_debug_output; $time_end = cpgGetMicroTime(); $time = round($time_end - $cpg_time_start, 3); $query_count = count($query_stats); $total_query_time = array_sum($query_stats); $debug_underline = '
------------------
'; $debug_separate = '
==========================
'; $debug_toggle_link = ' <a href="javascript:;" onclick="show_section(\'debug_output_rows\');" class="admin_menu" id="debug_output_toggle" style="display:none;">' . $lang_cpg_debug_output['show_hide'] . '</a>'; echo '<form name="debug" action="' . $_SERVER['PHP_SELF'] . '" id="debug">'; starttable('100%', $lang_cpg_debug_output['debug_info'] . $debug_toggle_link, 2); //echo '<div name="debug_output_rows" id="debug_output_rows" style="display:block;">'; echo '<tr><td align="center" valign="top" width="100%" colspan="2">'; echo '<table border="0" cellspacing="0" cellpadding="0" width="100%" id="debug_output_rows">'; echo '<tr><td align="center" valign="middle" class="tableh2" width="100">'; echo '<script language="javascript" type="text/javascript"> <!-- function HighlightAll(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() } // only hide the debug_output if the user is capable to display it, i.e. if JavaScript is enabled. If JavaScript is off, debug_output will be displayed and the toggle will remain invisible (as it would not do anything anyway with JS off) addonload("document.getElementById(\'debug_output_rows\').style.display = \'none\'"); addonload("document.getElementById(\'debug_output_toggle\').style.display = \'inline\'"); //--> </script>'; echo ' <a href="javascript:HighlightAll(\'debug.debugtext\')" class="admin_menu">' . $lang_cpg_debug_output['select_all'] . '</a>'; echo '</td><td align="left" valign="middle" class="tableh2">'; if (GALLERY_ADMIN_MODE) { echo '<span class="album_stat">' . $lang_cpg_debug_output['copy_and_paste_instructions'] . '</span>'; } echo '</td></tr>'; echo '<tr><td class="tableb" colspan="2">'; echo '<textarea rows="10" cols="60" class="debug_text" name="debugtext">'; echo "USER: "******"USER DATA:"; echo $debug_underline; print_r($USER_DATA); echo $debug_separate; echo "Queries:"; echo $debug_underline; print_r($queries); echo $debug_separate; echo "GET :"; echo $debug_underline; print_r($_GET); echo $debug_separate; echo "POST :"; echo $debug_underline; print_r($_POST); echo $debug_separate; if (GALLERY_ADMIN_MODE) { echo "VERSION INFO :"; echo $debug_underline; $version_comment = ' - OK'; if (strcmp('4.0.0', phpversion()) == 1) { $version_comment = ' - your PHP version isn\'t good enough! Minimum requirements: 4.x'; } echo 'PHP version: ' . phpversion() . $version_comment; echo $debug_underline; $version_comment = ''; $mySqlVersion = cpg_phpinfo_mysql_version(); if (strcmp('3.23.23', $mySqlVersion) == 1) { $version_comment = ' - your mySQL version isn\'t good enough! Minimum requirements: 3.23.23'; } echo 'mySQL version: ' . $mySqlVersion . $version_comment; echo $debug_underline; echo 'Coppermine version: '; echo COPPERMINE_VERSION . '(' . COPPERMINE_VERSION_STATUS . ')'; echo $debug_separate; // error_reporting (E_ERROR | E_WARNING | E_PARSE); // New maze's error report system if (function_exists('gd_info') == true) { echo 'Module: GD'; echo $debug_underline; $gd_array = gd_info(); foreach ($gd_array as $key => $value) { echo $key . ': ' . $value . "\n"; } echo $debug_separate; } else { echo cpg_phpinfo_mod_output('gd', 'text'); } echo cpg_phpinfo_mod_output('mysql', 'text'); echo cpg_phpinfo_mod_output('zlib', 'text'); echo 'Server restrictions (safe mode)?'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("safe_mode"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("safe_mode_gid"); echo cpg_phpinfo_conf_output("safe_mode_include_dir"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("sql.safe_mode"); echo cpg_phpinfo_conf_output("disable_functions"); echo cpg_phpinfo_conf_output("file_uploads"); echo cpg_phpinfo_conf_output("include_path"); echo cpg_phpinfo_conf_output("open_basedir"); echo $debug_separate; echo 'email'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("sendmail_from"); echo cpg_phpinfo_conf_output("sendmail_path"); echo cpg_phpinfo_conf_output("SMTP"); echo cpg_phpinfo_conf_output("smtp_port"); echo $debug_separate; echo 'Size and Time'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("max_execution_time"); echo cpg_phpinfo_conf_output("max_input_time"); echo cpg_phpinfo_conf_output("upload_max_filesize"); echo cpg_phpinfo_conf_output("post_max_size"); echo $debug_separate; } echo <<<EOT Page generated in {$time} seconds - {$query_count} queries in {$total_query_time} seconds - Album set : {$ALBUM_SET}; Meta set: {$META_ALBUM_SET}; EOT; echo '</textarea>'; echo '</td>'; echo '</tr>'; echo '</table>'; echo '</td></tr>'; if (GALLERY_ADMIN_MODE) { echo "<tr><td class=\"tablef\" colspan=\"2\">"; echo "<a href=\"phpinfo.php\" class=\"admin_menu\">" . $lang_cpg_debug_output['phpinfo'] . "</a>"; // error_reporting (E_ERROR | E_WARNING | E_PARSE); // New maze's error report system echo "</td></tr>"; } // Maze's new error report system global $cpgdebugger; $report = $cpgdebugger->stop(); if (is_array($report) && $CONFIG['debug_notice'] != 0) { echo '<tr><td class="tableh1" colspan="2">'; echo '<b>'; echo $lang_cpg_debug_output['notices']; echo '</b>'; echo '</td></tr>'; echo '<tr><td class="tableb" colspan="2">'; foreach ($report as $file => $errors) { echo '<b>' . substr($file, $strstart) . '</b><ul>'; foreach ($errors as $error) { echo "<li>{$error}</li>"; } echo '</ul>'; } echo '</td></tr>'; } endtable(); echo "</form>"; }
function cpg_debug_output() { global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS; global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries, $lang_cpg_debug_output; $time_end = cpgGetMicroTime(); $time = round($time_end - $time_start, 3); $query_count = count($query_stats); $query_times = ''; $total_query_time = 0; foreach ($query_stats as $qtime) { $query_times .= round($qtime, 3) . "s "; $total_query_time += $qtime; } $total_query_time = round($total_query_time, 3); $debug_underline = '
------------------
'; $debug_separate = '
==========================
'; echo '<form name="debug">'; starttable('100%', $lang_cpg_debug_output['debug_info'], 2); echo '<tr><td align="center" valign="middle" class="tableh2">'; echo '<script language="Javascript"> <!-- function HighlightAll(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() } //--> </script>'; echo ' <div class="admin_menu"><a href="javascript:HighlightAll(\'debug.debugtext\')" class="adm_menu">' . $lang_cpg_debug_output['select_all'] . '</a></div>'; echo '</td><td align="left" valign="middle" class="tableh2">'; if (GALLERY_ADMIN_MODE) { echo '<span class="album_stat">(' . $lang_cpg_debug_output['copy_and_paste_instructions'] . ')</span>'; } echo '</td></tr>'; echo '<tr><td class="tableb" colspan="2">'; echo '<textarea rows="10" class="debug_text" name="debugtext">'; echo "USER: "******"USER DATA:"; echo $debug_underline; print_r($USER_DATA); echo $debug_separate; echo "Queries:"; echo $debug_underline; print_r($queries); echo $debug_separate; echo "GET :"; echo $debug_underline; print_r($HTTP_GET_VARS); echo $debug_separate; echo "POST :"; echo $debug_underline; print_r($HTTP_POST_VARS); echo $debug_separate; if (GALLERY_ADMIN_MODE) { echo "VERSION INFO :"; echo $debug_underline; $version_comment = ' - OK'; if (strcmp('4.0.0', phpversion()) == 1) { $version_comment = ' - your PHP version isn\'t good enough! Minimum requirements: 4.x'; } echo 'PHP version: ' . phpversion() . $version_comment; echo $debug_underline; $version_comment = ''; $mySqlVersion = cpg_phpinfo_mysql_version(); if (strcmp('3.23.23', $mySqlVersion) == 1) { $version_comment = ' - your mySQL version isn\'t good enough! Minimum requirements: 3.23.23'; } echo 'mySQL version: ' . $mySqlVersion . $version_comment; echo $debug_underline; echo 'Coppermine version: '; echo COPPERMINE_VERSION; echo $debug_separate; error_reporting(E_ERROR | E_WARNING | E_PARSE); echo cpg_phpinfo_mod_output('gd', 'text'); echo cpg_phpinfo_mod_output('mysql', 'text'); echo cpg_phpinfo_mod_output('zlib', 'text'); echo 'Server restrictions (safe mode)?'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("safe_mode"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("safe_mode_gid"); echo cpg_phpinfo_conf_output("safe_mode_include_dir"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("sql.safe_mode"); echo cpg_phpinfo_conf_output("disable_functions"); echo cpg_phpinfo_conf_output("file_uploads"); echo cpg_phpinfo_conf_output("include_path"); echo cpg_phpinfo_conf_output("open_basedir"); echo $debug_separate; echo 'email'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("sendmail_from"); echo cpg_phpinfo_conf_output("sendmail_path"); echo cpg_phpinfo_conf_output("SMTP"); echo cpg_phpinfo_conf_output("smtp_port"); echo $debug_separate; echo 'Size and Time'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("max_execution_time"); echo cpg_phpinfo_conf_output("max_input_time"); echo cpg_phpinfo_conf_output("upload_max_filesize"); echo cpg_phpinfo_conf_output("post_max_size"); echo $debug_separate; } echo <<<EOT Page generated in {$time} seconds - {$query_count} queries in {$total_query_time} seconds - Album set : {$ALBUM_SET} EOT; echo "</textarea>"; echo "</td>"; echo "</tr>"; if (GALLERY_ADMIN_MODE) { echo "<tr><td class=\"tableb\" colspan=\"2\">"; echo "<a href=\"phpinfo.php\">" . $lang_cpg_debug_output['phpinfo'] . "</a>"; error_reporting(E_ERROR | E_WARNING | E_PARSE); echo "</td></tr>"; } endtable(); echo "</form>"; }
/** * cpg_debug_output() * * defined new debug_output function here in functions.inc.php instead of theme.php with different function names to avoid incompatibilities with users not updating their themes as required. Advanced info is only output if (GALLERY_ADMIN_MODE == TRUE) * **/ function cpg_debug_output() { global $USER, $USER_DATA, $META_ALBUM_SET, $ALBUM_SET, $CONFIG, $cpg_time_start, $query_stats, $queries, $lang_cpg_debug_output, $CPG_PHP_SELF, $superCage, $CPG_PLUGINS; $time_end = cpgGetMicroTime(); $time = round($time_end - $cpg_time_start, 3); $query_count = count($query_stats); $total_query_time = array_sum($query_stats); $debug_underline = '
------------------
'; $debug_separate = '
==========================
'; $debug_toggle_link = ' <a href="javascript:;" onclick="show_section(\'debug_output_rows\');" class="admin_menu" id="debug_output_toggle" style="display:none;">' . $lang_cpg_debug_output['show_hide'] . '</a>'; echo '<form name="debug" action="' . $CPG_PHP_SELF . '" id="debug">'; starttable('100%', $lang_cpg_debug_output['debug_info'] . $debug_toggle_link, 2); //echo '<div name="debug_output_rows" id="debug_output_rows" style="display:block;">'; echo '<tr><td align="center" valign="top" width="100%" colspan="2">'; echo '<table border="0" cellspacing="0" cellpadding="0" width="100%" id="debug_output_rows">'; echo '<tr><td align="center" valign="middle" class="tableh2" width="100">'; echo '<script language="javascript" type="text/javascript"> <!-- // only hide the debug_output if the user is capable to display it, i.e. if JavaScript is enabled. If JavaScript is off, debug_output will be displayed and the toggle will remain invisible (as it would not do anything anyway with JS off) addonload("document.getElementById(\'debug_output_rows\').style.display = \'none\'"); addonload("document.getElementById(\'debug_output_toggle\').style.display = \'inline\'"); //--> </script>'; echo <<<EOT <script type="text/javascript"> document.write('<a href="javascript:HighlightAll(\\'debug.debugtext\\')" class="admin_menu">'); document.write("{$lang_cpg_debug_output['select_all']}"); document.write('</a>'); </script> </td><td align="left" valign="middle" class="tableh2"> EOT; if (GALLERY_ADMIN_MODE) { echo '<span class="album_stat">' . $lang_cpg_debug_output['copy_and_paste_instructions'] . '</span>'; } echo '</td></tr>'; echo '<tr><td class="tableb" colspan="2">'; echo '<textarea rows="10" cols="60" class="debug_text" name="debugtext">'; echo "USER: "******"USER DATA:"; echo $debug_underline; print_r($USER_DATA); echo $debug_separate; echo "Queries:"; echo $debug_underline; print_r($queries); echo $debug_separate; echo "GET :"; echo $debug_underline; print_r($superCage->get->_source); echo $debug_separate; echo "POST :"; echo $debug_underline; print_r($superCage->post->_source); echo $debug_separate; echo "COOKIE :"; echo $debug_underline; print_r($superCage->cookie->_source); echo $debug_separate; if ($superCage->cookie->keyExists('PHPSESSID')) { echo "SESSION :"; echo $debug_underline; session_id($superCage->cookie->getAlnum('PHPSESSID')); session_start(); print_r($_SESSION); echo $debug_separate; } if (GALLERY_ADMIN_MODE) { echo "VERSION INFO :"; echo $debug_underline; $version_comment = ' - OK'; if (strcmp('4.2.0', phpversion()) == 1) { $version_comment = ' - your PHP version isn\'t good enough! Minimum requirements: 4.2.0'; } echo 'PHP version: ' . phpversion() . $version_comment; echo "\n"; $version_comment = ' - OK'; $mySqlVersion = cpg_phpinfo_mysql_version(); if (strcmp('3.23.23', $mySqlVersion) == 1) { $version_comment = ' - your MySQL version isn\'t good enough! Minimum requirements: 3.23.23'; } echo 'MySQL version: ' . $mySqlVersion . $version_comment; echo "\n"; echo 'Coppermine version: '; echo COPPERMINE_VERSION . '(' . COPPERMINE_VERSION_STATUS . ')'; echo "\n"; echo $debug_separate; // error_reporting (E_ERROR | E_WARNING | E_PARSE); // New maze's error report system if (function_exists('gd_info') == true) { echo 'Module: GD'; echo $debug_underline; $gd_array = gd_info(); foreach ($gd_array as $key => $value) { echo $key . ': ' . $value . "\n"; } echo $debug_separate; } else { echo cpg_phpinfo_mod_output('gd', 'text'); } echo 'Key config settings'; echo $debug_underline; echo cpg_config_output("allow_private_albums"); echo cpg_config_output("cookie_name"); echo cpg_config_output("cookie_path"); echo cpg_config_output("ecards_more_pic_target"); echo cpg_config_output("impath"); echo cpg_config_output("lang"); echo cpg_config_output("language_fallback"); echo cpg_config_output("main_page_layout"); echo cpg_config_output("silly_safe_mode"); echo cpg_config_output("smtp_host"); echo cpg_config_output("theme"); echo cpg_config_output("thumb_method"); echo $debug_separate; echo 'Plugins'; echo $debug_underline; foreach ($CPG_PLUGINS as $plugin) { echo 'Plugin: ' . $plugin->name . "\n"; echo 'Actions: ' . implode(', ', array_keys($plugin->actions)) . "\n"; echo 'Filters: ' . implode(', ', array_keys($plugin->filters)); echo $debug_underline; } echo $debug_separate; echo 'Server restrictions'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("safe_mode"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("safe_mode_gid"); echo cpg_phpinfo_conf_output("safe_mode_include_dir"); echo cpg_phpinfo_conf_output("safe_mode_exec_dir"); echo cpg_phpinfo_conf_output("sql.safe_mode"); echo cpg_phpinfo_conf_output("disable_functions"); echo cpg_phpinfo_conf_output("file_uploads"); echo cpg_phpinfo_conf_output("include_path"); echo cpg_phpinfo_conf_output("open_basedir"); echo cpg_phpinfo_conf_output("allow_url_fopen"); echo "\n{$debug_separate}"; echo 'Resource limits'; echo $debug_underline; echo 'Directive | Local Value | Master Value'; echo cpg_phpinfo_conf_output("max_execution_time"); echo cpg_phpinfo_conf_output("max_input_time"); echo cpg_phpinfo_conf_output("upload_max_filesize"); echo cpg_phpinfo_conf_output("post_max_size"); echo cpg_phpinfo_conf_output("memory_limit"); echo "\n{$debug_separate}"; } echo <<<EOT Page generated in {$time} seconds - {$query_count} queries in {$total_query_time} seconds - Album set : {$ALBUM_SET}; Meta set: {$META_ALBUM_SET}; EOT; echo '</textarea>'; echo '</td>'; echo '</tr>'; echo '</table>'; echo '</td></tr>'; if (GALLERY_ADMIN_MODE) { echo "<tr><td class=\"tablef\" colspan=\"2\">"; echo "<a href=\"phpinfo.php\" class=\"admin_menu\">" . $lang_cpg_debug_output['phpinfo'] . "</a>"; // error_reporting (E_ERROR | E_WARNING | E_PARSE); // New maze's error report system echo "</td></tr>"; } // Maze's new error report system global $cpgdebugger; $report = $cpgdebugger->stop(); if (is_array($report) && $CONFIG['debug_notice'] != 0) { echo '<tr><td class="tableh1" colspan="2">'; echo '<b>'; echo $lang_cpg_debug_output['notices']; echo '</b>'; echo '</td></tr>'; echo '<tr><td class="tableb" colspan="2">'; foreach ($report as $file => $errors) { echo '<b>' . substr($file, $strstart) . '</b><ul>'; foreach ($errors as $error) { echo "<li>{$error}</li>"; } echo '</ul>'; } echo '</td></tr>'; } endtable(); echo "</form>"; }