本文整理汇总了PHP中is_digits函数的典型用法代码示例。如果您正苦于以下问题:PHP is_digits函数的具体用法?PHP is_digits怎么用?PHP is_digits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_digits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index_action
public function index_action()
{
$_GET['per_page'] = $_GET['per_page'] ? intval($_GET['per_page']) : get_setting('contents_per_page');
$result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['type'], $_GET['page'], $_GET['per_page'], $_GET['topic_ids'], $_GET['is_recommend']);
if (!$result) {
$result = array();
}
if ($_GET['is_question_id'] and is_digits($_GET['q'])) {
$question_info = $this->model('question')->get_question_info_by_id($_GET['q']);
if ($question_info) {
$result[] = $this->model('search')->prase_result_info($question_info);
}
}
if ($result) {
$key_arr = array('type', 'search_id', 'name', 'detail');
foreach ($result as $key => $val) {
foreach ($val as $k => $v) {
if (!in_array($k, $key_arr)) {
unset($result[$key][$k]);
}
}
}
}
H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($result), 'rows' => $result), 1, null));
}
示例2: refresh_access_token
function refresh_access_token($id, $sina_token)
{
if (!is_digits($id) or empty($sina_token['access_token'])) {
return false;
}
return $this->update('users_sina', array('access_token' => $sina_token['access_token'], 'expires_time' => time() + $sina_token['expires_in']), 'id = ' . $id);
}
示例3: set_slide_sort
public function set_slide_sort($id, $order)
{
if (!is_digits($id) or !is_digits($order) or $order < 0 or $order > 99) {
return false;
}
return $this->update('slide', array('order' => intval($order)), 'id = ' . intval($id));
}
示例4: index_action
public function index_action()
{
if (is_digits($_GET['id'])) {
$feature_info = $this->model('feature')->get_feature_by_id($_GET['id']);
} else {
$feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']);
}
if (!$feature_info) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
}
if (!$feature_info['enabled']) {
H::redirect_msg(AWS_APP::lang()->_t('专题未启用'), '/');
}
if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) {
HTTP::redirect('/feature/' . $feature_info['url_token']);
}
if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) {
H::redirect_msg(AWS_APP::lang()->_t('专题下必须包含一个以上话题'), '/');
}
if ($feature_info['seo_title']) {
TPL::assign('page_title', $feature_info['seo_title']);
} else {
$this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']);
}
TPL::assign('sidebar_hot_topics', $topic_list);
TPL::assign('feature_info', $feature_info);
TPL::import_js('js/app/feature.js');
TPL::output('feature/detail');
}
示例5: index_action
public function index_action()
{
if (isset($_GET['notification_id'])) {
$this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
}
if (is_mobile()) {
HTTP::redirect('/m/people/' . $_GET['id']);
}
if (is_digits($_GET['id'])) {
if (!($user = $this->model('account')->get_user_info_by_uid($_GET['id'], TRUE))) {
$user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE);
}
} else {
if ($user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE)) {
} else {
$user = $this->model('account')->get_user_info_by_url_token($_GET['id'], TRUE);
}
}
if (!$user) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('用户不存在'), '/');
}
if ($user['forbidden'] and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('该用户已被封禁'), '/');
}
if (urldecode($user['url_token']) != $_GET['id']) {
HTTP::redirect('/people/' . $user['url_token']);
}
$this->model('people')->update_views($user['uid']);
TPL::assign('user', $user);
$job_info = $this->model('account')->get_jobs_by_id($user['job_id']);
TPL::assign('job_name', $job_info['job_name']);
if ($user['weibo_visit']) {
if ($users_sina = $this->model('openid_weibo_oauth')->get_weibo_user_by_uid($user['uid'])) {
TPL::assign('sina_weibo_url', 'http://www.weibo.com/' . $users_sina['id']);
}
}
TPL::assign('education_experience_list', $this->model('education')->get_education_experience_list($user['uid']));
$jobs_list = $this->model('work')->get_jobs_list();
if ($work_experience_list = $this->model('work')->get_work_experience_list($user['uid'])) {
foreach ($work_experience_list as $key => $val) {
$work_experience_list[$key]['job_name'] = $jobs_list[$val['job_id']];
}
}
TPL::assign('work_experience_list', $work_experience_list);
TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $user['uid']));
$this->crumb(AWS_APP::lang()->_t('%s 的个人主页', $user['user_name']), 'people/' . $user['url_token']);
TPL::import_css('css/user.css');
TPL::assign('reputation_topics', $this->model('people')->get_user_reputation_topic($user['uid'], $user['reputation'], 12));
TPL::assign('fans_list', $this->model('follow')->get_user_fans($user['uid'], 5));
TPL::assign('friends_list', $this->model('follow')->get_user_friends($user['uid'], 5));
TPL::assign('focus_topics', $this->model('topic')->get_focus_topic_list($user['uid'], 10));
TPL::assign('user_actions_questions', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ADD_QUESTION, $this->user_id));
TPL::assign('user_actions_answers', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ANSWER_QUESTION, $this->user_id));
TPL::assign('user_actions', $this->model('actions')->get_user_actions($user['uid'], 5, implode(',', array(ACTION_LOG::ADD_QUESTION, ACTION_LOG::ANSWER_QUESTION, ACTION_LOG::ADD_REQUESTION_FOCUS, ACTION_LOG::ADD_AGREE, ACTION_LOG::ADD_TOPIC, ACTION_LOG::ADD_TOPIC_FOCUS, ACTION_LOG::ADD_ARTICLE)), $this->user_id));
TPL::output('people/index');
}
示例6: send
public function send($email, $subject, $message, $link = null, $link_title = null, $server = 'master')
{
if (is_digits($email)) {
if (!($user_info = $this->model('account')->get_user_info_by_uid($email))) {
return false;
}
$user_name = $user_info['user_name'];
$email = $user_info['email'];
}
return AWS_APP::mail()->send($email, $subject, $this->get_mail_template($user_name, $subject, $message, $link, $link_title), get_setting('site_name'), $user_name, $server);
}
示例7: get_article_info_by_id
public function get_article_info_by_id($article_id)
{
if (!is_digits($article_id)) {
return false;
}
static $articles;
if (!$articles[$article_id]) {
$articles[$article_id] = $this->fetch_row('article', 'id = ' . $article_id);
}
return $articles[$article_id];
}
示例8: get_joined_digits
function get_joined_digits(&$v, &$ids)
{
$ids = explode(',', $v);
if (count($ids) === 0) {
return false;
}
foreach ($ids as $id) {
if (!is_digits($id)) {
return false;
}
}
return true;
}
示例9: search_action
public function search_action()
{
$result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['type'], 1, $_GET['limit'], $_GET['topic_ids'], $_GET['is_recommend']);
if (!$result) {
$result = array();
}
if ($_GET['is_question_id'] and is_digits($_GET['q'])) {
$question_info = $this->model('question')->get_question_info_by_id($_GET['q']);
if ($question_info) {
$result[] = $this->model('search')->prase_result_info($question_info);
}
}
H::ajax_json_output($result);
}
示例10: list_users
function list_users(&$msg, &$data)
{
get_user_data_modal($user_modal);
$user_id = P('id');
$options = array('data modal' => $user_modal, 'left join' => array(array('qwp_role', 'r', 'r.id=u.role')), 'where' => 'u.id<>1 and role<>1');
if ($user_id) {
$data = array();
if ($user_id != '1' && is_digits($user_id)) {
$options['where'] .= ' and u.id=' . $user_id;
qwp_db_get_data(array('qwp_user', 'u'), $data, null, $options);
}
} else {
$options['default order'] = array('role', array('id', 'desc'));
$options['search condition'] = array('condition' => array('fields' => array('u.name' => 'like', 'avatar' => 'set_avatar_condition', 'gender' => array('s' => array('<>', 'x'))), 'condition' => array('op' => 'or', 'fields' => array('phone' => 'like', 'account' => 'like', 'email' => 'like', 'name' => 'like'))));
$options['search converter'] = 'convert_search_data';
qwp_db_retrieve_data(array('qwp_user', 'u'), $data, $options);
}
}
示例11: save_action
public static function save_action($uid, $associate_id, $action_type, $action_id, $action_content = null, $action_attch = null, $add_time = null, $anonymous = null, $addon_data = null)
{
if (!$uid or !$associate_id) {
return false;
}
if (is_digits($action_attch)) {
$action_attch_insert = $action_attch;
} else {
$action_attch_insert = '-1';
$action_attch_update = $action_attch;
}
if (!$add_time) {
$add_time = time();
}
$history_id = AWS_APP::model()->insert('user_action_history', array('uid' => intval($uid), 'associate_type' => $action_type, 'associate_action' => $action_id, 'associate_id' => $associate_id, 'associate_attached' => $action_attch_insert, 'add_time' => $add_time, 'anonymous' => intval($anonymous)));
AWS_APP::model()->insert('user_action_history_data', array('history_id' => $history_id, 'associate_content' => htmlspecialchars($action_content), 'associate_attached' => htmlspecialchars($action_attch_update), 'addon_data' => $addon_data ? serialize($addon_data) : ''));
self::associate_fresh_action($history_id, $associate_id, $action_type, $action_id, $uid, $anonymous, $add_time);
return $history_id;
}
示例12: update_third_party_login
public function update_third_party_login($id = null, $action, $name, $url, $token, $enabled = null, $account_id = null, $rank = null)
{
if ($action == 'update' and !is_digits($id) or $action == 'add' and !is_digits($account_id)) {
return false;
}
$to_save_rule = array();
if ($name) {
$to_save_rule['name'] = $name;
}
if ($url) {
$to_save_rule['url'] = $url;
}
if ($token) {
$to_save_rule['token'] = $token;
}
if ($enabled !== null) {
if ($enabled == 1) {
$to_save_rule['enabled'] = '1';
} else {
$to_save_rule['enabled'] = '0';
}
}
if (is_digits($account_id)) {
$to_save_rule['account_id'] = $account_id;
}
if (is_digits($rank) and $rank >= 0 and $rank <= 99) {
$to_save_rule['rank'] = $rank;
}
switch ($action) {
case 'add':
return $this->insert('weixin_third_party_login', $to_save_rule);
break;
case 'update':
return $this->update('weixin_third_party_login', $to_save_rule, 'id = ' . $id);
break;
default:
return false;
break;
}
}
示例13: save_question
/**
*
* 增加问题内容
* @param string $question_content //问题内容
* @param string $question_detail //问题说明
*
* @return boolean true|false
*/
public function save_question($question_content, $question_detail, $published_uid, $question_difficulty, $quiz_id, $anonymous = 0, $ip_address = null, $from = null)
{
if (!$ip_address) {
$ip_address = fetch_ip();
}
$now = time();
$to_save_question = array('question_content' => htmlspecialchars($question_content), 'question_detail' => htmlspecialchars($question_detail), 'add_time' => $now, 'update_time' => $now, 'published_uid' => intval($published_uid), 'difficulty' => intval($question_difficulty), 'quiz_id' => intval($quiz_id), 'anonymous' => intval($anonymous), 'ip' => ip2long($ip_address));
if ($from and is_array($from)) {
foreach ($from as $type => $from_id) {
if (!is_digits($from_id)) {
continue;
}
$to_save_question[$type . '_id'] = $from_id;
}
}
$question_id = $this->insert('question', $to_save_question);
if ($question_id) {
$this->shutdown_update('users', array('question_count' => $this->count('question', 'published_uid = ' . intval($published_uid))), 'uid = ' . intval($published_uid));
$this->model('search_fulltext')->push_index('question', $question_content, $question_id);
}
return $question_id;
}
示例14: remove_assoc
function remove_assoc($from, $type, $id)
{
if (!$from or !$type or !is_digits($id)) {
return false;
}
return $this->query('UPDATE ' . $this->get_table($from) . ' SET `' . $type . '_id` = NULL WHERE `' . $type . '_id` = ' . $id);
}
示例15: check_username_char
public function check_username_char($user_name)
{
if (is_digits($user_name)) {
return AWS_APP::lang()->_t('用户名不能为纯数字');
}
if (strstr($user_name, '-')) {
return AWS_APP::lang()->_t('用户名不能包含 -');
}
$length = strlen(convert_encoding($user_name, 'UTF-8', 'GB2312'));
$length_min = intval(get_setting('username_length_min'));
$length_max = intval(get_setting('username_length_max'));
if ($length < $length_min || $length > $length_max) {
$flag = true;
}
switch (get_setting('username_rule')) {
default:
break;
case 1:
if (!preg_match('/^[\\x{4e00}-\\x{9fa5}_a-zA-Z0-9]+$/u', $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入大于 %s 字节的用户名, 允许汉字、字母与数字', $length_min . ' - ' . $length_max);
}
break;
case 2:
if (!preg_match("/^[a-zA-Z0-9_]+\$/i", $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入 %s 个字母、数字或下划线', $length_min . ' - ' . $length_max);
}
break;
case 3:
if (!preg_match("/^[\\x{4e00}-\\x{9fa5}]+\$/u", $user_name) or $flag) {
return AWS_APP::lang()->_t('请输入 %s 个汉字', ceil($length_min / 2) . ' - ' . floor($length_max / 2));
}
break;
}
return false;
}