本文整理汇总了PHP中safe_convert函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_convert函数的具体用法?PHP safe_convert怎么用?PHP safe_convert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_convert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_profile
function save_profile()
{
need_login('ajax');
$current_id = $this->user->get_field('id');
$arr['user_nicename'] = safe_convert($this->getPost('user_nicename'));
$new_pass = $this->getPost('new_pass');
$old_pass = $this->getPost('old_pass');
$new_pass_again = $this->getPost('new_pass_again');
$extra_arr = $this->getPost('extra');
if ($extra_arr['email'] && !check_email($extra_arr['email'])) {
form_ajax_failed('text', lang('error_email'));
}
if ($new_pass) {
if (!$this->user->check_pass($current_id, md5($old_pass))) {
form_ajax_failed('text', lang('old_pass_error'));
}
if ($new_pass != $new_pass_again) {
form_ajax_failed('text', lang('pass_twice_error'));
}
$arr['user_pass'] = md5($new_pass);
}
if ($this->user->update($current_id, $arr)) {
$this->user->save_extra($current_id, $extra_arr);
form_ajax_success('box', lang('modify_success') . ($new_pass ? lang('pass_edit_ok') : ''), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
form_ajax_failed('text', lang('modify_failed'));
}
}
示例2: save
function save()
{
need_login('ajax');
$from = $this->getPost('from');
$data['name'] = safe_convert($this->getPost('cate_name'));
$data['par_id'] = $this->getPost('par_id');
$data['sort'] = intval($this->getPost('sort'));
if ($data['name'] == '') {
form_ajax_failed('text', lang('category_name_empty'));
}
if (($id = $this->mdl_cate->save($data)) == true) {
if ($this->getPost('add_nav')) {
$nav_data['type'] = 1;
$nav_data['name'] = $data['name'];
$nav_data['url'] = site_link('albums', 'index', array('cate' => $id));
$nav_data['sort'] = 100;
$nav_data['enable'] = 1;
$mdl_nav =& loader::model('nav');
$mdl_nav->save($nav_data);
//清除菜单缓存
$mdl_nav->clear_nav_cache();
}
if ($from) {
form_ajax_success('box', lang('create_category_succ') . '<script>setTimeout(function(){ Mui.box.show("' . $from . '",true); },1000)</script>');
} else {
form_ajax_success('box', lang('create_category_succ'), null, 0.5, $_SERVER['HTTP_REFERER']);
}
} else {
form_ajax_failed('text', lang('create_category_fail'));
}
}
示例3: save_reply
function save_reply()
{
if (!$this->setting->get_conf('system.enable_comment')) {
form_ajax_failed('text', lang('album_comment_closed'));
}
$comment['email'] = safe_convert($this->getPost('email'));
$comment['author'] = safe_convert($this->getPost('author'));
$comment['content'] = safe_convert($this->getPost('content'));
$comment['ref_id'] = intval($this->getPost('ref_id'));
$comment['type'] = intval($this->getPost('type'));
$comment['reply_author'] = safe_convert($this->getPost('reply_author'));
$comment['pid'] = intval($this->getPost('pid'));
$this->plugin->trigger('before_post_comment');
if ($this->setting->get_conf('system.enable_comment_captcha') && !$this->user->loggedin()) {
$captcha =& loader::lib('captcha');
if (!$captcha->check($this->getPost('captcha'))) {
form_ajax_failed('text', lang('invalid_captcha_code'));
}
}
if ($comment['email'] && !check_email($comment['email'])) {
form_ajax_failed('text', lang('error_email'));
}
if (!$comment['author']) {
form_ajax_failed('text', lang('error_comment_author'));
}
if (!$comment['content']) {
form_ajax_failed('text', lang('empty_content'));
}
if (!$comment['ref_id'] || !$comment['type'] || !$comment['pid'] || !$comment['reply_author']) {
form_ajax_failed('text', lang('miss_argument'));
}
$comment['post_time'] = time();
$comment['author_ip'] = get_real_ip();
if ($this->setting->get_conf('system.comment_audit') == 1 && !$this->user->loggedin()) {
$comment['status'] = 0;
} else {
$comment['status'] = 1;
}
if ($reply_id = $this->mdl_comment->save($comment)) {
$comment['id'] = $reply_id;
$this->output->set('info', $comment);
$this->plugin->trigger('reply_comment', $reply_id);
form_ajax_success('text', loader::view('comments/view', false));
} else {
form_ajax_failed('text', lang('reply_failed'));
}
}
示例4: save_priv
function save_priv()
{
need_login('ajax');
$album['priv_type'] = $this->getPost('priv_type', '0');
$album['priv_pass'] = $this->getPost('priv_pass');
$album['priv_question'] = safe_convert($this->getPost('priv_question'));
$album['priv_answer'] = safe_convert($this->getPost('priv_answer'));
$id = intval($this->getGet('id'));
if ($album['priv_type'] == '1') {
if ($album['priv_pass'] == '') {
form_ajax_failed('text', lang('album_password_empty'));
}
}
if ($album['priv_type'] == '2') {
if ($album['priv_question'] == '') {
form_ajax_failed('text', lang('album_question_empty'));
}
if ($album['priv_answer'] == '') {
form_ajax_failed('text', lang('album_answer_empty'));
}
}
if ($this->mdl_album->update($id, $album)) {
$this->plugin->trigger('modified_album_priv', $id);
form_ajax_success('box', lang('modify_album_priv_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
} else {
form_ajax_failed('text', lang('modify_album_priv_failed'));
}
}
示例5: safe_convert
$content = safe_convert($content, 0, 1);
} else {
$content = preg_replace("/\\[code\\](.+?)\\[\\/code\\]/ise", "phpcode('\\1')", $content);
$content = safe_convert($content, 1, 1);
}
if ($comefrom && $originsrc) {
$comefrom = safe_convert($comefrom);
$originsrc = safe_convert($originsrc);
} else {
$comefrom = $originsrc = '';
}
if ($tags) {
$tags_array = @explode(' ', mystrtolower(trim($tags)));
$tags_array_all = array_unique($tags_array);
$tags = @implode(' ', $tags_array_all);
$tags = safe_convert($tags);
$tags = str_replace(' ', '', $tags);
$tags_array = @explode(' ', $tags);
$tags = '>' . str_replace(' ', '>', $tags) . '>';
} else {
$tags = '';
}
$currentuserid = $userdetail['userid'];
if ($changemytime == 1) {
acceptrequest('newyear,newmonth,newday,newhour,newmin,newsec');
$finaltime = gmmktime($newhour, $newmin, $newsec, $newmonth, $newday, $newyear) - $config['timezone'] * 3600;
} else {
$finaltime = time();
}
$records = array();
$records[0] = array('blogid' => $blogid, 'title' => $title, 'pubtime' => $finaltime, 'authorid' => $currentuserid, 'replies' => 0, 'tbs' => 0, 'views' => 0, 'property' => $property, 'category' => $category, 'tags' => $tags, 'sticky' => $sticky, 'htmlstat' => $htmlstat, 'ubbstat' => $ubbstat, 'emotstat' => $emotstat, 'content' => $content, 'editorid' => 0, 'edittime' => 0, 'weather' => $sweather, 'mobile' => 0, 'pinged' => $pinged, 'permitgp' => '', 'starred' => $starred, 'blogpsw' => $blogpsw, 'frontpage' => $frontpage, 'entrysummary' => $entrysummary, 'comefrom' => $comefrom, 'originsrc' => $originsrc, 'blogalias' => $blogalias);
示例6: acceptrequest
}
if ($job == 'ajaxverify') {
acceptrequest('savecookie,securitycode');
$savecookie = floor($savecookie);
if ($config['loginvalidation'] == 1) {
if ($db_defaultsessdir != 1) {
session_save_path("./{$db_tmpdir}");
}
session_cache_limiter("private, must-revalidate");
session_start();
if ($securitycode == '' || strtolower($securitycode) != strtolower($_SESSION['code'])) {
catcherror($lnc[165]);
}
}
$password = md5($_POST['password']);
$username = safe_convert(mystrtolower($_POST['username']));
$try = $blog->getbyquery("SELECT * FROM `{$db_prefix}user` WHERE LOWER(username)='{$username}' AND `userpsw`='{$password}'");
if (!is_array($try)) {
catcherror($lnc[166]);
} else {
$userid = $try['userid'];
catchsuccess("{$userid}-{$password}-{$savecookie}");
}
}
if ($job == 'ajaxloginsuccess') {
if ($permission['CP'] == 1) {
$destine = array("{$lnc[163]}|index.php", "{$lnc[107]}|admin.php");
} else {
$destine = "{$lnc[163]}|index.php";
}
catchsuccess("{$lnc[167]} " . $userdetail['username'], $destine);
示例7: intval
$mtitle = $strAttachment;
//保存参数
$action = $_GET['action'];
$mark_id = intval($_GET['mark_id']);
$seekname = encode($_REQUEST['seekname']);
$seekcate = isset($_REQUEST['seekcate']) ? encode($_REQUEST['seekcate']) : "";
$seektype = isset($_REQUEST['seektype']) ? $_REQUEST['seektype'] : "";
$editorcode = isset($_GET['editorcode']) ? $_GET['editorcode'] : "";
$basedir = isset($_GET['basedir']) ? $_GET['basedir'] : "../attachments/";
if (!preg_match("/^(..\\/attachments\\/)/i", $basedir)) {
$basedir = "../attachments/";
}
if (strrpos($basedir, "/") != strlen($basedir) - 1) {
$basedir .= "/";
}
$basedir = safe_convert($basedir);
//操作目录或数据库
if (empty($_GET['job'])) {
$job = "folder";
} else {
$job = $_GET['job'];
}
//保存数据
if ($action == "save") {
$check_info = 1;
$Error_Message = "";
$OK_Message = "";
//检测输入内容
if (empty($_FILES['myfile']) && empty($_POST['remotepath'])) {
$ActionMessage = $strErrNull;
$check_info = 0;
示例8: stripslashes
$func_code = stripslashes($func_code);
$func_code = str_replace("\"", "\\\"", $func_code);
$func_code = str_replace("\r", '', $func_code);
$func_code = str_replace("\n", '\\n', $func_code);
$value .= "'type'=>'extraheader', 'code'=>\"{$func_code}\"";
break;
}
}
$value = trim($value);
if (substr($value, -1, 1) == ',') {
$value = substr($value, 0, strlen($value) - 1);
}
//Remove last ','
$workout = "\$blogitem['" . safe_convert($newitemname) . "']=array({$value});\n";
if ($job == 'modulenew') {
$newitemname = safe_convert($newitemname);
$newitemname = str_replace('_', '', $newitemname);
$newitemnameforcheck = urlencode($newitemname);
if (strstr($newitemnameforcheck, '%')) {
catcherror($lna[931]);
}
$maxmodid = $blog->countbyquery("SELECT MAX(`modorder`) FROM `{$db_prefix}mods`");
$maxmodid += 1;
$blog->query("INSERT INTO `{$db_prefix}mods` VALUES ('{$newitemposition}', '{$newitemname}', '{$newitemdesc}', '{$newitemactive}', '{$maxmodid}', 'custom')");
if ($newitemactive == 1) {
recache_mods();
}
mod_append($workout);
} else {
$blog->query("UPDATE `{$db_prefix}mods` SET `desc`='{$newitemdesc}', `active`='{$newitemactive}' WHERE `name`='{$newitemname}'");
mod_replace($newitemname, $workout, true);
示例9: catcherror
catcherror($lna[1168]);
}
$newurlcatename = urlencode($newcateurlname);
if (strstr($newcateurlname, '%')) {
catcherror($lna[1168]);
}
$newcateurlname = addslashes($newcateurlname);
if ($job == 'save') {
$queryplus = " AND `cateid`<>'{$itemid}'";
}
$tmpresult = $blog->getbyquery("SELECT * FROM `{$db_prefix}categories` WHERE `cateurlname`='{$newcateurlname}' {$queryplus} LIMIT 1");
if ($tmpresult['catename']) {
catcherror($lna[1169]);
}
}
$newcatedesc = addslashes(safe_convert(stripslashes($newcatedesc), 1));
$newcatedesc = str_replace('<|>', '<|>', $newcatedesc);
if ($job == 'new' || $job == 'newinedit') {
$new_cate_id = $maxrecord['maxcateid'] + 1;
$targetcate = floor($targetcate);
if ($targetcate != -2) {
if ($targetcate == -1) {
$tmpresult = $blog->getbyquery("SELECT * FROM `{$db_prefix}categories` ORDER BY `cateorder` ASC LIMIT 1");
} else {
$tmpresult = $blog->getbyquery("SELECT * FROM `{$db_prefix}categories` WHERE `cateid`='{$targetcate}' LIMIT 1");
$insertcateorder = $tmpresult['cateorder'];
$tmpresult = $blog->getbyquery("SELECT * FROM `{$db_prefix}categories` WHERE `cateorder`>'{$insertcateorder}' ORDER BY `cateorder` ASC LIMIT 1");
}
if (trim($tmpresult['cateorder']) != '') {
$insertcateorder = $tmpresult['cateorder'];
$result = $blog->query("UPDATE `{$db_prefix}categories` SET `cateorder`=`cateorder`+1 WHERE `cateorder`>={$insertcateorder}");
示例10: save_display
function save_display()
{
$site = $this->getPost('site');
$display = $this->getPost('display');
$this->setting->set_conf('site.footer', safe_convert($site['footer'], true, true));
$this->setting->set_conf('site.logo', $site['logo']);
$this->setting->set_conf('display.album_pageset', $display['album_pageset']);
$this->setting->set_conf('display.photo_pageset', $display['photo_pageset']);
$this->setting->set_conf('display.album_sort_default', $display['album_sort_default']);
$this->setting->set_conf('display.photo_sort_default', $display['photo_sort_default']);
if ($this->getPost('show_process_info')) {
$this->setting->set_conf('system.show_process_info', true);
} else {
$this->setting->set_conf('system.show_process_info', false);
}
form_ajax_success('box', lang('save_setting_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
}
示例11: Copyright
禁止使用Windows记事本修改文件,由此造成的一切使用不正常恕不解答!
PHP+MySQL blog system.
Code: Bob Shen
Offical site: http://www.bo-blog.com
Copyright (c) Bob Shen 中国-上海
In memory of my university life
------------------------------------------------------- */
if (!defined('VALIDREQUEST')) {
die('Access Denied.');
}
if (!$job) {
$job = 'default';
} else {
$job = basename($job);
}
$itemid = safe_convert($itemid);
acceptrequest('tag');
if ($tag !== '') {
$job = 'show';
}
$tag = addslashes(urldecode($tag));
if ($job == 'default') {
$sequence = $mbcon['tagorder'] == '1' ? 'tagcounter' : 'tagid';
$tagperpage = floor($mbcon['tagperpage']);
$start_id = ($page - 1) * $tagperpage;
$alltags = $blog->getarraybyquery("SELECT tagid,tagname,tagcounter FROM `{$db_prefix}tags` ORDER BY {$sequence} DESC LIMIT {$start_id}, {$tagperpage}");
$maxtagcounter = $blog->countbyquery("SELECT MAX(tagcounter) FROM `{$db_prefix}tags`");
$alltagcounter = $blog->countbyquery("SELECT COUNT(tagcounter) FROM `{$db_prefix}tags`");
for ($i = 0; $i < count($alltags['tagid']); $i++) {
$bit_tag_size = get_tag_size($alltags['tagcounter'][$i], $maxtagcounter);
if ($mbcon['tagunderlinetospace'] == 1) {
示例12: changesingleconfig
function changesingleconfig($configname, $value, $configtype = 'mbcon', $configfile = 'data/mod_config.php')
{
// Change a single value for config
global ${$configtype}, $lnc;
$rar = ${$configtype};
$rar[$configname] = $value;
$savetext = "<?PHP\n";
while (@(list($key, $val) = @each($rar))) {
$savetext .= "\${$configtype}['{$key}']='" . safe_convert(stripslashes($val)) . "';\n";
}
if (writetofile($configfile, $savetext)) {
return true;
} else {
catcherror($lnc[7] . $configfile);
}
}
示例13: safe_convert
}
-->
</script>
<?php
if (!empty($_GET['action']) && $_GET['action'] == "save") {
$check_info = 1;
if (empty($_POST['subject']) || empty($_POST['fromaddress']) || empty($_POST['toaddress'])) {
$ActionMessage = $strGuestBookBlankError;
$check_info = 0;
} else {
$_POST['validate'] = safe_convert($_POST['validate']);
$_POST['subject'] = safe_convert($_POST['subject']);
$_POST['fromaddress'] = safe_convert($_POST['fromaddress']);
$_POST['toaddress'] = safe_convert($_POST['toaddress']);
$_POST['body'] = safe_convert($_POST['body']);
}
if ($check_info == 1) {
$toemail = explode(";", $_POST['toaddress']);
foreach ($toemail as $value) {
if (check_email($value) == 0) {
$ActionMessage = $strErrEmail;
$check_info = 0;
break;
}
}
}
if ($check_info == 1 && check_email($_POST['fromaddress']) == 0) {
$ActionMessage = $strErrEmail;
$check_info = 0;
}
示例14: catcherror
if ($p['newpsw'] != $p['confirmpsw']) {
catcherror($lna[496]);
}
$password = "`userpsw`='" . md5($p['newpsw']) . "', ";
} else {
$password = "";
}
}
$email = strtolower(trimplus(safe_convert($p['email'])));
$homepage = trimplus(safe_convert($p['homepage']));
$gender = floor($p['gender']);
$qq = floor($p['qq']);
$msn = trimplus(safe_convert($p['msn']));
$skype = trimplus(safe_convert($p['skype']));
$from = trimplus(safe_convert($p['from']));
$intro = trimplus(safe_convert($p['intro']));
$musergroup = floor($p['usergroup']);
if ($job == 'savenewuser') {
$currentuserid = $maxrecord['maxuserid'] + 1;
$imajikan = time();
$blog->query("INSERT INTO `{$db_prefix}user` VALUES ('{$currentuserid}', '{$username}', '{$password}', '{$imajikan}', '{$musergroup}', '{$email}', '{$homepage}', '{$qq}', '{$msn}', '{$intro}', '{$gender}', '{$skype}', '{$from}', '0', '{$userdetail['ip']}', '')");
$blog->query("UPDATE `{$db_prefix}maxrec` SET `maxuserid`=`maxuserid`+1");
$blog->query("UPDATE `{$db_prefix}counter` SET `users`=`users`+1");
} else {
$blog->query("UPDATE `{$db_prefix}user` SET {$password} `usergroup`='{$musergroup}', `email`='{$email}', homepage='{$homepage}', qq='{$qq}', msn='{$msn}', intro='{$intro}', gender='{$gender}', skype='{$skype}', `fromplace`='{$from}' WHERE `userid`='{$p['userid']}'");
recache_adminlist();
}
catchsuccess($finishok2, array($backtouseradmin, $backtoaddnew));
}
if ($job == 'deluser') {
if ($itemid === '') {
示例15: checkuser
function checkuser($username, $password)
{
global $defualtcategoryid, $DMC, $DBPrefix;
$username = safe_convert(trim($username));
$password = md5(safe_convert($password));
$sql = "SELECT * FROM " . $DBPrefix . "members WHERE username='" . $username . "' and password='" . $password . "' and role='admin'";
$userInfo = $DMC->fetchArray($DMC->query($sql));
if (count($userInfo) > 0) {
return $userInfo;
} else {
return false;
}
}