/**
  * Constructor (generates a connection to the API)
  * @param   string  Clockworksms API key required to use the plugin
  * @return  void
  */
 public function __construct($apiKey = null)
 {
     $plugin = ClockworksmsPlugin::create();
     $clockWorkSMSPlugin = $plugin->get('tool_enable');
     if (empty($apiKey)) {
         $clockWorkSMSApiKey = $plugin->get('api_key');
     } else {
         $clockWorkSMSApiKey = $apiKey;
     }
     $this->table = Database::get_main_table('user_field_values');
     if ($clockWorkSMSPlugin == true) {
         $this->apiKey = $clockWorkSMSApiKey;
         // Setting Clockworksms api
         define('CONFIG_SECURITY_API_KEY', $this->apiKey);
         $trimmedApiKey = trim(CONFIG_SECURITY_API_KEY);
         if (!empty($trimmedApiKey)) {
             $this->api = new Clockwork(CONFIG_SECURITY_API_KEY);
         } else {
             $this->api = new Clockwork(' ');
             $recipient_name = api_get_person_name(
                 api_get_setting('administratorName'),
                 api_get_setting('administratorSurname'),
                 null,
                 PERSON_NAME_EMAIL_ADDRESS
             );
             $email_form = get_setting('emailAdministrator');
             $emailsubject = 'Clockworksms error';
             $emailbody = 'Key cannot be blank';
             $sender_name = $recipient_name;
             $email_admin = $email_form;
             api_mail_html($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin);
         }
         $this->plugin_enabled = true;
     }
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     // if this is a load balancer FoOlSlide, disable the public interface
     if (get_setting('fs_balancer_master_url')) {
         show_404();
     }
     // We need to set some theme stuff, so let's load the template system
     $this->load->library('template');
     $this->config->load('theme');
     // Set theme by using the theme variable
     $this->template->set_theme(get_setting('fs_theme_dir') ? get_setting('fs_theme_dir') : 'default');
     // load the controller from the current theme, else load the default one
     if (file_exists('content/themes/' . get_setting('fs_theme_dir') . '/reader_controller.php')) {
         require_once 'content/themes/' . get_setting('fs_theme_dir') . '/reader_controller.php';
     } else {
         require_once 'content/themes/' . $this->config->item('theme_extends') . '/reader_controller.php';
     }
     $this->RC = new Reader_Controller();
     // load the functions from the current theme, else load the default one
     if (file_exists('content/themes/' . get_setting('fs_theme_dir') . '/reader_functions.php')) {
         require_once 'content/themes/' . get_setting('fs_theme_dir') . '/reader_functions.php';
     } else {
         require_once 'content/themes/' . $this->config->item('theme_extends') . '/reader_functions.php';
     }
 }
示例#3
0
 function register($_username, $_password, $_email)
 {
     if ($this->ucenter_charset != 'utf-8') {
         $result = uc_user_register(convert_encoding($_username, 'utf-8', $this->ucenter_charset), $_password, $_email);
     } else {
         $result = uc_user_register($_username, $_password, $_email);
     }
     switch ($result) {
         default:
             $uid = $this->model('account')->user_register($_username, $_password, $_email);
             if (get_setting('register_valid_type') == 'N' or get_setting('register_valid_type') == 'email' and get_setting('register_type') == 'invite') {
                 $this->model('active')->active_user_by_uid($uid);
             }
             return array('user_info' => $this->model('account')->get_user_info_by_username($_username), 'uc_uid' => $result, 'username' => $_username, 'email' => $_email);
             break;
         case -1:
             return '用户名不合法';
             break;
         case -2:
             return '用户名包含不允许注册的词语';
             break;
         case -3:
             return '用户名已经存在';
             break;
         case -4:
             return 'Email 格式有误';
             break;
         case -5:
             return 'Email 不允许注册';
             break;
         case -6:
             return '该 Email 已经被注册';
             break;
     }
 }
示例#4
0
 /**
  * User command for betting on the coin toss game in the casino
  *
  * @param bet int The amount of money to bet on the coin toss game
  * @return Array
  *
  * @note
  * If the player bets within ~1% of the maximum bet, they will receive a reward item
  */
 public function bet()
 {
     $player = new Player(self_char_id());
     $bet = intval(in('bet'));
     $negative = $bet < 0;
     set_setting('bet', max(0, $bet));
     $pageParts = ['reminder-max-bet'];
     if ($negative) {
         $pageParts = ['result-cheat'];
         $player->vo->health = subtractHealth($player->id(), 99);
     } else {
         if ($bet > $player->vo->gold) {
             $pageParts = ['result-no-gold'];
         } else {
             if ($bet > 0 && $bet <= self::MAX_BET) {
                 if (rand(0, 1) === 1) {
                     $pageParts = ['result-win'];
                     $player->vo->gold = add_gold($player->id(), $bet);
                     if ($bet >= round(self::MAX_BET * 0.99)) {
                         // within about 1% of the max bet & you win, you get a reward item.
                         add_item($player->id(), self::REWARD, 1);
                     }
                 } else {
                     $player->vo->gold = subtract_gold($player->id(), $bet);
                     $pageParts = ['result-lose'];
                 }
             }
         }
     }
     // End of not cheating check.
     return $this->render(['pageParts' => $pageParts, 'player' => $player, 'bet' => get_setting('bet')]);
 }
示例#5
0
 function binding_callback_action()
 {
     $oauth = new Services_Weibo_WeiboOAuth(get_setting('sina_akey'), get_setting('sina_skey'));
     if ($_GET['uid'] and $this->user_info['permission']['is_administortar']) {
         $user_id = intval($_GET['uid']);
         $user_info = $this->model('account')->get_user_info_by_uid($user_id);
         if (empty($user_info)) {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本地用户不存在,无法绑定')));
         }
         $sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/uid-' . $user_id)));
     } else {
         $user_id = $this->user_id;
         AWS_APP::session()->sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/')));
         $sina_token = AWS_APP::session()->sina_token;
         $redirect = get_js_url('/account/setting/openid/');
     }
     $client = new Services_Weibo_WeiboClient(get_setting('sina_akey'), get_setting('sina_skey'), $sina_token['access_token']);
     $uid_get = $client->get_uid();
     $sina_profile = $client->show_user_by_id($uid_get['uid']);
     if ($sina_profile['error']) {
         H::redirect_msg(AWS_APP::lang()->_t('与微博通信出错, 错误代码: %s', $sina_profile['error']), "/account/setting/openid/");
     }
     if (!$this->model('integral')->fetch_log($user_id, 'BIND_OPENID')) {
         $this->model('integral')->process($user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
     }
     //$this->model('openid_weibo')->bind_account($sina_profile, get_js_url('/account/setting/openid/'), $user_id, $last_key['oauth_token'], $last_key['oauth_token_secret'], $sina_token);
     $this->model('openid_weibo')->bind_account($sina_profile, $redirect, $user_id, $sina_token);
 }
示例#6
0
 public function send_activation_mail($email, $name, $role, $token)
 {
     $this->load->library('mailer');
     $mail = new PHPMailer();
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = "ssl";
     $mail->Host = "smtp.gmail.com";
     $mail->Port = 465;
     $mail->Username = "******";
     $mail->Password = "******";
     $mail->Subject = "Jagamana Registration";
     $template = file_get_contents(base_url() . '/assets/template/registration.html');
     $template = preg_replace('%SITEPATH%', base_url() . "register/activate", $template);
     $template = preg_replace('%NAME%', $name, $template);
     $template = preg_replace('%ROLE%', $role, $template);
     $template = preg_replace('%TOKEN%', $token, $template);
     $template = preg_replace('%YEAR%', date("Y"), $template);
     $template = preg_replace('%ADDRESS%', get_setting("Address"), $template);
     $template = preg_replace('%WEBSITE%', get_setting("Website Name"), $template);
     $mail->Body = $template;
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->SetFrom('*****@*****.**', 'Jagamana Service');
     $mail->AddReplyTo("*****@*****.**", "Jagamana Service");
     $mail->AddAddress($email, $name);
     if ($mail->Send()) {
         return true;
     }
     return false;
 }
示例#7
0
 public function build_auth_header($args = array(), $request_url, $request_method)
 {
     if (isset($args) and !is_array($args)) {
         return false;
     }
     if (isset($args['oauth_token_secret'])) {
         $oauth_token_secret = $args['oauth_token_secret'];
         unset($args['oauth_token_secret']);
     }
     $timestamp = time();
     $args['oauth_consumer_key'] = get_setting('twitter_consumer_key');
     $args['oauth_nonce'] = base64_encode(md5($timestamp));
     $args['oauth_signature_method'] = 'HMAC-SHA1';
     $args['oauth_timestamp'] = $timestamp;
     $args['oauth_version'] = '1.0';
     ksort($args);
     $parm_str = http_build_query($args, '', '&', PHP_QUERY_RFC3986);
     $sign_base_str = $request_method . '&' . rawurlencode($request_url) . '&' . rawurlencode($parm_str);
     $sign_key = rawurlencode(get_setting('twitter_consumer_secret')) . '&' . rawurlencode($oauth_token_secret);
     $args['oauth_signature'] = base64_encode(hash_hmac('sha1', $sign_base_str, $sign_key, true));
     ksort($args);
     $auth_header = 'Authorization: OAuth ';
     foreach ($args as $key => $value) {
         $auth_header .= $key . '="' . rawurlencode($value) . '", ';
     }
     return substr($auth_header, 0, strlen($auth_header) - 2);
 }
示例#8
0
 public function index_action()
 {
     if ($_GET['tag']) {
         $this->crumb(AWS_APP::lang()->_t('标签') . ': ' . $_GET['tag'], '/favorite/tag-' . $_GET['tag']);
     }
     //边栏可能感兴趣的人或话题
     if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'favorite/index')) {
         $recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id);
         TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics);
     }
     if ($action_list = $this->model('favorite')->get_item_list($_GET['tag'], $this->user_id, calc_page_limit($_GET['page'], get_setting('contents_per_page')))) {
         foreach ($action_list as $key => $val) {
             $item_ids[] = $val['item_id'];
         }
         TPL::assign('list', $action_list);
     } else {
         if (!$_GET['page'] or $_GET['page'] == 1) {
             $this->model('favorite')->remove_favorite_tag(null, null, $_GET['tag'], $this->user_id);
         }
     }
     if ($item_ids) {
         $favorite_items_tags = $this->model('favorite')->get_favorite_items_tags_by_item_id($this->user_id, $item_ids);
         TPL::assign('favorite_items_tags', $favorite_items_tags);
     }
     TPL::assign('favorite_tags', $this->model('favorite')->get_favorite_tags($this->user_id));
     TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/favorite/tag-' . $_GET['tag']), 'total_rows' => $this->model('favorite')->count_favorite_items($this->user_id, $_GET['tag']), 'per_page' => get_setting('contents_per_page')))->create_links());
     TPL::output('favorite/index');
 }
示例#9
0
function normal_sign($uid, $tieba)
{
    $setting = get_setting($uid);
    $url = "http://tieba.baidu.com/mo/m?kw={$tieba[unicode_name]}";
    $get_url = curl_get($url, $uid);
    if (!$get_url) {
        return array(1, '无法打开贴吧首页', 0);
    }
    $get_url = wrap_text($get_url);
    preg_match('/<ahref="([^"]*?)">签到<\\/a>/', $get_url, $matches);
    if (isset($matches[1])) {
        $s = str_replace('&amp;', '&', $matches[1]);
        $sign_url = 'http://tieba.baidu.com' . $s;
        $get_sign = curl_get($sign_url, $uid, $setting['use_bdbowser']);
        $done++;
        if (!$get_sign) {
            return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
        }
        $get_sign = wrap_text($get_sign);
        preg_match('/<spanclass="light">签到成功,经验值上升<spanclass="light">(\\d+)<\\/span>/', $get_sign, $matches);
        if ($matches[1]) {
            return array(2, "签到成功,经验值+{$matches[1]}", $matches[1]);
        } else {
            return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
        }
    } else {
        preg_match('/<span>已签到<\\/span>/', $get_url, $matches);
        if ($matches[0]) {
            return array(2, '此前已成功签到', 0);
        } else {
            return array(-1, '找不到签到链接,稍后重试', 0);
        }
    }
}
示例#10
0
 public function setup()
 {
     if (get_setting('index_per_page')) {
         $this->per_page = get_setting('index_per_page');
     }
     HTTP::no_cache_header();
 }
示例#11
0
 protected function Upload($dir, $files)
 {
     global $lang;
     $sum = 0;
     foreach ($files as $key => $val) {
         $sum += $_FILES[$val]['size'];
     }
     if ($sum <= 2097152) {
         $rel_dir = 'Uploads/';
         $make_dir = FALSE;
         if (get_setting('ftp', 'use_ftp') || intval(get_setting('ftp', 'use_ftp')) == 1) {
             if ($conn_id = ftp_connect(get_setting('ftp', 'server'))) {
                 if (@ftp_login($conn_id, get_setting('ftp', 'username'), get_setting('ftp', 'password'))) {
                     @ftp_mkdir($conn_id, $rel_dir . $dir);
                     @ftp_chmod($conn_id, 0777, $rel_dir . $dir);
                     $make_dir = TRUE;
                 }
             }
         } else {
             if (@mkdir($rel_dir . $dir)) {
                 $make_dir = TRUE;
             }
         }
         if ($make_dir) {
             foreach ($files as $key => $file) {
                 @move_uploaded_file($_FILES[$file]['tmp_name'], $rel_dir . $dir . '/' . $_FILES[$file]['name']);
             }
         }
     } else {
         return SetError::Set($lang['L_ERRORFILESTOOBIG']);
     }
     return TRUE;
 }
示例#12
0
 public function Execute(Template $template, Session $session, $request)
 {
     if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) {
         $dba = DBA::Open();
         $table = $request['act'] == 'addpi' ? POSTICONS : EMOTICONS;
         $img_location = $table == POSTICONS ? 'PostIcons' : 'Emoticons';
         $description = $dba->Quote($request['description']);
         if ($_FILES['upload']['error'] == 0) {
             $image = $_FILES['upload']['name'];
             move_uploaded_file($_FILES['upload']['tmp_name'], $rel_dir . 'Images/' . get_setting('template', 'imgfolder') . '/Icons/' . $img_location . '/' . $_FILES['upload']['name']);
         } else {
             $image = $dba->Quote($request['current_images']);
         }
         if ($table == POSTICONS) {
             if ($dba->Query("INSERT INTO " . $table . " (image, description) VALUES ('{$image}', '{$description}')")) {
                 header("Location: admin.php?act=icons");
             }
         } else {
             $typed = htmlspecialchars($request['typed']);
             if ($dba->Query("INSERT INTO " . $table . " (image, description, typed) VALUES ('{$image}', '{$description}', '{$typed}')")) {
                 header("Location: admin.php?act=icons");
             }
         }
     }
 }
示例#13
0
 public function search_result_action()
 {
     if (!in_array($_GET['search_type'], array('questions', 'topics', 'users', 'articles'))) {
         $_GET['search_type'] = null;
     }
     $search_result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['search_type'], $_GET['page'], get_setting('contents_per_page'), null, $_GET['is_recommend']);
     if ($this->user_id and $search_result) {
         foreach ($search_result as $key => $val) {
             switch ($val['type']) {
                 case 'questions':
                     $search_result[$key]['focus'] = $this->model('question')->has_focus_question($val['search_id'], $this->user_id);
                     break;
                 case 'topics':
                     $search_result[$key]['focus'] = $this->model('topic')->has_focus_topic($this->user_id, $val['search_id']);
                     break;
                 case 'users':
                     $search_result[$key]['focus'] = $this->model('follow')->user_follow_check($this->user_id, $val['search_id']);
                     break;
             }
         }
     }
     TPL::assign('search_result', $search_result);
     if (is_mobile()) {
         TPL::output('m/ajax/search_result');
     } else {
         TPL::output('search/ajax/search_result');
     }
 }
示例#14
0
 /**
  * Connects to FoOlPod to retrieve which is the latest version from the API
  *
  * @param type $force forces returning the download even if FoOlSlide is up to date
  * @return type FALSE or the download URL
  */
 function check_latest($force = FALSE)
 {
     if (function_exists('curl_init')) {
         $this->load->library('curl');
         $result = $this->curl->simple_post($this->pod . '/api/software/foolslide', array('url' => site_url(), 'version' => get_setting('fs_priv_version')));
     } else {
         $result = file_get_contents($this->pod . '/api/software/foolslide');
     }
     if (!$result) {
         set_notice('error', _('FoOlPod server could not be contacted: impossible to check for new versions.'));
         return FALSE;
     }
     $data = json_decode($result);
     $new_versions = array();
     foreach ($data->versions as $new) {
         if (!$this->is_bigger_version(FOOLSLIDE_VERSION, $new)) {
             break;
         }
         $new_versions[] = $new;
     }
     if (!empty($new_versions)) {
         return $new_versions;
     }
     if ($force) {
         return array($data->versions[0]);
     }
     return FALSE;
 }
示例#15
0
 public function __construct($request)
 {
     global $lang;
     $this->lang = $lang;
     if (isset($_GET['sort']) && $_GET['sort'] != "*") {
         //if($request['sort'] == "*") {
         //$order ="[a-zA-Z].*$";
         //$like = 'REGEXP';
         //} else {
         $order = strtolower($_GET['sort']) . '%';
         $like = 'LIKE';
         //}
     } else {
         $order = "%";
         $like = 'LIKE';
     }
     $limit = isset($_GET['limit']) ? intval($_GET['limit']) : NULL;
     $start = isset($_GET['start']) ? intval($_GET['start']) : NULL;
     global $settings;
     $db_type = get_setting(get_setting('application', 'dba_name'), 'type');
     $proper_limit = $db_type == 'pgsql' ? "LIMIT {$limit} OFFSET {$start}" : "LIMIT {$start}, {$limit}";
     $extra = !is_null($limit) && !is_null($start) ? $proper_limit : "LIMIT " . $settings['memberlistperpage'];
     $query = "SELECT * FROM " . USERS . " WHERE name {$like} '{$order}' {$extra}";
     $this->users = DBA::Open()->Query($query)->GetIterator();
 }
示例#16
0
 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));
 }
示例#17
0
function list_setting($config)
{
    $initalMoney = get_setting($config, 'InitialMoney');
    $lastCheckTime = get_setting($config, 'LastCheckTime');
    ?>
<form action="setting.php" method="post">
<input type="hidden" name="action_type" value="submit_edit"/>

<table border="0">
	<tr>
		<td>Initial money</td>
		<td>
			<input type="text" name="InitialMoney" 
				value="<?php 
    echo $initalMoney['Value'];
    ?>
"/>
		</td>
	</tr>
	<tr>
		<td>Last check time</td>
		<td>
			<?php 
    showTimeBox("setting_lastchecktime", $lastCheckTime['Value']);
    ?>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input type="submit" value="Save" /></td>
	</tr>
</table>
</form>
<?php 
}
示例#18
0
 public function __construct()
 {
     $this->setting = get_setting();
     $this->bduss = get_robot_bduss();
     $this->un = self::getun($this->bduss[0]);
     $this->cron();
 }
示例#19
0
 public function sign_in_action()
 {
     if ($_GET['uid'] != $this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('签到失败!')));
     }
     if ($this->model('sign')->is_signed_today($_GET['uid'])) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     }
     $continous = $this->model('sign')->sign_in($_GET['uid']);
     $integral_every_day = get_setting('sign_integral_every_day');
     $integral_seventh_day = get_setting('sign_integral_seventh_day');
     // 积分操作
     $is_seventh_day = false;
     if ($continous < 0) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     } else {
         if ($continous == 6) {
             $integral = $integral_seventh_day;
             $integral_message = '连续7天签到积分';
             $is_seventh_day = true;
         } else {
             $integral = $integral_every_day;
             $integral_message = '每日签到积分';
         }
     }
     $this->model('integral')->process($_GET['uid'], 'SIGN_IN', $integral, $integral_message, $_GET['uid']);
     H::ajax_json_output(AWS_APP::RSM(array('is_signed' => false, 'continous' => $continous, 'integral_every_day' => $integral_every_day, 'integral_seventh_day' => $integral_seventh_day, 'user_integral' => $this->user_info['integral'] + $integral)), 1, null);
 }
示例#20
0
 public static final function Open($name = '')
 {
     static $databases = NULL;
     static $connections = NULL;
     if ($name == '') {
         $name = get_setting('application', 'dba_name') == '' ? get_setting('', 'database', FALSE) : get_setting('application', 'dba_name');
     }
     //First build a list of databases if it doesn't exist
     if ($databases == NULL) {
         $databases = array();
         $connections = array();
         $ini_file = PC_CONFIG_DIR . '/databases.ini.php';
         if (!is_readable($ini_file)) {
             throw new Exception('todo');
         }
         $databases = parse_ini_file($ini_file, true);
     }
     //Second, check for an existing connection
     if (isset($connections[$name])) {
         return $connections[$name];
     }
     //echo "Database name: $name<br />" . OS_ENDL;
     if (!isset($databases[$name])) {
         throw new Exception('That Database doesn\'t exist. Check in pagecraft.ini AND/OR databases.ini to see if you have properly configured PageCraft.');
     }
     //Finally, attempt to create a new connection
     if (!isset($databases[$name]['type'])) {
         throw new Exception('todo');
     }
     $class = $databases[$name]['type'] . '_Connection';
     $connections[$name] = new $class($databases[$name]);
     return $connections[$name];
 }
示例#21
0
 public function list_action()
 {
     if ($_GET['feature_id']) {
         $topic_ids = $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']);
     } else {
         $topic_ids = explode(',', $_GET['topic_id']);
     }
     if ($_GET['per_page']) {
         $per_page = intval($_GET['per_page']);
     } else {
         $per_page = get_setting('contents_per_page');
     }
     if ($_GET['sort_type'] == 'hot') {
         $posts_list = $this->model('posts')->get_hot_posts($_GET['post_type'], $_GET['category'], $topic_ids, $_GET['day'], $_GET['page'], $per_page);
     } else {
         $posts_list = $this->model('posts')->get_posts_list($_GET['post_type'], $_GET['page'], $per_page, $_GET['sort_type'], $topic_ids, $_GET['category'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
     }
     if (!is_mobile() and $posts_list) {
         foreach ($posts_list as $key => $val) {
             if ($val['answer_count']) {
                 $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
             }
         }
     }
     TPL::assign('posts_list', $posts_list);
     if (is_mobile()) {
         TPL::output('m/ajax/explore_list');
     } else {
         TPL::output('explore/ajax/list');
     }
 }
示例#22
0
 public function save_comment_action()
 {
     if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('指定文章不存在')));
     }
     if ($article_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已经锁定的文章不能回复')));
     }
     $message = trim($_POST['message'], "\r\n\t");
     if (!$message) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入回复内容')));
     }
     if (strlen($message) < get_setting('answer_length_lower')) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回复内容字数不得少于 %s 字节', get_setting('answer_length_lower'))));
     }
     if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($message)) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
     }
     if (human_valid('answer_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请填写正确的验证码')));
     }
     // !注: 来路检测后面不能再放报错提示
     if (!valid_post_hash($_POST['post_hash'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('页面停留时间过长,或内容已提交,请刷新页面')));
     }
     if ($this->publish_approval_valid()) {
         $this->model('publish')->publish_approval('article_comment', array('article_id' => intval($_POST['article_id']), 'message' => $message, 'at_uid' => intval($_POST['at_uid'])), $this->user_id);
         H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/article_id-' . intval($_POST['article_id']) . '__is_mobile-' . $_POST['_is_mobile'])), 1, null));
     } else {
         $comment_id = $this->model('publish')->publish_article_comment($_POST['article_id'], $message, $this->user_id, $_POST['at_uid']);
         $url = get_js_url('/article/' . intval($_POST['article_id']) . '?item_id=' . $comment_id);
         H::ajax_json_output(AWS_APP::RSM(array('url' => $url), 1, null));
     }
 }
示例#23
0
function get_available_money($config)
{
    $initial_money_str = get_setting($config, "InitialMoney");
    $initial_money = intval($initial_money_str["Value"]);
    $total_payment = data_get_total_payment($config);
    $total_receipt = data_get_total_receipt($config);
    return $initial_money - $total_payment + $total_receipt;
}
示例#24
0
 public function update_views($uid)
 {
     if (AWS_APP::cache()->get('update_views_people_' . md5(session_id()) . '_' . intval($uid))) {
         return false;
     }
     AWS_APP::cache()->set('update_views_people_' . md5(session_id()) . '_' . intval($uid), time(), get_setting('cache_level_normal'));
     return $this->query('UPDATE ' . $this->get_table('users') . ' SET views_count = views_count + 1 WHERE uid = ' . intval($uid));
 }
示例#25
0
 public function rule_action()
 {
     $this->crumb(AWS_APP::lang()->_t('%s 积分规则', get_setting('site_name')));
     if (get_setting('integral_system_enabled') != 'Y') {
         H::redirect_msg(AWS_APP::lang()->_t('本站未启用积分系统'), '/');
     }
     TPL::output('integral/rule');
 }
示例#26
0
 public function get_font()
 {
     if (!($captcha_fonts = AWS_APP::cache()->get('captcha_fonts'))) {
         $captcha_fonts = fetch_file_lists(AWS_PATH . 'core/fonts/');
         AWS_APP::cache()->set('captcha_fonts', $captcha_fonts, get_setting('cache_level_normal'));
     }
     return array_random($captcha_fonts);
 }
示例#27
0
function db_connect()
{
    $connection = mysql_connect(get_setting('db_server'), get_setting('db_username'), get_setting('db_password'));
    if (!$connection) {
        die('<strong>You were not able to connect to your database because ' . mysql_error() . '</strong>');
    }
    mysql_select_db(get_setting('db_database'));
}
示例#28
0
 public function index_action()
 {
     if (!$this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请先登录或注册')));
     }
     $this->per_page = get_setting('contents_per_page');
     if ($_GET['per_page']) {
         $this->per_page = intval($_GET['per_page']);
     }
     //$data = $this->model('myhome')->home_activity($this->user_id, (intval($_GET['page']) * $this->per_page) . ", {$this->per_page}");
     $data = $this->model('actions')->home_activity($this->user_id, intval($_GET['page']) * $this->per_page . ", {$this->per_page}");
     if (!is_array($data)) {
         $data = array();
     } else {
         $data_key = array('history_id', 'associate_action', 'user_info', 'answer_info', 'question_info', 'article_info', 'comment_info', 'add_time');
         $user_info_key = array('uid', 'user_name', 'signature');
         $article_info_key = array('id', 'title', 'message', 'comments', 'views', 'add_time');
         $answer_info_key = array('answer_id', 'answer_content', 'add_time', 'against_count', 'agree_count');
         $question_info_key = array('question_id', 'question_content', 'add_time', 'update_time', 'answer_count', 'agree_count');
         foreach ($data as $key => $val) {
             foreach ($val as $k => $v) {
                 if (!in_array($k, $data_key)) {
                     unset($data[$key][$k]);
                 }
             }
             if ($val['user_info']) {
                 foreach ($val['user_info'] as $k => $v) {
                     if (!in_array($k, $user_info_key)) {
                         unset($data[$key]['user_info'][$k]);
                     }
                 }
                 $data[$key]['user_info']['avatar_file'] = get_avatar_url($data[$key]['user_info']['uid'], 'mid');
             }
             if ($val['article_info']) {
                 foreach ($val['article_info'] as $k => $v) {
                     if (!in_array($k, $article_info_key)) {
                         unset($data[$key]['article_info'][$k]);
                     }
                 }
             }
             if ($val['answer_info']) {
                 foreach ($val['answer_info'] as $k => $v) {
                     if (!in_array($k, $answer_info_key)) {
                         unset($data[$key]['answer_info'][$k]);
                     }
                 }
             }
             if ($val['question_info']) {
                 foreach ($val['question_info'] as $k => $v) {
                     if (!in_array($k, $question_info_key)) {
                         unset($data[$key]['question_info'][$k]);
                     }
                 }
             }
         }
     }
     H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($data), 'rows' => array_values($data)), 1, null));
 }
示例#29
0
 public function __construct()
 {
     $this->setting = get_setting();
     $this->bduss = get_robot_bduss();
     // 黑名单加入小号,防止重复回复
     $this->setting[3] .= get_robot_name();
     $this->un = self::getun($this->bduss[0]);
     $this->cron();
 }
示例#30
0
 function info_get()
 {
     $result = array();
     $result["title"] = get_setting('fs_gen_site_title');
     $result["version"] = FOOLSLIDE_VERSION;
     $result["home_team"] = get_home_team()->to_array();
     $this->response($result, 200);
     // 200 being the HTTP response code
 }