本文整理汇总了PHP中change_q函数的典型用法代码示例。如果您正苦于以下问题:PHP change_q函数的具体用法?PHP change_q怎么用?PHP change_q使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了change_q函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSpamComplaint
/**
* Сохраняет жалобу на спам в личных сообщениях
*
* @param string $sSpamerId UID спамера
* @param string $sUserId UID пожаловавшегося пользователя
* @param string $aParams массив параметров жалобы на спам
* @return bool true - успех, false - провал
*/
function addSpamComplaint($sSpamerId = '', $sUserId = '', $aParams = array())
{
$DB = new DB('plproxy');
// plproxy
$bRet = false;
$sMsgMd5 = md5($aParams['msg']);
if ($sSpamerId && $sUserId && $aParams) {
$DB->val("SELECT messages_spam_add(?i, ?i, ?i, ?, ?)", $sSpamerId, $sUserId, $aParams['id'], $sMsgMd5, change_q($aParams['txt']));
if (!$DB->error) {
$bRet = true;
$oMemBuf = new memBuff();
$oMemBuf->delete('messages_spam_count');
}
}
return $bRet;
}
示例2: processForm
function processForm($aFormValues)
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
global $session;
session_start();
get_uid(false);
$objResponse = new xajaxResponse();
//$pname = change_q($_POST['name'], true);
$msg = change_q($aFormValues['calltext'], false, 0);
//$mail = trim($_POST['mail']);
//$attach = $_FILES['attach'];
$login = $_SESSION['login'] ? $_SESSION['login'] : 'Anonymous';
$tn = 0;
$f_name = '';
$uid = get_uid(false);
$usr = new users($uid);
$pname = $_SESSION['name'] . ' ' . $_SESSION['surname'];
$mail = $usr->GetField($uid, $error, 'email');
if (!$msg) {
$alert['msg'] = 'Поле заполнено некорректно';
$error_flag = 1;
}
if (!$error_flag) {
$error .= blogs::NewThread($uid, 3, 0, $name, $msg, $f_name, getRemoteIP(), 1, $tn);
}
if (!$error && !$error_flag) {
$sm = new smail();
$error .= $sm->NewFeedbackPost($pname, $msg, $mail, $_SESSION['login'], 4);
$msg = $name = $mail = '';
$info_msg = '<br><center><table class="view_info" border="0" cellpadding="2" cellspacing="0"><tbody><tr class="n_qpr"><td height="20"><img src="/images/ico_ok.gif" alt="" border="0" height="18" width="19"></td><td nowrap>Ваше сообщение отправлено</td></tr></tbody></table>';
$objResponse->assign('calltext', 'value', '');
$objResponse->assign('cbok', 'innerHTML', $info_msg);
//$objResponse->assign("submitButton","disabled",false);
$objResponse->assign('submitButton', 'value', 'Отправить');
}
return $objResponse;
}
示例3: SafetyPhoneNow
/**
* Привязать телефон к аккаунту.
*/
function SafetyPhoneNow()
{
session_start();
return;
// #0019588
$aRes = array('success' => false);
if (trim($_POST['phone']) == '') {
$aRes['error'] = iconv('CP1251', 'UTF-8', 'Вы должны ввести номер телефона');
} else {
$users = new users();
$sPhone = change_q(stripslashes($_POST['phone']), true);
$aPhone = $users->CheckSafetyPhone($sPhone);
if ($aPhone['error_flag'] == 1) {
$aRes['error'] = iconv('CP1251', 'UTF-8', $aPhone['alert'][2]);
} elseif (isset($_SESSION['uid'])) {
$sPhoneOnly = $_POST['phone_only'] == 't' ? 't' : 'f';
if ($users->updateSafetyPhone($_SESSION['uid'], $sPhone, $sPhoneOnly)) {
$aRes['success'] = true;
}
}
}
echo json_encode($aRes);
}
示例4: quickYandexKassaAC
/**
* Покупка услуги верификации по банковской карте через ЯКассу
* в случае успешной покупки делается запрос на возврат 10 рублей.
*
* @return \xajaxResponse
*/
function quickYandexKassaAC($fname, $lname)
{
$objResponse = new xajaxResponse();
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/billing.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/yandex_kassa.php';
$uid = get_uid(false);
$bill = new billing($uid);
//@todo: нужна проверка текущей верификации
$option = array('uname' => change_q(substr(trim($fname), 0, 21)), 'usurname' => change_q(substr(trim($lname), 0, 21)));
$billReserveId = $bill->addServiceAndCheckout(Verification::YKASSA_AC_OP_CODE, $option);
$sum = $bill->getOrderPayedSum();
$yandex_kassa = new yandex_kassa();
$html_form = $yandex_kassa->render($sum, $bill->account->id, yandex_kassa::PAYMENT_AC, $billReserveId);
$objResponse->script("\n if (window.verification_popup) {\n window.verification_popup.openWindowYandexKassaAC('{$html_form}');\n }\n ");
$_SESSION['quickver_is_begin'] = 1;
return $objResponse;
}
示例5: users
require_once ABS_PATH . "/classes/attachedfiles.php";
require_once ABS_PATH . "/classes/CFile.php";
$userObj = new users();
$userID = get_uid();
$aFiles = new attachedfiles($_POST['attachedfiles_session']);
$userpics = $aFiles->getFiles(array(1));
if (is_array($userpics) && !empty($userpics)) {
$userpic = array_pop($userpics);
$aFiles->setStatusTo3($userpic['id']);
$foto = new CFile($userpic['id']);
$to = $foto->path . 'sm_' . $foto->name;
$foto->resizeImage($to, 50, 50, 'auto', true);
$userObj->photo = $userpic['name'];
}
$name = change_q(substr(trim($_POST['name']), 0, 21), true);
$surname = change_q(substr(trim($_POST['surname']), 0, 21), true);
if ($name && !preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $name)) {
$error_flag = 1;
$alert[1] = "Поле заполнено некорректно";
}
if ($surname && !preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $surname)) {
$error_flag = 1;
$alert[2] = "Поле заполнено некорректно";
}
if (!$error_flag) {
if ($name) {
$userObj->uname = $name;
}
if ($surname) {
$userObj->usurname = $surname;
}
示例6: reset
if (!$uid) {
return;
}
if (is_array($_POST['attachedfiles_session'])) {
reset($_POST['attachedfiles_session']);
$_POST['attachedfiles_session'] = current($_POST['attachedfiles_session']);
}
if (!$_POST['attachedfiles_session']) {
$generate_session = attachedfiles::createSessionID();
$_POST['attachedfiles_session'] = $generate_session;
}
$action = $_POST['attachedfiles_action'];
$type = $_POST['attachedfiles_type'];
$sess = $_POST['attachedfiles_session'];
$formid = change_q($_POST['attachedfiles_formid'], true);
$del_id = change_q(__paramInit('string', null, 'attachedfiles_delete'));
$attachedfiles = new attachedfiles($sess);
switch ($action) {
case 'add':
if (is_array($_FILES['attachedfiles_file']) && !$_FILES['attachedfiles_file']['error']) {
$login = $_SESSION['login'];
$dir = $login . "/attach";
$cFile = new CFile($_FILES['attachedfiles_file']);
$cFile->table = 'file';
switch ($type) {
case 'contacts':
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/messages.php";
$max_files = messages::MAX_FILES;
$max_files_size = messages::MAX_FILE_SIZE;
break;
case 'blog':
示例7: CheckInput
/**
* Валидация данных.
*
* @return string сообщение об ошибке
*/
public function CheckInput()
{
$this->address = substr(change_q($this->address), 0, 128);
$this->fio = substr(change_q($this->fio), 0, 64);
$this->bank_code = $this->bank_code ? $this->bank_code : self::BC_SB;
$this->sum = (double) $this->sum;
setlocale(LC_ALL, 'en_US.UTF-8');
$this->fm_sum = $bp->sum / EXCH_TR;
// if(isset($this->id))
// $this->id = (int)$this->id;
if (!$this->fio) {
$alert['fio'] = 'Поле заполненно некорректно.';
}
if (!$this->address) {
$alert['address'] = 'Поле заполненно некорректно.';
}
if (!$this->sum || $this->sum < 0.01) {
$alert['sum'] = 'Поле заполненно некорректно.';
}
return $alert;
}
示例8: trim
exit;
// пользуемся /siteadmin/admin/
if (!is_admin_sm()) {
exit;
}
$action = trim($_GET['action']);
if (!$action) {
$action = trim($_POST['action']);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/spam.php';
$sm = new spam();
switch ($action) {
case 'post_msg':
$msg = change_q($_POST['msg']);
$name = change_q($_POST['name']);
$role = $_POST['role'];
switch ($role) {
case 'npro':
$irole = 0;
break;
case 'pro':
$irole = 1;
break;
case 'emp':
$irole = 2;
break;
}
$error = $sm->Update($msg, $name, $irole);
if (!$error) {
unset($msg);
示例9: ChangeSafetyPhone
/**
* Изменение номера телефона востановления паролья через SMS.
*
* @param integer $uid ID пользователя
* @param string $phone номер телефона
*
* @return string сообщение об ошибке
*/
public function ChangeSafetyPhone($uid, $phone, $only_phone)
{
global $DB;
$res = '';
$t_phone = change_q(stripslashes($phone), true);
$c_phone = self::CheckSafetyPhone($t_phone);
$phone = $c_phone['phone'];
$res = $c_phone['alert'][2];
if (!$res) {
$only_phone = $only_phone == 't' ? 't' : 'f';
$sql = 'UPDATE users SET safety_phone=?, safety_only_phone=? WHERE uid=?i';
$DB->query($sql, $phone, $only_phone, $uid);
}
return $res;
}
示例10: setPrimaryIp
/**
* Обновляет адреса пользователя в сером списке IP
*
* @param int $nUserId UID пользователя
* @param string $sUserLogin Логин пользователя
* @param int $nAdminId UID админа
* @param string $sIp список IP адресов
* @return object xajaxResponse
*/
function setPrimaryIp($nUserId = 0, $sUserLogin = '', $nAdminId = 0, $sIp = '')
{
session_start();
$objResponse = new xajaxResponse();
$objResponse->script('gray_ip.clearEditAll();');
$sIp = change_q(trim(stripslashes($sIp)), true);
$aIp = users::CheckSafetyIP($sIp);
if (!$aIp['error_flag']) {
$bRes = gray_ip::updatePrimaryIp($nUserId, $sUserLogin, $nAdminId, $aIp['ip_addresses'], $bDel);
if ($bRes) {
$objResponse->alert('IP адреса успешно сохранены' . ($bDel ? "\nСтраница будет перезагружена" : ''));
if ($bDel) {
$objResponse->script('window.location.reload(true)');
}
} else {
$objResponse->alert('Ошибка сохранения IP адресов');
}
} else {
$objResponse->alert($aIp['alert'][1]);
}
return $objResponse;
}
示例11: CheckInput
/**
* Проверяем введенные данные записываем их в класс и приводим их к нормальной форме
*
* @return string Сообщение об ошибке
*/
function CheckInput($sbr = false)
{
$this->org_name = $this->org_name ? change_q(substr($this->org_name, 0, 128)) : '';
$this->phone = $this->phone ? substr(change_q($this->phone), 0, 24) : '';
$this->fax = $this->fax ? substr(change_q($this->fax), 0, 24) : '';
$this->email = $this->email ? substr(change_q($this->email), 0, 64) : '';
$this->country = $this->country ? substr(change_q($this->country), 0, 64) : '';
$this->country_id = intval($this->country_id);
$this->city = $this->city ? substr(change_q($this->city), 0, 64) : '';
$this->city_id = intval($this->city_id);
$this->index = $this->index ? substr(change_q($this->index), 0, 7) : '';
$this->address = $this->address ? substr(change_q($this->address), 0, 128) : '';
$this->address_grz = $this->address_grz ? substr(change_q($this->address_grz), 0, 128) : '';
$this->inn = $this->inn ? substr(change_q($this->inn), 0, 32) : '';
$this->kpp = $this->kpp ? substr(change_q($this->kpp), 0, 32) : '';
$this->okpo = $this->okpo ? substr(change_q($this->okpo), 0, 10) : '';
$this->full_name = $this->full_name ? change_q(substr($this->full_name, 0, 128)) : '';
$this->fio = $this->fio ? substr(change_q($this->fio), 0, 64) : '';
$this->address_jry = $this->address_jry ? substr(change_q($this->address_jry), 0, 128) : '';
$this->bank_name = $this->bank_name ? substr(change_q($this->bank_name), 0, 64) : '';
$this->bank_city = $this->bank_city ? substr(change_q($this->bank_city), 0, 32) : '';
$this->bank_ks = $this->bank_ks ? substr(change_q($this->bank_ks), 0, 64) : '';
$this->bank_rs = $this->bank_rs ? substr(change_q($this->bank_rs), 0, 64) : '';
$country_id = country::getCountryId($this->country);
$aRequired = array("org_name", "phone", "email", "country_id", "city_id", "index", "address", "inn", "full_name", "address_jry");
// убираем не обязательные поля в зависимости от ситуации
if ($this->country_id != 1) {
unset($aRequired[7]);
// inn
}
if ($sbr) {
unset($aRequired[0]);
// org_name
}
$error = $this->check_required($aRequired);
if (isset($error['country'])) {
$error['country'] = 'Пожалуйста, выберите страну';
}
if (isset($error['city'])) {
$error['city'] = 'Пожалуйста, выберите город';
}
if (!is_email($this->email)) {
$error['email'] = "Поле заполнено некорректно";
}
if ($this->kpp && !preg_match("/^\\d{9}\$/", $this->kpp)) {
$error['kpp'] = "Поле заполнено некорректно";
}
if ($country_id == 1) {
if (!preg_match("/^\\d{10,12}\$/", $this->inn) || strlen($this->inn) == 11) {
$error['inn'] = "Поле заполнено некорректно";
}
}
if (!preg_match("/^([0-9]+)\$/", $this->index)) {
$error['index'] = "Поле заполнено некорректно";
}
if ($this->okpo && !preg_match('/^(?:\\d{8}|\\d{10})$/', $this->okpo)) {
$error['okpo'] = "Поле заполнено некорректно";
}
if (!preg_match("/^[A-Za-z\\d\\-\\(\\)+\\s]+\$/", $this->phone)) {
$error['phone'] = "Поле заполнено некорректно";
}
return $error;
}
示例12: registration
$reg = new registration();
$reg->checkUserAccess(get_uid(), true);
$selected = $_POST['id'];
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/teams.php";
$error .= teams::teamsDelFavoritesExcept(get_uid(), $selected);
}
if (!$error && !$error_flag) {
//$info = "Изменения внесены";
header_location_exit('/users/' . $_SESSION['login'] . '/setup/info/?msg=1');
}
break;
case "main_change":
$name = change_q(substr(trim($_POST['name']), 0, 21), true);
$surname = change_q(substr(trim($_POST['surname']), 0, 21), true);
$email = change_q(substr(trim($_POST['email']), 0, 64), true);
$pname = change_q(substr(trim(stripslashes($_POST['pname'])), 0, 100), true);
$oldpwd = trim($_POST['oldpwd']);
$question_button_hide = intval($_POST['consultant_show']);
$promo_block_hide = intval($_POST['promo_show']);
$direct_links = intval($_POST['direct_links']);
setlocale(LC_ALL, 'ru_RU.CP1251');
if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $name)) {
$error_flag = 1;
$alert[1] = "Поле заполнено некорректно";
}
if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $surname)) {
$error_flag = 1;
$alert[2] = "Поле заполнено некорректно";
}
if (!is_email($email)) {
$error_flag = 1;
示例13: RnFolder
function RnFolder($form_values)
{
session_start();
$fuid = get_uid(false);
$objResponse = new xajaxResponse();
$bError = false;
$fld = new mess_folders();
$msgs = new messages();
$contacts = $msgs->GetContacts($fuid);
$users_folders = $msgs->GetUsersInFolders($fuid);
if (!isset($form_values['id'])) {
$objResponse->alert("Не выбрана папка.");
$bError = true;
} else {
$folder_id = intval($form_values['id']);
$cur_folder = intval($form_values['cur_folder']);
$cont = intval($form_values['cont']);
$logins = addslashes($form_values['logins']);
$arr_logins = split('~', $logins);
if ($folder_id <= 0) {
$objResponse->alert("Не выбрана папка.");
} else {
if (!isset($form_values['new_name'])) {
$objResponse->alert("Не указано новое имя папки.");
} else {
// $folder_name = addslashes($form_values['new_name']);
$folder_name = substr(change_q($form_values['new_name'], false, 64), 0, 64);
$request_folder_name = substr(change_q(stripslashes($form_values['new_name']), false, 64), 0, 64);
$srch = array("<", ">");
$folder_name = trim(str_replace($srch, "", $folder_name));
if (empty($folder_name) || $folder_name == '') {
$objResponse->alert("Не указано новое имя папки.");
$objResponse->assign("savebtn", "disabled", false);
} else {
$fld->fname = $folder_name;
$fld->id = $folder_id;
$fld->from_id = get_uid(false);
if (!($ermsg = $fld->Rename($folder_id))) {
$GLOBALS['xajax']->setCharEncoding("windows-1251");
$objResponse->script("old_name='" . $folder_name . "';");
if ($cur_folder == $folder_id) {
$folder_html = "<img class=\"li\" src=\"/images/ico_dir.gif\" />" . reformat($request_folder_name, 15, 0, 1);
$folder_header = 'Сообщения / ' . reformat($folder_name, 15, 0, 1);
$objResponse->assign("cht", "innerHTML", $folder_header);
} else {
$folder_html = "<a href=\"/contacts/?folder=" . $folder_id . "\"><span style=\"float:left;\"><img class=\"li\" src=\"/images/ico_dir.gif\" /></a></span><a href=\"/contacts/?folder=" . $folder_id . "\" class=\"blue\">" . reformat($request_folder_name, 15, 0, 1) . "</a>";
}
foreach ($arr_logins as $login) {
$objResponse->assign("folder" . $folder_id . "u" . $login, "innerHTML", reformat($folder_name, 25, 0, 1));
$objResponse->assign("vfolder" . $folder_id . "u" . $login, "innerHTML", reformat($folder_name, 25, 0, 1));
}
$folder_html .= " (<span id=\"fldcount" . $folder_id . "\">" . $cont . "</span>)";
$folder_html .= "<div style=\"margin-top: 17px; text-align:right\"><a href=\"/contacts/?action=delfolder&id=" . $folder_id . "\" onClick=\"return warning(9)\" title=\"Удалится только папка. Контакты переместятся в папку «Все».\">Удалить</a> | <a href='javascript:rename(\"" . $folder_id . "\",\"" . $cur_folder . "\",\"" . str_replace("\\", "\\\\", htmlspecialchars($request_folder_name)) . "\",\"" . $cont . "\",\"" . $logins . "\");'>Переименовать</a></div>";
$objResponse->assign("li_folder" . $folder_id, "innerHTML", $folder_html);
} else {
$objResponse->alert($ermsg);
$objResponse->assign("savebtn", "disabled", false);
}
}
}
}
}
return $objResponse;
}
示例14: UpdateSpecDesc
/**
* Обновляем описание специализации в разделе портфолио пользователя (Время и стоимость работы)
*
* @deprecated
*
* @param integer $fid ИД Пользователя
* @param array $prof_ids ИД Профессий
* @param array $prises Стоимость, Цены работ
* @param array $times Время затраченное для работ
* @return string сообщение об ошибке если есть
*/
function UpdateSpecDesc($fid, $prof_ids, $prises, $times)
{
global $DB;
$i = 0;
if ($prof_ids) {
foreach ($prof_ids as $id) {
$id = (int) trim($id);
$prise = substr(change_q($prises[$i], true, 13), 0, 64);
$time = substr(change_q($times[$i], true, 13), 0, 128);
if ($prise == '') {
$prise = "NULL";
} else {
$prise = "'" . $prise . "'";
}
if ($time == '') {
$time = "NULL";
} else {
$time = "'" . $time . "'";
}
$sql .= "UPDATE spec_choise SET prise={$prise}, m_time={$time} WHERE (user_id='{$fid}' AND prof_id='{$id}'); ";
$i++;
}
$DB->query($sql);
$error = $DB->error;
}
return $error;
}
示例15: updateOfferBlock
/**
* Изменение блокировки предложения фрилансера.
*
* @param int $offer_id ID предложения фрилансера
* @param int $act_id ID нового действия (admin_actions)
* @param int $src_id ID исходного действия (в данном случае равен $obj_id или 0 - просто индикатор)
* @param string $reason причина
* @param int $reason_id ID причины, если она выбрана из списка (таблица admin_reasons, где act_id = 13)
*
* @return object xajaxResponse
*/
function updateOfferBlock($offer_id, $act_id, $src_id, $reason = '', $reason_id = null)
{
session_start();
$objResponse = new xajaxResponse();
if (hasPermissions('projects')) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/freelancer_offers.php';
$frl_offers = new freelancer_offers();
$offer_id = intval($offer_id);
$offer = $frl_offers->getOfferById($offer_id);
if ($offer) {
$objUser = new users();
$objUser->GetUserByUID($offer['user_id']);
$sObjName = $offer['title'];
$sObjLink = '';
// нет ссылки на конкретное предложение
$reason_id = $reason_id ? $reason_id : 0;
$reason = str_replace('%USERNAME%', $objUser->uname . ' ' . $objUser->usurname, $reason);
$reason = change_q($reason, false, 0, true);
if ($act_id == 14 && $src_id) {
// разблокируем предложение
$update = array('is_blocked' => 'f', 'reason' => '', 'reason_id' => 0, 'admin' => 0);
$frl_offers->Update($offer_id, $update);
// пишем лог админских действий
admin_log::addLog(admin_log::OBJ_CODE_OFFER, 14, $offer['user_id'], $offer_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason);
// так как появилось новое действие в логе
$objResponse->script('window.location="/siteadmin/admin_log/?site=offer";');
} elseif ($act_id == 13 && $src_id) {
// редактируем текущую блокировку предложения
admin_log::updateOfferBlock($src_id, $reason, $reason_id);
$objResponse->script('window.location.reload(true)');
} elseif ($act_id == 13 && !$src_id) {
// блокируем предложение
$update = array('is_blocked' => 't', 'reason' => $reason, 'reason_id' => $reason_id, 'admin' => $_SESSION['uid']);
$frl_offers->Update($offer_id, $update);
// пишем лог админских действий
admin_log::addLog(admin_log::OBJ_CODE_OFFER, 13, $offer['user_id'], $offer_id, $sObjName, $sObjLink, 0, '', $reason_id, $reason, $offer_id);
// так как появилось новое действие в логе
$objResponse->script('window.location="/siteadmin/admin_log/?site=offer";');
}
} else {
$objResponse->script('adminLogOverlayClose();');
$objResponse->alert('Несуществующее предложение');
}
}
return $objResponse;
}