// ------------------------------------------------------------------------- // define('IN_COPPERMINE', true); define('PLUGINMGR_PHP', true); define('CORE_PLUGIN', true); require 'include/init.inc.php'; if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } // write the plugin enable/disable change to the db if ($superCage->post->keyExists('update_config')) { if (!checkFormToken()) { global $lang_errors; cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } $value = $superCage->post->getInt('enable_plugins'); cpg_config_set('enable_plugins', $value); header('Location: pluginmgr.php'); } function display_plugin_list() { global $CPG_PLUGINS, $lang_pluginmgr_php, $lang_plugin_php, $lang_common, $CONFIG, $CPG_PHP_SELF; list($timestamp, $form_token) = getFormToken(); $help = ' ' . cpg_display_help('f=plugins.htm&as=plugin_manager&ae=plugin_manager_end&top=1', '800', '600'); $help_plugin_enable = cpg_display_help('f=configuration.htm&as=admin_general_enable-plugins&ae=admin_general_enable-plugins_end', 400, 300); // configure plugin api (enabled or disabled) $yes_selected = $CONFIG['enable_plugins'] ? 'checked="checked"' : ''; $no_selected = !$CONFIG['enable_plugins'] ? 'checked="checked"' : ''; print '<form name="pluginenableconfig" id="cpgform2" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">'; starttable('-1', cpg_fetch_icon('plugin_mgr', 2) . $lang_pluginmgr_php['pmgr'] . $help, 3); echo <<<EOT <tr>
function write_to_db($step) { global $BRIDGE, $CONFIG, $default_bridge_data, $lang_bridgemgr_php, $posted_var, $LINEBREAK; $error = 0; // do the check for plausibility of posted data foreach ($posted_var as $key => $value) { // loop through the posted data -- start // filter the post data that doesn't get written if (array_key_exists($key, $BRIDGE)) { // post data exists as db key -- start // do the lookups $options = explode(',', $default_bridge_data[$BRIDGE['short_name']][$key . '_used']); foreach ($options as $key2) { $options[$key2] = trim($options[$key2], ','); // get rid of the delimiters } if ($options[0] != '') { // only continue with this loop if there really is an option to check --- start if ($options[0] == 'lookfor') { // check for the existance of a local file/folder --- start if (file_exists($value . $options[1]) == false) { $return[$key] = sprintf($lang_bridgemgr_php['error_folder_not_exist'], '<tt>' . $value . $options[1] . '</tt>', '<i>' . $lang_bridgemgr_php[$key] . '</i>'); } } // check for the existance of a file/folder --- end if ($options[0] == 'cookie') { // check for the existance of a cookie --- start foreach ($_COOKIE as $key2 => $value2) { // loop through the cookie global var --- start //print '<br>cookie:'.$key2.', content:'.$value2.'<br />' . $LINEBREAK; if (@strstr($key2, $value) == false && $options[1] == 'not_empty') { $return[$key] = sprintf($lang_bridgemgr_php['error_cookie_not_readible'], '"<tt>' . $value . '</tt>*"', '<i>' . $lang_bridgemgr_php[$key] . '</i>'); } } // loop through the cookie global var --- end if (isset($temp_err)) { $return[$key] = $temp_err; } } // check for the existance of a cookie --- end if ($options[1] == 'not_empty') { // check for empty mandatory fields --- start if ($value == '') { $return[$key] = sprintf($lang_bridgemgr_php['error_mandatory_field_empty'], '<i>' . $lang_bridgemgr_php[$key] . '</i>'); } } // check for empty mandatory fields --- end if ($options[0] == 'no_trailing_slash' || $options[1] == 'no_trailing_slash' || $options[2] == 'no_trailing_slash') { // check for unneeded trailing slashes --- start if ($value != rtrim($value, '/')) { $return[$key] = sprintf($lang_bridgemgr_php['error_no_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>'); } } // check for unneeded traling slashes --- end if ($options[0] == 'trailing_slash' || $options[1] == 'trailing_slash' || $options[2] == 'trailing_slash') { // check for needed trailing slashes --- start if ($value == rtrim($value, '/')) { $return[$key] = sprintf($lang_bridgemgr_php['error_trailing_slash'], '<i>' . $lang_bridgemgr_php[$key] . '</i>'); } } // check for needed traling slashes --- end } // only continue with this loop if there really is an option to check --- end } // post data exists as db key -- end } // loop through the posted data -- end // loop through the expected data //void // do some checking according to the step we're currently in switch ($step) { case "choose_bbs": if ($posted_var['short_name'] == '') { $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs']; $error++; } if ($posted_var['short_name'] == 'custom_selector') { $posted_var['short_name'] = $posted_var['custom_filename']; if ($posted_var['short_name'] == '') { $return['short_name'] = $lang_bridgemgr_php['error_no_blank_name']; } if (preg_match('/[^a-z0-9_-]/i', $posted_var['short_name'])) { $return['short_name'] = $lang_bridgemgr_php['error_no_special_chars']; } } // check if the bridge file actually exists if (file_exists('bridge/' . $posted_var['short_name'] . '.inc.php') == false) { $return['bridge_file_not_exist'] = sprintf($lang_bridgemgr_php['error_bridge_file_not_exist'], '<i>bridge/' . $posted_var['short_name'] . '.inc.php</i>'); } break; case "settings_path": //if ($posted_var['short_name'] == '') { // $return['short_name'] = $lang_bridgemgr_php['error_specify_bbs']; //} break; } // end switch // write the post data to the database foreach ($posted_var as $key => $value) { // filter the post data that doesn't get written if (array_key_exists($key, $BRIDGE)) { if ($CONFIG['debug_mode'] != 0) { // print what actually get's written when in debug_mode print '<span class="explanation">Writing to database: '; print $key . '|' . $value; print '<br /></span>'; } if ($return[$key] != '') { //print '|Error in this key'; } else { cpg_db_query("UPDATE {$CONFIG['TABLE_BRIDGE']} SET value = '{$value}' WHERE name = '{$key}'"); } //print '<br />'; } } $value = $posted_var['bridge_enable']; if ($value != '0' && $value != '1') { $value = $CONFIG['bridge_enable']; } cpg_config_set('bridge_enable', $value); if ($posted_var['clear_unused_db_fields'] == 1) { // clear all database entries that aren't actually used with the current bridge file // not implemented yet (not sure if necessary after all) } // ouput error messages, if any if (is_array($return)) { starttable(-1, $lang_bridgemgr_php['error_title']); print '<tr><td class="tableb" align="left"><ul>'; foreach ($return as $key) { print '<li>' . $key . '</li>'; } print '</ul></td></tr>'; print '<tr>' . $LINEBREAK; print ' <td class="tablef" align="center">' . $LINEBREAK; print ' <a href="javascript:history.back()" class="admin_menu" title="' . $lang_bridgemgr_php['back'] . '" />«' . $lang_bridgemgr_php['back'] . '</a>' . $LINEBREAK; print ' </td>' . $LINEBREAK; print '</tr>' . $LINEBREAK; endtable(); $error = 1; } print '<br />'; if ($error != '') { return 'error'; } }
if (($cat_count = $result->numRows()) > 0) { while ($row = $result->fetchAssoc()) { $children[] = $row['cid']; verify_children($row['cid'], $cid); } } $result->free(); return false; } if ($superCage->post->keyExists('update_config')) { //Check if the form token is valid if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } $value = $superCage->post->getInt('categories_alpha_sort'); cpg_config_set('categories_alpha_sort', $value); rebuild_tree(); } if ($superCage->get->keyExists('op')) { $op = $superCage->get->getAlpha('op'); //Check if the form token is valid if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } } else { $op = ''; } $current_category = array('cid' => 0, 'name' => '', 'parent' => 0, 'description' => ''); switch ($op) { case 'move': if (!$superCage->get->keyExists('cid1') || !$superCage->get->keyExists('cid2') || !$superCage->get->keyExists('pos1') || !$superCage->get->keyExists('pos2')) {
**********************************************/ define('IN_COPPERMINE', true); define('MODE_PHP', true); require 'include/init.inc.php'; if ($superCage->get->getAlpha('what') == 'news') { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } if ($CONFIG['display_coppermine_news'] == 0) { $value = 1; $message = $lang_mode_php['news_show']; } else { $value = 0; $message = $lang_mode_php['news_hide']; } cpg_config_set('display_coppermine_news', $value); cpgRedirectPage($CPG_REFERER, $lang_common['information'], $message, 3); } else { if (!USER_IS_ADMIN) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } if (!$superCage->get->keyExists('admin_mode') || !$CPG_REFERER) { cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__); } $admin_mode = $superCage->get->getInt('admin_mode') ? 1 : 0; $USER['am'] = $admin_mode; if (!$admin_mode) { $CPG_REFERER = 'index.php'; } cpgRedirectPage($CPG_REFERER, $lang_common['information'], $lang_mode_php[$admin_mode], 3); }
$admin_data_array[$adminDataKey] = $evaluate_value; // replace the stuff in the form field with the improper input, so the user can see and correct his error if (in_array($adminDataKey, $problemFields_array) != TRUE) { $problemFields_array[] = $adminDataKey; } if (in_array($config_section_key, $collapseSections_array) == TRUE) { unset($collapseSections_array[array_search($config_section_key, $collapseSections_array)]); } } if ($superCage->post->keyExists('update_config') && $regexValidation == '1' && $evaluate_value != $CONFIG[$adminDataKey] && $CONFIG[$adminDataKey] !== stripslashes($evaluate_value)) { // A space cannot be stored in the config table since the value field is VARCHAR, so %20 is used instead. if ($adminDataKey == 'keyword_separator' && $evaluate_value == ' ') { $evaluate_value = '%20'; } // finally, all criteria have been met - let's write the updated data to the database cpg_config_set($adminDataKey, $evaluate_value); // perform special tasks -- start // Code to rename system thumbs in images folder $old_thumb_pfx =& $CONFIG['thumb_pfx']; $matches = $superCage->post->getMatched('thumb_pfx', '/^[0-9A-Za-z_-]+$/'); $thumb_pfx = $matches[0]; if ($old_thumb_pfx != $thumb_pfx) { $folders = array('images/', $THEME_DIR . 'images/'); foreach ($folders as $folder) { $thumbs = cpg_get_system_thumb_list($folder); foreach ($thumbs as $thumb) { @rename($folder . $thumb['filename'], $folder . str_replace($old_thumb_pfx, $thumb_pfx, $thumb['filename'])); } } } // perform special tasks -- end
function keyword_convert() { global $CONFIG, $lang_common, $lang_util_php, $icon_array; $superCage = Inspekt::makeSuperCage(); $set_config = $superCage->post->keyExists('keyword_set') ? $superCage->post->getInt('keyword_set') : 0; $replace_from = $superCage->post->keyExists('keyword_from') ? html_entity_decode($superCage->post->getEscaped('keyword_from')) : ''; $replace_to = $superCage->post->keyExists('keyword_to') ? html_entity_decode($superCage->post->getEscaped('keyword_to')) : ''; $replace1 = $superCage->post->keyExists('keyword_replace1') ? $superCage->post->getInt('keyword_replace1') : 0; $replace1_from = $superCage->post->keyExists('keyword_replace1_from') ? html_entity_decode($superCage->post->getEscaped('keyword_replace1_from')) : ''; $replace1_to = $superCage->post->keyExists('keyword_replace1_to') ? html_entity_decode($superCage->post->getEscaped('keyword_replace1_to')) : ''; $replace2 = $superCage->post->keyExists('keyword_replace2') ? $superCage->post->getInt('keyword_replace2') : 0; $replace2_from = $superCage->post->keyExists('keyword_replace2_from') ? html_entity_decode($superCage->post->getEscaped('keyword_replace2_from')) : ''; $replace2_to = $superCage->post->keyExists('keyword_replace2_to') ? html_entity_decode($superCage->post->getEscaped('keyword_replace2_to')) : ''; starttable('100%', $icon_array['info'] . ' ' . $lang_util_php['keyword_convert'], 1); echo ' <tr><td><br />' . $LINEBREAK; $replace_options = array_merge($lang_common['keyword_separators'], $lang_util_php['keyword_replace_values']); if ($replace1 && strlen($replace1_from) && strlen($replace1_to) && $replace1_from != $replace1_to) { $sql = "UPDATE `{$CONFIG['TABLE_PICTURES']}` SET keywords = REPLACE(keywords, '{$replace1_from}', '{$replace1_to}')"; cpg_db_query($sql); echo ' ' . sprintf($lang_util_php['keyword_replace_before'], '<strong>' . $replace_options[$replace1_from] . '</strong>', '<strong>' . $replace_options[$replace1_to] . '</strong>') . ': ' . $lang_common['done'] . '<br /><br />' . $LINEBREAK; } if (strlen($replace_from) && strlen($replace_to) && $replace_from != $replace_to) { $sql = "UPDATE `{$CONFIG['TABLE_PICTURES']}` SET keywords = REPLACE(keywords, '{$replace_from}', '{$replace_to}')"; cpg_db_query($sql); echo ' ' . sprintf($lang_util_php['keyword_from_to'], '<strong>' . $replace_options[$replace_from] . '</strong>', '<strong>' . $replace_options[$replace_to] . '</strong>') . ': ' . $lang_common['done'] . '<br /><br />' . $LINEBREAK; } if ($replace2 && strlen($replace2_from) && strlen($replace2_to) && $replace2_from != $replace2_to) { $sql = "UPDATE `{$CONFIG['TABLE_PICTURES']}` SET keywords = REPLACE(keywords, '{$replace2_from}', '{$replace2_to}')"; cpg_db_query($sql); echo ' ' . sprintf($lang_util_php['keyword_replace_after'], '<strong>' . $replace_options[$replace2_from] . '</strong>', '<strong>' . $replace_options[$replace2_to] . '</strong>') . ': ' . $lang_common['done'] . '<br /><br />' . $LINEBREAK; } if ($set_config) { cpg_config_set('keyword_separator', $replace_to); echo "{$lang_util_php['keyword_set']} (<strong>" . $lang_common['keyword_separators'][$replace_to] . '</strong>): ' . $lang_common['done'] . '<br /><br />' . $LINEBREAK; } echo " </td></tr>"; endtable(); }
pageheader($lang_search_new_php['page_title']); $help = ' ' . cpg_display_help('f=uploading_batch-add.htm&as=batch_add_pics&ae=batch_add_pics_end&top=1', '600', '450'); echo '<form name="interfaceconfig" id="cpgform" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">'; starttable(-1, $icon_array['batch_add'] . $lang_search_new_php['select_dir'] . $help); // write the interface change to the db //if (isset($_POST['update_config'])) { if ($superCage->post->keyExists('update_config')) { //$browse_batch_add = (int)$_POST['browse_batch_add']; $browse_batch_add = $superCage->post->getInt('browse_batch_add'); if ($browse_batch_add != $CONFIG['browse_batch_add']) { cpg_config_set('browse_batch_add', $browse_batch_add); } //$display_thumbs_batch_add = (int)$_POST['display_thumbs_batch_add']; $display_thumbs_batch_add = $superCage->post->getInt('display_thumbs_batch_add'); if ($display_thumbs_batch_add != $CONFIG['display_thumbs_batch_add']) { cpg_config_set('display_thumbs_batch_add', $display_thumbs_batch_add); } } // define folder prefix, separator, and regex (to sanitize incoming parameters) if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { // Windows server $folder_sep = '\\'; } else { // *nix server $folder_sep = '/'; } $iframe_startfolder = str_replace('searchnew.php', '', __FILE__) . rtrim($CONFIG['fullpath'], '/') . $folder_sep; echo ' <tr>' . $LINEBREAK; echo ' <td class="tableb" align="center">' . $LINEBREAK; if ($CONFIG['browse_batch_add'] == 1) { echo ' <iframe src="minibrowser.php?startfolder=' . $iframe_startfolder . '&parentform=choosefolder&formelementname=startdir&no_popup=1&limitfolder=' . $iframe_startfolder . '&linktarget=' . $CPG_PHP_SELF . '&searchnew_php=1&radio=0" width="95%" height="400" name="popup_in_a_box"></iframe>' . $LINEBREAK;
// end the script if we just need a blank page if ($type == 'blank') { die; } // perform database write queries if needed - start if (GALLERY_ADMIN_MODE) { $configChangesApplied = ''; if ($superCage->get->getAlpha('mode') == 'editForm') { $get_hit_details = $superCage->get->getInt('hit_details'); if ($get_hit_details != $CONFIG['hit_details'] && $superCage->get->getEscaped('go') != '') { cpg_config_set('hit_details', $get_hit_details); $configChangesApplied = $lang_stat_details_php['upd_success']; } $get_vote_details = $superCage->get->getInt('vote_details'); if ($get_vote_details != $CONFIG['vote_details'] && $superCage->get->getEscaped('go') != '') { cpg_config_set('vote_details', $get_vote_details); $configChangesApplied = $lang_stat_details_php['upd_success']; } } if ($superCage->get->getEscaped('emptyhitstats') == TRUE) { cpg_db_query("DELETE FROM {$CONFIG['TABLE_HIT_STATS']}"); $configChangesApplied = $lang_stat_details_php['upd_success']; } if ($superCage->get->getEscaped('emptyvotestats') == TRUE) { cpg_db_query("DELETE FROM {$CONFIG['TABLE_VOTE_STATS']}"); $configChangesApplied = $lang_stat_details_php['upd_success']; } } // perform database write queries if needed - end // output the header depending on the mode (fullscreen vs embedded) - start if ($mode == 'fullscreen') {
} pageheader($lang_db_input_php['com_added'], "<meta http-equiv=\"refresh\" content=\"1;url={$redirect}\" />"); msg_box($lang_db_input_php['info'], $lang_db_input_php['com_added'], $lang_common['continue'], $redirect); pagefooter(); exit; } else { // Registered users, we can use Location to redirect // Perform Akismet check if applicable for registered users if ($CONFIG['comment_akismet_api_key'] != '' && $CONFIG['comment_akismet_group'] != 1) { //$comment_evaluation_array['comment_author_email'] = '';// TODO: populate the email address from the user's profile $akismet_result = cpg_akismet_submit_data($comment_evaluation_array); if ($akismet_result == TRUE) { // returns true if Akismet thinks the comment is spam // Increase the spam counter by one $spam_count = $CONFIG['comment_akismet_counter'] + 1; cpg_config_set('comment_akismet_counter', $spam_count); if ($CONFIG['comment_akismet_enable'] == 0) { $akismet_approval_needed = 1; // Temporarily just set comment approval to "on" $spam = 'YES'; } elseif ($CONFIG['comment_akismet_enable'] == 1) { $redirect = "displayimage.php?pid={$pid}"; cpgRedirectPage($redirect, $lang_db_input_php['info'], $lang_display_comments['comment_rejected'], 5); } else { $redirect = "displayimage.php?pid={$pid}"; cpgRedirectPage($redirect, $lang_db_input_php['info'], $lang_db_input_php['com_added'], 1); } } } if ($CONFIG['comment_approval'] == 1 && !USER_IS_ADMIN || $akismet_approval_needed == 1) { // comments need approval, set approval status to "no"
/** * 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>'; }
$icon_array['stop'] = cpg_fetch_icon('stop', 2); $icon_array['cancel'] = cpg_fetch_icon('cancel', 2); // Change config options if applicable if ($superCage->post->keyExists('is_submit')) { //Check if the form token is valid if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } if ($superCage->post->keyExists('approval_only')) { $approval_only = 1; } else { $approval_only = 0; } if ($approval_only != $CONFIG['display_comment_approval_only']) { // the user wants to see the option changed - let's write it to the database cpg_config_set('display_comment_approval_only', $approval_only); $flag_conf_change = 1; } } // we have made sure that an admin is logged in - let's check for GET parameters if the admin is trying to approve things from the intermediate image view $get_data_rejected = 0; $single_approval_array = array('pos' => $superCage->get->getInt('pos'), 'msg_id' => $superCage->get->getInt('msg_id'), 'what' => $superCage->get->getAlpha('what')); foreach ($single_approval_array as $value) { if (!$value) { $get_data_rejected++; } } // We have gathered enough data for a basic check - let's only perform the rest of the individual approval if everthying is OK, i.e. all previous critieria have been met. if ($get_data_rejected == 0) { // individual approval start //Check if the form token is valid
function process_post_data() { global $CONFIG, $lang_errors; $superCage = Inspekt::makeSuperCage(); //Check if the form token is valid if (!checkFormToken()) { cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__); } $field_list = array('group_name', 'group_quota', 'can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval', 'access_level'); $group_id_array = get_post_var('group_id'); $guests_disabled = $CONFIG['allow_unlogged_access'] == 0; foreach ($group_id_array as $key => $group_id) { // For guest/anonymous group, update the configuration setting 'allow_unlogged_access' if ($group_id == 3) { cpg_config_set('allow_unlogged_access', $superCage->post->getInt('access_level_' . $group_id)); } // For the guest/anonymous group, don't update the database if the settings were disabled if ($group_id == 3 && $guests_disabled) { continue; } $set_statement = ''; foreach ($field_list as $field) { if ($field == 'group_name') { $set_statement .= $field . "='" . $superCage->post->getEscaped($field . '_' . $group_id) . "',"; } else { $set_statement .= $field . "='" . $superCage->post->getInt($field . '_' . $group_id) . "',"; } } $set_statement = substr($set_statement, 0, -1); cpg_db_query("UPDATE {$CONFIG['TABLE_USERGROUPS']} SET {$set_statement} WHERE group_id = '{$group_id}' LIMIT 1"); } }
// Strip the whitespace and coma from the query $query = rtrim(trim($query), ','); $query .= " WHERE `lang_id` = '" . $posted_lang_id . "' LIMIT 1;"; } $result = cpg_db_query($query); $query = ''; } // foreach loop end // Now let's set the default language // DEFAULT_LANGUAGE $submit_default_id = $superCage->post->getEscaped('is_default'); if ($submit_default_id != DEFAULT_LANGUAGE) { // only write the change if the submit default language differs from the current default language // Check if the "new" default language is enabled in the first place if ($superCage->post->getAlpha('enable_' . $submit_default_id) == 'YES') { $CONFIG['lang'] = $CONFIG['lang_config']; cpg_config_set('lang', $submit_default_id); $CONFIG['default_lang'] = $submit_default_id; $query_output .= sprintf($query_output_ok, sprintf($lang_langmgr_php['default_language'], $submit_default_id)); } else { $query_output .= sprintf($query_output_error, $lang_langmgr_php['enable_default']); } } // Output status messages if applicable if ($query_output != '') { starttable('100%', cpg_fetch_icon('info', 2) . $lang_langmgr_php['status'], 1); print <<<EOT <tr> <td class="tableb"> <ul> {$query_output} </ul>
$exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution"; $exifRawData = explode("|", $exif_info); // The form has been submit --- start if ($superCage->post->keyExists('save')) { $str = ""; $exif_tags = $superCage->post->getEscaped('exif_tags'); foreach ($exifRawData as $val) { if (in_array($val, $exif_tags)) { $str .= "1|"; } else { $str .= "0|"; } } //Remove the last pipe from the string. $selectedExifTags = trim($str, '|'); cpg_config_set('show_which_exif', $selectedExifTags); $output_message = $lang_picinfo['success']; } // The form has been submit --- end $exifCurrentData = explode("|", $CONFIG['show_which_exif']); // Main code starts here echo <<<EOT <form method="post" action="" name="editForm" id="cpgform"> <input type="hidden" name="save" value="save" /> EOT; $exif_help = ' ' . cpg_display_help('f=exif.htm&as=exif&ae=exif_end', '640', '450'); starttable('100%', cpg_fetch_icon('exif_mgr', 2) . $lang_picinfo['ManageExifDisplay'] . $exif_help, 2); echo <<<EOT <tr> <td class="tableh2"> <span class="cpg_user_message">{$output_message}</span>