本文整理汇总了PHP中iPHP::code方法的典型用法代码示例。如果您正苦于以下问题:PHP iPHP::code方法的具体用法?PHP iPHP::code怎么用?PHP iPHP::code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iPHP
的用法示例。
在下文中一共展示了iPHP::code方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_seccode
public static function check_seccode()
{
if ($_POST['username'] && $_POST['password']) {
$seccode = iS::escapeStr($_POST['iACP_seccode']);
iPHP::seccode($seccode, true, 'iACP_seccode') or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json');
}
}
示例2: vote
private function vote($_do)
{
// iPHP::app('user.class','static');
// user::get_cookie() OR iPHP::code(0,'iCMS:!login',0,'json');
$aid = (int) $_GET['iid'];
$aid or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json');
$ackey = 'article_' . $_do . '_' . $aid;
$vote = iPHP::get_cookie($ackey);
$vote && iPHP::code(0, 'iCMS:article:!' . $_do, 0, 'json');
if ($_do == 'good') {
$sql = '`good`=good+1';
} else {
$sql = '`bad`=bad+1';
}
iDB::query("UPDATE `#iCMS@__article` SET {$sql} WHERE `id` ='{$aid}' limit 1");
iPHP::set_cookie($ackey, time(), 86400);
iPHP::code(1, 'iCMS:article:' . $_do, 0, 'json');
}
示例3: API_mobileUp
public function API_mobileUp()
{
$this->auth or iPHP::code(0, 'iCMS:!login', 0, 'json');
$F = iFS::upload('upfile');
$F['path'] && ($url = iFS::fp($F['path'], '+http'));
iPHP::js_callback(array('url' => $url, 'code' => $F['code']));
}
示例4: ACTION_add
public function ACTION_add()
{
if (!iCMS::$config['comment']['enable']) {
iPHP::code(0, 'iCMS:comment:close', 0, 'json');
}
iPHP::app('user.class', 'static');
user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json');
$seccode = iS::escapeStr($_POST['seccode']);
if (iCMS::$config['comment']['seccode']) {
iPHP::seccode($seccode, true) or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json');
}
iPHP::app('user.msg.class', 'static');
$appid = (int) $_POST['appid'];
$iid = (int) $_POST['iid'];
$cid = (int) $_POST['cid'];
$suid = (int) $_POST['suid'];
$reply_id = (int) $_POST['id'];
$reply_uid = (int) $_POST['userid'];
$reply_name = iS::escapeStr($_POST['name']);
$title = iS::escapeStr($_POST['title']);
$content = iS::escapeStr($_POST['content']);
$iid or iPHP::code(0, 'iCMS:article:empty_id', 0, 'json');
$content or iPHP::code(0, 'iCMS:comment:empty', 0, 'json');
$fwd = iCMS::filter($content);
$fwd && iPHP::code(0, 'iCMS:comment:filter', 0, 'json');
$appid or $appid = iCMS_APP_ARTICLE;
$addtime = $_SERVER['REQUEST_TIME'];
$ip = iPHP::getIp();
$userid = user::$userid;
$username = user::$nickname;
$status = iCMS::$config['comment']['examine'] ? '0' : '1';
$up = '0';
$down = '0';
$quote = '0';
$floor = '0';
$fields = array('appid', 'cid', 'iid', 'suid', 'title', 'userid', 'username', 'content', 'reply_id', 'reply_uid', 'reply_name', 'addtime', 'status', 'up', 'down', 'ip', 'quote', 'floor');
$data = compact($fields);
$id = iDB::insert('comment', $data);
iDB::query("UPDATE `#iCMS@__article` SET comments=comments+1 WHERE `id` ='{$iid}' limit 1");
user::update_count($userid, 1, 'comments');
if (iCMS::$config['comment']['examine']) {
iPHP::code(0, 'iCMS:comment:examine', $id, 'json');
}
iPHP::code(1, 'iCMS:comment:success', $id, 'json');
}
示例5: status
public static function status($url = null, $st = null)
{
$status = false;
$auth = self::get_cookie(true);
if ($auth) {
$user = self::get($auth['userid'], false);
if ($auth['username'] == $user->username && $auth['password'] == $user->password) {
$status = true;
}
unset($user->password);
}
unset($auth);
if ($status) {
if ($url && $st == "login") {
if (self::$format == 'json') {
return iPHP::code(1, 0, $url, 'json');
}
iPHP::gotourl($url);
}
return $user;
} else {
if ($url && $st == "nologin") {
if (self::$format == 'json') {
return iPHP::code(0, 0, $url, 'json');
}
iPHP::gotourl($url);
}
return false;
}
}
示例6: ACTION_create
/**
* [ACTION_create 创建新收藏夹]
*/
public function ACTION_create()
{
$this->__login();
$uid = user::$userid;
$nickname = user::$nickname;
$title = iS::escapeStr($_POST['title']);
$description = iS::escapeStr($_POST['description']);
$mode = (int) $_POST['mode'];
empty($title) && iPHP::code(0, 'iCMS:favorite:create_empty', 0, 'json');
$fwd = iCMS::filter($title);
$fwd && iPHP::code(0, 'iCMS:favorite:create_filter', 0, 'json');
if ($description) {
$fwd = iCMS::filter($description);
$fwd && iPHP::code(0, 'iCMS:favorite:create_filter', 0, 'json');
}
$max = iDB::value("SELECT COUNT(id) FROM `#iCMS@__favorite` WHERE `uid`='{$uid}'");
$max >= 10 && iPHP::code(0, 'iCMS:favorite:create_max', 0, 'json');
$count = 0;
$follow = 0;
$fields = array('uid', 'nickname', 'title', 'description', 'follow', 'count', 'mode');
$data = compact($fields);
$cid = iDB::insert('favorite', $data);
$cid && iPHP::code(1, 'iCMS:favorite:create_success', $cid, 'json');
iPHP::code(0, 'iCMS:favorite:create_failure', 0, 'json');
}