本文整理汇总了PHP中clean_slweg函数的典型用法代码示例。如果您正苦于以下问题:PHP clean_slweg函数的具体用法?PHP clean_slweg怎么用?PHP clean_slweg使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clean_slweg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace_glossary_tag
function replace_glossary_tag($matches)
{
global $content;
$inner = trim($matches[2]);
// search keyword in glossary table
$keyword = trim($matches[1]);
if ($keyword !== '') {
$keyword = html_entity_decode($keyword, ENT_QUOTES, PHPWCMS_CHARSET);
// check against cache
if (!isset($content['glossary_cache'][$keyword])) {
$like = aporeplace($keyword);
$where = 'glossary_status=1 AND glossary_highlight=1 AND (';
$where .= "glossary_keyword LIKE '" . $like . "' OR ";
$where .= "glossary_keyword LIKE '" . $like . ",%' OR ";
$where .= "glossary_keyword LIKE '%, " . $like . ",%' OR ";
$where .= "glossary_keyword LIKE '%, " . $like . "'";
$where .= ')';
// retrieve only single keyword that matches best
$entry = _dbGet('phpwcms_glossary', 'glossary_title, glossary_keyword, glossary_text, COUNT(glossary_id) AS count_all', $where, 'glossary_id', 'count_all DESC', '1');
if (isset($entry[0])) {
// get keywords to store each in cache
$keywords = convertStringToArray($entry[0]['glossary_keyword']);
$title = empty($entry[0]['glossary_title']) ? $inner : html($entry[0]['glossary_title']);
$text = trim(clean_slweg($entry[0]['glossary_text']));
// store glossary item in cache
foreach ($keywords as $key) {
$content['glossary_cache'][$key] = array('title' => $title, 'text' => $text);
}
}
}
// create ABBR
if (isset($content['glossary_cache'][$keyword])) {
$inner = '<abbr class="glossary" title="' . $content['glossary_cache'][$keyword]['title'] . ' :: ' . $content['glossary_cache'][$keyword]['text'] . '">' . $inner . '</abbr>';
}
}
return $inner;
}
示例2: headerRedirect
require PHPWCMS_ROOT . '/include/inc_lib/dbcon.inc.php';
require PHPWCMS_ROOT . '/include/inc_lib/general.inc.php';
require PHPWCMS_ROOT . '/include/inc_lib/backend.functions.inc.php';
if (empty($_SESSION["wcs_user"])) {
headerRedirect('', 401);
die('Sorry, access forbidden');
}
if (isset($_POST['action'])) {
$action = isset($_POST['action']) ? $_POST['action'] : false;
$method = isset($_POST['method']) ? $_POST['method'] : 'json';
$value = isset($_POST['value']) ? clean_slweg($_POST['value'], 0, false) : '';
$jquery = false;
} elseif ($_GET['action']) {
$action = isset($_GET['action']) ? $_GET['action'] : false;
$method = isset($_GET['method']) ? $_GET['method'] : 'json';
$value = isset($_GET['value']) ? clean_slweg($_GET['value'], 0, false) : '';
$jquery = true;
}
if (empty($value)) {
$action = 'empty';
}
// do charset conversions for value
if (PHPWCMS_CHARSET != 'utf-8') {
$value = @mb_convert_encoding($value, PHPWCMS_CHARSET, 'utf-8');
}
$data = array();
switch ($action) {
case 'category':
$where = "cat_status=1 AND cat_type NOT IN('module_shop') AND ";
$where .= "cat_name LIKE '%" . _dbEscape(preg_replace('/[^\\w\\- ]/', '', $value), false) . "%'";
$result = _dbGet('phpwcms_categories', 'cat_name', $where, 'cat_name', 'cat_name', 20);
示例3: session_start
<?php
/**
* phpwcms content management system
*
* @author Oliver Georgi <og@phpwcms.org>
* @copyright Copyright (c) 2002-2015, Oliver Georgi
* @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
* @link http://www.phpwcms.de
*
**/
session_start();
$phpwcms = array();
require_once '../../include/config/conf.inc.php';
require_once '../inc_lib/default.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/helper.session.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/dbcon.inc.php';
require_once PHPWCMS_ROOT . '/include/inc_lib/general.inc.php';
checkLogin();
validate_csrf_tokens();
require_once PHPWCMS_ROOT . '/include/inc_lib/backend.functions.inc.php';
$chat_message = clean_slweg(trim($_POST['chatmsg']));
$chatlist = intval($_POST['chatlist']);
if ($chat_message) {
$sql = "INSERT INTO " . DB_PREPEND . "phpwcms_chat (chat_uid, chat_name, chat_text, chat_cat) ";
$sql .= "VALUES (" . $_SESSION['wcs_user_id'] . "," . _dbEscape($_SESSION['wcs_user']) . "," . _dbEscape($chat_message) . ",0)";
_dbQuery($sql, 'INSERT');
}
headerRedirect(PHPWCMS_URL . 'phpwcms.php?' . get_token_get_string('csrftoken') . '&do=chat&p=1&l=' . $chatlist . '&' . get_token_get_string('csrftoken'));
示例4: die
/**
* phpwcms content management system
*
* @author Oliver Georgi <og@phpwcms.org>
* @copyright Copyright (c) 2002-2015, Oliver Georgi
* @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
* @link http://www.phpwcms.de
*
**/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
$_userInfo['delimeter'] = clean_slweg($_POST['delimeter']);
if (empty($_userInfo['delimeter'])) {
$_userInfo['delimeter'] = ';';
}
$_userInfo['subscribe_active'] = empty($_POST['subscribe_active']) ? 0 : 1;
$_userInfo['subscribe_all'] = empty($_POST['subscribe_all']) ? 0 : 1;
if (isset($_POST['subscribe_select']) && is_array($_POST['subscribe_select'])) {
$_userInfo['subscribe_select'] = $_POST['subscribe_select'];
} else {
$_userInfo['subscribe_select'] = array();
$_userInfo['subscribe_all'] = 1;
}
// check uploaded FILE
if (getimagesize($_FILES['cvsfile']['tmp_name'])) {
$_userInfo['csvError'] = 'False MIME TYPE. Be sure to upload CSV file only.';
} elseif (is_uploaded_file($_FILES['cvsfile']['tmp_name']) && !$_FILES['cvsfile']['error']) {
示例5: empty
$content["media_transparent"] = empty($_POST["cmedia_transparent"]) ? 0 : 1;
$content["media_control"] = empty($_POST["cmedia_control"]) ? 0 : 1;
$content["media_pos"] = intval($_POST["cimage_pos"]);
$content["media_width"] = intval($_POST["cmedia_width"]);
$content["media_width"] = $content["media_width"] ? $content["media_width"] : '';
$content["media_height"] = intval($_POST["cmedia_height"]);
$content["media_height"] = $content["media_height"] ? $content["media_height"] : '';
$content["media_id"] = intval($_POST["cmedia_id"]);
$content["media_name"] = clean_slweg($_POST["cmedia_name"]);
$content["media_extern"] = clean_slweg($_POST["cmedia_extern"]);
$content["image_name"] = clean_slweg($_POST["cimage_name"]);
$content["image_id"] = empty($_POST["cimage_id"]) ? '' : intval($_POST["cimage_id"]);
$content["image_caption"] = clean_slweg($_POST["cimage_caption"]);
$content['media'] = array();
$content['media']["media_type"] = $content["media_type"];
$content['media']["media_player"] = $content["media_player"];
$content['media']["media_src"] = $content["media_src"];
$content['media']["media_auto"] = $content["media_auto"];
$content['media']["media_transparent"] = $content["media_transparent"];
$content['media']["media_control"] = $content["media_control"];
$content['media']["media_pos"] = $content["media_pos"];
$content['media']["media_width"] = $content["media_width"];
$content['media']["media_height"] = $content["media_height"];
$content['media']["media_id"] = $content["media_id"];
$content['media']["media_name"] = $content["media_name"];
$content['media']["media_extern"] = $content["media_extern"];
$content['media']["image_name"] = $content["image_name"];
$content['media']["image_id"] = $content["image_id"];
$content['media']["image_caption"] = $content["image_caption"];
$content["template"] = clean_slweg($_POST['template']);
示例6: set_time_limit
$file_tags = '';
$file_granted = 0;
$file_gallerydownload = 0;
$file_sort = 0;
//Auswerten des Formulars
if (isset($_POST["file_aktion"]) && intval($_POST["file_aktion"]) == 1) {
if (!ini_get('safe_mode') && function_exists('set_time_limit')) {
set_time_limit(0);
}
$file_pid = intval($_POST["file_pid"]);
$file_aktiv = empty($_POST["file_aktiv"]) ? 0 : 1;
$file_public = empty($_POST["file_public"]) ? 0 : 1;
$file_shortinfo = clean_slweg($_POST["file_shortinfo"]);
$file_longinfo = slweg(trim($_POST["file_longinfo"]));
$file_copyright = clean_slweg($_POST["file_copyright"]);
$file_tags = trim(clean_slweg($_POST["file_tags"]), ',');
$file_granted = empty($_POST["file_granted"]) ? 0 : 1;
$file_gallerydownload = empty($_POST["file_gallerydownload"]) ? 0 : 1;
$file_keys = '';
$file_sort = intval($_POST["file_sort"]);
if (count($phpwcms['allowed_lang']) > 1) {
$file_vars = array();
foreach ($phpwcms['allowed_lang'] as $lang) {
$lang = strtolower($lang);
if (isset($_POST['file_longinfo_' . $lang])) {
$file_vars[$lang]['longinfo'] = slweg($_POST['file_longinfo_' . $lang]);
}
if (isset($_POST['file_copyright_' . $lang])) {
$file_vars[$lang]['copyright'] = slweg($_POST['file_copyright_' . $lang]);
}
}
示例7: trim
$_SESSION['list_user_count'] = trim($_GET['c']) == 'all' ? '99999' : intval($_GET['c']);
}
if (isset($_GET['page'])) {
$_SESSION['subscriber_page'] = intval($_GET['page']);
}
// set default values for paginating
if (empty($_SESSION['list_user_count'])) {
$_SESSION['list_user_count'] = 25;
}
// get filter and paginating form values
if (isset($_POST['do_pagination'])) {
$_SESSION['list_active'] = empty($_POST['showactive']) ? 0 : 1;
$_SESSION['list_inactive'] = empty($_POST['showinactive']) ? 0 : 1;
$_SESSION['list_channel'] = empty($_POST['showchannel']) ? 0 : 1;
$_SESSION['subscriber_page'] = intval($_POST['page']);
$_SESSION['filter_subscriber'] = clean_slweg($_POST['filter']);
if (empty($_SESSION['filter_subscriber'])) {
unset($_SESSION['filter_subscriber']);
} else {
$_SESSION['filter_subscriber'] = convertStringToArray($_SESSION['filter_subscriber'], ' ');
}
}
if (empty($_SESSION['subscriber_page'])) {
$_SESSION['subscriber_page'] = 1;
}
// default settings for listing selected users
$_userInfo['list_active'] = isset($_SESSION['list_active']) ? $_SESSION['list_active'] : 1;
$_userInfo['list_inactive'] = isset($_SESSION['list_inactive']) ? $_SESSION['list_inactive'] : 1;
$_userInfo['list_channel'] = isset($_SESSION['list_channel']) ? $_SESSION['list_channel'] : 0;
if ($_userInfo['list_channel'] && isset($_POST['showchannel'])) {
$_userInfo['channel'] = empty($_POST['subscribe_select']) ? false : $_POST['subscribe_select'];
示例8: die
**/
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
// try
if (isset($_GET['edit'])) {
$glossary['id'] = intval($_GET['edit']);
} else {
$glossary['id'] = 0;
}
// process post form
if (isset($_POST['glossary_title'])) {
$glossary['data'] = array('glossary_id' => intval($_POST['glossary_id']), 'glossary_title' => clean_slweg($_POST['glossary_title']), 'glossary_created' => date('Y-m-d H:i:s'), 'glossary_changed' => date('Y-m-d H:i:s'), 'glossary_tag' => clean_slweg($_POST['glossary_tag']), 'glossary_keyword' => clean_slweg($_POST['glossary_keyword']), 'glossary_text' => slweg($_POST['glossary_text']), 'glossary_object' => array(), 'glossary_status' => empty($_POST['glossary_status']) ? 0 : 1, 'glossary_highlight' => empty($_POST['glossary_highlight']) ? 0 : 1);
if (empty($glossary['data']['glossary_title'])) {
$glossary['error']['glossary_title'] = 1;
}
if (empty($glossary['data']['glossary_keyword'])) {
$glossary['error']['glossary_keyword'] = 1;
} else {
$sql = 'SELECT COUNT(*) FROM ' . DB_PREPEND . "phpwcms_glossary ";
$sql .= "WHERE glossary_keyword LIKE '" . aporeplace($glossary['data']['glossary_keyword']);
$sql .= "' AND glossary_id <> " . $glossary['data']['glossary_id'];
if (_dbQuery($sql, 'COUNT')) {
$glossary['error']['glossary_keyword'] = 1;
}
}
if (!isset($glossary['error'])) {
if ($glossary['data']['glossary_id']) {
示例9: genlogname
// ----------------------------------------------------------------
$new_login = genlogname();
$new_password = generic_string(8);
$new_email = '';
$new_name = '';
$set_user_aktiv = 0;
$set_user_admin = 0;
$set_user_fe = 0;
$send_verification = 1;
$user_err = '';
if (isset($_POST["form_aktion"]) && $_POST["form_aktion"] == "create_account") {
//Create Account Daten verarbeiten
$new_login = slweg($_POST["form_newloginname"]);
$new_password = slweg($_POST["form_newpassword"]);
$new_email = clean_slweg($_POST["form_newemail"]);
$new_name = clean_slweg($_POST["form_newrealname"]);
$set_user_aktiv = isset($_POST["form_active"]) ? 1 : 0;
$set_user_admin = isset($_POST["form_admin"]) ? 1 : 0;
$set_user_fe = isset($_POST["form_feuser"]) ? intval($_POST["form_feuser"]) : 0;
if ($set_user_admin) {
$set_user_fe = 2;
}
$send_verification = isset($_POST["verification_email"]) ? 1 : 0;
if (isEmpty($new_login)) {
$user_err = $BL['be_admin_usr_err2'] . "\n";
} else {
$sql = "SELECT COUNT(*) AS anzahl FROM " . DB_PREPEND . "phpwcms_user WHERE usr_login='" . aporeplace($new_login) . "'";
if ($result = mysql_query($sql, $db)) {
if ($check_anzahl = mysql_fetch_array($result)) {
if ($check_anzahl["anzahl"]) {
$user_err .= $BL['be_admin_usr_err1'] . "\n";
示例10: render_cnt_template
$content['glossary']['detail_entry'] = render_cnt_template($content['glossary']['detail_entry'], 'TITLE', html_specialchars($content['glossary']['entry']['glossary_title']));
$content['glossary']['item'] = $content['glossary']['detail_head'] . $content['glossary']['detail_entry'] . $content['glossary']['detail_footer'];
$content['glossary']['item'] = str_replace('{GLOSSARY_ID}', $content['glossary']['entry']['glossary_id'], $content['glossary']['item']);
$content['glossary']['item'] = str_replace('{BACKLINK}', rel_url(), $content['glossary']['item']);
// fine we will display given glossary ID
$CNT_TMP .= $content['glossary']['item'];
} else {
// get list entries template sections
$content['glossary']['list_head'] = get_tmpl_section('GLOSSARY_LIST_HEAD', $content['glossary']['glossary_template']);
$content['glossary']['list_footer'] = get_tmpl_section('GLOSSARY_LIST_FOOTER', $content['glossary']['glossary_template']);
$content['glossary']['list_entry'] = get_tmpl_section('GLOSSARY_LIST_ENTRY', $content['glossary']['glossary_template']);
$content['glossary']['list_spacer'] = get_tmpl_section('GLOSSARY_LIST_SPACER', $content['glossary']['glossary_template']);
// OK we build filter
$content['glossary']['glossary_alphabet'] = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$content['glossary']['glossary_filter'] = convertStringToArray(strtoupper($content['glossary']['glossary_filter']), ' ');
$content['glossary']['glossary_filter_active'] = empty($GLOBALS['_getVar']['glossary']) ? '' : strtoupper(clean_slweg($GLOBALS['_getVar']['glossary']));
if (in_array($content['glossary']['glossary_filter_active'], $content['glossary']['glossary_filter'])) {
// build SQL query
if (strpos($content['glossary']['glossary_filter_active'], '-')) {
$content['glossary']['filter'] = explode('-', $content['glossary']['glossary_filter_active']);
$content['glossary']['filter'][0] = substr($content['glossary']['filter'][0], 0, 1);
$content['glossary']['filter'][1] = empty($content['glossary']['filter'][1]) ? '?' : substr($content['glossary']['filter'][1], 0, 1);
// is there start and end
if (strpos($content['glossary']['glossary_alphabet'], $content['glossary']['filter'][0]) !== false && strpos($content['glossary']['glossary_alphabet'], $content['glossary']['filter'][1]) !== false) {
$content['glossary']['glossary_alphabet'] = preg_split('//', $content['glossary']['glossary_alphabet'], -1, PREG_SPLIT_NO_EMPTY);
$content['glossary']['filters'] = array();
$content['glossary']['filter_run'] = false;
foreach ($content['glossary']['glossary_alphabet'] as $content['glossary']['char']) {
// OK start here
if ($content['glossary']['char'] == $content['glossary']['filter'][0]) {
$content['glossary']['filter_run'] = true;
示例11: intval
$keyword["id"] = intval($_GET["keyid"]);
if ($keyword["id"]) {
$sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_keyword WHERE keyword_id=" . $keyword["id"] . " LIMIT 1;";
if ($result = mysql_query($sql, $db) or die("error while retrieving keywords")) {
if ($row = mysql_fetch_array($result)) {
$keyword["name"] = $row["keyword_name"];
}
mysql_free_result($result);
}
$sendbutton = $BL['be_admin_fcat_button1'];
} else {
$sendbutton = $BL['be_admin_fcat_button2'];
}
if (isset($_POST["keyword_aktion"]) && intval($_POST["keyword_aktion"])) {
// show form for editing keywords
$keyword["name"] = clean_slweg($_POST["keyword_name"], 250);
$keyword["id"] = intval($_POST["keyword_id"]);
$keyword["name"] = str_replace(';', ' ', $keyword["name"]);
$keyword["name"] = str_replace(',', ' ', $keyword["name"]);
$keyword["name"] = preg_replace('/\\s{1,}/', ' ', $keyword["name"]);
if (empty($keyword["name"])) {
$keyword["error"] = 1;
} else {
if (!$keyword["id"]) {
$sql = "INSERT INTO " . DB_PREPEND . "phpwcms_keyword SET ";
$sql .= "keyword_name = '" . aporeplace($keyword["name"]) . "'";
} else {
$sql = "UPDATE " . DB_PREPEND . "phpwcms_keyword SET ";
$sql .= "keyword_name='" . aporeplace($keyword["name"]);
$sql .= "' WHERE keyword_id=" . $keyword["id"];
}
示例12: jsOnDomReady
// set OnLoad (DomReady) JavaScript
if (count($block['js_ondomready'])) {
jsOnDomReady(implode(LF, $block['js_ondomready']));
}
// set OnUnLoad JavaScript
if (count($block['js_onunload'])) {
jsOnUnLoad(implode(LF, $block['js_onunload']));
}
// set Inline JS
if (count($block['js_inline'])) {
$block['custom_htmlhead']['inline'] = ' <script' . SCRIPT_ATTRIBUTE_TYPE . '>' . LF . SCRIPT_CDATA_START . LF;
$block['custom_htmlhead']['inline'] .= implode(LF, $block['js_inline']);
$block['custom_htmlhead']['inline'] .= LF . SCRIPT_CDATA_END . LF . ' </script>';
}
if (!empty($_GET['highlight'])) {
$highlight_words = explode(' ', clean_slweg(rawurldecode($_GET['highlight'])));
$content['all'] = preg_replace_callback("/<!--SEARCH_HIGHLIGHT_START\\/\\/-->(.*?)<!--SEARCH_HIGHLIGHT_END\\/\\/-->/si", "pregReplaceHighlightWrapper", $content['all']);
}
$content['all'] = str_replace(array('<!--SEARCH_HIGHLIGHT_START//-->', '<!--SEARCH_HIGHLIGHT_END//-->'), '', $content['all']);
// render content part pagination
if (!empty($_CpPaginate)) {
$content['all'] = str_replace(array('<!--CP_PAGINATE_START//-->', '<!--CP_PAGINATE_END//-->'), '', $content['all']);
unset($_getVar['aid'], $_getVar['id']);
// first build [1][2][3] paginate pages
if (strpos($content['all'], '{CP_PAGINATE}')) {
$content['CpPaginateNavi'] = array();
foreach ($content['CpPages'] as $key => $value) {
$content['CpPaginateNavi'][$key] = $template_default['attributes']['cp-paginate']['link-prefix'];
$content['CpPaginateNavi'][$key] .= '<a href="' . rel_url(array(), array(), $key ? 'aid=' . $aktion[1] . '-' . $key : '') . '" class="';
$content['CpPaginateNavi'][$key] .= $key == $content['aId_CpPage'] ? $template_default['classes']['cp-paginate-link'] : $template_default['classes']['cp-paginate-link-active'];
$content['CpPaginateNavi'][$key] .= '">' . $template_default['attributes']['cp-paginate']['value-prefix'] . $value . $template_default['attributes']['cp-paginate']['value-suffix'] . '</a>';
示例13: array
case 'newsletter':
/*
* Newsletter
*/
$form_newletter_setting = array();
$form_newletter_setting['double_optin'] = 0;
$form_value = array();
if ($POST_DO && ($cnt_form["fields"][$key]['required'] || isset($_POST[$POST_name]))) {
if (isset($_POST[$POST_name]) && is_array($_POST[$POST_name])) {
$POST_val[$POST_name] = array_map('combined_POST_cleaning', $_POST[$POST_name]);
$POST_val[$POST_name] = array_diff($POST_val[$POST_name], array(''));
if (!count($POST_val[$POST_name])) {
$POST_val[$POST_name] = false;
}
} else {
$POST_val[$POST_name] = isset($_POST[$POST_name]) ? remove_unsecure_rptags(clean_slweg($_POST[$POST_name])) : false;
}
if ($cnt_form["fields"][$key]['required'] && ($POST_val[$POST_name] === false || $POST_val[$POST_name] == '')) {
$POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
$cnt_form["fields"][$key]['class'] = getFieldErrorClass($value['class'], $cnt_form["error_class"]);
} else {
$cnt_form["fields"][$key]['value'] = str_replace(' checked', '', $cnt_form["fields"][$key]['value']);
}
if (isset($POST_val[$POST_name])) {
$form_newletter_setting['selection'] = $POST_val[$POST_name];
} else {
$form_newletter_setting['selection'] = false;
}
}
// prepare default settings for newsletter field
$form_value_default = convertStringToArray($cnt_form["fields"][$key]['value'], "\n", 'UNIQUE', false);
示例14: mysql_free_result
mysql_free_result($guestbook['result']);
}
}
}
// Captcha check
if (empty($guestbook['captcha'])) {
$guestbook['form'] = replace_tmpl_section('CAPTCHA', $guestbook['form']);
} else {
$guestbook['captcha_maxchar'] = empty($guestbook['captcha_maxchar']) ? 5 : $guestbook['captcha_maxchar'];
$guestbook['form'] = str_replace('{CAPTCHA}', '<img src="img/captcha.php?regen=y&length=' . $guestbook['captcha_maxchar'] . '&' . time() . '" alt="Captcha" id="gbCaptchaImage" />', $guestbook['form']);
}
if (isset($_POST['guestbook_email']) && !empty($guestbook['captcha'])) {
include_once PHPWCMS_ROOT . '/include/inc_ext/SPAF_FormValidator.class.php';
// instantiate the object
$spaf_obj = new SPAF_FormValidator();
$guestbook['post']['captcha'] = isset($_POST['guestbook_captcha']) ? clean_slweg($_POST['guestbook_captcha']) : '';
if ($spaf_obj->validRequest($guestbook['post']['captcha'])) {
// destroy successful code
$spaf_obj->destroy();
} else {
$guestbook['error']['captcha'] = 'Fill in the correct captcha code. Proof it twice!';
}
}
if (isset($_POST['guestbook_email']) && !$guestbook['flooding']) {
// make global spam check
if (!checkFormTrackingValue()) {
$guestbook['flooding'] = 1;
$guestbook['readform'] = 1;
$guestbook['spamalert'] = '<div class="spamFormAlert">Your IP ' . getRemoteIP() . ' is not allowed to send form!</div>';
}
}
示例15: update_404redirect
function update_404redirect()
{
$data = array('error' => array(), 'data' => array('rid' => intval($_POST['rid']), 'alias' => clean_slweg($_POST['alias']), 'id' => trim($_POST['id']) === '' ? '' : intval($_POST['id']), 'aid' => trim($_POST['aid']) === '' || !intval($_POST['aid']) ? '' : intval($_POST['aid']), 'type' => empty($_POST['type']) || !in_array($_POST['type'], array('alias', 'id', 'aid', 'link')) ? '' : clean_slweg($_POST['type']), 'active' => empty($_POST['active']) ? 0 : 1, 'shortcut' => empty($_POST['shortcut']) ? 0 : 1, 'code' => empty($_POST['code']) || !in_array($_POST['code'], array('301', '307', '404', '401', '503')) ? '' : clean_slweg($_POST['code']), 'target' => clean_slweg($_POST['target']), 'changed' => date('Y-m-d H:i:s')));
if (!$data['data']['aid'] && !$data['data']['alias'] && $data['data']['id'] == '' && !isset($_POST['delete_' . md5($data['data']['rid'])])) {
$data['error'][] = $GLOBALS['BL']['be_redirect_error1'];
}
if ($data['data']['type'] && $data['data']['target'] === '') {
$data['error'][] = $GLOBALS['BL']['be_redirect_error2'];
} elseif (($data['data']['type'] == 'id' || $data['data']['type'] == 'aid') && !is_intval($data['data']['target'])) {
$data['error'][] = $GLOBALS['BL']['be_redirect_error3'];
}
if (count($data['error'])) {
$data['data']['active'] = 0;
set_status_message(implode('<br />', $data['error']), 'error');
} else {
$data['error'] = NULL;
$rid = $data['data']['rid'];
unset($data['data']['rid']);
if ($rid) {
// Mark for deletion
if (isset($_POST['delete_' . md5($rid)])) {
$data['data']['active'] = 9;
$result = _dbQuery('DELETE FROM ' . DB_PREPEND . 'phpwcms_redirect WHERE rid=' . $rid, 'DELETE');
} else {
$result = _dbUpdate('phpwcms_redirect', $data['data'], 'rid=' . $rid);
}
} else {
$result = _dbInsert('phpwcms_redirect', $data['data']);
if (isset($result['INSERT_ID'])) {
$rid = $result['INSERT_ID'];
}
}
$data['data']['rid'] = $rid;
if ($result) {
if ($data['data']['active'] == 9) {
set_status_message(str_replace('{ID}', $data['data']['rid'], $GLOBALS['BL']['be_action_deleted']), 'success');
headerRedirect('phpwcms.php?' . get_token_get_string('csrftoken') . '&do=admin&p=14');
} else {
set_status_message($GLOBALS['BL']['be_successfully_saved'], 'success');
}
} else {
set_status_message($GLOBALS['BL']['be_error_while_save'], 'error');
}
}
return $data;
}