本文整理汇总了PHP中addNotice函数的典型用法代码示例。如果您正苦于以下问题:PHP addNotice函数的具体用法?PHP addNotice怎么用?PHP addNotice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addNotice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_tags
protected function post_tags()
{
global $aidlink;
if (isset($_POST['save_tag'])) {
$this->data = array('tag_id' => isset($_GET['tag_id']) && isnum($_GET['tag_id']) ? intval($_GET['tag_id']) : 0, 'tag_title' => form_sanitizer($_POST['tag_title'], '', 'tag_title'), 'tag_language' => form_sanitizer($_POST['tag_language'], '', 'tag_language'), 'tag_color' => form_sanitizer($_POST['tag_color'], '', 'tag_color'), 'tag_description' => form_sanitizer($_POST['tag_description'], '', 'tag_description'), 'tag_status' => isset($_POST['tag_status']) && isnum($_POST['tag_status']) ? intval($_POST['tag_status']) : 0);
if (\defender::safe()) {
if (!empty($this->data['tag_id'])) {
/**
* Update
*/
dbquery_insert(DB_FORUM_TAGS, $this->data, "update");
addNotice('success', self::$locale['forum_tag_0105']);
redirect(FUSION_SELF . $aidlink . '§ion=ft');
} else {
/**
* Save New
*/
dbquery_insert(DB_FORUM_TAGS, $this->data, "save");
addNotice('success', self::$locale['forum_tag_0106']);
redirect(FUSION_SELF . $aidlink . '§ion=ft');
}
}
}
if (isset($_GET['delete']) && isnum($_GET['delete'])) {
$result = dbquery("DELETE FROM " . DB_FORUM_TAGS . " WHERE tag_id='" . $_GET['delete'] . "'");
if ($result) {
addNotice("success", self::$locale['forum_tag_0107']);
redirect(FUSION_SELF . $aidlink . '§ion=ft');
}
}
}
示例2: post_forum_ranks
protected function post_forum_ranks()
{
global $aidlink;
if (isset($_POST['save_rank'])) {
$this->data = array('rank_id' => isset($_GET['rank_id']) && isnum($_GET['rank_id']) ? intval($_GET['rank_id']) : 0, 'rank_title' => form_sanitizer($_POST['rank_title'], '', 'rank_title'), 'rank_image' => form_sanitizer($_POST['rank_image'], "", "rank_image"), 'rank_language' => form_sanitizer($_POST['rank_language'], "", "rank_language"), 'rank_posts' => isset($_POST['rank_posts']) && isnum($_POST['rank_posts']) ? $_POST['rank_posts'] : 0, 'rank_type' => isset($_POST['rank_type']) && isnum($_POST['rank_type']) ? $_POST['rank_type'] : 0, 'rank_apply_normal' => isset($_POST['rank_apply_normal']) && isnum($_POST['rank_apply_normal']) ? $_POST['rank_apply_normal'] : USER_LEVEL_MEMBER, 'rank_apply_special' => isset($_POST['rank_apply_special']) && isnum($_POST['rank_apply_special']) ? $_POST['rank_apply_special'] : 1);
$this->data += array('rank_apply' => $this->data['rank_type'] == 2 ? $this->data['rank_apply_special'] : $this->data['rank_apply_normal']);
if (\defender::safe()) {
if (!empty($this->data['rank_id']) && !$this->check_duplicate_ranks()) {
/**
* Update
*/
dbquery_insert(DB_FORUM_RANKS, $this->data, "update");
addNotice('info', self::$locale['411']);
redirect(FUSION_SELF . $aidlink . '§ion=fr');
} elseif (!$this->check_duplicate_ranks()) {
/**
* Save New
*/
dbquery_insert(DB_FORUM_RANKS, $this->data, "save");
addNotice('info', self::$locale['410']);
redirect(FUSION_SELF . $aidlink . '§ion=fr');
}
}
}
if (isset($_GET['delete']) && isnum($_GET['delete'])) {
$result = dbquery("DELETE FROM " . DB_FORUM_RANKS . " WHERE rank_id='" . $_GET['delete'] . "'");
if ($result) {
addNotice("success", self::$locale['412']);
redirect(FUSION_SELF . $aidlink . '§ion=fr');
}
}
}
示例3: form_btngroup
/**
* Button Groups
* @param $input_name
* @param string $label
* @param $input_value
* @param array $options
* @return string
*/
function form_btngroup($input_name, $label = "", $input_value, array $options = array())
{
global $defender, $locale;
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_value = isset($input_value) && !empty($input_value) ? stripinput($input_value) : "";
$default_options = array('options' => array($locale['disable'], $locale['enable']), 'input_id' => $input_name, 'class' => "btn-default", 'icon' => "", "multiple" => FALSE, "delimiter" => ",", 'deactivate' => FALSE, 'error_text' => "", 'inline' => FALSE, 'safemode' => FALSE, 'required' => FALSE, 'callback_check' => '');
$options += $default_options;
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . "clearfix'>\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0" : 'col-xs-12 col-sm-12 col-md-12 col-lg-12 p-l-0') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == 1 ? "<span class='required'>*</span>" : '') . "</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9'>\n" : '';
$html .= "<div class='btn-group' id='" . $options['input_id'] . "'>";
$i = 1;
if (!empty($options['options']) && is_array($options['options'])) {
foreach ($options['options'] as $arr => $v) {
$active = '';
if ($input_value == $arr) {
$active = "active";
}
$html .= "<button type='button' data-value='{$arr}' class='btn " . $options['class'] . " " . (count($options['options']) == $i ? 'last-child' : '') . " {$active}'>" . $v . "</button>\n";
$i++;
}
}
$html .= "</div>\n";
$html .= "<input name='{$input_name}' type='hidden' id='" . $options['input_id'] . "-text' value='{$input_value}' />\n";
$html .= $defender->inputHasError($input_name) ? "<div id='" . $options['input_id'] . "-help' class='label label-danger p-5 display-inline-block'>" . $options['error_text'] . "</div>" : "";
$html .= $options['inline'] ? "</div>\n" : '';
$html .= "</div>\n";
$input_name = $options['multiple'] ? str_replace("[]", "", $input_name) : $input_name;
$defender->add_field_session(array('input_name' => $input_name, 'title' => trim($title, '[]'), 'id' => $options['input_id'], 'type' => 'dropdown', 'required' => $options['required'], 'callback_check' => $options['callback_check'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text'], 'delimiter' => $options['delimiter']));
add_to_jquery("\n\t\$('#" . $options['input_id'] . " button').bind('click', function(e){\n\t\t\$('#" . $options['input_id'] . " button').removeClass('active');\n\t\t\$(this).toggleClass('active');\n\t\tvalue = \$(this).data('value');\n\t\t\$('#" . $options['input_id'] . "-text').val(value);\n\t});\n\t");
return $html;
}
示例4: form_colorpicker
function form_colorpicker($input_name, $label = '', $input_value = '', array $options = array())
{
global $defender, $locale;
if (!defined("COLORPICKER")) {
define("COLORPICKER", TRUE);
add_to_head("<link href='" . DYNAMICS . "assets/colorpick/css/bootstrap-colorpicker.css' rel='stylesheet' media='screen' />");
add_to_head("<script src='" . DYNAMICS . "assets/colorpick/js/bootstrap-colorpicker.js'></script>");
}
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = stripinput($input_name);
$input_value = stripinput($input_value);
$default_options = array('input_id' => $input_name, 'required' => FALSE, 'placeholder' => '', 'deactivate' => FALSE, 'width' => '250px', 'class' => '', 'inline' => FALSE, 'error_text' => $locale['error_input_default'], 'safemode' => FALSE, 'icon' => "", "tip" => "", 'format' => 'hex');
$options += $default_options;
if (!$options['width']) {
$options['width'] = $default_options['width'];
}
$input_id = $options['input_id'] ?: $default_options['input_id'];
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='{$input_id}-field' class='form-group clearfix m-b-10 " . $error_class . $options['class'] . " '>\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3" : '') . "' for='{$input_id}'>{$label} " . ($options['required'] ? "<span class='required'>*</span>" : '') . "\n\t" . ($options['tip'] ? "<i class='pointer fa fa-question-circle' title='" . $options['tip'] . "'></i>" : '') . "\n\t</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 col-sm-9 col-md-9 col-lg-9'>\n" : "<br/>\n";
$html .= "<div id='{$input_id}' style='width: " . $options['width'] . "' class='input-group colorpicker-component bscp colorpicker-element m-b-10' data-color='{$input_value}' data-color-format='" . $options['format'] . "'>";
$html .= "<input type='text' name='{$input_name}' class='form-control " . $options['class'] . "' id='" . $input_id . "' value='{$input_value}' data-color-format='" . $options['format'] . "' placeholder='" . $options['placeholder'] . "' " . ($options['deactivate'] ? "readonly" : "") . ">";
$html .= "<span id='{$input_id}-cp' class='input-group-addon'>";
$html .= "<i style='background: rgba(255,255,255,1);'></i>";
$html .= "</span></div>";
$html .= $options['inline'] ? "</div>\n" : "";
$html .= "</div>\n";
$defender->add_field_session(array('input_name' => $input_name, 'type' => 'color', 'title' => $title, 'id' => $input_id, 'required' => $options['required'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text']));
add_to_jquery("\$('#{$input_id}').colorpicker({ format : '" . $options['format'] . "' });");
return $html;
}
示例5: flood_control
function flood_control($field, $table, $where, $debug = FALSE)
{
global $userdata, $settings, $locale, $defender;
$flood = FALSE;
if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD) || $debug) {
$result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
if (dbrows($result)) {
$time = time();
$data = dbarray($result);
if ($time - $data['last_post'] < $settings['flood_interval']) {
$defender->stop();
addNotice('warning', sprintf($locale['flood'], countdown($settings['flood_interval'] - ($time - $data['last_post']))));
$flood = TRUE;
$result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_ip_type, flood_timestamp) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '" . time() . "')");
// This should be in settings, "After how many flood offences take action" then a setting for what action to take
if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
if (!$debug) {
if (iMEMBER && $settings['flood_autoban'] == "1") {
require_once INCLUDES . "sendmail_include.php";
require_once INCLUDES . "suspend_include.php";
$result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
suspend_log($userdata['user_id'], 4, $locale['global_440'], TRUE);
$message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
$message = str_replace("[USER_IP]", USER_IP, $message);
$message = str_replace("[USER_IP]", USER_IP, $message);
$message = str_replace("[SITE_EMAIL]", $settings['siteemail'], $message);
$message = str_replace("[SITEUSERNAME]", $settings['siteusername'], $message);
$subject = str_replace("[SITENAME]", $settings['sitename'], $locale['global_441']);
sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
} elseif (!iMEMBER) {
$result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_ip_type, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '', '" . $locale['global_440'] . "')");
}
} else {
addNotice('info', "DEBUG MESSAGE: Triggered flood control action due to repeated offences. This could've resulted in a ban or suspenstion");
}
}
}
}
}
return $flood;
}
示例6: viewSettingsAdmin
public function viewSettingsAdmin()
{
global $aidlink;
pageAccess('F');
$forum_settings = $this->get_forum_settings();
add_breadcrumb(array('link' => ADMIN . 'settings_forum.php' . $aidlink, 'title' => self::$locale['forum_settings']));
if (isset($_POST['recount_user_post'])) {
$result = dbquery("SELECT post_author, COUNT(post_id) as num_posts FROM " . DB_FORUM_POSTS . " GROUP BY post_author");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$result2 = dbquery("UPDATE " . DB_USERS . " SET user_posts='" . $data['num_posts'] . "' WHERE user_id='" . $data['post_author'] . "'");
}
addNotice('success', self::$locale['forum_061']);
}
}
if (isset($_POST['savesettings'])) {
$numofthreads = form_sanitizer($_POST['numofthreads'], 20, 'numofthreads');
$threads_num = form_sanitizer($_POST['threads_per_page'], 20, 'threads_per_page');
$posts_num = form_sanitizer($_POST['posts_per_page'], 20, 'posts_per_page');
$forum_ips = form_sanitizer($_POST['forum_ips'], -103, 'forum_ips');
$attachmax = form_sanitizer($_POST['calc_b'], 1, 'calc_b') * form_sanitizer($_POST['calc_c'], 1000000, 'calc_c');
$attachmax_count = form_sanitizer($_POST['forum_attachmax_count'], 5, 'forum_attachmax_count');
$attachtypes = form_sanitizer($_POST['forum_attachtypes'], '.pdf,.gif,.jpg,.png,.zip,.rar,.tar,.bz2,.7z', 'forum_attachtypes');
$thread_notify = form_sanitizer($_POST['thread_notify'], '0', 'thread_notify');
$forum_ranks = form_sanitizer($_POST['forum_ranks'], '0', 'forum_ranks');
$forum_rank_style = form_sanitizer($_POST['forum_rank_style'], '0', 'forum_rank_style');
$forum_edit_lock = form_sanitizer($_POST['forum_edit_lock'], '0', 'forum_edit_lock');
$forum_edit_timelimit = form_sanitizer($_POST['forum_edit_timelimit'], '0', 'forum_edit_timelimit');
$popular_threads_timeframe = form_sanitizer($_POST['popular_threads_timeframe'], '604800', 'popular_threads_timeframe');
$forum_last_posts_reply = form_sanitizer($_POST['forum_last_posts_reply'], '0', 'forum_last_posts_reply');
$forum_last_post_avatar = form_sanitizer($_POST['forum_last_post_avatar'], '0', 'forum_last_post_avatar');
$forum_editpost_to_lastpost = form_sanitizer($_POST['forum_editpost_to_lastpost'], '0', 'forum_editpost_to_lastpost');
if (\defender::safe()) {
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$numofthreads}' WHERE settings_name='numofthreads' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$threads_num}' WHERE settings_name='threads_per_page' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$posts_num}' WHERE settings_name='posts_per_page' AND settings_inf='forum'");
//".(isnum($_POST['forum_ips']) ? $_POST['forum_ips'] : "103")."
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ips}' WHERE settings_name='forum_ips' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax}' WHERE settings_name='forum_attachmax' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax_count}' WHERE settings_name='forum_attachmax_count' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachtypes}' WHERE settings_name='forum_attachtypes' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$thread_notify}' WHERE settings_name='thread_notify' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ranks}' WHERE settings_name='forum_ranks' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_rank_style}' WHERE settings_name='forum_rank_style' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_lock}' WHERE settings_name='forum_edit_lock' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_timelimit}' WHERE settings_name='forum_edit_timelimit' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$popular_threads_timeframe}' WHERE settings_name='popular_threads_timeframe' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_posts_reply}' WHERE settings_name='forum_last_posts_reply' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_post_avatar}' WHERE settings_name='forum_last_post_avatar' AND settings_inf='forum'");
dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_editpost_to_lastpost}' WHERE settings_name='forum_editpost_to_lastpost' AND settings_inf='forum'");
addNotice('success', self::$locale['900']);
redirect(FUSION_SELF . $aidlink . '§ion=fs');
}
}
$yes_no_array = array('1' => self::$locale['yes'], '0' => self::$locale['no']);
echo "<div class='well'>" . self::$locale['forum_description'] . "</div>";
echo openform('forum_settings_form', 'post', FUSION_REQUEST, array('class' => 'm-t-20'));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-8'>\n";
openside('');
echo "<span class='small pull-right'>* " . self::$locale['506'] . "</span><br/>\n";
echo form_text('numofthreads', self::$locale['505'], $forum_settings['numofthreads'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
closeside();
openside('');
echo form_text('threads_per_page', self::$locale['forum_080'], $forum_settings['threads_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
echo form_text('posts_per_page', self::$locale['forum_081'], $forum_settings['posts_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number'));
closeside();
openside('');
echo form_select('thread_notify', self::$locale['512'], $forum_settings['thread_notify'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
closeside();
openside('');
echo "<span class='pull-right position-absolute small' style='right:30px;'>" . self::$locale['537'] . "</span>\n";
echo form_select('forum_edit_timelimit', self::$locale['536'], $forum_settings['forum_edit_timelimit'], array('options' => array('0', '10', '30', '45', '60'), 'max_length' => 2, 'width' => '100px', 'required' => 1, 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_ips', self::$locale['507'], $forum_settings['forum_ips'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_ranks', self::$locale['520'], $forum_settings['forum_ranks'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_rank_style', self::$locale['forum_064'], $forum_settings['forum_rank_style'], array('options' => array(self::$locale['forum_063'], self::$locale['forum_062']), 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_last_post_avatar', self::$locale['539'], $forum_settings['forum_last_post_avatar'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_edit_lock', self::$locale['521'], $forum_settings['forum_edit_lock'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
echo form_select('forum_editpost_to_lastpost', self::$locale['538'], $forum_settings['forum_editpost_to_lastpost'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1));
closeside();
echo "</div>\n";
echo "<div class='col-xs-12 col-sm-4'>\n";
openside('');
$calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
$calc_c = self::calculate_byte($forum_settings['forum_attachmax']);
$calc_b = $forum_settings['forum_attachmax'] / $calc_c;
require_once INCLUDES . "mimetypes_include.php";
$mime = mimeTypes();
$mime_opts = array();
foreach ($mime as $m => $Mime) {
$ext = ".{$m}";
$mime_opts[$ext] = $ext;
}
sort($mime_opts);
echo "<div class='clearfix'>\n";
echo "<span class='pull-right small'>" . self::$locale['509'] . "</span>";
echo "<label for='calc_c'>" . self::$locale['508'] . "</label><br />\n";
echo form_text('calc_b', '', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => self::$locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'm-r-10 pull-left'));
echo form_select('calc_c', '', $calc_c, array('options' => $calc_opts, 'placeholder' => self::$locale['choose'], 'class' => 'pull-left', 'width' => '100%'));
echo "</div>\n";
//.........这里部分代码省略.........
示例7: add_breadcrumb
add_breadcrumb(array('link' => ADMIN . 'banners.php' . $aidlink, 'title' => $locale['850']));
$message = '';
if (isset($_GET['error'])) {
switch ($_GET['error']) {
case '1':
$message = $locale['901'];
$status = 'danger';
$icon = "<i class='fa fa-alert fa-lg fa-fw'></i>";
break;
default:
$message = $locale['900'];
$status = 'success';
$icon = "<i class='fa fa-check-square-o fa-lg fa-fw'></i>";
}
if ($message) {
addNotice($status, $icon . $message);
}
}
if (isset($_POST['save_banners'])) {
$error = 0;
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . addslash($_POST['sitebanner1']) . "' WHERE settings_name='sitebanner1'");
if (!$result) {
$error = 1;
}
$result = dbquery("UPDATE " . DB_SETTINGS . " SET settings_value='" . addslash($_POST['sitebanner2']) . "' WHERE settings_name='sitebanner2'");
if (!$result) {
$error = 1;
}
redirect(FUSION_SELF . $aidlink . "&error=" . $error, TRUE);
}
if (isset($_POST['preview_banners'])) {
示例8: form_textarea
function form_textarea($input_name, $label = '', $input_value = '', array $options = array())
{
global $locale, $defender, $userdata;
// for editor
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = isset($input_name) && !empty($input_name) ? stripinput($input_name) : "";
require_once INCLUDES . "bbcode_include.php";
require_once INCLUDES . "html_buttons_include.php";
include_once LOCALE . LOCALESET . "admin/html_buttons.php";
include_once LOCALE . LOCALESET . "error.php";
if (!empty($options['bbcode'])) {
$options['type'] = "bbcode";
} elseif (!empty($options['html'])) {
$options['type'] = "html";
}
$options = array('input_id' => !empty($options['input_id']) ? $options['input_id'] : $input_name, "type" => !empty($options['type']) && in_array($options['type'], array("html", "bbcode", "tinymce")) ? $options['type'] : "", 'required' => !empty($options['required']) && $options['required'] == 1 ? '1' : '0', 'placeholder' => !empty($options['placeholder']) ? $options['placeholder'] : '', 'deactivate' => !empty($options['deactivate']) && $options['deactivate'] == 1 ? '1' : '', 'width' => !empty($options['width']) ? $options['width'] : '100%', 'height' => !empty($options['height']) ? $options['height'] : '80px', 'class' => !empty($options['class']) ? $options['class'] : '', 'inline' => !empty($options['inline']) && $options['inline'] == 1 ? '1' : '0', 'length' => !empty($options['length']) ? $options['length'] : '200', 'error_text' => !empty($options['error_text']) ? $options['error_text'] : $locale['error_input_default'], 'safemode' => !empty($options['safemode']) && $options['safemode'] == 1 ? '1' : '0', 'form_name' => !empty($options['form_name']) ? $options['form_name'] : 'input_form', 'tinymce' => !empty($options['tinymce']) && in_array($options['tinymce'], array(TRUE, 'simple', 'advanced')) ? $options['tinymce'] : "simple", 'no_resize' => !empty($options['no_resize']) && $options['no_resize'] == '1' ? '1' : '0', 'autosize' => !empty($options['autosize']) && $options['autosize'] == 1 ? '1' : '0', 'preview' => !empty($options['preview']) && $options['preview'] == TRUE ? TRUE : FALSE, 'path' => !empty($options['path']) && $options['path'] ? $options['path'] : IMAGES, 'maxlength' => !empty($options['maxlength']) && isnum($options['maxlength']) ? $options['maxlength'] : '', 'tip' => !empty($options['tip']) ? $options['tip'] : '');
if ($options['type'] == "tinymce") {
$tinymce_list = array();
$image_list = makefilelist(IMAGES, ".|..|");
$image_filter = array('png', 'PNG', 'bmp', 'BMP', 'jpg', 'JPG', 'jpeg', 'gif', 'GIF', 'tiff', 'TIFF');
foreach ($image_list as $image_name) {
$image_1 = explode('.', $image_name);
$last_str = count($image_1) - 1;
if (in_array($image_1[$last_str], $image_filter)) {
$tinymce_list[] = array('title' => $image_name, 'value' => IMAGES . $image_name);
}
}
$tinymce_list = json_encode($tinymce_list);
$tinymce_smiley_vars = "";
if (!defined('tinymce')) {
add_to_head("<style type='text/css'>.mceIframeContainer iframe{width:100%!important; height:30px;}</style>");
add_to_footer("<script type='text/javascript' src='" . INCLUDES . "jscripts/tinymce/tinymce.min.js'></script>");
define('tinymce', TRUE);
// PHP-Fusion Parse Cache Smileys
$smileys = cache_smileys();
$tinymce_smiley_vars = "";
if (!empty($smileys)) {
$tinymce_smiley_vars = "var shortcuts = {\n";
foreach ($smileys as $params) {
$tinymce_smiley_vars .= "'" . strtolower($params['smiley_code']) . "' : '<img alt=\"" . $params['smiley_text'] . "\" src=\"" . IMAGES . "smiley/" . $params['smiley_image'] . "\"/>',\n";
}
$tinymce_smiley_vars .= "};\n";
$tinymce_smiley_vars .= "\n\t\t\t\ted.on('keyup load', function(e){\n\t\t\t\t\tvar marker = tinymce.activeEditor.selection.getBookmark();\n\t\t\t\t\t// Store editor contents\n\t\t\t\t\tvar content = tinymce.activeEditor.getContent({'format':'raw'});\n\t\t\t\t\t// Loop through all shortcuts\n\t\t\t\t\tfor(var key in shortcuts){\n\t\t\t\t\t\t// Check if the editor html contains the looped shortcut\n\t\t\t\t\t\tif(content.toLowerCase().indexOf(key) != -1) {\n\t\t\t\t\t\t\t// Escaping special characters to be able to use the shortcuts in regular expression\n\t\t\t\t\t\t\tvar k = key.replace(/[<>*()?']/ig, \"\\\$&\");\n\t\t\t\t\t\t\ttinymce.activeEditor.setContent(content.replace(k, shortcuts[key]));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Now put cursor back where it was\n\t\t\t\t\ttinymce.activeEditor.selection.moveToBookmark(marker);\n\t\t\t\t});\n\t\t\t\t";
}
}
// Mode switching for TinyMCE
switch ($options['tinymce']) {
case 'advanced':
add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n entity_encoding : 'raw',\n width: '100%',\n height: 300,\n plugins: [\n 'advlist autolink autoresize link image lists charmap print preview hr anchor pagebreak spellchecker',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'save table contextmenu directionality template paste textcolor'\n ],\n image_list: {$tinymce_list},\n content_css: '" . THEMES . "admin_templates/" . fusion_get_settings("admin_theme") . "/acp_styles.css',\n toolbar1: 'insertfile undo redo | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | newdocument fullscreen preview cut copy paste pastetext spellchecker searchreplace code',\n toolbar2: 'styleselect formatselect removeformat | fontselect fontsizeselect bold italic underline strikethrough subscript superscript blockquote | forecolor backcolor',\n toolbar3: 'hr pagebreak insertdatetime | link unlink anchor | image media | table charmap visualchars visualblocks emoticons',\n image_advtab: true,\n style_formats: [\n {title: 'Bold text', inline: 'b'},\n {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},\n {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},\n {title: 'Example 1', inline: 'span', classes: 'example1'},\n {title: 'Example 2', inline: 'span', classes: 'example2'},\n {title: 'Table styles'},\n {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}\n ],\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n ");
break;
case 'simple':
add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n menubar: false,\n statusbar: false,\n content_css: '" . THEMES . "/templates/tinymce.css',\n image_list: {$tinymce_list},\n plugins: [\n 'advlist autolink autoresize link lists charmap print preview hr anchor pagebreak spellchecker',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'contextmenu directionality template paste bbcode autoresize'\n ],\n height: 30,\n image_advtab: true,\n toolbar1: 'undo redo | bold italic underline | bullist numlist blockquote | hr media | fullscreen',\n entity_encoding : 'raw',\n language: '" . $locale['tinymce'] . "',\n object_resizing: false,\n resize: false,\n relative_urls: false,\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n ");
add_to_jquery("\n\t\t\t\t\$('#inject').bind('click', function() {\n\t\t\t\t\ttinyMCE.activeEditor.execCommand(\"mceInsertContent\", true, '[b]I am injecting in stuff..[/b]');\n\t\t\t\t\t});\n\t\t\t\t");
break;
case 'default':
add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n entity_encoding : 'raw',\n language:'" . $locale['tinymce'] . "',\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n ");
break;
}
} else {
if (!defined('autogrow') && $options['autosize']) {
define('autogrow', TRUE);
add_to_footer("<script src='" . DYNAMICS . "assets/autosize/jquery.autosize.min.js'></script>");
}
if ($options['autosize']) {
add_to_jquery("\n\t\t \$('#" . $options['input_id'] . "').autosize();\n\t\t ");
}
}
if ($input_value !== '') {
$input_value = html_entity_decode(stripslashes($input_value), ENT_QUOTES, $locale['charset']);
$input_value = str_replace("<br />", "", $input_value);
}
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
$new_error_text = $defender->getErrorText($input_name);
if (!empty($new_error_text)) {
$options['error_text'] = $new_error_text;
}
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
$html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . $options['class'] . "' " . ($options['inline'] && $options['width'] && !$label ? "style='width: " . $options['width'] . " !important;'" : '') . ">\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0" : '') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == 1 ? "<span class='required'>*</span>" : '') . " " . ($options['tip'] ? "<i class='pointer fa fa-question-circle' title='" . $options['tip'] . "'></i>" : '') . "</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 " . ($label ? "col-sm-9 col-md-9 col-lg-9 p-r-0" : "col-sm-12 p-l-0") . "'>\n" : "";
$tab_active = 0;
$tab_title = array();
if ($options['preview'] && ($options['type'] == "html" || $options['type'] == "bbcode")) {
$tab_title['title'][] = $locale['preview'];
$tab_title['id'][] = "prw-" . $options['input_id'];
$tab_title['icon'][] = '';
$tab_title['title'][] = $locale['texts'];
$tab_title['id'][] = "txt-" . $options['input_id'];
$tab_title['icon'][] = '';
$tab_active = tab_active($tab_title, 1);
$html .= opentab($tab_title, $tab_active, $options['input_id'] . "-link", "", "editor-wrapper");
$html .= opentabbody($tab_title['title'][1], "txt-" . $options['input_id'], $tab_active);
}
$html .= $options['type'] == "html" || $options['type'] == "bbcode" ? "<div class='panel panel-default panel-txtarea m-b-0' " . ($options['preview'] ? "style='border-top:0 !important; border-radius:0 !important;'" : '') . ">\n<div class='panel-heading clearfix' style='padding-bottom:0 !important;'>\n" : '';
if ($options['type'] == "bbcode" && $options['form_name']) {
//.........这里部分代码省略.........
示例9: dbcount
include INCLUDES . "rewrites/" . $rewrite_name . "_rewrite_info.php";
}
$rows = dbcount("(rewrite_id)", DB_PERMALINK_REWRITE, "rewrite_name='" . $rewrite_name . "'");
if ($rows > 0) {
$result = dbquery("SELECT p.* FROM " . DB_PERMALINK_REWRITE . " r\n INNER JOIN " . DB_PERMALINK_METHOD . " p ON r.rewrite_id=p.pattern_type\n WHERE r.rewrite_name='" . $rewrite_name . "'");
if (dbrows($result) > 0) {
while ($data = dbarray($result)) {
$driver[] = $data;
}
$edit_name = sprintf($locale['405'], $permalink_name);
} else {
addNotice("danger", sprintf($locale['422'], $permalink_name));
redirect(FUSION_SELF . $aidlink);
}
} else {
addNotice('danger', $locale['423']);
redirect(FUSION_SELF . $aidlink);
}
} else {
$result = dbquery("SELECT * FROM " . DB_PERMALINK_REWRITE . " ORDER BY rewrite_name ASC");
if (dbrows($result)) {
while ($data = dbarray($result)) {
$permalink[] = $data;
$enabled_rewrites[] = $data['rewrite_name'];
}
}
}
$tab['title'][] = $edit_name == TRUE ? $edit_name : $locale['400'];
$tab['id'][] = $default_section;
$tab['icon'][] = "";
$tab['title'][] = $locale['401'];
示例10: __construct
//.........这里部分代码省略.........
$qr_form .= form_checkbox('notify_me', $locale['forum_0171'], $thread_data['user_tracked'], array('class' => 'm-b-0'));
}
$qr_form .= "</div>\n";
$qr_form .= closeform();
}
/**
* Generate Poll Form
*/
$poll = array();
$poll_form = "";
if ($this->getThreadPermission("can_access") && $thread_data['thread_poll'] == TRUE) {
$poll_result = dbquery("SELECT\n\t\t\t\tpoll_opts.*, poll.forum_poll_title, poll.forum_poll_votes\n\t\t\t\tFROM " . DB_FORUM_POLL_OPTIONS . " poll_opts\n\t\t\t\tINNER JOIN " . DB_FORUM_POLLS . " poll using (thread_id)\n\t\t\t\tWHERE poll.thread_id='" . intval($thread_data['thread_id']) . "'\n\t\t\t\t");
if (dbrows($poll_result) > 0) {
$i = 0;
// Construct poll data - model
while ($pdata = dbarray($poll_result)) {
if ($i == 0) {
$poll['forum_poll_title'] = $pdata['forum_poll_title'];
$poll['forum_poll_votes'] = $pdata['forum_poll_votes'];
$poll['forum_poll_max_options'] = dbrows($poll_result);
}
$poll['forum_poll_options'][$pdata['forum_poll_option_id']] = $pdata;
$i++;
}
// SQL cast poll vote
if (isset($_POST['poll_option']) && isnum($_POST['poll_option']) && $_POST['poll_option'] <= $poll['forum_poll_max_options']) {
if ($this->getThreadPermission("can_vote_poll") == TRUE) {
$pollInput['poll_option_id'] = stripinput($_POST['poll_option']);
global $defender;
if ($defender->safe()) {
dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_votes=forum_poll_option_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "' AND forum_poll_option_id='" . intval($pollInput['poll_option_id']) . "'");
dbquery("UPDATE " . DB_FORUM_POLLS . " SET forum_poll_votes=forum_poll_votes+1 WHERE thread_id='" . intval($thread_data['thread_id']) . "'");
dbquery("INSERT INTO " . DB_FORUM_POLL_VOTERS . " (thread_id, forum_vote_user_id, forum_vote_user_ip, forum_vote_user_ip_type) VALUES ('" . $thread_data['thread_id'] . "', '" . $userdata['user_id'] . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
addNotice('success', $locale['forum_0614']);
redirect(INFUSIONS . "forum/viewthread.php?forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']);
} else {
addNotice("danger", "You are not eligible to cast a vote in the poll.");
}
}
}
$poll_form_start = "";
$poll_form_end = "";
if ($this->getThreadPermission("can_vote_poll")) {
$poll_form_start = openform("poll_vote_form", "post", INFUSIONS . "forum/viewthread.php?thread_id=" . $thread_data['thread_id']);
$poll_form_end = form_button('vote', $locale['forum_2010'], 'vote', array('class' => 'btn btn-sm btn-primary m-l-20 '));
$poll_form_end .= closeform();
}
// need to fix security.
if ($this->getThreadPermission("can_edit_poll")) {
$poll_form .= "<div class='pull-right btn-group'>\n";
$poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=editpoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "'>" . $locale['forum_0603'] . "</a>\n";
$poll_form .= "<a class='btn btn-sm btn-default' href='" . INFUSIONS . "forum/viewthread.php?action=deletepoll&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "' onclick='confirm('" . $locale['forum_0616'] . "');'>" . $locale['delete'] . "</a>\n";
$poll_form .= "</div>\n";
}
$poll_form .= $poll_form_start;
$poll_form .= "<h3 class='strong m-b-10'><i class='fa fa-fw fa-pie-chart fa-lg'></i>" . $locale['forum_0377'] . " : " . $poll['forum_poll_title'] . "</h3>\n";
$poll_form .= "<ul class='p-l-20 p-t-0'>\n";
if (!empty($poll['forum_poll_options'])) {
$i = 1;
$vote_options = $poll['forum_poll_options'];
foreach ($vote_options as $poll_option) {
if ($this->getThreadPermission("can_vote_poll") == TRUE) {
$poll_form .= "<li><label for='opt-" . $i . "'><input id='opt-" . $i . "' type='radio' name='poll_option' value='" . $i . "' class='m-r-20'> <span class='m-l-10'>" . $poll_option['forum_poll_option_text'] . "</span>\n</label></li>\n";
} else {
$option_votes = $poll['forum_poll_votes'] ? number_format(100 / $poll['forum_poll_votes'] * $poll_option['forum_poll_option_votes']) : 0;
$poll_form .= progress_bar($option_votes, $poll_option['forum_poll_option_text'], '', '10px');
示例11: author
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
pageAccess("S8");
if (isset($_POST['savesettings'])) {
$error = 0;
$inputArray = array("article_pagination" => form_sanitizer($_POST['article_pagination'], 0, "article_pagination"), "article_allow_submission" => form_sanitizer($_POST['article_allow_submission'], 0, "article_allow_submission"), "article_extended_required" => isset($_POST['article_extended_required']) ? 1 : 0);
if (defender::safe()) {
foreach ($inputArray as $settings_name => $settings_value) {
$inputSettings = array("settings_name" => $settings_name, "settings_value" => $settings_value, "settings_inf" => "article");
dbquery_insert(DB_SETTINGS_INF, $inputSettings, "update", array("primary_key" => "settings_name"));
}
addNotice("success", $locale['900']);
redirect(FUSION_REQUEST);
} else {
addNotice('danger', $locale['901']);
}
}
echo "<div class='well'>" . $locale['articles_0031'] . "</div>";
echo openform('settingsform', 'post', FUSION_REQUEST);
openside('');
echo form_text("article_pagination", $locale['articles_0032'], $article_settings['article_pagination'], array("inline" => TRUE, "max_length" => 4, "width" => "150px", "type" => "number"));
echo form_select("article_allow_submission", $locale['articles_0033'], $article_settings['article_allow_submission'], array("inline" => TRUE, "options" => array($locale['disable'], $locale['enable'])));
echo form_checkbox("article_extended_required", $locale['articles_0034'], $article_settings['article_extended_required'], array("inline" => TRUE));
closeside();
echo form_button('savesettings', $locale['750'], $locale['750'], array('class' => 'btn-primary'));
echo closeform();
示例12: dbquery
$result = dbquery("\n\t\t\tSELECT ts.submit_id, ts.submit_datestamp, ts.submit_criteria\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tWHERE submit_type='d' and submit_id='" . intval($_GET['submit_id']) . "'\n\t\t");
if (dbrows($result) > 0) {
$callback_data = dbarray($result);
// delete all the relevant files
$delCriteria = unserialize($callback_data['submit_criteria']);
if (!empty($delCriteria['download_image']) && file_exists(INFUSIONS . "downloads/submisisons/images/" . $delCriteria['download_image'])) {
unlink(INFUSIONS . "downloads/submisisons/images/" . $delCriteria['download_image']);
}
if (!empty($delCriteria['download_image_thumb']) && file_exists(INFUSIONS . "downloads/submisisons/images/" . $delCriteria['download_image_thumb'])) {
unlink(INFUSIONS . "downloads/submisisons/images/" . $delCriteria['download_image_thumb']);
}
if (!empty($delCriteria['download_file']) && file_exists(INFUSIONS . "downloads/submisisons/images/" . $delCriteria['download_file'])) {
unlink(INFUSIONS . "downloads/submisisons/" . $delCriteria['download_file']);
}
$result = dbquery("DELETE FROM " . DB_SUBMISSIONS . " WHERE submit_id='" . intval($callback_data['submit_id']) . "'");
addNotice("success", $locale['download_0062']);
}
redirect(clean_request("", array("submit_id"), FALSE));
} else {
$result = dbquery("SELECT ts.submit_id,\n\t\t\tts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status\n\t\t\tFROM " . DB_SUBMISSIONS . " ts\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ts.submit_user=tu.user_id\n\t\t\tWHERE submit_type='d' order by submit_datestamp desc");
if (dbrows($result) > 0) {
$data = dbarray($result);
$submit_criteria = unserialize($data['submit_criteria']);
$callback_data = array("download_title" => $submit_criteria['download_title'], "download_keywords" => $submit_criteria['download_keywords'], "download_description" => $submit_criteria['download_description'], "download_description_short" => $submit_criteria['download_description_short'], "download_cat" => $submit_criteria['download_cat'], "download_homepage" => $submit_criteria['download_homepage'], "download_license" => $submit_criteria['download_license'], "download_copyright" => $submit_criteria['download_copyright'], "download_os" => $submit_criteria['download_os'], "download_version" => $submit_criteria['download_version'], "download_file" => $submit_criteria['download_file'], "download_url" => $submit_criteria['download_url'], "download_filesize" => $submit_criteria['download_file'] ? $submit_criteria['download_filesize'] : 0, "download_image" => $submit_criteria['download_image'], "download_image_thumb" => $submit_criteria['download_image_thumb'], "download_id" => 0, "download_allow_comments" => TRUE, "download_allow_ratings" => TRUE, "download_visibility" => iGUEST, "download_datestamp" => $data['submit_datestamp']);
add_to_title($locale['global_200'] . $locale['503'] . $locale['global_201'] . $callback_data['download_title'] . "?");
echo openform("publish_download", "post", FUSION_REQUEST);
echo "<div class='well clearfix'>\n";
echo "<div class='pull-left'>\n";
echo display_avatar($callback_data, "30px", "", "", "");
echo "</div>\n";
echo "<div class='overflow-hide'>\n";
示例13: dbquery
if (isset($_GET['action']) && $_GET['action'] == "delete" && (isset($_GET['weblink_id']) && isnum($_GET['weblink_id']))) {
$result = dbquery("DELETE FROM " . DB_WEBLINKS . " WHERE weblink_id='" . $_GET['weblink_id'] . "'");
addNotice("success", $locale['wl_0302']);
redirect(FUSION_SELF . $aidlink);
}
if (isset($_POST['save_link'])) {
$data = array("weblink_id" => form_sanitizer($_POST['weblink_id'], 0, 'weblink_id'), "weblink_cat" => form_sanitizer($_POST['weblink_cat'], 0, 'weblink_cat'), "weblink_name" => form_sanitizer($_POST['weblink_name'], '', 'weblink_name'), "weblink_description" => form_sanitizer($_POST['weblink_description'], '', 'weblink_description'), "weblink_visibility" => form_sanitizer($_POST['weblink_visibility'], '0', 'weblink_visibility'), "weblink_url" => form_sanitizer($_POST['weblink_url'], '', 'weblink_url'), "weblink_datestamp" => form_sanitizer($_POST['weblink_datestamp'], '', 'weblink_datestamp'));
if (defender::safe()) {
if (dbcount("(weblink_id)", DB_WEBLINKS, "weblink_id='" . intval($data['weblink_id']) . "'")) {
$data['weblink_datestamp'] = isset($_POST['update_datestamp']) ? time() : $data['weblink_datestamp'];
dbquery_insert(DB_WEBLINKS, $data, "update");
addNotice("success", $locale['wl_0301']);
redirect(FUSION_SELF . $aidlink);
} else {
dbquery_insert(DB_WEBLINKS, $data, "save");
addNotice("success", $locale['wl_0300']);
redirect(FUSION_SELF . $aidlink);
}
}
}
if ($weblink_edit) {
$result = dbquery("SELECT * FROM " . DB_WEBLINKS . " WHERE weblink_id='" . intval($_GET['weblink_id']) . "'");
if (dbrows($result)) {
$data = dbarray($result);
} else {
redirect(FUSION_SELF . $aidlink);
}
}
echo openform('inputform', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-8'>\n";
示例14: form_fileinput
function form_fileinput($input_name, $label = '', $input_value = FALSE, array $options = array())
{
global $locale, $defender;
$title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
$input_name = isset($input_name) && !empty($input_name) ? stripinput($input_name) : "";
$template_choices = array('classic', 'modern', 'thumbnail');
$default_options = array("input_id" => $input_name, "upload_path" => IMAGES, "required" => FALSE, "safemode" => FALSE, "deactivate" => FALSE, "preview_off" => FALSE, "type" => "image", "width" => "100%", "label" => $locale['browse'], "inline" => TRUE, "class" => "", "tip" => "", "ext_tip" => "", "error_text" => $locale['error_input_file'], "btn_class" => "btn-default", "icon" => "fa fa-upload", "jsonurl" => FALSE, "valid_ext" => ".jpg,.png,.PNG,.JPG,.JPEG,.gif,.GIF,.bmp,.BMP", "thumbnail" => FALSE, "thumbnail_w" => 300, "thumbnail_h" => 300, "thumbnail_folder" => "", "thumbnail_suffix" => "_t1", "thumbnail2" => FALSE, "thumbnail2_w" => 600, "thumbnail2_h" => 400, "thumbnail2_suffix" => "_t2", "delete_original" => FALSE, "max_width" => 1800, "max_height" => 1600, "max_byte" => 1500000, "max_count" => 1, "multiple" => FALSE, "template" => "classic");
$options += $default_options;
if (!is_dir($options['upload_path'])) {
$options['upload_path'] = IMAGES;
}
$options['thumbnail_folder'] = rtrim($options['thumbnail_folder'], "/");
if (!in_array($options['template'], $template_choices)) {
$options['template'] = "classic";
}
$options['input_id'] = trim($options['input_id'], "[]");
$error_class = "";
if ($defender->inputHasError($input_name)) {
$error_class = "has-error ";
if (!empty($options['error_text'])) {
addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']);
}
}
// default max file size
$format = '';
$browseLabel = $locale['df_300'];
// file type if single filter, if not will accept as object if left empty.
$type_for_js = NULL;
if ($options['type']) {
if (!stristr($options['type'], ',') && $options['type']) {
if ($options['type'] == 'image') {
$format = "image/*";
$browseLabel = $locale['df_301'];
} elseif ($options['type'] == 'video') {
$format = "video/*";
$browseLabel = $locale['df_302'];
} elseif ($options['type'] == 'audio') {
$format = "audio/*";
$browseLabel = $locale['df_303'];
}
}
$type_for_js = json_encode((array) $options['type']);
}
$value = '';
if (!empty($input_value)) {
if (is_array($input_value)) {
foreach ($input_value as $value) {
$value[] = "<img class='img-responsive' src='" . $value . "/>";
}
} else {
$value = "<img class='img-responsive' src='" . $input_value . "'/>";
}
$value = json_encode($value);
}
if (!defined('form_fileinput')) {
add_to_head("<link href='" . DYNAMICS . "assets/fileinput/css/fileinput.min.css' media='all' rel='stylesheet' type='text/css' />");
add_to_footer("<script src='" . DYNAMICS . "assets/fileinput/js/fileinput.min.js' type='text/javascript'></script>");
define('form_fileinput', TRUE);
}
$html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . $options['class'] . "' " . ($options['width'] && !$label ? "style='width: " . $options['width'] . " !important;'" : '') . ">\n";
$html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0" : '') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] ? "<span class='required'>*</span>" : '') . "\n\t" . ($options['tip'] ? "<i class='pointer fa fa-question-circle' title='" . $options['tip'] . "'></i>" : '') . "\n\t</label>\n" : '';
$html .= $options['inline'] ? "<div class='col-xs-12 " . ($label ? "col-sm-9 col-md-9 col-lg-9" : "col-sm-12") . "'>\n" : "";
$html .= "<input type='file' " . ($format ? "accept='" . $format . "'" : '') . " name='" . $input_name . "' id='" . $options['input_id'] . "' style='width:" . $options['width'] . "' " . ($options['deactivate'] ? 'readonly' : '') . " " . ($options['multiple'] ? "multiple='1'" : '') . " />\n";
$html .= $options['ext_tip'] ? "<br/>\n<span class='tip'><i>" . $options['ext_tip'] . "</i></span>" : "";
$html .= $options['required'] == 1 && $defender->inputHasError($input_name) || $defender->inputHasError($input_name) ? "<div id='" . $options['input_id'] . "-help' class='label label-danger p-5 display-inline-block'>" . $options['error_text'] . "</div>" : "";
$html .= $options['inline'] ? "</div>\n" : "";
$html .= "</div>\n";
$defender->add_field_session(array('input_name' => trim($input_name, '[]'), 'type' => (array) $options['type'] == array('image') ? 'image' : 'file', 'title' => $title, 'id' => $options['input_id'], 'required' => $options['required'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text'], 'path' => $options['upload_path'], 'thumbnail_folder' => $options['thumbnail_folder'], 'thumbnail' => $options['thumbnail'], 'thumbnail_suffix' => $options['thumbnail_suffix'], 'thumbnail_w' => $options['thumbnail_w'], 'thumbnail_h' => $options['thumbnail_h'], 'thumbnail2' => $options['thumbnail2'], 'thumbnail2_w' => $options['thumbnail2_w'], 'thumbnail2_h' => $options['thumbnail2_h'], 'thumbnail2_suffix' => $options['thumbnail2_suffix'], 'delete_original' => $options['delete_original'], 'max_width' => $options['max_width'], 'max_height' => $options['max_height'], 'max_count' => $options['max_count'], 'max_byte' => $options['max_byte'], 'multiple' => $options['multiple'], 'valid_ext' => $options['valid_ext']));
switch ($options['template']) {
case "classic":
add_to_jquery("\n \$('#" . $options['input_id'] . "').fileinput({\n allowedFileTypes: " . $type_for_js . ",\n allowedPreviewTypes : " . $type_for_js . ",\n " . ($value ? "initialPreview: " . $value . ", " : '') . "\n " . ($options['preview_off'] ? "showPreview: false, " : '') . "\n browseClass: 'btn " . $options['btn_class'] . " button',\n uploadClass: 'btn btn-default button',\n captionClass : '',\n removeClass : 'btn btn-default button',\n browseLabel: '" . $browseLabel . "',\n browseIcon: '<i class=\"" . $options['icon'] . " m-r-10\"></i>',\n " . ($options['jsonurl'] ? "uploadUrl : '" . $options['url'] . "'," : '') . "\n " . ($options['jsonurl'] ? '' : 'showUpload: false') . "\n });\n ");
break;
case "modern":
add_to_jquery("\n \$('#" . $options['input_id'] . "').fileinput({\n allowedFileTypes: " . $type_for_js . ",\n allowedPreviewTypes : " . $type_for_js . ",\n " . ($value ? "initialPreview: " . $value . ", " : '') . "\n " . ($options['preview_off'] ? "showPreview: false, " : '') . "\n browseClass: 'btn btn-modal',\n uploadClass: 'btn btn-modal',\n captionClass : '',\n removeClass : 'btn button',\n browseLabel: '" . $browseLabel . "',\n browseIcon: '<i class=\"fa fa-plus m-r-10\"></i>',\n showCaption: false,\n showRemove: false,\n showUpload: false,\n layoutTemplates: {\n main2: '<div class=\"btn-photo-upload btn-link\">'+' {browse}'+' </div></span></div> {preview}',\n },\n });\n ");
break;
case "thumbnail":
add_to_jquery("\n \$('#" . $options['input_id'] . "').fileinput({\n allowedFileTypes: " . $type_for_js . ",\n allowedPreviewTypes : " . $type_for_js . ",\n " . ($value ? "initialPreview: " . $value . ", " : '') . "\n " . ($options['preview_off'] ? "showPreview: false, " : '') . "\n defaultPreviewContent: '<img class=\"img-responsive\" src=\"" . IMAGES . "no_photo.png\" alt=\"" . $browseLabel . "\" style=\"width:100%;\">',\n browseClass: 'btn btn-sm btn-block btn-default',\n uploadClass: 'btn btn-modal',\n captionClass : '',\n removeClass : 'btn button',\n browseLabel: '" . $browseLabel . "',\n browseIcon: '<i class=\"fa fa-plus m-r-10\"></i>',\n showCaption: false,\n showRemove: false,\n showUpload: false,\n layoutTemplates: {\n main2: '<div class=\"panel panel-default\">'+'{preview}'+'<div class=\"panel-body\">'+' {browse}'+'</div></div>',\n },\n });\n ");
break;
}
return $html;
}
示例15: verifyCode
public function verifyCode($value)
{
global $locale, $userdata;
if (!preg_check("/^[0-9a-z]{32}\$/i", $value)) {
redirect("index.php");
}
$result = dbquery("SELECT * FROM " . DB_EMAIL_VERIFY . " WHERE user_code='" . $value . "'");
if (dbrows($result)) {
$data = dbarray($result);
if ($data['user_id'] == $userdata['user_id']) {
if ($data['user_email'] != $userdata['user_email']) {
$result = dbquery("SELECT user_email FROM " . DB_USERS . " WHERE user_email='" . $data['user_email'] . "'");
if (dbrows($result) > 0) {
addNotice("danger", $locale['u164'] . "<br />\n" . $locale['u121']);
} else {
$this->_completeMessage = $locale['u169'];
}
$result = dbquery("UPDATE " . DB_USERS . " SET user_email='" . $data['user_email'] . "' WHERE user_id='" . $data['user_id'] . "'");
$result = dbquery("DELETE FROM " . DB_EMAIL_VERIFY . " WHERE user_id='" . $data['user_id'] . "'");
}
} else {
redirect("index.php");
}
} else {
redirect("index.php");
}
}