本文整理汇总了PHP中getFormToken函数的典型用法代码示例。如果您正苦于以下问题:PHP getFormToken函数的具体用法?PHP getFormToken怎么用?PHP getFormToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFormToken函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flv_player_cleanup
function flv_player_cleanup($action)
{
$superCage = Inspekt::makeSuperCage();
$cleanup = $superCage->server->getEscaped('REQUEST_URI');
if ($action == 1) {
global $lang_common;
list($timestamp, $form_token) = getFormToken();
echo <<<EOT
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="tableb">
Playback of existing flv files won't work anymore!
</td>
<td class="tableb">
<form action="pluginmgr.php" method="post">
<input type="submit" name="submit" value="{$lang_common['back']}" class="button" />
</form>
</td>
<td class="tableb">
<form action="{$cleanup}" method="post">
<input type="hidden" name="drop" value="1" />
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
<input type="submit" name="submit" value="{$lang_common['continue']}" class="button" />
</form>
</td>
</tr>
</table>
EOT;
}
}
示例2: online_configure
function online_configure()
{
global $lang_plugin_php, $CONFIG, $lang_common, $lang_pluginmgr_php, $lang_admin_php, $icon_array;
$superCage = Inspekt::makeSuperCage();
if (!defined('ADMIN_PHP')) {
defined('ADMIN_PHP');
}
$action = $superCage->server->getEscaped('REQUEST_URI');
$matches = $superCage->post->getMatched('main_page_layout', '/^[0-9a-z,\\/]{1,}$/');
$contentOfTheMainpage_array = explode('/', $matches[0]);
if (in_array('onlinestats', $contentOfTheMainpage_array) == TRUE) {
// We have a winner
}
$icon_array['ok'] = cpg_fetch_icon('ok', 2);
$icon_array['config'] = cpg_fetch_icon('config', 2);
if (isset($CONFIG['mod_updates_duration']) != TRUE) {
$CONFIG['mod_updates_duration'] = 10;
}
list($timestamp, $form_token) = getFormToken();
echo <<<EOT
<form action="{$action}" method="post" name="onlinestats_configure">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="tableb" width="50%">
{$lang_plugin_php['onlinestats_config_text']}
</td>
<td class="tableb" width="50%">
<input size="2" type="text" name="duration" value="{$CONFIG['mod_updates_duration']}" class="textinput" />
{$lang_plugin_php['onlinestats_minute']}
</td>
</tr>
<tr>
<td class="tableb tableb_alternate">
{$lang_admin_php['main_page_layout']}
</td>
<td class="tableb tableb_alternate">
<input type="text" size="50" maxlength="250" class="textinput" style="width:90%" name="main_page_layout" id="main_page_layout" value="{$CONFIG['main_page_layout']}" />
</td>
</tr>
<tr>
<td class="tablef">
</td>
<td class="tablef">
<button type="submit" class="button" name="submit" value="{$lang_common['go']}">{$icon_array['ok']}{$lang_common['go']}</button>
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
</td>
</tr>
</table>
</form>
EOT;
}
示例3: external_tracker_cleanup
function external_tracker_cleanup($action)
{
global $CONFIG, $lang_common, $lang_plugin_external_tracker;
require_once 'plugins/external_tracker/include/init.inc.php';
$superCage = Inspekt::makeSuperCage();
$form_action = $superCage->server->getEscaped('REQUEST_URI');
if ($action == '1') {
list($timestamp, $form_token) = getFormToken();
$help_icon = '<img src="images/help.gif" width="13" height="11" border="0" alt="" />';
echo <<<EOT
<form action="{$form_action}" method="post">
<p>
{$lang_plugin_external_tracker['clean_up_question']} <a href="plugins/external_tracker/docs/{$doc_lng}.html?hide_nav=1#uninstall" class="greybox" title="{$lang_plugin_external_tracker['help']}">{$help_icon}</a>
</p>
<div style="margin:25;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="radio" name="remove" value="1" /></td>
<td>{$lang_common['yes']}</td>
</tr>
<tr>
<td><input type="radio" name="remove" checked="checked" value="0" /></td>
<td>{$lang_common['no']}</td>
</tr>
</table>
</div>
<br />
<span>
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
<input type="submit" name="submit" class="button" value="{$lang_common['continue']}" />
<input type="button" name="cancel" class="button" onClick="window.location='pluginmgr.php';" value="{$lang_common['back']}" />
</span>
</form>
EOT;
}
}
示例4: theme_html_comments
function theme_html_comments($pid)
{
global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $lang_date, $HTML_SUBST, $THEME_DIR;
global $template_image_comments, $template_add_your_comment, $lang_display_comments, $lang_common, $REFERER, $lang_bbcode_help_title, $lang_bbcode_help;
$superCage = Inspekt::makeSuperCage();
$template_add_your_comment = CPGPluginAPI::filter('theme_add_comment', $template_add_your_comment);
$template_image_comments = CPGPluginAPI::filter('theme_edit_comment', $template_image_comments);
list($timestamp, $form_token) = getFormToken();
$html = '';
//report to moderator buttons
if (!($CONFIG['report_post'] == 1 && USER_CAN_SEND_ECARDS)) {
template_extract_block($template_image_comments, 'report_comment_button');
}
if (!$CONFIG['enable_smilies']) {
$tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
template_extract_block($template_image_comments, 'edit_box_smilies');
template_extract_block($template_add_your_comment, 'input_box_smilies');
} else {
$tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
template_extract_block($template_image_comments, 'edit_box_no_smilies');
template_extract_block($template_add_your_comment, 'input_box_no_smilies');
}
$tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
$tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');
if ($CONFIG['comments_sort_descending'] == 1) {
$comment_sort_order = 'DESC';
} else {
$comment_sort_order = 'ASC';
}
$result = cpg_db_query("SELECT COUNT(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}'");
list($num) = mysql_fetch_row($result);
if ($num) {
$limit = $CONFIG['comments_per_page'];
$max = ceil($num / $limit);
if ($superCage->get->keyExists('page')) {
$page = $superCage->get->getInt('page');
$page = min($page, $max);
$page = max(0, $page);
} else {
if ($CONFIG['comments_sort_descending'] == 1) {
$page = 1;
} else {
$page = $max;
}
}
$start = max(0, $num - ($max - ($page - 1)) * $limit);
$location = defined('THEME_HAS_COMMENT_GRAPHICS') ? $THEME_DIR : '';
ob_start();
echo '<br />';
starttable();
echo '<tr><td class="tableh2"><div style="float: left">' . $lang_display_comments['comment'] . ' ' . sprintf($lang_display_comments['comment_x_to_y_of_z'], $start + 1, min($num, $start + $limit), $num) . '</div>';
echo '<div style="float: right">' . $lang_display_comments['page'] . ': ';
$links = array();
for ($i = 1; $i <= $max; $i++) {
if ($i < 5 || $i > $max - 5 || $i > $page - 5 && $i < $page + 5) {
$links[$i] = '<a href="displayimage.php?pid=' . $pid . '&page=' . $i . '#comments_top">' . $i . '</a>';
}
}
$links[$page] = "<b>{$page}</b>";
echo implode(' - ', $links);
echo '</div></td></tr>';
endtable();
echo '<br />';
$html .= $tabs = ob_get_clean();
$result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid, approval FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id {$comment_sort_order} LIMIT {$start}, {$limit}");
while ($row = mysql_fetch_assoc($result)) {
// while-loop start
$user_can_edit = GALLERY_ADMIN_MODE || USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || !USER_ID && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
if ($user_can_edit != '' && $CONFIG['comment_user_edit'] != 0 || GALLERY_ADMIN_MODE) {
$comment_buttons = $tmpl_comments_buttons;
$comment_edit_box = $tmpl_comment_edit_box;
} else {
$comment_buttons = '';
$comment_edit_box = '';
}
$comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
$hide_comment = 0;
// comment approval
$pending_approval = '';
if (USER_IS_ADMIN) {
//display the selector approve/disapprove
if ($row['approval'] == 'NO') {
$pending_approval = '<img src="' . $location . 'images/icons/comment_disapprove_disabled.png" border="0" alt="" width="16" height="16" class="icon" /><a href="reviewcom.php?pos=-{PID}&msg_id={MSG_ID}&form_token={FORM_TOKEN}&timestamp={TIMESTAMP}&what=approve" title="' . $lang_display_comments['approve'] . '"><img src="' . $location . 'images/icons/comment_approve.png" border="0" alt="" width="16" height="16" class="icon" /></a>';
} else {
$pending_approval = '<a href="reviewcom.php?pos=-{PID}&msg_id={MSG_ID}&form_token={FORM_TOKEN}&timestamp={TIMESTAMP}&what=disapprove" title="' . $lang_display_comments['disapprove'] . '"><img src="' . $location . 'images/icons/comment_disapprove.png" border="0" alt="" width="16" height="16" class="icon" /></a><img src="' . $location . 'images/icons/comment_approve_disabled.png" border="0" alt="" width="16" height="16" class="icon" />';
}
} else {
// user or guest is logged in - start
if ($row['approval'] == 'NO') {
// the comment is not approved - start
if ($user_can_edit) {
// the comment comes from the current visitor, display it with a warning that it needs admin approval
$pending_approval = '<img src="' . $location . 'images/icons/comment_approval.png" border="0" alt="" width="16" height="16" title="' . $lang_display_comments['pending_approval'] . '" class="icon" />';
} else {
// the comment comes from someone else - don't display it at all
if ($CONFIG['comment_placeholder'] == 0) {
$hide_comment = 1;
} else {
$row['msg_author'] = $lang_display_comments['unapproved_comment'];
$row['msg_body'] = $lang_display_comments['pending_approval_message'];
//.........这里部分代码省略.........
示例5: social_bookmarks_configure
//.........这里部分代码省略.........
$option_output['plugin_social_bookmarks_greyout'] = '';
} else {
$option_output['plugin_social_bookmarks_greyout'] = 'checked="checked"';
}
if ($CONFIG['plugin_social_bookmarks_layout'] == '0') {
$option_output['plugin_social_bookmarks_layout_simple_list'] = 'checked="checked"';
$option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
$option_output['plugin_social_bookmarks_layout_icons_only'] = '';
} elseif ($CONFIG['plugin_social_bookmarks_layout'] == '1') {
//
$option_output['plugin_social_bookmarks_layout_simple_list'] = '';
$option_output['plugin_social_bookmarks_layout_advanced_list'] = 'checked="checked"';
$option_output['plugin_social_bookmarks_layout_icons_only'] = '';
} elseif ($CONFIG['plugin_social_bookmarks_layout'] == '2') {
//
$option_output['plugin_social_bookmarks_layout_simple_list'] = '';
$option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
$option_output['plugin_social_bookmarks_layout_icons_only'] = 'checked="checked"';
}
if ($CONFIG['plugin_social_bookmarks_smart_language'] == '0') {
$option_output['plugin_social_bookmarks_smart_language'] = '';
} else {
$option_output['plugin_social_bookmarks_smart_language'] = 'checked="checked"';
}
if ($CONFIG['plugin_social_bookmarks_admin_menu'] == '0') {
$option_output['plugin_social_bookmarks_admin_menu'] = '';
} else {
$option_output['plugin_social_bookmarks_admin_menu'] = 'checked="checked"';
}
// Create the table row that is displayed during initial install
if ($social_bookmarks_installation == 1) {
$additional_submit_information = '<div class="cpg_message_info">' . $lang_plugin_social_bookmarks['submit_to_install'] . '</div>';
}
list($timestamp, $form_token) = getFormToken();
// Start the actual output
echo <<<EOT
<form action="" method="post" name="social_bookmarks_config" id="social_bookmarks_config">
EOT;
starttable('100%', $social_bookmarks_icon_array['configure'] . $lang_plugin_social_bookmarks['config'], 3);
echo <<<EOT
<tr>
<td valign="top" class="tableh2" colspan="3">
{$lang_plugin_social_bookmarks['site_integration']}
</td>
</tr>
<tr>
<td valign="top" class="tableb" rowspan="4">
{$lang_plugin_social_bookmarks['position_of_button']}
</td>
<td valign="top" class="tableb">
<input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_placeholder_token" class="radio" value="0" {$option_output['plugin_social_bookmarks_position_placeholder_token']} />
</td>
<td valign="top" class="tableb">
\t<label for="plugin_social_bookmarks_position_placeholder_token" class="clickable_option">
\t {$lang_plugin_social_bookmarks['placeholder_token']} ({$lang_plugin_social_bookmarks['placeholder_token_explain1']})
\t <br />
\t <span class="album_stat">
\t {$lang_plugin_social_bookmarks['placeholder_token_explain2']}
\t </span>
\t</label>
</td>
</tr>
<tr>
<td valign="top" class="tableb">
<input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_content_of_main_page" class="radio" value="1" {$option_output['plugin_social_bookmarks_position_content_of_main_page']} />
</td>
示例6: html5_display_upload_form
function html5_display_upload_form($upload_settings)
{
global $CONFIG, $USER_DATA, $lang_common, $lang_upload_php, $lang_plugin_html5upload, $icon_array, $h5a_upload, $lang_bbcode_help_title, $lang_bbcode_help;
list($upload_form, $upload_select) = $upload_settings;
if ($upload_form != 'html5_upload') {
return $upload_settings;
}
$plugpath = 'plugins/html5upload';
$grpn = USER_ID > 0 ? (int) $USER_DATA['group_id'] : 0;
$grpc = $grpn ? $grpn : '';
$cfg = isset($CONFIG['html5upload_config' . $grpc]) ? unserialize($CONFIG['html5upload_config' . $grpc]) : unserialize($CONFIG['html5upload_config']);
$maxfilesizebytes = $cfg['upldsize'] ? max($cfg['upldsize'], $h5a_upload->sys_max_upl_size) : $h5a_upload->sys_max_upl_size;
$maxfilesize = sprintf($lang_upload_php['max_fsize'], $h5a_upload->to_KMG($maxfilesizebytes));
list($timestamp, $form_token) = getFormToken(time() + 14400);
//allow up to 4 hours for upload to complete
set_js_var('timestamp', $timestamp - 14400);
//subtract those 4 hours so edits happen correctly
set_js_var('concurrent', $cfg['concurrent']);
set_js_var('autoedit', $cfg['autoedit']);
set_js_var('user_id', USER_ID);
set_js_var('guest_edit', $CONFIG['allow_guests_enter_file_details']);
set_js_var('H5uPath', "{$plugpath}/");
set_js_var('maxfilesize', $maxfilesizebytes);
set_js_var('maxchunksize', $h5a_upload->sys_max_chnk_size);
set_js_var('fup_payload', array('event' => 'picture', 'process' => 1, 'form_token' => $form_token, 'timestamp' => $timestamp, 'MFU' => 1));
set_js_var('h5uM', array('selAlb' => $lang_plugin_html5upload['albmSelMsg'], 'aborted' => $lang_plugin_html5upload['aborted'], 'type_err' => $lang_plugin_html5upload['type_err'], 'size_err' => $lang_plugin_html5upload['size_err'], 'extallow' => $lang_plugin_html5upload['extallow'], 'q_stop' => $lang_plugin_html5upload['q_stop'], 'q_go' => $lang_plugin_html5upload['q_resume'], 'q_can' => $lang_plugin_html5upload['q_cancel']));
$allowed_types = array_merge(explode('/', $CONFIG['allowed_img_types']), explode('/', $CONFIG['allowed_mov_types']), explode('/', $CONFIG['allowed_snd_types']), explode('/', $CONFIG['allowed_doc_types']));
set_js_var('allowed_file_types', $allowed_types);
// include the javascript upload engine (minified unless in debug mode)
$jsv = $CONFIG['debug_mode'] == 1 || $CONFIG['debug_mode'] == 2 && GALLERY_ADMIN_MODE ? '' : '.min';
js_include('plugins/html5upload/js/upload' . $jsv . '.js');
// add our style sheet
$h5up_meta = '<link rel="stylesheet" href="plugins/html5upload/css/upload.css" type="text/css" />';
pageheader($lang_plugin_html5upload['title'], $h5up_meta);
$upload_help = $h5a_upload->help_button('use');
$upload_table_header = <<<EOT
\t<table border="0" cellspacing="0" cellpadding="0" width="100%">
\t\t<tr>
\t\t\t<td>
\t\t\t\t{$icon_array['upload']}{$lang_plugin_html5upload['upldfiles']}{$upload_help}
\t\t\t</td>
\t\t\t<td style="text-align:right">
\t\t\t\t<span id="upload_method_selector">{$upload_select}</span>
\t\t\t</td>
\t\t</tr>
\t</table>
EOT;
starttable('100%', $upload_table_header, 2);
echo '<tr><td colspan="2" class="tableb tableb_alternate"><strong>' . $maxfilesize . '</strong></td></tr>';
form_alb_list_box($lang_common['album'], 'h5u_album');
echo <<<EOT
\t<tr id="navailrow" style="text-align:center;background-color:yellow;display:none">
\t\t<td colspan="2">{$lang_plugin_html5upload['notavail']}</td>
\t</tr>
\t<tr class="H5upV">
\t\t<td class="tableb" width="30%">{$lang_plugin_html5upload['flistitl']}</td>
\t\t<td class="tableb"><input type="checkbox" id="flistitl" onchange="shide_titlrow(this);" /></td>
\t</tr>
EOT;
if (USER_ID > 0 || $CONFIG['allow_guests_enter_file_details'] == 1) {
if ($cfg['enabtitl']) {
echo '<tr id="titlrow"><td class="tableb">' . $lang_upload_php['pic_title'] . '</td><td class="tableb"><input type="text" name="title" id="title" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
if ($cfg['enabdesc']) {
$desclabl = $lang_upload_php['description'];
if ($CONFIG['show_bbcode_help']) {
$desclabl .= ' ' . cpg_display_help('f=empty.htm&base=64&h=' . urlencode(base64_encode(serialize($lang_bbcode_help_title))) . '&t=' . urlencode(base64_encode(serialize($lang_bbcode_help))), 470, 245);
}
echo '<tr><td class="tableb">' . $desclabl . '</td><td class="tableb"><textarea name="caption" rows="2" id="caption" class="textinput" style="width:90%" /></textarea></td></tr>';
}
if ($cfg['enabkeys']) {
$keywordLabel = sprintf($lang_common['keywords_insert1'], $lang_common['keyword_separators'][$CONFIG['keyword_separator']]) . '<br /><a href="keyword_select.php" class="greybox">' . $lang_common['keywords_insert2'] . '</a>';
echo '<tr><td class="tableb">' . $keywordLabel . '</td><td class="tableb"><input type="text" name="keywords" id="keywords" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
if ($cfg['enabusr1'] && !empty($CONFIG['user_field1_name'])) {
echo '<tr><td class="tableb">' . $CONFIG['user_field1_name'] . '</td><td class="tableb"><input type="text" name="user1" id="user1" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
if ($cfg['enabusr2'] && !empty($CONFIG['user_field2_name'])) {
echo '<tr><td class="tableb">' . $CONFIG['user_field2_name'] . '</td><td class="tableb"><input type="text" name="user2" id="user2" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
if ($cfg['enabusr3'] && !empty($CONFIG['user_field3_name'])) {
echo '<tr><td class="tableb">' . $CONFIG['user_field3_name'] . '</td><td class="tableb"><input type="text" name="user3" id="user3" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
if ($cfg['enabusr4'] && !empty($CONFIG['user_field4_name'])) {
echo '<tr><td class="tableb">' . $CONFIG['user_field4_name'] . '</td><td class="tableb"><input type="text" name="user4" id="user4" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}
}
$acptmime = $cfg['acptmime'] ? "accept=\"{$cfg['acptmime']}\"" : '';
echo <<<EOT
\t<tr id="h5upldrow">
\t\t<td class="tableb">{$lang_plugin_html5upload['files']}</td>
\t\t<td class="tableb" style="padding:1em">
\t\t\t<div style="width:480px">
\t\t\t\t<input type="file" name="userpictures" id="upload_field" multiple="multiple" {$acptmime}/>
\t\t\t\t <br />
\t\t\t\t<div id="dropArea">{$lang_plugin_html5upload['drop_files']}</div>
\t\t\t\t <br />
\t\t\t\t<div id="progress_report" style="position:relative">
\t\t\t\t\t<div id="progress_report_name"></div>
\t\t\t\t\t<div id="progress_report_status" style="font-style: italic;"></div>
//.........这里部分代码省略.........
示例7: endtable
EOT;
endtable();
echo '<br />';
}
echo '<form action="index.php?file=limit_upload/admin" method="post">';
starttable("100%", $lang_plugin_limit_upload['limit_upload'] . " - " . $lang_gallery_admin_menu['admin_lnk'], 3);
$upload_limit = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_upload_limit'"), 0);
$time_limit = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_time_limit'"), 0);
foreach ($lang_plugin_limit_upload['upload_limit_values'] as $key => $value) {
$selected = $time_limit == $key ? 'selected="selected"' : '';
$time_limit_options .= "<option value=\"{$key}\" {$selected}>{$value}</option>";
}
$submit_icon = cpg_fetch_icon('ok', 1);
echo <<<EOT
<tr>
<td class="tableb">
{$lang_plugin_limit_upload['upload_limit']}
</td>
<td class="tableb">
<input type="input" class="listbox" size="5" name="upload_limit" id="plugin_limit_upload_files" value="{$upload_limit}" /> <select class="listbox" name="time_limit">{$time_limit_options}</select>
</td>
<td class="tableb">
<button value="{$lang_common['apply_changes']}" name="submit" class="button" type="submit">{$submit_icon}{$lang_common['apply_changes']}</button>
</td>
</tr>
EOT;
endtable();
list($timestamp, $form_token) = getFormToken();
echo "<input type=\"hidden\" name=\"form_token\" value=\"{$form_token}\" />";
echo "<input type=\"hidden\" name=\"timestamp\" value=\"{$timestamp}\" />";
pagefooter();
示例8: display_cat_list
function display_cat_list()
{
global $CAT_LIST, $CONFIG, $lang_catmgr_php, $lang_common, $CPG_PHP_SELF, $LINEBREAK;
$CAT_LIST3 = $CAT_LIST;
$loop_counter = 0;
list($timestamp, $form_token) = getFormToken();
$form_token = "&form_token={$form_token}&timestamp={$timestamp}";
foreach ($CAT_LIST3 as $key => $category) {
if ($category['cid'] == 0) {
continue;
}
if ($loop_counter == 0) {
$row_style_class = 'tableb';
} else {
$row_style_class = 'tableb tableb_alternate';
}
$loop_counter++;
if ($loop_counter > 1) {
$loop_counter = 0;
}
echo ' <tr>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="80%"><strong>' . $category['name'] . '</strong></td>' . $LINEBREAK;
if ($category['pos'] > 0 && $CONFIG['categories_alpha_sort'] != 1) {
echo ' <td class="' . $row_style_class . '" width="4%"><a href="' . $CPG_PHP_SELF . '?op=movetop&cid1=' . $category['cid'] . '&pos1=' . $category['pos'] . $form_token . '" class="rounded_menu"><span>' . cpg_fetch_icon('upup', 0, $lang_common['move_top']) . '</span></a></td>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="4%"><a href="' . $CPG_PHP_SELF . '?op=move&cid1=' . $category['cid'] . '&pos1=' . ($category['pos'] - 1) . '&cid2=' . $category['prev'] . '&pos2=' . $category['pos'] . $form_token . '" class="rounded_menu"><span>' . cpg_fetch_icon('up', 0, $lang_common['move_up']) . '</span></a></td>' . $LINEBREAK;
} else {
echo ' <td class="' . $row_style_class . '" width="4%">' . ' ' . '</td>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="4%">' . ' ' . '</td>' . $LINEBREAK;
}
if ($category['pos'] < $CAT_LIST[$category['parent']]['cat_count'] - 1 && $CONFIG['categories_alpha_sort'] != 1) {
echo ' <td class="' . $row_style_class . '" width="4%"><a href="' . $CPG_PHP_SELF . '?op=move&cid1=' . $category['cid'] . '&pos1=' . ($category['pos'] + 1) . '&cid2=' . $category['next'] . '&pos2=' . $category['pos'] . $form_token . '" class="rounded_menu"><span>' . cpg_fetch_icon('down', 0, $lang_common['move_down']) . '</span></a></td>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="4%"><a href="' . $CPG_PHP_SELF . '?op=movebottom&cid1=' . $category['cid'] . '&pos1=' . $category['pos'] . $form_token . '" class="rounded_menu"><span>' . cpg_fetch_icon('downdown', 0, $lang_common['move_bottom']) . '</span></a></td>' . $LINEBREAK;
} else {
echo ' <td class="' . $row_style_class . '" width="4%">' . ' ' . '</td>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="4%">' . ' ' . '</td>' . $LINEBREAK;
}
if ($category['cid'] != 1) {
echo ' <td class="' . $row_style_class . '" width="4%"><a href="' . $CPG_PHP_SELF . '?op=deletecat&cid=' . $category['cid'] . $form_token . '" onclick="return confirmDel(\'' . addslashes(str_replace(' ', '', $category['name'])) . '\')" class="rounded_menu"><span>' . cpg_fetch_icon('delete', 0, $lang_common['delete']) . '</span></a></td>' . $LINEBREAK;
} else {
echo ' <td class="' . $row_style_class . '" width="4%">' . ' ' . '</td>' . $LINEBREAK;
}
echo ' <td class="' . $row_style_class . '" width="4%">' . '<a href="' . $CPG_PHP_SELF . '?op=editcat&cid=' . $category['cid'] . $form_token . '" class="rounded_menu"><span>' . cpg_fetch_icon('edit', 0, $lang_common['edit']) . '</span></a></td>' . $LINEBREAK;
echo ' <td class="' . $row_style_class . '" width="4%">' . $LINEBREAK . cat_list_box($category['cid'], $CAT_LIST3[$category['parent']]) . $LINEBREAK . '</td>' . $LINEBREAK;
echo ' </tr>' . $LINEBREAK;
}
}
示例9: html_albummenu3
/**
* html_albummenu3()
*
* This function draws the links for admin menu of Albums when pics can't be edited
*
* @param integer $id ID of the album for which the links are being drawn
* @return string The evaluated template block with links
**/
function html_albummenu3($id)
{
global $lang_album_admin_menu;
/**
* This template variable can be defined in theme.php of respective theme.
* This is done here for simplicity.
*/
$template_album_admin_no_pic_edit_menu = <<<EOT
<div class="buttonlist align_right">
<ul>
<li>
<a href="delete.php?id={ALBUM_ID}&what=album&form_token={FORM_TOKEN}&timestamp={TIMESTAMP}" onclick="return confirm('{CONFIRM_DELETE}');"><span>{DELETE}</span></a>
</li>
<li>
<a href="modifyalb.php?album={ALBUM_ID}"><span>{MODIFY}</span></a>
</li>
</ul>
</div>
<div class="clearer"></div>
EOT;
static $template = '';
if ($template == '') {
list($timestamp, $form_token) = getFormToken();
$params = array('{CONFIRM_DELETE}' => $lang_album_admin_menu['confirm_delete'], '{DELETE}' => cpg_fetch_icon('delete', 1) . $lang_album_admin_menu['delete'], '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_album_admin_menu['modify'], '{FORM_TOKEN}' => $form_token, '{TIMESTAMP}' => $timestamp);
$template = template_eval($template_album_admin_no_pic_edit_menu, $params);
}
$params = array('{ALBUM_ID}' => $id);
return template_eval($template, $params);
}
示例10: h5u_config_form
//.........这里部分代码省略.........
} elseif ($uplsiz % 1048576 == 0) {
$uplsizm = 1;
$uplsiz = $uplsiz >> 20;
} else {
$uplsiz = $uplsiz >> 10;
}
} else {
$uplsiz = '';
}
$sizmopts = '';
foreach (array('K', 'M', 'G') as $k => $v) {
$selected = $uplsizm == $k ? 'selected="selected"' : '';
$sizmopts .= "<option value=\"{$k}\" {$selected}>{$v}</option>";
}
$sysfmax = $h5a_upload->sys_max_upl_size;
$sysfmaxh = $h5a_upload->to_KMG($sysfmax);
$autochecked = $tcfg['autoedit'] ? 'checked="checked" ' : '';
$titlchecked = $tcfg['enabtitl'] ? 'checked="checked" ' : '';
$descchecked = $tcfg['enabdesc'] ? 'checked="checked" ' : '';
$keyschecked = $tcfg['enabkeys'] ? 'checked="checked" ' : '';
$usr1checked = $tcfg['enabusr1'] ? 'checked="checked" ' : '';
$usr2checked = $tcfg['enabusr2'] ? 'checked="checked" ' : '';
$usr3checked = $tcfg['enabusr3'] ? 'checked="checked" ' : '';
$usr4checked = $tcfg['enabusr4'] ? 'checked="checked" ' : '';
$enabflds = '';
if (!empty($CONFIG['user_field1_name'])) {
$enabflds .= '<br /><input type="checkbox" name="usr1fld" id="usr1fld" ' . $usr1checked . '/> <label for="usr1fld">' . $CONFIG['user_field1_name'] . '</label>';
}
if (!empty($CONFIG['user_field2_name'])) {
$enabflds .= '<br /><input type="checkbox" name="usr2fld" id="usr2fld" ' . $usr2checked . '/> <label for="usr2fld">' . $CONFIG['user_field2_name'] . '</label>';
}
if (!empty($CONFIG['user_field3_name'])) {
$enabflds .= '<br /><input type="checkbox" name="usr3fld" id="usr3fld" ' . $usr3checked . '/> <label for="usr3fld">' . $CONFIG['user_field3_name'] . '</label>';
}
if (!empty($CONFIG['user_field4_name'])) {
$enabflds .= '<br /><input type="checkbox" name="usr4fld" id="usr4fld" ' . $usr4checked . '/> <label for="usr4fld">' . $CONFIG['user_field4_name'] . '</label>';
}
$submit_icon = cpg_fetch_icon('ok', 1);
$rvrtbut = '';
if ($grpn && $scfg) {
$undo_icon = cpg_fetch_icon('undo', 1);
$rvrtbut = '<button value="' . $lang_plugin_html5upload['revert'] . '" name="revert" class="button" type="submit">' . $undo_icon . $lang_plugin_html5upload['revert'] . ' </button> ';
}
echo <<<EOT
\t<tr>
\t\t<td class="tableb" width="50%">
\t\t\t{$lang_plugin_html5upload['select']}
\t\t</td>
\t\t<td class="tableb">
\t\t\t<select class="listbox" name="concurrent">{$concopts}</select>
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="tableb">
\t\t\t{$lang_plugin_html5upload['maxUplSiz']} (PHP:CPG = {$sysfmaxh})
\t\t</td>
\t\t<td class="tableb">
\t\t\t<input type="text" name="upsize" style="width:4em" maxlength="5" value="{$uplsiz}" />
\t\t\t<select class="listbox" name="upsizem">{$sizmopts}</select>
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="tableb">
\t\t\t{$lang_plugin_html5upload['acptmime']}
\t\t</td>
\t\t<td class="tableb">
\t\t\t<input type="text" name="acptmime" style="width:90%" maxlength="60" value="{$tcfg['acptmime']}" />
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="tableb">
\t\t\t{$lang_plugin_html5upload['autoedit']}
\t\t</td>
\t\t<td class="tableb">
\t\t\t<input type="checkbox" name="autoedit" {$autochecked}/>
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="tableb">
\t\t\t{$lang_plugin_html5upload['incflds']}
\t\t</td>
\t\t<td class="tableb">
\t\t\t<input type="checkbox" name="titlfld" id="titlfld" {$titlchecked}/> <label for="titlfld">{$lang_common['title']}</label>
\t\t\t<br /><input type="checkbox" name="descfld" id="descfld" {$descchecked}/> <label for="descfld">{$lang_common['caption']}</label>
\t\t\t<br /><input type="checkbox" name="keysfld" id="keysfld" {$keyschecked}/> <label for="keysfld">{$lang_common['keywords']}</label>
\t\t\t{$enabflds}
\t\t</td>
\t</tr>
\t<tr>
\t\t<td class="tableb" colspan="2" style="text-align:center">
\t\t\t{$rvrtbut}<button value="{$lang_common['apply_changes']}" name="save" class="button" type="submit">{$submit_icon}{$lang_common['apply_changes']} </button>
\t\t</td>
\t</tr>
EOT;
endtable();
list($timestamp, $form_token) = getFormToken();
echo "<input type=\"hidden\" name=\"form_token\" value=\"{$form_token}\" />";
echo "<input type=\"hidden\" name=\"timestamp\" value=\"{$timestamp}\" />";
pagefooter();
}
示例11: custom_thumb_page_start
function custom_thumb_page_start()
{
global $CONFIG, $lang_errors;
$superCage = Inspekt::makeSuperCage();
if ($superCage->get->keyExists('custom_thmb_id')) {
$pid = $superCage->get->getInt('custom_thmb_id');
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE p.pid = '{$pid}' LIMIT 1");
$row = mysql_fetch_assoc($result);
if (!(USER_ADMIN_MODE && $row['category'] == FIRST_USER_CAT + USER_ID || $CONFIG['users_can_edit_pics'] && $row['owner_id'] == USER_ID && USER_ID != 0 || GALLERY_ADMIN_MODE)) {
load_template();
cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
require_once "./plugins/custom_thumb/lang/english.php";
if ($CONFIG['lang'] != 'english' && file_exists("./plugins/custom_thumb/lang/{$CONFIG['lang']}.php")) {
require_once "./plugins/custom_thumb/lang/{$CONFIG['lang']}.php";
}
if ($superCage->files->keyExists('fileupload') && $row) {
if (!checkFormToken()) {
load_template();
global $lang_errors;
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
$fileupload = $superCage->files->_source['fileupload'];
if ($fileupload['error']) {
load_template();
cpg_die(ERROR, $lang_errors['error'] . ' ' . $fileupload['error'], __FILE__, __LINE__);
}
if (is_image($fileupload['name'])) {
if (!is_image($row['filename'])) {
$path_parts = pathinfo($row['filename']);
$row['filename'] = basename($row['filename'], '.' . $path_parts['extension']) . '.png';
}
$thumb = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['thumb_pfx'] . $row['filename'];
if (move_uploaded_file($fileupload['tmp_name'], $thumb) == TRUE) {
require 'include/picmgmt.inc.php';
if ($superCage->post->keyExists('create_intermediate')) {
$normal = $CONFIG['fullpath'] . $row['filepath'] . $CONFIG['normal_pfx'] . $row['filename'];
$resize_method = $CONFIG['picture_use'] == "thumb" ? $CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use'] : $CONFIG['picture_use'];
resize_image($thumb, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $resize_method);
}
resize_image($thumb, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);
} else {
load_template();
cpg_die(ERROR, sprintf($lang_plugin_custom_thumb['error_move_file'], $fileupload['tmp_name'], $thumb), __FILE__, __LINE__);
}
} else {
load_template();
cpg_die(ERROR, $lang_plugin_custom_thumb['error_images_only'], __FILE__, __LINE__);
}
header("Location: {$CONFIG['site_url']}displayimage.php?pid={$pid}");
die;
} else {
load_template();
pageheader($lang_plugin_custom_thumb['custom_thumbnail']);
echo '<form method="post" enctype="multipart/form-data">';
starttable('60%', $lang_plugin_custom_thumb['upload_custom_thumbnail'], 2);
list($timestamp, $form_token) = getFormToken();
echo <<<EOT
<tr>
<td class="tableb" valign="top">
{$lang_plugin_custom_thumb['browse']}
</td>
<td class="tableb" valign="top">
<input type="file" name="fileupload" size="40" class="listbox" />
</td>
</tr>
<tr>
<td class="tableb" valign="top">
{$lang_plugin_custom_thumb['create_intermediate']}
</td>
<td class="tableb" valign="top">
<input type="checkbox" name="create_intermediate" />
</td>
</tr>
<tr>
<td align="center" colspan="2" class="tablef">
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
<input type="submit" name="commit" class="button" value="{$lang_plugin_custom_thumb['upload']}"/>
</td>
</tr>
EOT;
endtable();
echo '</form>';
pagefooter();
exit;
}
}
}
示例12: newsletter_configure
function newsletter_configure()
{
global $CONFIG, $thisplugin, $lang_plugin_newsletter, $lang_common, $newsletter_icon_array, $lang_errors, $newsletter_installation;
$superCage = Inspekt::makeSuperCage();
if (!GALLERY_ADMIN_MODE) {
cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
// Form submit?
if ($superCage->post->keyExists('submit') == TRUE) {
//Check if the form token is valid
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
$config_changes_counter = newsletter_configuration_submit();
if ($config_changes_counter > 0) {
$additional_submit_information = '<div class="cpg_message_success">' . $lang_plugin_newsletter['changes_saved'] . '</div>';
} else {
$additional_submit_information = '<div class="cpg_message_validation">' . $lang_plugin_newsletter['no_changes'] . '</div>';
}
}
// Set the option output stuff
if ($CONFIG['plugin_newsletter_guest_subscriptions'] == '1') {
$option_output['plugin_newsletter_guest_subscriptions_yes'] = 'checked="checked"';
$option_output['plugin_newsletter_guest_subscriptions_no'] = '';
} else {
//
$option_output['plugin_newsletter_guest_subscriptions_yes'] = '';
$option_output['plugin_newsletter_guest_subscriptions_no'] = 'checked="checked"';
}
if ($CONFIG['plugin_newsletter_admin_menu_links'] == '1') {
$option_output['plugin_newsletter_admin_menu_links_all'] = '';
$option_output['plugin_newsletter_admin_menu_links_single'] = 'checked="checked"';
$option_output['plugin_newsletter_admin_menu_links_no'] = '';
} elseif ($CONFIG['plugin_newsletter_admin_menu_links'] == '2') {
//
$option_output['plugin_newsletter_admin_menu_links_all'] = 'checked="checked"';
$option_output['plugin_newsletter_admin_menu_links_single'] = '';
$option_output['plugin_newsletter_admin_menu_links_no'] = '';
} else {
$option_output['plugin_newsletter_admin_menu_links_all'] = '';
$option_output['plugin_newsletter_admin_menu_links_single'] = '';
$option_output['plugin_newsletter_admin_menu_links_no'] = 'checked="checked"';
}
if ($CONFIG['plugin_newsletter_visitor_menu_links'] == '1') {
$option_output['plugin_newsletter_visitor_menu_links_sys'] = 'checked="checked"';
$option_output['plugin_newsletter_visitor_menu_links_sub'] = '';
$option_output['plugin_newsletter_visitor_menu_links_no'] = '';
} elseif ($CONFIG['plugin_newsletter_visitor_menu_links'] == '2') {
$option_output['plugin_newsletter_visitor_menu_links_sys'] = '';
$option_output['plugin_newsletter_visitor_menu_links_sub'] = 'checked="checked"';
$option_output['plugin_newsletter_visitor_menu_links_no'] = '';
} else {
$option_output['plugin_newsletter_visitor_menu_links_sys'] = '';
$option_output['plugin_newsletter_visitor_menu_links_sub'] = '';
$option_output['plugin_newsletter_visitor_menu_links_no'] = 'checked="checked"';
}
if ($CONFIG['plugin_newsletter_default_on_register'] == '1') {
$option_output['plugin_newsletter_default_on_register_yes'] = 'checked="checked"';
$option_output['plugin_newsletter_default_on_register_no'] = '';
} else {
//
$option_output['plugin_newsletter_default_on_register_yes'] = '';
$option_output['plugin_newsletter_default_on_register_no'] = 'checked="checked"';
}
// Create the table row that is displayed during initial install
if ($newsletter_installation == 1) {
$additional_submit_information = '<div class="cpg_message_info">' . $lang_plugin_newsletter['submit_to_install'] . '</div>';
$install_section = <<<EOT
EOT;
}
list($timestamp, $form_token) = getFormToken();
// Start the actual output
echo <<<EOT
<form action="" method="post" name="newsletter_config" id="newsletter_config">
EOT;
starttable('100%', $newsletter_icon_array['config'] . $lang_plugin_newsletter['config'], 2);
echo <<<EOT
<tr>
<td valign="top" class="tableb">
{$lang_plugin_newsletter['allow_guest_subscriptions']}
</td>
<td valign="top" class="tableb">
<input type="radio" name="plugin_newsletter_guest_subscriptions" id="plugin_newsletter_guest_subscriptions_yes" class="checkbox" value="1" {$option_output['plugin_newsletter_guest_subscriptions_yes']} />
<label for="plugin_newsletter_guest_subscriptions_yes">{$lang_common['yes']}</label>
<input type="radio" name="plugin_newsletter_guest_subscriptions" id="plugin_newsletter_guest_subscriptions_no" class="checkbox" value="0" {$option_output['plugin_newsletter_guest_subscriptions_no']} />
<label for="plugin_newsletter_guest_subscriptions_no">{$lang_common['no']}</label>
</td>
</tr>
<tr>
<td valign="top" class="tableb tableb_alternate">
{$lang_plugin_newsletter['salutation_for_guests']}
</td>
<td valign="top" class="tableb tableb_alternate">
<input type="text" name="plugin_newsletter_salutation_for_guests" id="plugin_newsletter_salutation_for_guests" class="textinput" size="30" maxlength="100" value="{$CONFIG['plugin_newsletter_salutation_for_guests']}" />
</td>
</tr>
<tr>
<td valign="top" class="tableb">
{$lang_plugin_newsletter['from_email']}
//.........这里部分代码省略.........
示例13: file_replacer_page_start
//.........这里部分代码省略.........
if (!copy($image, $orig)) {
return false;
} else {
$work_image = $orig;
}
}
//if (!file_exists($thumb)) {
// create thumbnail
if (($result = resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false", 1)) !== true) {
return $result;
}
//}
if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) {
// create intermediate sized picture
$resize_method = $CONFIG['picture_use'] == "thumb" ? $CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use'] : $CONFIG['picture_use'];
$watermark = $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') ? 'true' : 'false';
if (($result = resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $resize_method, $watermark)) !== true) {
return $result;
}
}
// watermark full sized picture
if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
$wm_max_upl_width_height = $picture_original_size ? max($imagesize[0], $imagesize[1]) : $CONFIG['max_upl_width_height'];
// use max aspect of original image if it hasn't been resized earlier
if (($result = resize_image($work_image, $image, $wm_max_upl_width_height, $CONFIG['thumb_method'], 'any', 'true')) !== true) {
return $result;
}
}
list($width, $height) = getimagesize($image);
} else {
$width = 0;
$height = 0;
}
$image_filesize = filesize($image);
$total_filesize = is_image($row['filename']) ? $image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb) : $image_filesize;
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET filesize = '{$image_filesize}', total_filesize = '{$total_filesize}', pwidth = '{$width}', pheight = '{$height}' {$metadata_sql} WHERE pid = '{$pid}' LIMIT 1");
if ($superCage->post->keyExists('update_timestamp')) {
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET ctime = '" . time() . "' WHERE pid = '{$pid}' LIMIT 1");
}
cpg_db_query("DELETE FROM {$CONFIG['TABLE_EXIF']} WHERE pid = '{$pid}' LIMIT 1");
if ($CONFIG['read_exif_data']) {
include "include/exif_php.inc.php";
exif_parse_file($image, $pid);
}
$CONFIG['site_url'] = rtrim($CONFIG['site_url'], '/');
} else {
if (is_image($image)) {
@unlink($normal);
@unlink($thumb);
}
@unlink($image);
}
header("Location: {$CONFIG['site_url']}/displayimage.php?pid={$pid}");
die;
} else {
load_template();
pageheader($lang_plugin_file_replacer['file_replacer']);
echo '<form method="post" enctype="multipart/form-data">';
starttable('60%', $lang_plugin_file_replacer['upload_file'], 2);
list($timestamp, $form_token) = getFormToken();
echo <<<EOT
<tr>
<td class="tableb" valign="top">
{$lang_plugin_file_replacer['browse']}
</td>
<td class="tableb" valign="top">
<input type="file" name="fileupload" size="40" class="listbox" />
</td>
</tr>
<tr>
<td class="tableb" valign="top">
{$lang_plugin_file_replacer['update_timestamp']}
</td>
<td class="tableb" valign="top">
<input type="checkbox" name="update_timestamp" />
</td>
</tr>
<tr>
<td class="tableb" valign="top">
{$lang_plugin_file_replacer['overwrite_metadata']}
</td>
<td class="tableb" valign="top">
<input type="checkbox" name="overwrite_metadata" />
</td>
</tr>
<tr>
<td align="center" colspan="2" class="tablef">
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
<input type="submit" name="commit" class="button" value="{$lang_plugin_file_replacer['upload']}"/>
</td>
</tr>
EOT;
endtable();
echo '</form>';
pagefooter();
exit;
}
}
}
示例14: display_group_list
function display_group_list()
{
global $CONFIG, $LINEBREAK, $custom_group_counter;
global $lang_groupmgr_php, $lang_byte_units, $lang_common;
$row_counter = 0;
$table_start = '<table border="0" cellspacing="0" cellpadding="0" style="white-space:nowrap;font-size:90%;">' . $LINEBREAK;
$table_end = '</table>' . $LINEBREAK;
$tr_start = '<tr>' . $LINEBREAK;
$tr_end = '</tr>' . $LINEBREAK;
$td_start = '<td>' . $LINEBREAK;
$td_end = '</td>' . $LINEBREAK;
//$approval_needed = ', admin approval needed';
//$approval_not_needed = ', visible instantly';
$default_group_names = array('1' => 'Administrators', '2' => 'Registered', '3' => 'Anonymous');
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_USERGROUPS']} WHERE 1 ORDER BY group_id");
if (!mysql_num_rows($result)) {
cpg_db_query("INSERT INTO {$CONFIG['TABLE_USERGROUPS']}\n VALUES (1, 'Administrators', 0, 1, 1, 1, 1, 1, 1, 0, 0, 3)");
cpg_db_query("INSERT INTO {$CONFIG['TABLE_USERGROUPS']}\n VALUES (2, 'Registered', 1024, 0, 1, 1, 1, 1, 1, 1, 0, 3)");
cpg_db_query("INSERT INTO {$CONFIG['TABLE_USERGROUPS']}\n VALUES (3, 'Anonymous', 0, 0, 1, 0, 0, 0, 0, 1, 1, 3)");
cpg_die(CRITICAL_ERROR, $lang_groupmgr_php['error_group_empty'], __FILE__, __LINE__);
}
$field_list = array('can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval');
$custom_group_counter = 0;
$access_levels = array(0 => $lang_groupmgr_php['none'], 1 => $lang_groupmgr_php['thumbnail_only'], 2 => $lang_groupmgr_php['thumbnail_intermediate'], 3 => $lang_groupmgr_php['thumbnail_intermediate_full']);
while ($group = mysql_fetch_assoc($result)) {
$group['group_name'] = $group['group_name'];
$row_counter++;
if ($row_counter == 1) {
$table_background = 'tableb';
} else {
$table_background = 'tableb tableb_alternate';
$row_counter = 0;
}
if ($group['group_id'] > 3 && UDB_INTEGRATION == 'coppermine') {
$custom_group_counter++;
echo <<<EOT
<tr>
<td class="{$table_background}" align="center" valign="top" style="padding-left: 1px; padding-right: 1px" >
<input type="checkbox" name="delete_group[]" value="{$group['group_id']}" class="checkbox" />
</td>
EOT;
} else {
echo <<<EOT
<tr>
<td class="{$table_background}" >
</td>
EOT;
}
// disable row if applicable
if ($group['group_id'] == 3 && $CONFIG['allow_unlogged_access'] == 0) {
$disabled = 'disabled="disabled" style="background-color:InactiveCaptionText;color:GrayText"';
$explain_greyedout = ' ' . cpg_display_help('f=empty.htm&base=64&h=' . urlencode(base64_encode(serialize($lang_groupmgr_php['explain_greyed_out_title']))) . '&t=' . urlencode(base64_encode(serialize(sprintf($lang_groupmgr_php['explain_guests_greyed_out_text'], '<em>' . $group['group_name'] . '</em>')))), '450', '300');
} else {
$disabled = '';
$explain_greyedout = '';
}
echo <<<EOT
<td class="{$table_background}" align="left" valign="top" style="white-space:nowrap">
<input type="hidden" name="group_id[]" value="{$group['group_id']}" />
<input type="text" name="group_name_{$group['group_id']}" value="{$group['group_name']}" class="textinput" size="18" style="font-size:80%;" />
{$explain_greyedout}
EOT;
// show reset option if applicable
if (UDB_INTEGRATION == 'coppermine' && isset($default_group_names[$group['group_id']])) {
if ($group['group_name'] != $default_group_names[$group['group_id']] && $default_group_names[$group['group_id']] != '') {
// we have a group here that doesn't have the default name
//print '<img src="images/flags/reset.gif" width="16" height="11" border="0" alt="" title="'.sprintf($lang_groupmgr_php['reset_to_default'], $default_group_names[$group['group_id']]).'" style="cursor:pointer" onclick="document.groupmanager.group_name_'.$group['group_id'].'.value=\''.$default_group_names[$group['group_id']].'\'" />';
print '<a href="javascript:;" onclick="document.groupmanager.group_name_' . $group['group_id'] . '.value=\'' . $default_group_names[$group['group_id']] . '\'">';
print cpg_fetch_icon('stop', 0, sprintf($lang_groupmgr_php['reset_to_default'], $default_group_names[$group['group_id']]));
print '</a>';
}
}
list($timestamp, $form_token) = getFormToken();
$assignedGroupsHelp = cpg_display_help('f=groups.htm&as=group_cp_assigned&ae=group_cp_assigned_end', '450', '300');
echo <<<EOT
<br />
{$lang_groupmgr_php['disk_quota']}: <input type="text" name="group_quota_{$group['group_id']}" value="{$group['group_quota']}" size="5" class="textinput" {$disabled} /> {$lang_byte_units[1]}
<br /><br /><a href="usermgr.php?op=group_alb_access&gid={$group['group_id']}&form_token={$form_token}&timestamp={$timestamp}" class="admin_menu">{$lang_groupmgr_php['group_assigned_album']}</a> {$assignedGroupsHelp}
</td>
<td class="{$table_background}" align="left" valign="top">
EOT;
foreach ($field_list as $field_name) {
$value = $group[$field_name];
$yes_selected = $value == 1 ? 'checked="checked"' : '';
$no_selected = $value == 0 ? 'checked="checked"' : '';
if ($field_name == 'can_rate_pictures') {
echo $table_start . $tr_start . $td_start . $lang_groupmgr_php['rating'] . $td_end;
} elseif ($field_name == 'can_send_ecards') {
echo $tr_start . $td_start . $lang_groupmgr_php['ecards'] . $td_end;
} elseif ($field_name == 'can_post_comments') {
echo $tr_start . $td_start . $lang_groupmgr_php['comments'] . $td_end;
} elseif ($field_name == 'can_upload_pictures') {
echo $table_start . $tr_start . $td_start . $lang_groupmgr_php['allowed'] . $td_end;
} elseif ($field_name == 'pub_upl_need_approval') {
echo $tr_start . $td_start . $lang_groupmgr_php['approval'] . $td_end;
} elseif ($field_name == 'can_create_albums') {
echo $table_start . $tr_start . $td_start . $lang_groupmgr_php['allowed'] . $td_end;
//.........这里部分代码省略.........
示例15: dst_configure
function dst_configure()
{
global $CONFIG, $dst_installation;
// create Inspekt supercage
$superCage = Inspekt::makeSuperCage();
if (!GALLERY_ADMIN_MODE) {
cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
require "./plugins/dst/lang/english.php";
if ($CONFIG['lang'] != 'english' && file_exists("./plugins/dst/lang/{$CONFIG['lang']}.php")) {
require "./plugins/dst/lang/{$CONFIG['lang']}.php";
}
$plugin_dst_icon['submit'] = cpg_fetch_icon('ok', 1);
include_once './plugins/dst/functions.inc.php';
$dst_array = plugin_dst_xml_read();
// create Inspekt supercage
$superCage = Inspekt::makeSuperCage();
// get sanitized POST parameters
if ($superCage->post->keyExists('submit')) {
//Check if the form token is valid
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
// Define the sanitization patterns
$sanitization_array = array('plugin_dst_country' => array('type' => 'raw', 'regex_ok' => '/^[a-zA-Z ]+$/'));
$config_changes_counter = 0;
foreach ($sanitization_array as $san_key => $san_value) {
if (isset($CONFIG[$san_key]) == TRUE) {
// only loop if config value is set --- start
if ($san_value['type'] == 'checkbox') {
// type is checkbox --- start
if ($superCage->post->getInt($san_key) == $san_value['max'] && $CONFIG[$san_key] != $san_value['max']) {
$CONFIG[$san_key] = $san_value['max'];
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
} elseif ($superCage->post->getInt($san_key) == $san_value['min'] && $CONFIG[$san_key] != $san_value['min']) {
$CONFIG[$san_key] = $san_value['min'];
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
} elseif ($superCage->post->keyExists($san_key) != TRUE && $CONFIG[$san_key] != '0') {
$CONFIG[$san_key] = 0;
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
}
}
// type is checkbox --- end
if ($san_value['type'] == 'int') {
// type is integer --- start
if ($superCage->post->getInt($san_key) <= $san_value['max'] && $superCage->post->getInt($san_key) >= $san_value['min'] && $superCage->post->getInt($san_key) != $CONFIG[$san_key]) {
$CONFIG[$san_key] = $superCage->post->getInt($san_key);
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
}
}
// type is integer --- end
if ($san_value['type'] == 'raw') {
// type is raw --- start
if (isset($san_value['regex_ok']) == TRUE && preg_match($san_value['regex_ok'], $superCage->post->getRaw($san_key)) && $superCage->post->getRaw($san_key) != $CONFIG[$san_key]) {
$CONFIG[$san_key] = $superCage->post->getRaw($san_key);
if ($superCage->post->getRaw($san_key) == 'none') {
$CONFIG[$san_key] = '';
}
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
}
}
// type is raw --- end
if ($san_value['type'] == 'array') {
// type is array --- start
$evaluate_value = $superCage->post->getRaw($san_key);
//print_r($superCage->post->getRaw($san_key));
if (is_array($evaluate_value) && isset($san_value['regex_ok']) == TRUE && isset($san_value['delimiter']) == TRUE) {
$temp = '';
for ($i = 0; $i <= count($evaluate_value); $i++) {
if (preg_match($san_value['regex_ok'], $evaluate_value[$i])) {
$temp .= $evaluate_value[$i] . $san_value['delimiter'];
}
}
unset($evaluate_value);
$evaluate_value = rtrim($temp, $san_value['delimiter']);
unset($temp);
}
if ($evaluate_value != $CONFIG[$san_key]) {
$CONFIG[$san_key] = $evaluate_value;
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG[$san_key]}' WHERE name='{$san_key}'");
$config_changes_counter++;
}
}
// type is array --- end
}
// only loop if config value is set --- end
}
}
list($timestamp, $form_token) = getFormToken();
if ($superCage->post->keyExists('submit')) {
if ($config_changes_counter == 0) {
msg_box($lang_common['error'], $lang_plugin_dst['no_changes'], '', '', 'error');
} else {
msg_box($lang_common['information'], $lang_plugin_dst['changes_saved'], '', '', 'success');
}
//.........这里部分代码省略.........