本文整理汇总了PHP中verifyparam函数的典型用法代码示例。如果您正苦于以下问题:PHP verifyparam函数的具体用法?PHP verifyparam怎么用?PHP verifyparam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verifyparam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verifyparam_groupid
function verifyparam_groupid($paramid)
{
global $settings, $errors;
$groupid = "";
if ($settings['enablegroups'] == '1') {
$groupid = verifyparam($paramid, "/^\\d{0,10}\$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$groupid = "";
}
}
}
return $groupid;
}
示例2: prepare_pagination
function prepare_pagination($items_count, $default_items_per_page = 15)
{
global $page;
if ($items_count) {
$items_per_page = verifyparam("items", "/^\\d{1,3}\$/", $default_items_per_page);
if ($items_per_page < 2) {
$items_per_page = 2;
}
$total_pages = div($items_count + $items_per_page - 1, $items_per_page);
$curr_page = verifyparam("page", "/^\\d{1,6}\$/", 1);
if ($curr_page < 1) {
$curr_page = 1;
}
if ($curr_page > $total_pages) {
$curr_page = $total_pages;
}
$start_index = ($curr_page - 1) * $items_per_page;
$end_index = min($start_index + $items_per_page, $items_count);
$page['pagination'] = array("page" => $curr_page, "items" => $items_per_page, "total" => $total_pages, "count" => $items_count, "start" => $start_index, "end" => $end_index, "limit" => "LIMIT {$start_index}," . ($end_index - $start_index));
} else {
$page['pagination'] = true;
}
}
示例3: operator_get_all
global $mibew_encoding;
echo "<operators>";
$operators = operator_get_all();
foreach ($operators as $operator) {
if (!operator_is_online($operator)) {
continue;
}
$name = myiconv($mibew_encoding, "utf-8", safe_htmlspecialchars(safe_htmlspecialchars($operator['vclocalename'])));
$away = operator_is_away($operator) ? " away=\"1\"" : "";
echo "<operator name=\"{$name}\"{$away}/>";
}
echo "</operators>";
}
$since = verifyparam("since", "/^\\d{1,10}\$/", 0);
$status = verifyparam("status", "/^\\d{1,2}\$/", 0);
$showonline = verifyparam("showonline", "/^1\$/", 0);
$link = connect();
loadsettings_($link);
if (!isset($_SESSION["{$mysqlprefix}operatorgroups"])) {
$_SESSION["{$mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link);
}
close_old_threads($link);
mysql_close($link);
$groupids = $_SESSION["{$mysqlprefix}operatorgroups"];
start_xml_output();
echo '<update>';
if ($showonline) {
print_operators();
}
print_pending_threads($groupids, $since);
echo '</update>';
示例4: header
}
header("Location: {$webimroot}/operator/operator.php?op={$opId}&stored");
exit;
}
} else {
$page['formlogin'] = topage($login);
$page['formname'] = topage($localname);
$page['formemail'] = topage($email);
$page['formjabber'] = topage($jabber);
$page['formjabbernotify'] = $jabbernotify;
$page['formcommonname'] = topage($commonname);
$page['opid'] = topage($opId);
}
} else {
if (isset($_GET['op'])) {
$opId = verifyparam('op', "/^\\d{1,9}\$/");
$op = operator_by_id($opId);
if (!$op) {
$errors[] = getlocal("no_such_operator");
$page['opid'] = topage($opId);
} else {
$page['formlogin'] = topage($op['vclogin']);
$page['formname'] = topage($op['vclocalename']);
$page['formemail'] = topage($op['vcemail']);
$page['formjabber'] = topage($op['vcjabbername']);
$page['formjabbernotify'] = $op['inotify'] != 0;
$page['formcommonname'] = topage($op['vccommonname']);
$page['opid'] = topage($op['operatorid']);
}
}
}
示例5: loadsettings
loadsettings();
$stringid = verifyparam("key", "/^\\d{0,10}\$/", "");
$errors = array();
$page = array();
if ($stringid) {
$message = load_message($stringid);
if (!$message) {
$errors[] = getlocal("cannededit.no_such");
$stringid = "";
}
} else {
$message = "";
$page['locale'] = verifyparam("lang", "/^[\\w-]{2,5}\$/", "");
$page['groupid'] = "";
if ($settings['enablegroups'] == '1') {
$page['groupid'] = verifyparam("group", "/^\\d{0,10}\$/");
}
}
if (isset($_POST['message'])) {
$message = getparam('message');
if (!$message) {
$errors[] = no_field("form.field.message");
}
if (count($errors) == 0) {
if ($stringid) {
save_message($stringid, $message);
} else {
add_message($page['locale'], $page['groupid'], $message);
}
$page['saved'] = true;
prepare_menu($operator, false);
示例6: array
* the provisions of the GPL are applicable instead of those above. If you wish
* to allow use of your version of this file only under the terms of the GPL, and
* not to allow others to use your version of this file under the terms of the
* EPL, indicate your decision by deleting the provisions above and replace them
* with the notice and other provisions required by the GPL.
*
* Contributors:
* Evgeny Gryaznov - initial API and implementation
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/settings.php';
$errors = array();
$page = array('version' => $version, 'showform' => true);
$opId = verifyparam("id", "/^\\d{1,9}\$/");
$token = verifyparam("token", "/^[\\dabcdef]+\$/");
$operator = operator_by_id($opId);
if (!$operator) {
$errors[] = "No such operator";
$page['showform'] = false;
} else {
if ($token != $operator['vcrestoretoken']) {
$errors[] = "Wrong token";
$page['showform'] = false;
}
}
if (count($errors) == 0 && isset($_POST['password'])) {
$password = getparam('password');
$passwordConfirm = getparam('passwordConfirm');
if (!$password) {
$errors[] = no_field("form.field.password");
示例7: runsql
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once 'dbinfo.php';
function runsql($query, $link)
{
$res = mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
return $res;
}
$act = verifyparam("act", "/^(silentcreateall|createdb|ct|dt|addcolumns)\$/");
$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass) or show_install_err('Could not connect: ' . mysql_error());
if ($act == "silentcreateall") {
mysql_query("CREATE DATABASE {$mysqldb}", $link) or show_install_err(' Query failed: ' . mysql_error($link));
foreach ($dbtables as $id) {
create_table($id, $link);
}
} else {
if ($act == "createdb") {
mysql_query("CREATE DATABASE {$mysqldb}", $link) or show_install_err(' Query failed: ' . mysql_error($link));
} else {
mysql_select_db($mysqldb, $link) or show_install_err('Could not select database');
if ($force_charset_in_connection) {
mysql_query("SET character set {$dbencoding}", $link);
}
if ($act == "ct") {
示例8: check_login
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
$operator = check_login();
$page = array();
setlocale(LC_TIME, getstring("time.locale"));
function notification_info($id)
{
global $mysqlprefix;
$link = connect();
$notification = select_one_row(db_build_select("id, locale, vckind, vcto, unix_timestamp(dtmcreated) as created, vcsubject, tmessage, refoperator", "{$mysqlprefix}chatnotification", array("id = {$id}"), ""), $link);
mysql_close($link);
return $notification;
}
$notificationid = verifyparam("id", "/^(\\d{1,9})\$/");
$page['notification'] = notification_info($notificationid);
prepare_menu($operator, false);
start_html_output();
require '../view/notification.php';
示例9: check_login
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
require_once '../libs/userinfo.php';
require_once '../libs/pagination.php';
$operator = check_login();
loadsettings();
$page = array();
setlocale(LC_TIME, getstring("time.locale"));
$userid = "";
if (isset($_GET['userid'])) {
$userid = verifyparam("userid", "/^.{0,63}\$/", "");
}
function threads_by_userid($userid)
{
global $mysqlprefix;
if ($userid == "") {
return null;
}
$link = connect();
$query = sprintf("select unix_timestamp(dtmcreated) as created, unix_timestamp(dtmmodified) as modified, " . " threadid, remote, agentName, userName " . "from {$mysqlprefix}chatthread " . "where userid=\"{$userid}\" order by created DESC", $userid);
$result = mysql_query($query, $link) or die(' Query failed: ' . mysql_error($link));
$foundThreads = array();
while ($thread = mysql_fetch_array($result, MYSQL_ASSOC)) {
$foundThreads[] = $thread;
}
mysql_free_result($result);
示例10: verifyparam
} else {
if (isset($_GET['id'])) {
$banId = verifyparam('id', "/^\\d{1,10}\$/");
$link = connect();
$ban = select_one_row("select banid,(unix_timestamp(dtmtill)-unix_timestamp(CURRENT_TIMESTAMP)) as days,address,comment from {$mysqlprefix}chatban where banid = " . intval($banId), $link);
mysql_close($link);
if ($ban) {
$page['banId'] = topage($ban['banid']);
$page['formaddress'] = topage($ban['address']);
$page['formdays'] = topage(round($ban['days'] / 86400));
$page['formcomment'] = topage($ban['comment']);
} else {
$errors[] = "Wrong id";
}
} else {
if (isset($_GET['thread'])) {
$threadid = verifyparam('thread', "/^\\d{1,10}\$/");
$thread = thread_by_id($threadid);
if ($thread) {
$page['thread'] = topage($thread['userName']);
$page['threadid'] = $threadid;
$page['formaddress'] = topage($thread['remote']);
$page['formdays'] = 15;
}
}
}
}
prepare_menu($operator, false);
start_html_output();
require '../view/ban.php';
exit;
示例11: check_login
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once '../libs/common.php';
require_once '../libs/operator.php';
require_once '../libs/chat.php';
require_once '../libs/userinfo.php';
$operator = check_login();
$page = array();
loadsettings();
setlocale(LC_TIME, getstring("time.locale"));
function thread_info($id)
{
global $mysqlprefix;
$link = connect();
$thread = select_one_row("select userName,agentName,remote,userAgent," . "unix_timestamp(dtmmodified) as modified, unix_timestamp(dtmcreated) as created," . "vclocalname as groupName " . "from {$mysqlprefix}chatthread left join {$mysqlprefix}chatgroup on {$mysqlprefix}chatthread.groupid = {$mysqlprefix}chatgroup.groupid " . "where threadid = " . intval($id), $link);
mysql_close($link);
return $thread;
}
if (isset($_GET['threadid'])) {
$threadid = verifyparam("threadid", "/^(\\d{1,10})?\$/", "");
$lastid = -1;
$page['threadMessages'] = get_messages($threadid, "html", false, $lastid);
$page['thread'] = thread_info($threadid);
}
prepare_menu($operator, false);
start_html_output();
require '../view/thread_log.php';
示例12: array
$page = array('agentId' => '');
$errors = array();
$options = array('enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', 'enablejabber', 'enablessl', 'forcessl', 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', 'surveyaskcaptcha', 'enablepopupnotification', 'showonlineoperators', 'enablecaptcha');
loadsettings();
if ($settings['featuresversion'] != $featuresversion) {
$settings['featuresversion'] = $featuresversion;
update_settings();
}
$params = array();
foreach ($options as $opt) {
$params[$opt] = $settings[$opt];
}
if (isset($_POST['sent'])) {
if (is_capable($can_administrate, $operator)) {
foreach ($options as $opt) {
$settings[$opt] = verifyparam($opt, "/^on\$/", "") == "on" ? "1" : "0";
}
update_settings();
header("Location: {$mibewroot}/operator/features.php?stored");
exit;
} else {
$errors[] = "Not an administrator";
}
}
$page['canmodify'] = is_capable($can_administrate, $operator);
$page['stored'] = isset($_GET['stored']);
foreach ($options as $opt) {
$page["form{$opt}"] = $params[$opt] == "1";
}
prepare_menu($operator);
setup_settings_tabs(1);
示例13: update_group
} else {
update_group($groupid, $name, $description, $commonname, $commondescription, $email);
header("Location: {$webimroot}/operator/group.php?gid={$groupid}&stored");
exit;
}
} else {
$page['formname'] = topage($name);
$page['formdescription'] = topage($description);
$page['formcommonname'] = topage($commonname);
$page['formcommondescription'] = topage($commondescription);
$page['formemail'] = topage($email);
$page['grid'] = topage($groupid);
}
} else {
if (isset($_GET['gid'])) {
$groupid = verifyparam('gid', "/^\\d{1,9}\$/");
$group = group_by_id($groupid);
if (!$group) {
$errors[] = getlocal("page.group.no_such");
$page['grid'] = topage($groupid);
} else {
$page['formname'] = topage($group['vclocalname']);
$page['formdescription'] = topage($group['vclocaldescription']);
$page['formcommonname'] = topage($group['vccommonname']);
$page['formcommondescription'] = topage($group['vccommondescription']);
$page['formemail'] = topage($group['vcemail']);
$page['grid'] = topage($group['groupid']);
}
}
}
$page['stored'] = isset($_GET['stored']);
示例14: post_message_
}
if ($email) {
post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.email', array($email), true), $link);
}
if ($info) {
post_message_($thread['threadid'], $kind_for_agent, getstring2('chat.visitor.info', array($info), true), $link);
}
post_message_($thread['threadid'], $kind_user, $message, $link, $name);
mysql_close($link);
}
$groupid = "";
$groupname = "";
$group = NULL;
loadsettings();
if ($settings['enablegroups'] == '1') {
$groupid = verifyparam("group", "/^\\d{1,10}\$/", "");
if ($groupid) {
$group = group_by_id($groupid);
if (!$group) {
$groupid = "";
} else {
$groupname = get_group_name($group);
}
}
}
$email = getparam('email');
$visitor_name = getparam('name');
$message = getparam('message');
$info = getparam('info');
$referrer = urldecode(getparam("referrer"));
if (!$email) {
示例15: start_xml_output
start_xml_output();
echo "<error><descr>{$message}</descr></error>";
exit;
}
ping_thread($thread, $isuser, $istyping);
if (!$isuser && $act != "rename") {
$operator = check_login();
check_for_reassign($thread, $operator);
}
if ($act == "refresh") {
$lastid = verifyparam("lastid", "/^\\d{1,10}\$/", -1);
print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']);
exit;
} else {
if ($act == "post") {
$lastid = verifyparam("lastid", "/^\\d{1,10}\$/", -1);
$message = getrawparam('message');
$kind = $isuser ? $kind_user : $kind_agent;
$from = $isuser ? $thread['userName'] : $thread['agentName'];
if (!$isuser && $operator['operatorid'] != $thread['agentId']) {
show_error("cannot send");
}
$link = connect();
$postedid = post_message_($threadid, $kind, $message, $link, $from, null, $isuser ? null : $operator['operatorid']);
if ($isuser && $postedid && $thread["shownmessageid"] == 0) {
commit_thread($thread['threadid'], array('shownmessageid' => intval($postedid)), $link);
}
mysql_close($link);
print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']);
exit;
} else {