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, $CONFIG, $cpg_time_start, $query_stats, $queries, $lang_cpg_debug_output, $CPG_PHP_SELF, $superCage, $CPG_PLUGINS, $LINEBREAK; if ($CONFIG['performance_timestamp'] == 0 || date('Y-m-d', $CONFIG['performance_timestamp']) < date('Y-m-d')) { // The metering data in the config table are outdated, let's write fresh values. // Currently happens each day. To extend the metering period to a whole week, // use 'Y-m-W' for both date functions above. Use 'Y-m' to extend the period over // one month and subsequently 'Y' for an entire year. $CONFIG['performance_timestamp'] = time(); cpg_config_set('performance_timestamp', $CONFIG['performance_timestamp']); $CONFIG['performance_page_generation_time'] = 0; $CONFIG['performance_page_query_time'] = 0; $CONFIG['performance_page_query_count'] = 0; } $time_end = cpgGetMicroTime(); $time = round(($time_end - $cpg_time_start) * 1000, 2); if ($CONFIG['performance_page_generation_time'] < $time) { $CONFIG['performance_page_generation_time'] = $time; cpg_config_set('performance_page_generation_time', $CONFIG['performance_page_generation_time']); } $query_count = count($query_stats); $total_query_time = round(array_sum($query_stats), 2); if ($CONFIG['performance_page_query_time'] < $total_query_time) { $CONFIG['performance_page_query_time'] = $total_query_time; cpg_config_set('performance_page_query_time', $CONFIG['performance_page_query_time']); } if ($CONFIG['performance_page_query_count'] < $query_count) { $CONFIG['performance_page_query_count'] = $query_count; cpg_config_set('performance_page_query_count', $CONFIG['performance_page_query_count']); } $debug_underline = '
------------------
'; $debug_separate = '
==========================
'; $debug_toggle_link = $lang_cpg_debug_output['debug_output'] . ': <span class="detail_head_collapsed">' . $lang_cpg_debug_output['show_hide'] . '</span>'; $debug_help = ' ' . cpg_display_help('f=empty.htm&h=lang_cpg_debug_output[debug_output_explain]&t=lang_cpg_debug_output[copy_and_paste_instructions]', 470, 245); $debug_phpinfo_link = GALLERY_ADMIN_MODE ? '<a href="phpinfo.php" class="admin_menu">' . cpg_fetch_icon('phpinfo', 1) . $lang_cpg_debug_output['phpinfo'] . '</a> ' : ''; echo <<<EOT <script language="javascript" type="text/javascript"> <!-- addonload("document.getElementById('debug_output_select_all').style.display = 'inline'"); //--> </script> <form name="debug" action="{$CPG_PHP_SELF}" id="debug"> EOT; starttable('100%', cpg_fetch_icon('bug', 2) . $lang_cpg_debug_output['debug_info'] . $debug_help, 2); echo <<<EOT <tr> <td> </td> </tr> <tr> <td valign="top" align="left" class="tableb"> {$debug_phpinfo_link}{$debug_toggle_link} <span class="detail_body"> <button type="button" class="button" name="debug_output_select_all" style="display:none" id="debug_output_select_all" value="{$lang_cpg_debug_output['select_all']}" onclick="HighlightAll('debug.debugtext');">{$lang_cpg_debug_output['select_all']}</button><br /> <textarea rows="30" cols="60" class="debug_text" name="debugtext"> EOT; echo "USER: "******"USER DATA:"; echo $debug_underline; echo htmlentities(print_r($USER_DATA, true)); echo $debug_separate; echo "Queries:"; echo $debug_underline; echo htmlentities(print_r($queries, true)); echo $debug_separate; echo "GET :"; echo $debug_underline; echo htmlentities(print_r($superCage->get->_source, true)); echo $debug_separate; echo "POST :"; echo $debug_underline; echo htmlentities(print_r($superCage->post->_source, true)); echo $debug_separate; echo "COOKIE :"; echo $debug_underline; echo htmlentities(print_r($superCage->cookie->_source, true)); echo $debug_separate; if ($superCage->cookie->keyExists('PHPSESSID')) { echo "SESSION :"; echo $debug_underline; if (!isset($_SESSION)) { session_id($superCage->cookie->getAlnum('PHPSESSID')); session_start(); } echo htmlentities(print_r($_SESSION, true)); echo $debug_separate; } if (GALLERY_ADMIN_MODE) { $table = array(); echo "VERSION INFO :"; echo $debug_underline; $my_php_version = phpversion(); if ($my_php_version == '') { $my_php_version = PHP_VERSION; } if (version_compare($my_php_version, '4.3.0', '>=')) { $version_comment = 'OK'; } else { $version_comment = 'Your PHP version isn\'t good enough! Minimum requirements: 4.3.0'; } $table[] = array('PHP version', $my_php_version, $version_comment); $mySqlVersion = cpg_phpinfo_mysql_version(); if (version_compare($mySqlVersion, '3.23.23', '>=')) { $version_comment = 'OK'; } else { $version_comment = 'Your MySQL version isn\'t good enough! Minimum requirements: 3.23.23'; } $table[] = array('MySQL version', $mySqlVersion, $version_comment); $table[] = array('Coppermine version', COPPERMINE_VERSION, COPPERMINE_VERSION_STATUS); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; if (function_exists('gd_info') == true) { echo 'Module: GD'; echo $debug_underline; $gd_array = gd_info(); $table = array(); if (array_key_exists('GD Version', $gd_array) == TRUE) { $table[] = array('Exact version', preg_replace('/[[:alpha:][:space:]()]+/', '', $gd_array['GD Version'])); } foreach ($gd_array as $key => $value) { $table[] = array($key, $value); } echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($gd_array); unset($table); echo $debug_separate; } else { echo cpg_phpinfo_mod_output('gd', 'text', '|'); } echo 'Key config settings'; echo $debug_underline; $table = array(); $table[] = array('site_url', $CONFIG['site_url']); $table[] = array('charset', $CONFIG['charset']); $table[] = array('allow_private_albums', $CONFIG['allow_private_albums']); $table[] = array('cookie_name', $CONFIG['cookie_name']); $table[] = array('cookie_path', $CONFIG['cookie_path']); $table[] = array('impath', $CONFIG['impath']); $table[] = array('lang', $CONFIG['lang']); $table[] = array('main_page_layout', $CONFIG['main_page_layout']); $table[] = array('silly_safe_mode', $CONFIG['silly_safe_mode']); $table[] = array('smtp_host', $CONFIG['smtp_host']); $table[] = array('theme', $CONFIG['theme']); $table[] = array('thumb_method', $CONFIG['thumb_method']); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; echo 'Plugins'; echo $debug_underline; $table = array(); foreach ($CPG_PLUGINS as $plugin) { $table[] = array('Name', $plugin->name); $table[] = array('Actions', implode(', ', array_keys($plugin->actions))); $table[] = array('Filters', implode(', ', array_keys($plugin->filters))); $table[] = array('--------------'); } echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; echo 'Server restrictions'; echo $debug_underline; $table = array(); $table[] = array('safe_mode', ini_get('safe_mode')); $table[] = array('safe_mode_exec_dir', ini_get('safe_mode_exec_dir')); $table[] = array('safe_mode_gid', ini_get('safe_mode_gid')); $table[] = array('safe_mode_include_dir', ini_get('safe_mode_include_dir')); $table[] = array('sql.safe_mode', ini_get('sql.safe_mode')); $table[] = array('disable_functions', ini_get('disable_functions')); $table[] = array('file_uploads', ini_get('file_uploads')); $table[] = array('include_path', ini_get('include_path')); $table[] = array('open_basedir', ini_get('open_basedir')); $table[] = array('allow_url_fopen', ini_get('allow_url_fopen')); $table[] = array('max_execution_time', ini_get('max_execution_time')); $table[] = array('max_input_time', ini_get('max_input_time')); $table[] = array('upload_max_filesize', ini_get('upload_max_filesize')); $table[] = array('post_max_size', ini_get('post_max_size')); $table[] = array('memory_limit', ini_get('memory_limit')); $table[] = array('suhosin.post.max_vars', ini_get('suhosin.post.max_vars')); $table[] = array('suhosin.request.max_vars', ini_get('suhosin.request.max_vars')); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $LINEBREAK . $debug_separate; echo 'Page (performance)'; echo $debug_underline; $table = array(); $table[] = array('Parameter', 'Current', 'Peak'); if (function_exists('memory_get_peak_usage')) { $peak_memory_usage = cpg_format_bytes(memory_get_peak_usage()); } else { $peak_memory_usage = 'n/a'; } $table[] = array('Memory usage', cpg_format_bytes(memory_get_usage()), $peak_memory_usage); $table[] = array('Page generation', $time . ' ms', $CONFIG['performance_page_generation_time'] . ' ms'); $table[] = array('Page query time', $total_query_time . ' ms', $CONFIG['performance_page_query_time'] . ' ms'); $table[] = array('Page query count', $query_count, $CONFIG['performance_page_query_count']); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $LINEBREAK . $debug_separate; } echo <<<EOT </textarea> </span> </td> </tr> EOT; if ($CONFIG['debug_notice'] != 0) { // Maze's error report system global $cpgdebugger; $report = $cpgdebugger->stop(); //$debug_notices_icon = cpg_fetch_icon('text_left', 2); if (GALLERY_ADMIN_MODE) { $notices_help = 'notices_help_admin'; } else { $notices_help = 'notices_help_non_admin'; } $notices_help = ' ' . cpg_display_help('f=empty.htm&h=lang_cpg_debug_output[notices]&t=lang_cpg_debug_output[' . $notices_help . ']', 470, 245); if (is_array($report)) { echo <<<EOT <tr> <td class="tableh2"> {$lang_cpg_debug_output['notices']}{$notices_help} </td> </tr> EOT; $noticesLoopCounter = 0; foreach ($report as $file => $errors) { if ($noticesLoopCounter / 2 == floor($noticesLoopCounter / 2)) { $cellstyle = 'tableb tableb_alternate'; } else { $cellstyle = 'tableb'; } echo <<<EOT <tr> <td class="{$cellstyle}"> EOT; //echo '<strong>' . substr($file, $strstart) . '</strong><ul>'; //$strstart does not exist echo '<strong>' . $file . '</strong><ul>'; foreach ($errors as $error) { echo "<li>{$error}</li>"; } echo <<<EOT </ul> </td> </tr> EOT; $noticesLoopCounter++; } } } 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; $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>"; }
/** * 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>"; }