本文整理汇总了PHP中cpg_config_set函数的典型用法代码示例。如果您正苦于以下问题:PHP cpg_config_set函数的具体用法?PHP cpg_config_set怎么用?PHP cpg_config_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpg_config_set函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
// ------------------------------------------------------------------------- //
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>
示例2: write_to_db
//.........这里部分代码省略.........
}
// 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';
}
}
示例3: while
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')) {
示例4: define
**********************************************/
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);
}
示例5: unset
$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
示例6: keyword_convert
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();
}
示例7: pageheader
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;
示例8: cpg_config_set
// 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') {
示例9: pageheader
}
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"
示例10: cpg_debug_output
/**
* 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: ";
echo $debug_underline;
echo htmlentities(print_r($USER, true));
echo $debug_separate;
echo "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 :";
//.........这里部分代码省略.........
示例11: cpg_fetch_icon
$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
示例12: process_post_data
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");
}
}
示例13: rtrim
// 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>
示例14: explode
$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>