function __construct() { parent::Controller(); $this->load->helper('url'); $this->load->helper('web_apps'); $this->load->config('kals'); if ($this->controller_enable_cache) { $this->_enable_cache(); } create_context(); if ($this->login_require === TRUE) { login_require(true); } }
function __construct() { parent::Controller(); $this->load->library('kals_actor/User'); $this->load->helper('url'); $this->load->helper('web_apps'); $this->load->config('kals'); if ($this->controller_enable_cache) { $this->_enable_cache(); } create_context(); if ($this->login_require === TRUE) { login_require(true); } $this->lang->load('kals_mobile_apps'); $this->lang->load('kals_web_apps'); $this->client_ip = array('ip' => get_client_ip(), 'browser' => $_SERVER['HTTP_USER_AGENT']); }
public function check_login($callback) { $output = FALSE; //$action = 1; $action = "login.check.success"; $user_id = NULL; if (login_require(FALSE)) { //表示有登入喔! $user = get_context_user(); set_context_user($user); $output = $this->_parse_user_output($user, FALSE); $user_id = $user->get_id(); } else { $output = $this->_create_default_data(); //$action = 2; $action = "login.check.failed"; } $memo = $this->client_ip; kals_log($this->db, $action, array('memo' => $memo, 'user_id' => $user_id)); context_complete(); return $this->_display_jsonp($output, $callback); }
/** * 檢查權限allow_logined * @param boolean $config */ private function _auth_check_allow_logined($config) { if ($config === TRUE) { login_require(true); } }
<?php require 'require.php'; session_name($_CONFIG['session_name']); session_start(); messages(); login_require(); params(); set_language(); action();
function __construct() { parent::__construct(); //檢查是否已經登入,未登入則丟出例外訊息 login_require(); }
/** * 用跟my一樣的方式回傳範圍,只是這次不限制只有my * @author Pulipuli Chen <*****@*****.**> 20151101 * @return array(0=> "basic", 1=> "custom") */ function other($json = NULL, $callback = NULL) { $check_time = NULL; if (isset($callback)) { $check_time = json_to_object($json); } else { $callback = $json; } //login_require(true); if (login_require(FALSE) === FALSE) { $output_data = array('basic' => array(), 'custom' => array()); return $this->_display_jsonp($output_data, $callback); } $user = get_context_user(); $type_scope_colls = array(); /** * @var array 自訂的類型 */ $custom_type_scope_colls = array(); $search = new Search_annotation_collection(); $search->set_target_topic(TRUE); $search->set_target_referer_webpage(); if (isset($check_time)) { $search->set_target_newer_update($check_time); } // 按照時間排序 $search->add_order(6, FALSE); //test_msg('準備要取得資料嚕'); //取得搜尋結果 foreach ($search as $annotation) { $annotation_type = $annotation->get_type(); $annotation_type_id = $annotation_type->get_type_id(); $annotation_type_name = $annotation_type->get_custom_name(); $is_basic = $annotation_type->is_basic(); //test_msg('is_basic', array($is_basic, $annotation_type_id, $annotation->get_id()) ); $annotation_scope_coll = $annotation->get_scopes(); if ($is_basic == true) { if (isset($type_scope_colls[$annotation_type_id]) === false) { $type_scope_colls[$annotation_type_id] = new Annotation_scope_collection(); } foreach ($type_scope_colls as $type_id => $scope_coll) { if ($annotation_type_id === $type_id) { foreach ($annotation_scope_coll as $scope) { $scope_coll->add_scope($scope); } } else { foreach ($annotation_scope_coll as $scope) { $scope_coll->exclude_scope($scope); } } } } else { if (isset($custom_type_scope_colls[$annotation_type_name]) === false) { //test_msg($annotation_type_name); $custom_type_scope_colls[$annotation_type_name] = new Annotation_scope_collection(); } foreach ($custom_type_scope_colls as $type_name => $scope_coll) { if ($annotation_type_name === $type_name) { foreach ($annotation_scope_coll as $scope) { $scope_coll->add_scope($scope); } } else { foreach ($annotation_scope_coll as $scope) { $scope_coll->exclude_scope($scope); } } } } // else { //test_msg('標註3', array($annotation_type_id, $annotation)); } //test_msg('完成取得標註'); $output_data = array('basic' => array(), 'custom' => array()); foreach ($type_scope_colls as $type_id => $scope_coll) { //這是給basic的! $output_data['basic'][$type_id] = $scope_coll->export_webpage_data($this->url); } foreach ($custom_type_scope_colls as $type_id => $scope_coll) { //這是給custom的! $output_data['custom'][$type_id] = $scope_coll->export_webpage_data($this->url); } return $this->_display_jsonp($output_data, $callback); }