function check_user_login() { global $ttH; $login = 0; $session_user_cur = Session::Get('user_cur', array()); $ttH->data['user_cur'] = isset($ttH->data['user_cur']) ? $ttH->data['user_cur'] : array(); if (count($ttH->data['user_cur']) >= 4) { if ($ttH->data['user_cur']["user_id"] == $session_user_cur["userid"] && $ttH->data['user_cur']["username"] == $session_user_cur["username"] && $ttH->data['user_cur']["password"] == $session_user_cur["password"] && $ttH->data['user_cur']["session"] == $session_user_cur["session"]) { return 1; } else { $arr_user = Session::Get('user_cur', array('userid' => '', 'username' => '', 'password' => '', 'session' => '')); return 0; } } else { $arr_user = Session::Get('user_cur', array('userid' => '', 'username' => '', 'password' => '', 'session' => '')); $query = "select * from user where is_show=1 and user_id='" . $arr_user["userid"] . "'"; //echo $query; $result = $ttH->db->query($query); if ($row = $ttH->db->fetch_row($result)) { if ($row["user_id"] == $arr_user["userid"] && $row["username"] == $arr_user["username"] && $row["password"] == $arr_user["password"] && $row["session"] == $arr_user["session"]) { $row['arr_address_book'] = unserialize($row['arr_address_book']); $ttH->data['user_cur'] = $row; $login = 1; } } } return $login; }
public function render() { ?> <table cellspacing="0" cellpadding="5"> <thead> <th>Key</th> <th>Value</th> </thead> <tbody> <?php foreach (Session::Get()->data as $key => $value) { ?> <tr> <td><?php echo $key; ?> </td> <td><?php if (is_array($value)) { print_r($value); } else { echo $value; } ?> </td> </tr> <?php } ?> </tbody> </table> <?php }
public function displayPage() { // Configure the theme Theme::Set('id', 'LogGridForRefresh'); Theme::Set('form_meta', '<input type="hidden" name="p" value="auditlog"><input type="hidden" name="q" value="Grid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager('LogGridForRefresh')); // Construct Filter Form if (Kit::IsFilterPinned('auditlog', 'Filter')) { $filter_pinned = 1; $filterFromDt = Session::Get('auditlog', 'filterFromDt'); $filterToDt = Session::Get('auditlog', 'filterToDt'); $filterUser = Session::Get('auditlog', 'filterUser'); $filterEntity = Session::Get('auditlog', 'filterEntity'); } else { $filter_pinned = 0; $filterFromDt = NULL; $filterToDt = NULL; $filterUser = NULL; $filterEntity = NULL; } // Fields $formFields = array(); $formFields[] = FormManager::AddDatePicker('filterFromDt', __('From Date'), $filterFromDt, NULL, 'f'); $formFields[] = FormManager::AddDatePicker('filterToDt', __('To Date'), $filterToDt, NULL, 't'); $formFields[] = FormManager::AddText('filterUser', __('User'), $filterUser, NULL, 'u'); $formFields[] = FormManager::AddText('filterEntity', __('Entity'), $filterEntity, NULL, 'e'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Call to render the template Theme::Set('header_text', __('Audit Trail')); Theme::Set('form_fields', $formFields); Theme::Render('grid_render'); }
/** * Controls which pages are to be displayed * @return */ function displayPage() { // Configure the theme $id = uniqid(); Theme::Set('id', $id); Theme::Set('displaygroup_form_add_url', 'index.php?p=displaygroup&q=AddForm'); Theme::Set('form_meta', '<input type="hidden" name="p" value="user"><input type="hidden" name="q" value="UserGrid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); if (Kit::IsFilterPinned('user_admin', 'Filter')) { $filter_pinned = 1; $filter_username = Session::Get('user_admin', 'filter_username'); $filter_usertypeid = Session::Get('user_admin', 'filter_usertypeid'); $filterRetired = Session::Get('user_admin', 'filterRetired'); } else { $filter_pinned = 0; $filter_username = NULL; $filter_usertypeid = NULL; $filterRetired = 0; } $formFields = array(); $formFields[] = FormManager::AddText('filter_username', __('Name'), $filter_username, NULL, 'n'); $usertypes = $this->db->GetArray("SELECT usertypeID, usertype FROM usertype ORDER BY usertype"); array_unshift($usertypes, array('usertypeID' => 0, 'usertype' => 'All')); $formFields[] = FormManager::AddCombo('filter_usertypeid', __('User Type'), $filter_usertypeid, $usertypes, 'usertypeID', 'usertype', NULL, 't'); $formFields[] = FormManager::AddCombo('filterRetired', __('Retired?'), $filterRetired, array(array('retiredId' => -1, 'retired' => 'All'), array('retiredId' => 1, 'retired' => 'Yes'), array('retiredId' => 0, 'retired' => 'No')), 'retiredId', 'retired', NULL, 'r'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Call to render the template Theme::Set('header_text', __('Users')); Theme::Set('form_fields', $formFields); Theme::Render('grid_render'); }
public function displayPage() { $db =& $this->db; // Default options if (Kit::IsFilterPinned('mediamanager', 'Filter')) { $filter_pinned = 1; $filter_layout_name = Session::Get('mediamanager', 'filter_layout_name'); $filter_region_name = Session::Get('mediamanager', 'filter_region_name'); $filter_media_name = Session::Get('mediamanager', 'filter_media_name'); $filter_type = Session::Get('mediamanager', 'filter_type'); } else { $filter_pinned = 0; $filter_layout_name = NULL; $filter_region_name = NULL; $filter_media_name = NULL; $filter_type = 0; } $id = uniqid(); Theme::Set('id', $id); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); Theme::Set('form_meta', '<input type="hidden" name="p" value="mediamanager"><input type="hidden" name="q" value="MediaManagerGrid">'); $formFields = array(); $formFields[] = FormManager::AddText('filter_layout_name', __('Layout'), $filter_layout_name, NULL, 'l'); $formFields[] = FormManager::AddText('filter_region_name', __('Region'), $filter_region_name, NULL, 'r'); $formFields[] = FormManager::AddText('filter_media_name', __('Media'), $filter_media_name, NULL, 'm'); $types = $db->GetArray("SELECT moduleid AS moduleid, Name AS module FROM `module` WHERE Enabled = 1 ORDER BY 2"); array_unshift($types, array('moduleid' => 0, 'module' => 'All')); $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, $types, 'moduleid', 'module', NULL, 't'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Call to render the template Theme::Set('header_text', __('Media Manager')); Theme::Set('form_fields', $formFields); Theme::Render('grid_render'); }
public static function GetNotice($type = self::MESSAGE_INDEX, $once = true) { $key = self::$messageKey . "_notice_{$type}"; $value = Session::Get($key, $once); $value = trim($value, ', '); return $value; }
function displayPage() { $db =& $this->db; // Configure the theme $id = uniqid(); Theme::Set('id', $id); Theme::Set('form_meta', '<input type="hidden" name="p" value="sessions"><input type="hidden" name="q" value="Grid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); // Construct Filter Form if (Kit::IsFilterPinned('sessions', 'Filter')) { $filter_pinned = 1; $filter_type = Session::Get('sessions', 'filter_type'); $filter_fromdt = Session::Get('sessions', 'filter_fromdt'); } else { $filter_pinned = 0; $filter_type = '0'; $filter_fromdt = NULL; } $formFields = array(); $formFields[] = FormManager::AddDatePicker('filter_fromdt', __('From Date'), $filter_fromdt, NULL, 't'); $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, array(array('typeid' => '0', 'type' => 'All'), array('typeid' => 'active', 'type' => 'Active'), array('typeid' => 'guest', 'type' => 'Guest'), array('typeid' => 'expired', 'type' => 'Expired')), 'typeid', 'type', NULL, 'd'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Call to render the template Theme::Set('header_text', __('Sessions')); Theme::Set('form_fields', $formFields); Theme::Render('grid_render'); }
/** * Return default skin path from configuration */ private static function GetDefault() { /** * Multilenguage Support */ $lang = Session::Get('lang'); if (!$lang) { $default = Configuration::Query("/configuration/skins/skin[@default='1']"); /* We should have one default skin */ if (!$default) { Error::Alert('Default Skin is not defined.'); } /* Default skin should have the language defined */ $lang = $default->item(0)->getAttribute('lang'); if (empty($lang)) { Error::Alert('Default Skin does not have a language defined.'); } Session::Set('lang', $lang); } // Util::debug($lang); $skin = Configuration::Query("/configuration/skins/skin[@lang='" . $lang . "']/path"); /* If there is not a skin for the language stored, something is really wrong */ if (!$skin) { Session::Destroy('lang'); Error::Alert('Could not load the skin for language "' . $lang . '".'); } $default = $skin->item(0)->nodeValue; $subdir = Configuration::Query('/configuration/domain/@subdir'); if ($subdir) { $default = '/' . $subdir->item(0)->nodeValue . $default; } return $default; }
public function __construct($request) { $this->session = Session::Get(); $this->request = $request; $this->metadata = AttributeReader::ClassAttributes($this); $this->setup(); }
/** * Display page logic */ function displayPage() { $db =& $this->db; // Default options if (Kit::IsFilterPinned('template', 'Filter')) { $pinned = 1; $name = Session::Get('template', 'filter_name'); $tags = Session::Get('template', 'filter_tags'); $showThumbnail = Session::Get('template', 'showThumbnail'); } else { $pinned = 0; $name = ''; $tags = ''; $showThumbnail = 1; } $id = uniqid(); Theme::Set('header_text', __('Templates')); Theme::Set('id', $id); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); Theme::Set('form_meta', '<input type="hidden" name="p" value="template"><input type="hidden" name="q" value="TemplateView">'); $formFields = array(); $formFields[] = FormManager::AddText('filter_name', __('Name'), $name, NULL, 'n'); $formFields[] = FormManager::AddText('filter_tags', __('Tags'), $tags, NULL, 't'); $formFields[] = FormManager::AddCheckbox('showThumbnail', __('Show Thumbnails'), $showThumbnail, NULL, 't'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $pinned, NULL, 'k'); Theme::Set('form_fields', $formFields); // Call to render the template Theme::Render('grid_render'); }
/** * Displays the page logic */ function displayPage() { $db =& $this->db; // Default options if (Kit::IsFilterPinned('content', 'Filter')) { Theme::Set('filter_pinned', 'checked'); Theme::Set('filter_name', Session::Get('content', 'filter_name')); Theme::Set('filter_type', Session::Get('content', 'filter_type')); Theme::Set('filter_retired', Session::Get('content', 'filter_retired')); Theme::Set('filter_owner', Session::Get('content', 'filter_owner')); Theme::Set('filter_duration_in_seconds', Session::Get('content', 'filter_duration_in_seconds')); Theme::Set('filter_duration_in_seconds_checked', Theme::Get('filter_duration_in_seconds') == 1 ? 'checked' : ''); } else { Theme::Set('filter_retired', 0); Theme::Set('filter_duration_in_seconds', 0); } Theme::Set('library_form_add_url', 'index.php?p=content&q=displayForms'); $id = uniqid(); Theme::Set('id', $id); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); Theme::Set('form_meta', '<input type="hidden" name="p" value="content"><input type="hidden" name="q" value="LibraryGrid">'); // Field list for a "retired" dropdown list Theme::Set('retired_field_list', array(array('retiredid' => 1, 'retired' => 'Yes'), array('retiredid' => 0, 'retired' => 'No'))); // Field list for a "owner" dropdown list Theme::Set('owner_field_list', $db->GetArray("SELECT 0 AS UserID, 'All' AS UserName UNION SELECT DISTINCT user.UserID, user.UserName FROM `media` INNER JOIN `user` ON media.UserID = user.UserID ")); // Module types filter $types = $db->GetArray("SELECT Module AS moduleid, Name AS module FROM `module` WHERE RegionSpecific = 0 AND Enabled = 1 ORDER BY 2"); array_unshift($types, array('moduleid' => '', 'module' => 'All')); Theme::Set('module_field_list', $types); // Call to render the template Theme::Render('library_page'); }
/** * Controls which pages are to be displayed * @return */ function displayPage() { // Configure the theme $id = uniqid(); Theme::Set('id', $id); Theme::Set('displaygroup_form_add_url', 'index.php?p=displaygroup&q=AddForm'); Theme::Set('form_meta', '<input type="hidden" name="p" value="user"><input type="hidden" name="q" value="UserGrid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); // Button URL's Theme::Set('user_form_add_url', 'index.php?p=user&q=DisplayForm'); Theme::Set('myapplications_form_add_url', 'index.php?p=user&q=MyApplications'); if (Kit::IsFilterPinned('user', 'Filter')) { Theme::Set('filter_pinned', 'checked'); Theme::Set('filter_username', Session::Get('user', 'filter_username')); Theme::Set('filter_usertypeid', Session::Get('user', 'filter_usertypeid')); } else { Theme::Set('filter_usertypeid', 0); } // List of Displays this user has permission for $usertypes = $this->db->GetArray("SELECT usertypeID, usertype FROM usertype ORDER BY usertype"); array_unshift($usertypes, array('usertypeID' => 0, 'usertype' => 'All')); Theme::Set('usertype_field_list', $usertypes); // Render the Theme and output Theme::Render('user_page'); }
public function cerrar() { $bitacora_inicio_cerrar = $this->_admin->bitacora_login_cerrar(Session::Get('id_usuario')); //Se destruyen todas las variables de sesión Session::destroy(); //Se redirecciona a otra página $this->redireccionar('principal/principal'); }
/** * Constructor * * @param Component Parent component, null if none. */ public function __construct(View $view = null, $content = null) { $this->view = $view; if ($view) { $this->controller = $view->controller; } $this->session = Session::Get(); $this->content = $content; }
/** * Get the login user id in wap * @author abei <*****@*****.**> * @version 20131028 */ static public function GetBizLoginId(){ $bizer_id = abs(intval(Session::Get('partner_mobile_id'))); if (!$bizer_id) { $bizer = self::GetRemeberPwdForWapBiz(); $bizer_id = $bizer['id']; } if ($bizer_id) self::BizLogin($bizer_id); return $bizer_id; }
public function index() { if (Session::Get('autenticado_adminsciocco') == true) { Session::set('modulo', "admin"); $this->_view->titulo = 'Panel Administrativo'; $this->_view->navegacion = ''; $this->_view->renderizar('index', "panel"); } else { $this->redireccionar('admin'); } }
/** * Global exception handler */ function exception_handler($exception) { // TODO: Error logging via email, page redirect on error try { uses_system('mail/mail'); $session = Session::Get(); email('error/exception', '*****@*****.**', '*****@*****.**', '[EXCEPTION] ' . $exception->getMessage(), array('session' => $session, 'exception' => $exception)); } catch (Exception $ex) { } include PATH_PUB . 'ohnoes.html'; }
public static function GetLoginId() { $user_id = abs(intval(Session::Get('user_id'))); if (!$user_id) { $u = ZUser::GetLoginCookie(self::$cookie_name); $user_id = abs(intval($u['id'])); } if ($user_id) { self::Login($user_id); } return $user_id; }
public function displayPage() { $db =& $this->db; // Configure the theme $id = uniqid(); Theme::Set('id', 'LogGridForRefresh'); Theme::Set('form_meta', '<input type="hidden" name="p" value="log"><input type="hidden" name="q" value="Grid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager('LogGridForRefresh')); // Construct Filter Form if (Kit::IsFilterPinned('log', 'Filter')) { $filter_pinned = 1; $filter_type = Session::Get('log', 'filter_type'); $filter_page = Session::Get('log', 'filter_page'); $filter_function = Session::Get('log', 'filter_function'); $filter_display = Session::Get('log', 'filter_display'); $filter_fromdt = Session::Get('log', 'filter_fromdt'); $filter_seconds = Session::Get('log', 'filter_seconds'); $filter_intervalTypeId = Session::Get('log', 'filter_intervalTypeId'); } else { $filter_pinned = 0; $filter_type = 0; $filter_page = NULL; $filter_function = NULL; $filter_display = 0; $filter_fromdt = NULL; $filter_seconds = 120; $filter_intervalTypeId = 1; } // Two tabs $tabs = array(); $tabs[] = FormManager::AddTab('general', __('General')); $tabs[] = FormManager::AddTab('advanced', __('Advanced')); $formFields = array(); $formFields['general'][] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, array(array('typeid' => 0, 'type' => 'All'), array('typeid' => 2, 'type' => 'Audit'), array('typeid' => 1, 'type' => 'Error')), 'typeid', 'type', NULL, 't'); $formFields['general'][] = FormManager::AddCombo('filter_intervalTypeId', __('Interval'), $filter_intervalTypeId, array(array('intervalTypeid' => 1, 'intervalType' => __('Seconds')), array('intervalTypeid' => 60, 'intervalType' => __('Minutes')), array('intervalTypeid' => 3600, 'intervalType' => __('Hours'))), 'intervalTypeid', 'intervalType', NULL, 'i'); $formFields['general'][] = FormManager::AddText('filter_seconds', __('Duration back'), $filter_seconds, NULL, 's'); $formFields['general'][] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Advanced Tab $formFields['advanced'][] = FormManager::AddDatePicker('filter_fromdt', __('From Date'), $filter_fromdt, NULL, 't'); $formFields['advanced'][] = FormManager::AddText('filter_page', __('Page'), $filter_page, NULL, 'p'); $formFields['advanced'][] = FormManager::AddText('filter_function', __('Function'), $filter_function, NULL, 'f'); // Display $displays = $this->user->DisplayList(); array_unshift($displays, array('displayid' => 0, 'display' => 'All')); $formFields['advanced'][] = FormManager::AddCombo('filter_display', __('Display'), $filter_display, $displays, 'displayid', 'display', NULL, 't'); // Call to render the template Theme::Set('header_text', __('Logs')); Theme::Set('form_tabs', $tabs); Theme::Set('form_fields_general', $formFields['general']); Theme::Set('form_fields_advanced', $formFields['advanced']); Theme::Render('grid_render'); }
public function getAccessToken($code) { $params = array('grant_type' => 'authorization_code', 'client_id' => $this->consumer->key, 'redirect_uri' => Session::Get('redirect_uri'), 'client_secret' => $this->consumer->secret, 'code' => $code); $response = parent::http($this->accessTokenURL(), 'POST', $params); if ($this->format === 'json' && $this->decode_json) { $response = json_decode($response, true); $response['oauth_token'] = $response['access_token']; $response['oauth_token_secret'] = $response['refresh_token']; $this->token = new OAuthConsumer($response['oauth_token'], $response['oauth_token_secret']); return $response; } return $response; }
/** * Displays the page logic */ function displayPage() { $db =& $this->db; // Default options if (Kit::IsFilterPinned('content', 'Filter')) { $filter_pinned = 1; $filter_name = Session::Get('content', 'filter_name'); $filterId = Session::Get('content', 'fiterId'); $filter_type = Session::Get('content', 'filter_type'); $filter_retired = Session::Get('content', 'filter_retired'); $filter_owner = Session::Get('content', 'filter_owner'); $filter_duration_in_seconds = Session::Get('content', 'filter_duration_in_seconds'); $showTags = Session::Get('content', 'showTags'); $filter_showThumbnail = Session::Get('content', 'filter_showThumbnail'); } else { $filter_pinned = 0; $filter_name = NULL; $filterId = NULL; $filter_type = NULL; $filter_retired = 0; $filter_owner = NULL; $filter_duration_in_seconds = 0; $filter_showThumbnail = 0; $showTags = 0; } $id = uniqid(); Theme::Set('id', $id); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); Theme::Set('form_meta', '<input type="hidden" name="p" value="content"><input type="hidden" name="q" value="LibraryGrid">'); $formFields = array(); $formFields[] = FormManager::AddText('filter_name', __('Name'), $filter_name, NULL, 'n'); $formFields[] = FormManager::AddText('filterId', __('ID'), $filterId, NULL, 'i'); // Users we have permission to see $users = $this->user->userList(); array_unshift($users, array('userid' => '', 'username' => 'All')); $formFields[] = FormManager::AddCombo('filter_owner', __('Owner'), $filter_owner, $users, 'userid', 'username', NULL, 'o'); $types = $db->GetArray("SELECT Module AS moduleid, Name AS module FROM `module` WHERE RegionSpecific = 0 AND Enabled = 1 ORDER BY 2"); array_unshift($types, array('moduleid' => '', 'module' => 'All')); $formFields[] = FormManager::AddCombo('filter_type', __('Type'), $filter_type, $types, 'moduleid', 'module', NULL, 'y'); $formFields[] = FormManager::AddCombo('filter_retired', __('Retired'), $filter_retired, array(array('retiredid' => 1, 'retired' => 'Yes'), array('retiredid' => 0, 'retired' => 'No')), 'retiredid', 'retired', NULL, 'r'); $formFields[] = FormManager::AddCheckbox('filter_duration_in_seconds', __('Duration in Seconds'), $filter_duration_in_seconds, NULL, 's'); $formFields[] = FormManager::AddCheckbox('showTags', __('Show Tags'), $showTags, NULL, 't'); $formFields[] = FormManager::AddCheckbox('filter_showThumbnail', __('Show Thumbnails'), $filter_showThumbnail, NULL, 't'); $formFields[] = FormManager::AddCheckbox('XiboFilterPinned', __('Keep Open'), $filter_pinned, NULL, 'k'); // Call to render the template Theme::Set('header_text', __('Library')); Theme::Set('form_fields', $formFields); Theme::Render('grid_render'); }
public static function Version() { /** * Multi version Support */ $version = Session::Get('version'); // If version is not set, take the last if (!$version) { $list = self::Source(); $version = end($list); Session::Set('version', $version); } return $version; }
/** * Constructor * * @param string $root The root uri path * @param array $segments The uri segments following the root path */ public function __construct($root,$segments) { $this->session=Session::Get(); $this->uri=new URI($root,$segments); $this->query=new Query(); // assign the get and post vars $this->post=Input::Post(); $this->get=Input::Get(); $this->files=Input::Files(); $this->setup(); }
public function soap($async = false, $username = null, $password = null, $serial = null) { $session = Session::Get(); if ($username === null) { $username = $session->getSOAPUsername() ?: $this->getUsername(); } if ($password === null) { $password = $session->getSOAPPassword() ?: $this->getPassword(); } $options = array('location' => $this->getAddress() . '/remote/', 'uri' => 'urn:halon', 'login' => $username, 'password' => $password, 'connection_timeout' => 3, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'compression' => SOAP_COMPRESSION_ACCEPT | (SOAP_COMPRESSION_GZIP | 0)); if ($async) { return new SoapClientAsync($options['location'] . '?wsdl', $options); } return new SoapClient($options['location'] . '?wsdl', $options); }
/** * Display page logic */ function displayPage() { // Configure the theme $id = uniqid(); Theme::Set('id', $id); Theme::Set('usergroup_form_add_url', 'index.php?p=group&q=GroupForm'); Theme::Set('form_meta', '<input type="hidden" name="p" value="group"><input type="hidden" name="q" value="Grid">'); Theme::Set('filter_id', 'XiboFilterPinned' . uniqid('filter')); Theme::Set('pager', ResponseManager::Pager($id)); // Default options if (Kit::IsFilterPinned('usergroup', 'Filter')) { Theme::Set('filter_pinned', 'checked'); Theme::Set('filter_name', Session::Get('usergroup', 'filter_name')); } // Render the Theme and output Theme::Render('usergroup_page'); }
/** * 获取登陆用户 */ public static function GetLoginUser() { $sessionKey = SESSION_LOGIN_USER; $cookieKey = COOKIE_USER_ID; $user = Session::Get($sessionKey); if ($user) { return $user; } $userID = Cookie::Get($cookieKey); if ($userID) { $user = self::Fetch($userID); if ($user) { self::SaveUser($user); return $user; } } return false; }
function __construct() { global $login_user; global $partner; // login as customer if ($this->_get('token')) { $cmd_user_id_viapm = intval(Crypt::de($this->_get('token'))); $login_user = D('CmsUsers')->getById($cmd_user_id_viapm); Session::Set("login_user", $login_user); Session::Set("via_pm", 1); } else { $login_user = Session::Get("login_user"); } if (!empty($login_user)) { $this->assign("login_user", $login_user); $user_info = D(PM_NAME . "://UserInfo")->getUserInfo($login_user['id']); if ($user_info && !$user_info['birthday']) { $user_info['birthday'] = '1990-01-01'; // if(!$user_info['submit_time']) { // $user_info['submit_time'] = date('Y-m-d'); // } } $this->user_info = $this->userinfo = $user_info; define(USER_ID, $login_user['id']); } else { redirect("/"); } $options = M("Options")->where("autoload = 'Y'")->select(); $INI = array(); foreach ($options as $index => $option) { $INI[$option['option_name']] = $option['option_value']; } $this->assign("INI", $INI); // 安全过滤 foreach ($_POST as $k => $v) { if (!is_array($v)) { $v = preg_replace('/script.*?\\/script/is', '', $v); $v = preg_replace('/alert\\(.*?\\)/is', '', $v); $v = str_replace(array('eval', 'function', 'onerror', 'alert'), '', $v); // $_POST[$k] = htmlspecialchars($v); } } // $this->user_info_items = $this->get_user_info(); }
/** * 模拟登录 */ public function Login($verify_code = NULL) { if (empty($this->blogname)) { return '绑定账号失败:请填写Widget ID'; } $data = array('form_email' => $this->account['username'], 'form_password' => $this->account['password'], 'redir' => 'http://success', 'remember' => 'on'); if ($verify_code) { $data['captcha-solution'] = $verify_code; $data['captcha-id'] = Session::Get('douban_chapcha_id'); } $ret = $this->post("https://www.douban.com/accounts/login", $data); if (str_contains($this->http_header['Location'], 'requirecaptcha') || str_contains($this->http_header['Location'], 'error=1011')) { return '绑定账号失败:请输入验证码'; } if ($this->http_header['Location'] != $data['redir']) { return '绑定账号失败:用户名或密码错误'; } return true; }
public static function select($name, $list = array(), $selected = null, $title = "", $show_key_name = 'name', $show_pk_name = 'id') { $default[] = "<option value='0' selected>-请选择{$title}-</option>"; if ($selected === null) { if (isset($_REQUEST[$name]) && $_REQUEST[$name]) { $selected = RequestParam::Request($name); } elseif (Session::Exists(SESSION_LAST_POST)) { $last_post = Session::Get(SESSION_LAST_POST); $selected = array_get($last_post, $name); } } if (!empty($list)) { foreach ($list as $one) { $selectedStyle = $one[$show_pk_name] == $selected ? 'selected' : ''; $default[] = sprintf('<option value="%s" %s>%s</option>', $one[$show_pk_name], $selectedStyle, $one[$show_key_name]); } } return join('', $default); }
public function resend_email() { $id = intval(Crypt::de($this->_get('id'))); $user = D("CmsUsers")->getById($id); if (!$id || !$user) { Session::Set('error', 'ID参数有误'); redirect('/register/preview_verify_email'); } // 最小30S间隔 $last_send_time = Session::Get('register_resend_email_timestamp'); if (time() - $last_send_time < 30) { Session::Set('error', '重发邮件间隔至少需要30秒'); redirect('/register/preview_verify_email?token=' . Crypt::en($id . '||' . $user['email'])); } // 发信 $this->send_verify_mail($id, $user['email'], $user['secret']); Session::Set('register_resend_email_timestamp', time()); redirect('/register/preview_verify_email?token=' . Crypt::en($id . '||' . $user['email'])); }