本文整理汇总了PHP中setSession函数的典型用法代码示例。如果您正苦于以下问题:PHP setSession函数的具体用法?PHP setSession怎么用?PHP setSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setSession函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doLogin
/**
* 执行登录
*/
public function doLogin()
{
$condition['name'] = $username = trim($_POST['username']);
$condition['password'] = $password = md5(trim($_POST['password']));
//稍后在加验证码验证逻辑
//$imgCode = $_POST['imgCode'];
if (empty($username) || empty($password)) {
$this->ajaxReturn(null, C("ERR_MSG_70"), "success:false");
}
$user = D("User")->relation(true)->where($condition)->find();
if (empty($user)) {
$this->ajaxReturn(null, "用户名或者密码错误", "success:false");
}
if (empty($user['apps']) && $user['role'] != UserModel::ADMIN) {
$this->ajaxReturn(null, '该用户不属于任何一个APP,不允许登录,请联系管理员!', 'success:false');
}
if (empty($user)) {
$this->ajaxReturn(null, C("ERR_MSG_70"), "success:false");
}
$defaultAppId = $user['defaultApp'] >= 0 ? $user['defaultApp'] : $user['apps'][0]['id'];
foreach ($user['apps'] as $app) {
if ($app['id'] == $defaultAppId) {
$appName = $app['appName'];
break;
}
}
$session = array('uid' => $user['id'], 'username' => $username, 'role' => $user['role'], 'appId' => $defaultAppId, 'appName' => $appName);
setSession($session);
$this->ajaxReturn($data, "恭喜,登录成功!", "success:true");
}
开发者ID:john1688,项目名称:BAT,代码行数:33,代码来源:LoginAction.class.php
示例2: authenticate
public function authenticate(SecurityContextInterface $context)
{
$token = $this->generateEmptyToken();
$client = null;
try {
$client = $this->userAuthenticationProvider->loadClientByCredentials($token->getClient()->getCredentials());
} catch (ClientCredentialsNotFoundException $e) {
$this->logger->addAlert('Client not found ' . $e->getMessage());
throw $e;
}
//validate the client, if good then add to the context
if (!is_null($client)) {
if ($this->statusIsLocked($client)) {
$this->container->get('EventDispatcher')->dispatch(__YML_KEY, 'login_status_locked', array('client' => $client));
setSession('_security_secured_area', null);
} elseif (!$this->checkPasswordsMatch($client->getPassword(), $token->getClient()->getPassword())) {
$this->container->get('EventDispatcher')->dispatch(__YML_KEY, 'login_password_mismatch', array('client' => $client));
} elseif (!$this->checkStatus($client)) {
$this->container->get('EventDispatcher')->dispatch(__YML_KEY, 'login_status_not_active', array('client' => $client));
}
$token->setClient($client);
}
$context->setToken($token);
setSession('_security_secured_area', serialize($token));
$this->container->set('securityContext', 'core\\components\\security\\core\\SecurityContext', $context);
}
开发者ID:dmeikle,项目名称:gossamerCMS-application,代码行数:26,代码来源:UserLoginManager.php
示例3: authenticate
function authenticate($uid, $pwd)
{
/*if ($pwd)
{
$ds = ldap_connect("172.31.1.42");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$a = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "uid=$uid" );
$b = ldap_get_entries( $ds, $a );
if(count($b) > 1)
$dn = $b[0]["dn"];
else
return 0;
$ldapbind=@ldap_bind($ds, $dn, $pwd);
if ($ldapbind) {
return 1;
setSession($uid);
}
else
return 0;
ldap_close($ds);
}
else
return 0;*/
setSession($uid);
return 1;
}
开发者ID:RonishKalia,项目名称:Feedback-Portal,代码行数:29,代码来源:sessionFunctions.php
示例4: Grid
function Grid()
{
$response = new ResponseManager();
$filterUser = Kit::GetParam('filterUser', _REQUEST, _STRING);
$filterEntity = Kit::GetParam('filterEntity', _REQUEST, _STRING);
$filterFromDt = Kit::GetParam('filterFromDt', _REQUEST, _STRING);
$filterToDt = Kit::GetParam('filterToDt', _REQUEST, _STRING);
setSession('auditlog', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
setSession('auditlog', 'filterFromDt', $filterFromDt);
setSession('auditlog', 'filterToDt', $filterToDt);
setSession('auditlog', 'filterUser', $filterUser);
setSession('auditlog', 'filterEntity', $filterEntity);
$search = array();
// Get the dates and times
if ($filterFromDt == '') {
$fromTimestamp = new DateTime();
$fromTimestamp = $fromTimestamp->sub(new DateInterval("P1D"));
} else {
$fromTimestamp = DateTime::createFromFormat('Y-m-d', $filterFromDt);
$fromTimestamp->setTime(0, 0, 0);
}
if ($filterToDt == '') {
$toTimestamp = new DateTime();
} else {
$toTimestamp = DateTime::createFromFormat('Y-m-d', $filterToDt);
$toTimestamp->setTime(0, 0, 0);
}
$search[] = array('fromTimeStamp', $fromTimestamp->format('U'));
$search[] = array('toTimeStamp', $toTimestamp->format('U'));
if ($filterUser != '') {
$search[] = array('userName', $filterUser);
}
if ($filterEntity != '') {
$search[] = array('entity', $filterEntity);
}
// Build the search string
$search = implode(' ', array_map(function ($element) {
return implode('|', $element);
}, $search));
$cols = array(array('name' => 'logId', 'title' => __('ID')), array('name' => 'logDate', 'title' => __('Date')), array('name' => 'userName', 'title' => __('User')), array('name' => 'entity', 'title' => __('Entity')), array('name' => 'message', 'title' => __('Message')), array('name' => 'objectAfter', 'title' => __('Object'), 'array' => true));
Theme::Set('table_cols', $cols);
$rows = \Xibo\Factory\AuditLogFactory::query('logId', array('search' => $search));
// Do some post processing
foreach ($rows as $row) {
/* @var \Xibo\Entity\AuditLog $row */
$row->logDate = DateManager::getLocalDate($row->logDate);
$row->objectAfter = json_decode($row->objectAfter);
}
Theme::Set('table_rows', json_decode(json_encode($rows), true));
$output = Theme::RenderReturn('table_render');
$response->initialSortOrder = 2;
$response->initialSortColumn = 1;
$response->pageSize = 20;
$response->SetGridResponse($output);
$response->Respond();
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:56,代码来源:auditlog.class.php
示例5: setDefaultLocale
public function setDefaultLocale($locale)
{
$userPreferences = getSession('userPreferences');
if (is_null($userPreferences) || !is_array($userPreferences)) {
$userPreferences = array();
}
$locales = $this->httpRequest->getAttribute('locales');
$userPreferences['defaultLocale'] = $locales[$locale];
setSession('userPreferences', $userPreferences);
}
开发者ID:dmeikle,项目名称:gossamerCMS-application,代码行数:10,代码来源:LocaleModel.php
示例6: Grid
function Grid()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$type = Kit::GetParam('filter_type', _POST, _WORD);
$fromdt = Kit::GetParam('filter_fromdt', _POST, _STRING);
///get the dates and times
if ($fromdt != '') {
$start_date = explode("/", $fromdt);
// dd/mm/yyyy
$starttime_timestamp = strtotime($start_date[1] . "/" . $start_date[0] . "/" . $start_date[2] . ' ' . date("H", time()) . ":" . date("i", time()) . ':59');
}
setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
setSession('sessions', 'filter_type', $type);
setSession('sessions', 'filter_fromdt', $fromdt);
$SQL = "SELECT session.userID, user.UserName, IsExpired, LastPage, session.LastAccessed, RemoteAddr, UserAgent ";
$SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
$SQL .= "WHERE 1 = 1 ";
if ($fromdt != '') {
$SQL .= sprintf(" AND session_expiration < '%s' ", $starttime_timestamp);
}
if ($type == "active") {
$SQL .= " AND IsExpired = 0 ";
}
if ($type == "expired") {
$SQL .= " AND IsExpired = 1 ";
}
if ($type == "guest") {
$SQL .= " AND session.userID IS NULL ";
}
// Load results into an array
$log = $db->GetArray($SQL);
if (!is_array($log)) {
trigger_error($db->error());
trigger_error(__('Error getting the log'), E_USER_ERROR);
}
$rows = array();
foreach ($log as $row) {
$row['userid'] = Kit::ValidateParam($row['userID'], _INT);
$row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
$row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 0 ? 'icon-ok' : 'icon-remove';
$row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
$row['lastaccessed'] = Kit::ValidateParam($row['LastAccessed'], _STRING);
$row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
$row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
// Edit
$row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
$output = Theme::RenderReturn('sessions_page_grid');
$response->SetGridResponse($output);
$response->Respond();
}
开发者ID:abbeet,项目名称:server39,代码行数:55,代码来源:sessions.class.php
示例7: TemplateView
/**
* Data grid
*/
function TemplateView()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$filter_name = Kit::GetParam('filter_name', _POST, _STRING);
$filter_tags = Kit::GetParam('filter_tags', _POST, _STRING);
setSession('template', 'filter_name', $filter_name);
setSession('template', 'filter_tags', $filter_tags);
setSession('template', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
// Show filter_showThumbnail
$showThumbnail = Kit::GetParam('showThumbnail', _POST, _CHECKBOX);
setSession('layout', 'showThumbnail', $showThumbnail);
$templates = $user->TemplateList(null, array('layout' => $filter_name, 'tags' => $filter_tags));
if (!is_array($templates)) {
trigger_error(__('Unable to get list of templates for this user'), E_USER_ERROR);
}
$cols = array(array('name' => 'layout', 'title' => __('Name')), array('name' => 'owner', 'title' => __('Owner')), array('name' => 'descriptionWithMarkup', 'title' => __('Description')), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $showThumbnail == 0), array('name' => 'permissions', 'title' => __('Permissions')));
Theme::Set('table_cols', $cols);
$rows = array();
foreach ($templates as $template) {
$template['permissions'] = $this->GroupsForTemplate($template['campaignid']);
$template['owner'] = $user->getNameFromID($template['ownerid']);
$template['thumbnail'] = '';
if ($showThumbnail == 1 && $template['backgroundImageId'] != 0) {
$template['thumbnail'] = '<a class="img-replace" data-toggle="lightbox" data-type="image" data-img-src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $template['backgroundImageId'] . '&width=100&height=100&dynamic=true&thumb=true" href="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $template['backgroundImageId'] . '"><i class="fa fa-file-image-o"></i></a>';
}
$template['buttons'] = array();
// Parse down for description
$template['descriptionWithMarkup'] = Parsedown::instance()->text($template['description']);
if ($template['edit']) {
// Edit Button
$template['buttons'][] = array('id' => 'template_button_edit', 'url' => 'index.php?p=template&q=EditForm&modify=true&layoutid=' . $template['layoutid'], 'text' => __('Edit'));
}
if ($template['del']) {
// Delete Button
$template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=DeleteTemplateForm&layoutid=' . $template['layoutid'], 'text' => __('Delete'));
}
if ($template['modifyPermissions']) {
// Permissions Button
$template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=campaign&q=PermissionsForm&CampaignID=' . $template['campaignid'], 'text' => __('Permissions'));
}
$template['buttons'][] = array('linkType' => 'divider');
// Export Button
$template['buttons'][] = array('id' => 'layout_button_export', 'linkType' => '_self', 'url' => 'index.php?p=layout&q=Export&layoutid=' . $template['layoutid'], 'text' => __('Export'));
// Add this row to the array
$rows[] = $template;
}
Theme::Set('table_rows', $rows);
$response->SetGridResponse(Theme::RenderReturn('table_render'));
$response->Respond();
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:55,代码来源:template.class.php
示例8: authenticate
function authenticate($username, $password)
{
$passwordcrypt = ENCRYPT . $password;
$passwordcrypt = SHA1($passwordcrypt);
$sql = "SELECT * FROM users WHERE username = :username AND password = :password AND isactive = 1 AND isdeleted = 0";
$params = array(':username' => $username, ':password' => $passwordcrypt);
$result = DatabaseHandler::GetAll($sql, $params);
if (count($result) > 0) {
setSession($username);
return 1;
}
return 0;
}
开发者ID:shubhamsharma24,项目名称:Website-EffervescenceMMXIV,代码行数:13,代码来源:sessionFunctions.php
示例9: login
function login($userid, $userpassword)
{
//check password for login
$password = getUserpassword($userid);
if (empty($password)) {
echo "ID not found!";
} else {
if ($password == $userpassword) {
echo "login success!";
setSession($userid, getUsername($userid), getUsertype($userid));
}
}
}
开发者ID:tenling,项目名称:2016-SE_project-RMS_system,代码行数:13,代码来源:user_control.php
示例10: Grid
function Grid()
{
$db =& $this->db;
$response = new ResponseManager();
$type = Kit::GetParam('filter_type', _POST, _WORD);
$fromDt = Kit::GetParam('filter_fromdt', _POST, _STRING);
setSession('sessions', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
setSession('sessions', 'filter_type', $type);
setSession('sessions', 'filter_fromdt', $fromDt);
$SQL = "SELECT session.userID, user.UserName, IsExpired, LastPage, session.LastAccessed, RemoteAddr, UserAgent ";
$SQL .= "FROM `session` LEFT OUTER JOIN user ON user.userID = session.userID ";
$SQL .= "WHERE 1 = 1 ";
if ($fromDt != '') {
// From Date is the Calendar Formatted DateTime in ISO format
$SQL .= sprintf(" AND session.LastAccessed < '%s' ", DateManager::getMidnightSystemDate(DateManager::getTimestampFromString($fromDt)));
}
if ($type == "active") {
$SQL .= " AND IsExpired = 0 ";
}
if ($type == "expired") {
$SQL .= " AND IsExpired = 1 ";
}
if ($type == "guest") {
$SQL .= " AND session.userID IS NULL ";
}
// Load results into an array
$log = $db->GetArray($SQL);
Debug::LogEntry('audit', $SQL);
if (!is_array($log)) {
trigger_error($db->error());
trigger_error(__('Error getting the log'), E_USER_ERROR);
}
$cols = array(array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'isexpired', 'title' => __('Active'), 'icons' => true), array('name' => 'username', 'title' => __('User Name')), array('name' => 'lastpage', 'title' => __('Last Page')), array('name' => 'ip', 'title' => __('IP Address')), array('name' => 'browser', 'title' => __('Browser')));
Theme::Set('table_cols', $cols);
$rows = array();
foreach ($log as $row) {
$row['userid'] = Kit::ValidateParam($row['userID'], _INT);
$row['username'] = Kit::ValidateParam($row['UserName'], _STRING);
$row['isexpired'] = Kit::ValidateParam($row['IsExpired'], _INT) == 1 ? 0 : 1;
$row['lastpage'] = Kit::ValidateParam($row['LastPage'], _STRING);
$row['lastaccessed'] = DateManager::getLocalDate(strtotime(Kit::ValidateParam($row['LastAccessed'], _STRING)));
$row['ip'] = Kit::ValidateParam($row['RemoteAddr'], _STRING);
$row['browser'] = Kit::ValidateParam($row['UserAgent'], _STRING);
// Edit
$row['buttons'][] = array('id' => 'sessions_button_logout', 'url' => 'index.php?p=sessions&q=ConfirmLogout&userid=' . $row['userid'], 'text' => __('Logout'));
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
$response->SetGridResponse(Theme::RenderReturn('table_render'));
$response->Respond();
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:51,代码来源:sessions.class.php
示例11: register
public function register()
{
// $registerForm=I('post.registerForm');
$registerForm['username'] = I('post.username');
$registerForm['email'] = I('post.email');
$registerForm['password'] = md5(I('post.password'));
if (I('post.password') == I('post.retype-password')) {
$this->_User->create($registerForm);
$result = $this->_User->add();
if ($result) {
setSession($result, $registerForm['username']);
} else {
}
}
echo I('post.username');
}
开发者ID:s1p21,项目名称:chouchou,代码行数:16,代码来源:IndexController.class.php
示例12: getAction
public function getAction()
{
if (empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
error404();
}
$model = new ChatModel();
$dialog = '';
$userList = '';
$lastMessageID = getSession('chat_lmid', false);
$chatList = $model->getChatMessages('chat', 'ASC', $lastMessageID);
if ($chatList) {
foreach ($chatList as $value) {
$msg = ' ' . $value['message'];
if (strpos($msg, Request::getParam('user')->nickname) !== false) {
$color = ' chat_your_msg';
} else {
$color = false;
}
$dialog .= '<div class="chat_message' . $color . '">' . '<div class="chat_img"><a href="' . url($value['uid']) . '" target="_blank"><img src="' . getAvatar($value['uid'], 's') . '"></a></div>' . '<div class="chat_text">' . '<div><span class="chat_nickname" onclick="chatNickname(\'' . $value['uName'] . '\');">' . $value['uName'] . '</span> <span class="chat_time">' . printTime($value['time']) . '</span></div>' . '<div>' . $value['message'] . '</div>' . '</div>' . '</div>';
setSession('chat_lmid', $value['id']);
}
}
unset($chatList);
/*
if (time()%5 == 0 OR getSession('chat_ses') == 0) {
$listUserOnline = $model->getUserOnline();
$countUser = 0;
while ($list = mysqli_fetch_object($listUserOnline)) {
$userList .= '<li><a href="' . url($list->id) . '" target="_blank"><span>' . $list->nickname . '</span><span class="level-icon">' . $list->level . '</span></a></li>';
$countUser++;
}
$response['userList'] = $userList;
$response['countUser'] = $countUser;
}
*/
$response['error'] = 0;
if ($dialog) {
$response['target_a']['#dialog'] = $dialog;
}
setSession('chat_ses', 1);
echo json_encode($response);
exit;
}
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:47,代码来源:Controller.php
示例13: login
/**
* 验证登录
*/
public function login($params = array())
{
$db = Yii::$app->db;
// validate
if (!$this->load($params) && !$this->validate()) {
return false;
}
$model_name = getClassName(get_class($this));
$data = $params[$model_name];
if (!$data['captcha'] || $data['captcha'] != getSession('__captcha/login/captcha')) {
//showMessage('验证码错误!');
return false;
}
$sql = 'select username from forum_account where username="' . $data['username'] . '" and password = "' . md5($data['password']) . '" limit 1';
$command = $db->createCommand($sql);
$data = $command->queryOne();
if ($data) {
setSession('username', $data['username']);
return true;
} else {
return false;
}
}
开发者ID:keltstr,项目名称:forum-1,代码行数:26,代码来源:AccountModel.php
示例14: CategoryGrid
/**
* Category Grid
*/
function CategoryGrid()
{
$user =& $this->user;
$response = new ResponseManager();
setSession('category', 'CategoryFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
// Show enabled
$filterEnabled = Kit::GetParam('filterEnabled', _POST, _INT);
setSession('category', 'filterEnabled', $filterEnabled);
$rows = $user->CategoryList(array('category'), array('enabled' => $filterEnabled));
$categorys = array();
$cols = array(array('name' => 'categoryid', 'title' => __('ID')), array('name' => 'category', 'title' => __('Category')));
Theme::Set('table_cols', $cols);
foreach ($rows as $row) {
// Edit Button
$row['buttons'][] = array('id' => 'category_button_edit', 'url' => 'index.php?p=category&q=EditForm&categoryid=' . $row['categoryid'], 'text' => __('Edit'));
// Delete Button
$row['buttons'][] = array('id' => 'category_button_delete', 'url' => 'index.php?p=category&q=DeleteForm&categoryid=' . $row['categoryid'], 'text' => __('Delete'));
// Add to the rows objects
$categorys[] = $row;
}
Theme::Set('table_rows', $categorys);
$response->SetGridResponse(Theme::RenderReturn('table_render'));
$response->Respond();
}
开发者ID:jisuzz,项目名称:Test,代码行数:27,代码来源:category.class.php
示例15: TemplateView
/**
* Data grid
*/
function TemplateView()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$filter_name = Kit::GetParam('filter_name', _POST, _STRING);
$filter_tags = Kit::GetParam('filter_tags', _POST, _STRING);
$filter_is_system = Kit::GetParam('filter_is_system', _POST, _INT);
setSession('template', 'filter_name', $filter_name);
setSession('template', 'filter_tags', $filter_tags);
setSession('template', 'filter_is_system', $filter_is_system);
setSession('template', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
$templates = $user->TemplateList($filter_name, $filter_tags, $filter_is_system);
if (!is_array($templates)) {
trigger_error(__('Unable to get list of templates for this user'), E_USER_ERROR);
}
$rows = array();
foreach ($templates as $template) {
$template['permissions'] = $this->GroupsForTemplate($template['templateid']);
$template['owner'] = $user->getNameFromID($template['ownerid']);
$template['buttons'] = array();
if ($template['del'] && $template['issystem'] == 'No') {
// Delete Button
$template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=DeleteTemplateForm&templateid=' . $template['templateid'], 'text' => __('Delete'));
}
if ($template['modifyPermissions'] && $template['issystem'] == 'No') {
// Permissions Button
$template['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=template&q=PermissionsForm&templateid=' . $template['templateid'], 'text' => __('Permissions'));
}
// Add this row to the array
$rows[] = $template;
}
Theme::Set('table_rows', $rows);
$response->SetGridResponse(Theme::RenderReturn('template_page_grid'));
$response->Respond();
}
开发者ID:abbeet,项目名称:server39,代码行数:39,代码来源:template.class.php
示例16: ResolutionGrid
/**
* Resolution Grid
*/
function ResolutionGrid()
{
$user =& $this->user;
$response = new ResponseManager();
setSession('resolution', 'ResolutionFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
// Show enabled
$filterEnabled = Kit::GetParam('filterEnabled', _POST, _INT);
setSession('resolution', 'filterEnabled', $filterEnabled);
$rows = $user->ResolutionList(array('resolution'), array('enabled' => $filterEnabled));
$resolutions = array();
$cols = array(array('name' => 'resolutionid', 'title' => __('ID')), array('name' => 'resolution', 'title' => __('Resolution')), array('name' => 'intended_width', 'title' => __('Width')), array('name' => 'intended_height', 'title' => __('Height')), array('name' => 'width', 'title' => __('Designer Width')), array('name' => 'height', 'title' => __('Designer Height')), array('name' => 'version', 'title' => __('Version')), array('name' => 'enabled', 'title' => __('Enabled?'), 'icons' => true));
Theme::Set('table_cols', $cols);
foreach ($rows as $row) {
// Edit Button
$row['buttons'][] = array('id' => 'resolution_button_edit', 'url' => 'index.php?p=resolution&q=EditForm&resolutionid=' . $row['resolutionid'], 'text' => __('Edit'));
// Delete Button
$row['buttons'][] = array('id' => 'resolution_button_delete', 'url' => 'index.php?p=resolution&q=DeleteForm&resolutionid=' . $row['resolutionid'], 'text' => __('Delete'));
// Add to the rows objects
$resolutions[] = $row;
}
Theme::Set('table_rows', $resolutions);
$response->SetGridResponse(Theme::RenderReturn('table_render'));
$response->Respond();
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:27,代码来源:resolution.class.php
示例17: EditFormForLibraryMedia
protected function EditFormForLibraryMedia($extraFormFields = NULL)
{
global $session;
$db =& $this->db;
$user =& $this->user;
if ($this->response == null) {
$this->response = new ResponseManager();
}
// Would like to get the regions width / height
$layoutid = $this->layoutid;
$regionid = $this->regionid;
$mediaid = $this->mediaid;
$lkid = $this->lkid;
$userid = $this->user->userid;
// Delete Old Version Checkbox Setting
$deleteOldVersionChecked = Config::GetSetting('LIBRARY_MEDIA_DELETEOLDVER_CHECKB') == 'Checked' ? 1 : 0;
// Can this user delete?
if (!$this->auth->edit) {
$this->response->SetError('You do not have permission to edit this media.');
$this->response->keepOpen = false;
return $this->response;
}
// Set the Session / Security information
$sessionId = session_id();
$securityToken = CreateFormToken();
$session->setSecurityToken($securityToken);
// Load what we know about this media into the object
$SQL = "SELECT name, originalFilename, userID, retired, storedAs, isEdited, editedMediaID FROM media WHERE mediaID = {$mediaid} ";
if (!($row = $db->GetSingleRow($SQL))) {
// log the error
trigger_error($db->error());
trigger_error(__('Error querying for the Media information'), E_USER_ERROR);
}
$name = $row['name'];
$originalFilename = $row['originalFilename'];
$userid = $row['userID'];
$retired = $row['retired'];
$storedAs = $row['storedAs'];
$isEdited = $row['isEdited'];
$editedMediaID = $row['editedMediaID'];
$ext = strtolower(substr(strrchr($originalFilename, '.'), 1));
// Save button is different depending on if we are on a region or not
if ($regionid != '' && $this->showRegionOptions) {
setSession('content', 'mediatype', $this->type);
$this->response->AddButton(__('Cancel'), 'XiboSwapDialog("index.php?p=timeline&layoutid=' . $layoutid . '®ionid=' . $regionid . '&q=RegionOptions")');
} elseif ($regionid != '' && !$this->showRegionOptions) {
$this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
} else {
$this->response->AddButton(__('Cancel'), 'XiboDialogClose()');
}
$this->response->AddButton(__('Save'), '$("#EditLibraryBasedMedia").submit()');
// Setup the theme
Theme::Set('form_id', 'EditLibraryBasedMedia');
Theme::Set('form_action', 'index.php?p=module&mod=' . $this->type . '&q=Exec&method=EditMedia');
Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" name="regionid" value="' . $regionid . '"><input type="hidden" name="mediaid" value="' . $mediaid . '"><input type="hidden" name="lkid" value="' . $lkid . '"><input type="hidden" name="showRegionOptions" value="' . $this->showRegionOptions . '" /><input type="hidden" id="txtFileName" name="txtFileName" readonly="true" /><input type="hidden" name="hidFileID" id="hidFileID" value="" />');
Theme::Set('form_upload_id', 'file_upload');
Theme::Set('form_upload_action', 'index.php?p=content&q=FileUpload');
Theme::Set('form_upload_meta', '<input type="hidden" id="PHPSESSID" value="' . $sessionId . '" /><input type="hidden" id="SecurityToken" value="' . $securityToken . '" /><input type="hidden" name="MAX_FILE_SIZE" value="' . $this->maxFileSizeBytes . '" />');
Theme::Set('prepend', Theme::RenderReturn('form_file_upload_single'));
$formFields = array();
$formFields[] = FormManager::AddMessage(sprintf(__('This form accepts: %s files up to a maximum size of %s'), $this->validExtensionsText, $this->maxFileSize));
$formFields[] = FormManager::AddText('name', __('Name'), $name, __('The Name of this item - Leave blank to use the file name'), 'n');
$formFields[] = FormManager::AddNumber('duration', __('Duration'), $this->duration, __('The duration in seconds this item should be displayed'), 'd', 'required', '', $this->auth->modifyPermissions);
$formFields[] = FormManager::AddText('tags', __('Tags'), $this->tags, __('Tag this media. Comma Separated.'), 'n');
if ($this->assignable) {
$formFields[] = FormManager::AddCheckbox('replaceInLayouts', __('Update this media in all layouts it is assigned to?'), Config::GetSetting('LIBRARY_MEDIA_UPDATEINALL_CHECKB') == 'Checked' ? 1 : 0, __('Note: It will only be replaced in layouts you have permission to edit.'), 'r');
}
$formFields[] = FormManager::AddCheckbox('deleteOldVersion', __('Delete the old version?'), $deleteOldVersionChecked, __('Completely remove the old version of this media item if a new file is being uploaded.'), 'c');
// Add in any extra form fields we might have provided by the super-class
if ($extraFormFields != NULL && is_array($extraFormFields)) {
foreach ($extraFormFields as $field) {
$formFields[] = $field;
}
}
Theme::Set('form_fields', $formFields);
$this->response->html = Theme::RenderReturn('form_render');
$this->response->dialogTitle = 'Edit ' . $this->displayType;
$this->response->dialogSize = true;
$this->response->dialogWidth = '450px';
$this->response->dialogHeight = '280px';
return $this->response;
}
开发者ID:rovak73,项目名称:xibo-cms,代码行数:82,代码来源:module.class.php
示例18: EditMedia
/**
* Edit Media in the Database
* @return
*/
public function EditMedia()
{
$this->response = new ResponseManager();
$db =& $this->db;
$layoutid = $this->layoutid;
$regionid = $this->regionid;
$mediaid = $this->mediaid;
if (!$this->auth->edit) {
$this->response->SetError('You do not have permission to edit this assignment.');
$this->response->keepOpen = false;
return $this->response;
}
$windowsCommand = Kit::GetParam('windowsCommand', _POST, _STRING);
$linuxCommand = Kit::GetParam('linuxCommand', _POST, _STRING);
if ($windowsCommand == '' && $linuxCommand == '') {
$this->response->SetError('You must enter a command');
$this->response->keepOpen = true;
return $this->response;
}
// Any Options
$this->duration = 1;
$this->SetOption('windowsCommand', urlencode($windowsCommand));
$this->SetOption('linuxCommand', urlencode($linuxCommand));
// Should have built the media object entirely by this time
// This saves the Media Object to the Region
$this->UpdateRegion();
// Set this as the session information
setSession('content', 'type', 'shellcommand');
if ($this->showRegionOptions) {
// We want to load a new form
$this->response->loadForm = true;
$this->response->loadFormUri = "index.php?p=timeline&layoutid={$layoutid}®ionid={$regionid}&q=RegionOptions";
}
return $this->response;
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:39,代码来源:shellcommand.module.php
示例19: steamAction
public function steamAction()
{
$model = new PageModel();
incFile('modules/page/system/inc/OpenId.inc.php');
$steamApi = "0426AC32C69FAF916BE374D15CA29B1D";
// новый ключ!!!
$openid = new LightOpenID(SITE_URL . 'page/steam');
if (!$openid->mode) {
$openid->identity = 'http://steamcommunity.com/openid/?l=english';
redirect($openid->authUrl());
} elseif ($openid->mode == 'cancel') {
$errorMessage = 'User has canceled authentication!';
} else {
if ($openid->validate()) {
$id = $openid->identity;
$ptn = "/^http:\\/\\/steamcommunity\\.com\\/openid\\/id\\/(7[0-9]{15,25}+)\$/";
preg_match($ptn, $id, $matches);
$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={$steamApi}&steamids={$matches['1']}";
$json_object = file_get_contents($url);
$json_decoded = json_decode($json_object);
if ($json_decoded) {
$userData = $json_decoded->response->players[0];
if ($matches[1] == $userData->steamid && $userData->steamid) {
$isUser = $model->getUserBySteam($userData->steamid);
if ($isUser->id) {
setSession('user', $isUser->id, false);
redirect(url($isUser->id));
} else {
$errorMessage = 'Не прикреплен Steam аккаунт';
}
} else {
$errorMessage = 'Попробуйте еще раз позже';
}
} else {
$errorMessage = 'Попробуйте еще раз позже';
}
unset($json_object, $json_decoded);
} else {
$errorMessage = 'User is not logged in.';
}
}
setMyCookie('error', $errorMessage, time() + 5);
redirect(url());
}
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:44,代码来源:Controller.php
示例20: start
public static function start()
{
// Include model
incFile('modules/profile/system/Model.php');
incFile('../mail/class.phpmailer.php');
// Connect to DB
$model = new ProfileModel();
if (getSession('user')) {
$id = getSession('user');
} else {
$id = getCookie('user');
setSession('user', $id, false);
}
// $id = (getSession('user')) ? getSession('user') : getCookie('user') ;
if ($id) {
$uData = array();
// Update user
$uData['controller'] = CONTROLLER;
$uData['action'] = ACTION;
$uData['dateLast'] = time();
$model->updateUserByID($uData, $id);
// Get data user
Request::setParam('user', $model->getUserByID($id));
// Count new message
Request::setParam('countMsg', $model->countMsg($id));
// Count new message
Request::setParam('countRequests', $model->countRequests($id));
// Count challenges
Request::setParam('countChal
|
请发表评论