Exemple #1
0
 /**
  *	执行登录
  */
 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");
 }
 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);
 }
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;
}
Exemple #4
0
 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();
 }
 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);
 }
Exemple #6
0
 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();
 }
Exemple #7
0
 /**
  * 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();
 }
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;
}
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));
        }
    }
}
Exemple #10
0
 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();
 }
 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');
 }
 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;
 }
Exemple #13
0
 /**
  * 验证登录
  */
 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="******" and password = "******" limit 1';
     $command = $db->createCommand($sql);
     $data = $command->queryOne();
     if ($data) {
         setSession('username', $data['username']);
         return true;
     } else {
         return false;
     }
 }
Exemple #14
0
 /**
  * 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();
 }
Exemple #15
0
 /**
  * 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();
 }
Exemple #16
0
 /**
  * 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();
 }
Exemple #17
0
 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 . '&regionid=' . $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;
 }
 /**
  * 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}&regionid={$regionid}&q=RegionOptions";
     }
     return $this->response;
 }
 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());
 }
 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('countChallenges', $model->countChallengesList($id));
     } else {
         $gip = ip2long($_SERVER['REMOTE_ADDR']);
         // Null
         Request::setParam('user', null);
         // Guest
         Request::setParam('guest', $model->getGuestByIP($gip));
         // Role
         Request::setRole('guest');
         /*
         // Language
         if (CONTROLLER == 'page' && ACTION == 'lang') {
             if (Request::getUri(0) == 'ru' OR Request::getUri(0) == 'en')
                 setMyCookie('lang', Request::getUri(0), time() + 365 * 86400);
         }
         
         $lang = getCookie('lang');
         
         if ($lang == 'ru' OR $lang == 'en')
             Lang::setLanguage($lang);
         else
             Lang::setLanguage();
         */
         if (Request::getParam('guest')->id) {
             $gData['count'] = Request::getParam('guest')->count + 1;
             $gData['time'] = time();
             $model->update('guests', $gData, "`id` = '" . Request::getParam('guest')->id . "' LIMIT 1");
         } else {
             $gData['ip'] = $gip;
             $gData['browser'] = $_SERVER['HTTP_USER_AGENT'];
             $gData['referer'] = $_SERVER['HTTP_REFERER'];
             $gData['count'] = 1;
             $gData['time'] = time();
             $model->insert('guests', $gData);
         }
     }
     // Count users online
     Request::setParam('countUsersOnline', $model->countUsersOnline());
     // Count guests online
     Request::setParam('countGuestsOnline', $model->countGuestsOnline());
 }
Exemple #21
0
<?php
	set_include_path('../backbone:../global:../jquery:../components:../content:../images:../model:../render:../scripts:../styles');
	require_once('RedirectBrowserException.php');
	require_once('Item.php');
	require_once('Category.php');
	require_once('Characteristic.php');
	require_once('Ingredient.php');

	require_once('Session.php');
	setSession(0, '/');
	
	$name = isset($_POST['name']) ? $_POST['name'] : null;
	$desc = isset($_POST['desc']) ? $_POST['desc'] : null;
	$cat = isset($_POST['cat']) ? $_POST['cat'] : null;
	$img = isset($_POST['image']) ? $_POST['image'] : null;
	$prep = isset($_POST['prep']) ? $_POST['prep'] : null;
	$lvl = isset($_POST['lvl']) ? $_POST['lvl'] : false;
	$price = isset($_POST['price']) ? $_POST['price'] : null;
	$ing = isset($_POST['ing']) ? $_POST['ing'] : null;
	$char = isset($_POST['char']) ? $_POST['char'] : null;
	
	$fwd = isset($_GET['fwd']) ? $_GET['fwd'] : null;
	
	//clean the AS inputs
	$cat = replaceName(explode(',', $cat), 0);
	$ing = replaceName(explode(',', $ing), 1);
	$char = replaceName(explode(',', $char), 2);
	
	$data = array(
				'name' => $name,
				'desc' => $desc,
 public function MediaManagerGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $filterLayout = Kit::GetParam('filter_layout_name', _POST, _STRING);
     $filterRegion = Kit::GetParam('filter_region_name', _POST, _STRING);
     $filterMediaName = Kit::GetParam('filter_media_name', _POST, _STRING);
     $filterMediaType = Kit::GetParam('filter_type', _POST, _INT);
     setSession('mediamanager', 'filter_layout_name', $filterLayout);
     setSession('mediamanager', 'filter_region_name', $filterRegion);
     setSession('mediamanager', 'filter_media_name', $filterMediaName);
     setSession('mediamanager', 'filter_type', $filterMediaType);
     setSession('mediamanager', 'Filter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Lookup the module name
     if ($filterMediaType != 0) {
         $module = $this->user->ModuleList(NULL, array('id' => $filterMediaType));
         if (count($module) > 0) {
             $filterMediaType = $module[0]['Name'];
             Debug::LogEntry('audit', 'Matched module type ' . $filterMediaType, get_class(), __FUNCTION__);
         }
     }
     $cols = array(array('name' => 'layout', 'title' => __('Layout'), 'colClass' => 'group-word'), array('name' => 'region', 'title' => __('Region')), array('name' => 'media', 'title' => __('Media')), array('name' => 'mediatype', 'title' => __('Type')), array('name' => 'seq', 'title' => __('Sequence')));
     Theme::Set('table_cols', $cols);
     // We would like a list of all layouts, media and media assignments that this user
     // has access to.
     $layouts = $user->LayoutList(NULL, array('layout' => $filterLayout));
     $rows = array();
     foreach ($layouts as $layout) {
         // We have edit permissions?
         if (!$layout['edit']) {
             continue;
         }
         // Every layout this user has access to.. get the regions
         $layoutXml = new DOMDocument();
         $layoutXml->loadXML($layout['xml']);
         // Get ever region
         $regionNodeList = $layoutXml->getElementsByTagName('region');
         $regionNodeSequence = 0;
         //get the regions
         foreach ($regionNodeList as $region) {
             $regionId = $region->getAttribute('id');
             $ownerId = $region->getAttribute('userId') == '' ? $layout['ownerid'] : $region->getAttribute('userId');
             $regionAuth = $user->RegionAssignmentAuth($ownerId, $layout['layoutid'], $regionId, true);
             // Do we have permission to edit?
             if (!$regionAuth->edit) {
                 continue;
             }
             $regionNodeSequence++;
             $regionName = $region->getAttribute('name') == '' ? 'Region ' . $regionNodeSequence : $region->getAttribute('name');
             if ($filterRegion != '' && !stristr($regionName, $filterRegion)) {
                 continue;
             }
             // Media
             $xpath = new DOMXPath($layoutXml);
             $mediaNodes = $xpath->query("//region[@id='{$regionId}']/media");
             $mediaNodeSequence = 0;
             foreach ($mediaNodes as $mediaNode) {
                 $mediaId = $mediaNode->getAttribute('id');
                 $lkId = $mediaNode->getAttribute('lkid');
                 $mediaOwnerId = $mediaNode->getAttribute('userId') == '' ? $layout['ownerid'] : $mediaNode->getAttribute('userId');
                 $mediaType = $mediaNode->getAttribute('type');
                 // Permissions
                 $auth = $user->MediaAssignmentAuth($mediaOwnerId, $layout['layoutid'], $regionId, $mediaId, true);
                 if (!$auth->edit) {
                     continue;
                 }
                 // Create the media object without any region and layout information
                 require_once 'modules/' . $mediaType . '.module.php';
                 $tmpModule = new $mediaType($db, $user, $mediaId, $layout['layoutid'], $regionId, $lkId);
                 $mediaName = $tmpModule->GetName();
                 if ($filterMediaName != '' && !stristr($mediaName, $filterMediaName)) {
                     continue;
                 }
                 if ($filterMediaType != '' && $mediaType != strtolower($filterMediaType)) {
                     continue;
                 }
                 $mediaNodeSequence++;
                 $layout['region'] = $regionName;
                 $layout['media'] = $mediaName;
                 $layout['mediatype'] = $mediaType;
                 $layout['seq'] = $mediaNodeSequence;
                 $layout['buttons'] = array();
                 // Edit
                 $layout['buttons'][] = array('id' => 'homepage_mediamanager_edit_button', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&showRegionOptions=0&layoutid=' . $layout['layoutid'] . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId, 'text' => __('Edit'));
                 $rows[] = $layout;
             }
         }
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->Respond();
 }
<div class="chatMain">

    <div class="chatBody" id="dialog">

        <?php 
// $list = array_reverse((array)$this->list);
if ($list) {
    foreach ($list as $value) {
        $msg = ' ' . $value['message'];
        if (strpos($msg, Request::getParam('user')->nickname) !== false) {
            $color = ' chat_your_msg';
        } else {
            $color = false;
        }
        echo '<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']);
    }
}
?>

    </div>



    <script>

        var height = winH()-450;

        if (height < 400)

            height = 400;
Exemple #24
0
 /**
  * Grid of Displays
  * @return
  */
 function DisplayGrid()
 {
     // validate displays so we get a realistic view of the table
     Display::ValidateDisplays();
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter by Name
     $filter_display = Kit::GetParam('filter_display', _POST, _STRING);
     setSession('display', 'filter_display', $filter_display);
     // Filter by Name
     $filterMacAddress = Kit::GetParam('filterMacAddress', _POST, _STRING);
     setSession('display', 'filterMacAddress', $filterMacAddress);
     // Display Group
     $filter_displaygroupid = Kit::GetParam('filter_displaygroup', _POST, _INT);
     setSession('display', 'filter_displaygroup', $filter_displaygroupid);
     // Thumbnail?
     $filter_showView = Kit::GetParam('filter_showView', _REQUEST, _INT);
     setSession('display', 'filter_showView', $filter_showView);
     $filterVersion = Kit::GetParam('filterVersion', _REQUEST, _STRING);
     setSession('display', 'filterVersion', $filterVersion);
     // filter_autoRefresh?
     $filter_autoRefresh = Kit::GetParam('filter_autoRefresh', _REQUEST, _INT, 0);
     setSession('display', 'filter_autoRefresh', $filter_autoRefresh);
     // Pinned option?
     setSession('display', 'DisplayFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     $displays = $user->DisplayList(array('displayid'), array('displaygroupid' => $filter_displaygroupid, 'display' => $filter_display, 'macAddress' => $filterMacAddress, 'clientVersion' => $filterVersion));
     if (!is_array($displays)) {
         trigger_error($db->error());
         trigger_error(__('Unable to get list of displays'), E_USER_ERROR);
     }
     // Do we want to make a VNC link out of the display name?
     $vncTemplate = Config::GetSetting('SHOW_DISPLAY_AS_VNCLINK');
     $linkTarget = Kit::ValidateParam(Config::GetSetting('SHOW_DISPLAY_AS_VNC_TGT'), _STRING);
     $cols = array(array('name' => 'displayid', 'title' => __('ID')), array('name' => 'displayWithLink', 'title' => __('Display')), array('name' => 'status', 'title' => __('Status'), 'icons' => true, 'iconDescription' => 'statusDescription'), array('name' => 'licensed', 'title' => __('License'), 'icons' => true), array('name' => 'currentLayout', 'title' => __('Current Layout'), 'hidden' => $filter_showView != 3), array('name' => 'storageAvailableSpaceFormatted', 'title' => __('Storage Available'), 'hidden' => $filter_showView != 3), array('name' => 'storageTotalSpaceFormatted', 'title' => __('Storage Total'), 'hidden' => $filter_showView != 3), array('name' => 'storagePercentage', 'title' => __('Storage Free %'), 'hidden' => $filter_showView != 3), array('name' => 'description', 'title' => __('Description'), 'hidden' => $filter_showView != 4), array('name' => 'layout', 'title' => __('Default Layout'), 'hidden' => $filter_showView != 0), array('name' => 'inc_schedule', 'title' => __('Interleave Default'), 'icons' => true, 'hidden' => $filter_showView == 1 || $filter_showView == 2), array('name' => 'email_alert', 'title' => __('Email Alert'), 'icons' => true, 'hidden' => $filter_showView != 0), array('name' => 'loggedin', 'title' => __('Logged In'), 'icons' => true), array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'clientVersionCombined', 'title' => __('Version'), 'hidden' => $filter_showView != 3), array('name' => 'clientaddress', 'title' => __('IP Address'), 'hidden' => $filter_showView == 1), array('name' => 'macaddress', 'title' => __('Mac Address'), 'hidden' => $filter_showView == 1), array('name' => 'screenShotRequested', 'title' => __('Screen shot?'), 'icons' => true, 'hidden' => $filter_showView != 1 && $filter_showView != 2), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $filter_showView != 1 && $filter_showView != 2));
     Theme::Set('table_cols', $cols);
     Theme::Set('rowClass', 'rowColor');
     $rows = array();
     foreach ($displays as $row) {
         // VNC Template as display name?
         if ($vncTemplate != '' && $row['clientaddress'] != '') {
             if ($linkTarget == '') {
                 $linkTarget = '_top';
             }
             $row['displayWithLink'] = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $row['display'] . '" target="' . $linkTarget . '">' . Theme::Prepare($row['display']) . '</a>', $row['clientaddress']);
         } else {
             $row['displayWithLink'] = $row['display'];
         }
         // Format last accessed
         $row['lastaccessed'] = DateManager::getLocalDate($row['lastaccessed']);
         // Create some login lights
         $row['rowColor'] = $row['mediainventorystatus'] == 1 ? 'success' : ($row['mediainventorystatus'] == 2 ? 'danger' : 'warning');
         // Set some text for the display status
         switch ($row['mediainventorystatus']) {
             case 1:
                 $row['statusDescription'] = __('Display is up to date');
                 break;
             case 2:
                 $row['statusDescription'] = __('Display is downloading new files');
                 break;
             case 3:
                 $row['statusDescription'] = __('Display is out of date but has not yet checked in with the server');
                 break;
             default:
                 $row['statusDescription'] = __('Unknown Display Status');
         }
         $row['status'] = $row['mediainventorystatus'] == 1 ? 1 : ($row['mediainventorystatus'] == 2 ? 0 : -1);
         // Thumbnail
         $row['thumbnail'] = '';
         // If we aren't logged in, and we are showThumbnail == 2, then show a circle
         if ($filter_showView == 2 && $row['loggedin'] == 0) {
             $row['thumbnail'] = '<i class="fa fa-times-circle"></i>';
         } else {
             if ($filter_showView != 0 && file_exists(Config::GetSetting('LIBRARY_LOCATION') . 'screenshots/' . $row['displayid'] . '_screenshot.jpg')) {
                 $row['thumbnail'] = '<a data-toggle="lightbox" data-type="image" href="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '"><img class="display-screenshot" src="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '&' . Kit::uniqueId() . '" /></a>';
             }
         }
         // Version
         $row['clientVersionCombined'] = $row['client_type'] . ' / ' . $row['client_version'];
         // Format the storage available / total space
         $row['storageAvailableSpaceFormatted'] = Kit::formatBytes($row['storageAvailableSpace']);
         $row['storageTotalSpaceFormatted'] = Kit::formatBytes($row['storageTotalSpace']);
         $row['storagePercentage'] = $row['storageTotalSpace'] == 0 ? 100 : round($row['storageAvailableSpace'] / $row['storageTotalSpace'] * 100.0, 2);
         // Edit and Delete buttons first
         if ($row['edit'] == 1) {
             // Edit
             $row['buttons'][] = array('id' => 'display_button_edit', 'url' => 'index.php?p=display&q=displayForm&displayid=' . $row['displayid'], 'text' => __('Edit'));
         }
         // Delete
         if ($row['del'] == 1) {
             $row['buttons'][] = array('id' => 'display_button_delete', 'url' => 'index.php?p=display&q=DeleteForm&displayid=' . $row['displayid'], 'text' => __('Delete'));
         }
         if ($row['edit'] == 1 || $row['del'] == 1) {
             $row['buttons'][] = array('linkType' => 'divider');
         }
         // Schedule Now
         if ($row['edit'] == 1 || Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes') {
             $row['buttons'][] = array('id' => 'display_button_schedulenow', 'url' => 'index.php?p=schedule&q=ScheduleNowForm&displayGroupId=' . $row['displaygroupid'], 'text' => __('Schedule Now'));
         }
         if ($row['edit'] == 1) {
             // Default Layout
             $row['buttons'][] = array('id' => 'display_button_defaultlayout', 'url' => 'index.php?p=display&q=DefaultLayoutForm&DisplayId=' . $row['displayid'], 'text' => __('Default Layout'));
             // File Associations
             $row['buttons'][] = array('id' => 'displaygroup_button_fileassociations', 'url' => 'index.php?p=displaygroup&q=FileAssociations&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Assign Files'));
             // Screen Shot
             $row['buttons'][] = array('id' => 'display_button_requestScreenShot', 'url' => 'index.php?p=display&q=RequestScreenShotForm&displayId=' . $row['displayid'], 'text' => __('Request Screen Shot'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=display&q=RequestScreenShot'), array('name' => 'rowtitle', 'value' => $row['display']), array('name' => 'displayId', 'value' => $row['displayid'])));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         // Media Inventory
         $row['buttons'][] = array('id' => 'display_button_mediainventory', 'url' => 'index.php?p=display&q=MediaInventory&DisplayId=' . $row['displayid'], 'text' => __('Media Inventory'));
         if ($row['edit'] == 1) {
             // Logs
             $row['buttons'][] = array('id' => 'displaygroup_button_logs', 'url' => 'index.php?p=log&q=LastHundredForDisplay&displayid=' . $row['displayid'], 'text' => __('Recent Log'));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         if ($row['modifypermissions'] == 1) {
             // Display Groups
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=display&q=MemberOfForm&DisplayID=' . $row['displayid'], 'text' => __('Display Groups'));
             // Permissions
             $row['buttons'][] = array('id' => 'display_button_group_membership', 'url' => 'index.php?p=displaygroup&q=PermissionsForm&DisplayGroupID=' . $row['displaygroupid'], 'text' => __('Permissions'));
             // Version Information
             $row['buttons'][] = array('id' => 'display_button_version_instructions', 'url' => 'index.php?p=displaygroup&q=VersionInstructionsForm&displaygroupid=' . $row['displaygroupid'] . '&displayid=' . $row['displayid'], 'text' => __('Version Information'));
             $row['buttons'][] = array('linkType' => 'divider');
         }
         if ($row['edit'] == 1) {
             // Wake On LAN
             $row['buttons'][] = array('id' => 'display_button_wol', 'url' => 'index.php?p=display&q=WakeOnLanForm&DisplayId=' . $row['displayid'], 'text' => __('Wake on LAN'));
         }
         // Assign this to the table row
         $rows[] = $row;
     }
     Theme::Set('table_rows', $rows);
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->refresh = Kit::GetParam('filter_autoRefresh', _REQUEST, _INT, 0);
     $response->Respond();
 }
Exemple #25
0
<?php
	require_once('Template.php');
	require_once('Session.php');
	setSession(0,"/");
	
	require_once('Item.php');
	require_once('Category.php');
	
	class Breadcrumb
	{
		private $type;
		private $id;
		
		private $path;
		
		public function __construct($type, $id)
		{
			$this->type = $type;
			$this->id = $id;

			if( $type == 'item' )
			{
				$item = Item::getByID($id);
				if( $item instanceof Item )
				{
					$cat = $item->category;
					
					$categories = array($cat);
					while( $cat->getParent() instanceof Category )
					{
						$cat = $cat->getParent();
Exemple #26
0
 /**
  * Shows the Layout Grid
  * @return 
  */
 function LayoutGrid()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter by Name
     $name = Kit::GetParam('filter_layout', _POST, _STRING);
     setSession('layout', 'filter_layout', $name);
     // User ID
     $filter_userid = Kit::GetParam('filter_userid', _POST, _INT);
     setSession('layout', 'filter_userid', $filter_userid);
     // Show retired
     $filter_retired = Kit::GetParam('filter_retired', _POST, _INT);
     setSession('layout', 'filter_retired', $filter_retired);
     // Show filterLayoutStatusId
     $filterLayoutStatusId = Kit::GetParam('filterLayoutStatusId', _POST, _INT);
     setSession('layout', 'filterLayoutStatusId', $filterLayoutStatusId);
     // Show showDescriptionId
     $showDescriptionId = Kit::GetParam('showDescriptionId', _POST, _INT);
     setSession('layout', 'showDescriptionId', $showDescriptionId);
     // Show filter_showThumbnail
     $showTags = Kit::GetParam('showTags', _POST, _CHECKBOX);
     setSession('layout', 'showTags', $showTags);
     // Show filter_showThumbnail
     $showThumbnail = Kit::GetParam('showThumbnail', _POST, _CHECKBOX);
     setSession('layout', 'showThumbnail', $showThumbnail);
     // Tags list
     $filter_tags = Kit::GetParam("filter_tags", _POST, _STRING);
     setSession('layout', 'filter_tags', $filter_tags);
     // Pinned option?
     setSession('layout', 'LayoutFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     // Get all layouts
     $layouts = $user->LayoutList(NULL, array('layout' => $name, 'userId' => $filter_userid, 'retired' => $filter_retired, 'tags' => $filter_tags, 'filterLayoutStatusId' => $filterLayoutStatusId, 'showTags' => $showTags));
     if (!is_array($layouts)) {
         trigger_error(__('Unable to get layouts for user'), E_USER_ERROR);
     }
     $cols = array(array('name' => 'layoutid', 'title' => __('ID')), array('name' => 'tags', 'title' => __('Tag'), 'hidden' => $showTags == 0, 'colClass' => 'group-word'), array('name' => 'layout', 'title' => __('Name')), array('name' => 'description', 'title' => __('Description'), 'hidden' => $showDescriptionId == 1 || $showDescriptionId == 3), array('name' => 'descriptionWithMarkdown', 'title' => __('Description'), 'hidden' => $showDescriptionId == 2 || $showDescriptionId == 3), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $showThumbnail == 0), array('name' => 'owner', 'title' => __('Owner')), array('name' => 'permissions', 'title' => __('Permissions')), array('name' => 'status', 'title' => __('Status'), 'icons' => true, 'iconDescription' => 'statusDescription'));
     Theme::Set('table_cols', $cols);
     $rows = array();
     foreach ($layouts as $layout) {
         // Construct an object containing all the layouts, and pass to the theme
         $row = array();
         $row['layoutid'] = $layout['layoutid'];
         $row['layout'] = $layout['layout'];
         $row['description'] = $layout['description'];
         $row['tags'] = $layout['tags'];
         $row['owner'] = $user->getNameFromID($layout['ownerid']);
         $row['permissions'] = $this->GroupsForLayout($layout['layoutid']);
         $row['thumbnail'] = '';
         if ($showThumbnail == 1 && $layout['backgroundImageId'] != 0) {
             $row['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=' . $layout['backgroundImageId'] . '&width=100&height=100&dynamic=true&thumb=true" href="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $layout['backgroundImageId'] . '"><i class="fa fa-file-image-o"></i></a>';
         }
         // Fix up the description
         if ($showDescriptionId == 1) {
             // Parse down for description
             $row['descriptionWithMarkdown'] = Parsedown::instance()->text($row['description']);
         } else {
             if ($showDescriptionId == 2) {
                 $row['description'] = strtok($row['description'], "\n");
             }
         }
         switch ($layout['status']) {
             case 1:
                 $row['status'] = 1;
                 $row['statusDescription'] = __('This Layout is ready to play');
                 break;
             case 2:
                 $row['status'] = 2;
                 $row['statusDescription'] = __('There are items on this Layout that can only be assessed by the Display');
                 break;
             case 3:
                 $row['status'] = 0;
                 $row['statusDescription'] = __('This Layout is invalid and should not be scheduled');
                 break;
             default:
                 $row['status'] = 0;
                 $row['statusDescription'] = __('The Status of this Layout is not known');
         }
         $row['layout_form_edit_url'] = 'index.php?p=layout&q=displayForm&layoutid=' . $layout['layoutid'];
         // Add some buttons for this row
         if ($layout['edit']) {
             // Design Button
             $row['buttons'][] = array('id' => 'layout_button_design', 'linkType' => '_self', 'url' => 'index.php?p=layout&modify=true&layoutid=' . $layout['layoutid'], 'text' => __('Design'));
         }
         // Preview
         $row['buttons'][] = array('id' => 'layout_button_preview', 'linkType' => '_blank', 'url' => 'index.php?p=preview&q=render&ajax=true&layoutid=' . $layout['layoutid'], 'text' => __('Preview Layout'));
         // Schedule Now
         $row['buttons'][] = array('id' => 'layout_button_schedulenow', 'url' => 'index.php?p=schedule&q=ScheduleNowForm&CampaignID=' . $layout['campaignid'], 'text' => __('Schedule Now'));
         $row['buttons'][] = array('linkType' => 'divider');
         // Only proceed if we have edit permissions
         if ($layout['edit']) {
             // Edit Button
             $row['buttons'][] = array('id' => 'layout_button_edit', 'url' => 'index.php?p=layout&q=displayForm&modify=true&layoutid=' . $layout['layoutid'], 'text' => __('Edit'));
             // Copy Button
             $row['buttons'][] = array('id' => 'layout_button_copy', 'url' => 'index.php?p=layout&q=CopyForm&layoutid=' . $layout['layoutid'] . '&oldlayout=' . urlencode($layout['layout']), 'text' => __('Copy'));
             // Retire Button
             $row['buttons'][] = array('id' => 'layout_button_retire', 'url' => 'index.php?p=layout&q=RetireForm&layoutid=' . $layout['layoutid'], 'text' => __('Retire'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=layout&q=Retire'), array('name' => 'rowtitle', 'value' => $row['layout']), array('name' => 'layoutid', 'value' => $layout['layoutid'])));
             // Extra buttons if have delete permissions
             if ($layout['del']) {
                 // Copy Button
                 $row['buttons'][] = array('id' => 'layout_button_delete', 'url' => 'index.php?p=layout&q=DeleteLayoutForm&layoutid=' . $layout['layoutid'], 'text' => __('Delete'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=layout&q=delete'), array('name' => 'rowtitle', 'value' => $row['layout']), array('name' => 'layoutid', 'value' => $layout['layoutid'])));
             }
             $row['buttons'][] = array('linkType' => 'divider');
             // Export Button
             $row['buttons'][] = array('id' => 'layout_button_export', 'linkType' => '_self', 'url' => 'index.php?p=layout&q=Export&layoutid=' . $layout['layoutid'], 'text' => __('Export'));
             // Extra buttons if we have modify permissions
             if ($layout['modifyPermissions']) {
                 // Permissions button
                 $row['buttons'][] = array('id' => 'layout_button_permissions', 'url' => 'index.php?p=campaign&q=PermissionsForm&CampaignID=' . $layout['campaignid'], 'text' => __('Permissions'));
             }
         }
         // Add the row
         $rows[] = $row;
     }
     // Store the table rows
     Theme::Set('table_rows', $rows);
     Theme::Set('gridId', Kit::GetParam('gridId', _REQUEST, _STRING));
     // Initialise the theme and capture the output
     $output = Theme::RenderReturn('table_render');
     $response->SetGridResponse($output);
     $response->initialSortColumn = 3;
     $response->Respond();
 }
Exemple #27
0
<?php
	requireComponent('LZ.PHP.Session');
	session_name('S20_BLOGLOUNGE_SESSION');

	setSession();
	session_set_save_handler('openSession', 'closeSession', 'readSession', 'writeSession', 'destroySession', 'gcSession');
	session_cache_expire(1);
	session_set_cookie_params(0, '/', ((substr(strtolower($_SERVER['HTTP_HOST']), 0, 4) == 'www.') ? substr($_SERVER['HTTP_HOST'], 3) : $_SERVER['HTTP_HOST']));
	register_shutdown_function('session_write_close');
	if (session_start() !== true) {
		header('HTTP/1.1 503 Service Unavailable');
	}	

	$session = array();
	$session['id'] = isset($_SESSION['_app_id_'])?$_SESSION['_app_id_']:0;
	$session['message'] = isset($_SESSION['_app_message_'])?$_SESSION['_app_message_']:'';
?>
 public function inventoryAction()
 {
     $response['error'] = 0;
     if (Request::getParam('user')->id) {
         $steamID = Request::getParam('user')->steamid;
         $steamNick = Request::getParam('user')->steamnick;
         if ($steamID && mb_strlen($steamID) > 16) {
             $result = json_decode(get_contents('http://steamcommunity.com/profiles/' . $steamID . '/inventory/json/730/2/'));
             if ((!$result || !$result->success) && !empty($steamNick)) {
                 $result = json_decode(get_contents('http://steamcommunity.com/id/' . $steamNick . '/inventory/json/730/2/'));
             }
             if ($result && allPost() && $result->success) {
                 $mid = post('mid', 'int');
                 $model = new ProfileModel();
                 $match = $model->getMatchByID($mid);
                 if ($match->status == 1 || $match->status == 2 && $match->blocked) {
                     if ($mid) {
                         $response['target_h']['#assets'] = "";
                         if ($result->rgInventory) {
                             foreach ($result->rgInventory as $item) {
                                 $handle = $item->classid . "_" . $item->instanceid;
                                 //handler to parse descriptions
                                 if ($result->rgDescriptions->{$handle}) {
                                     $asset = new stdClass();
                                     $asset->assetId = $item->id;
                                     $asset->amount = $item->amount;
                                     $asset->pos = $item->pos;
                                     $asset->name = $result->rgDescriptions->{$handle}->name;
                                     $asset->market_name = $result->rgDescriptions->{$handle}->market_name;
                                     $asset->icon_url = $result->rgDescriptions->{$handle}->icon_url;
                                     $asset->icon_url_large = $result->rgDescriptions->{$handle}->icon_url_large;
                                     $asset->classid = $item->classid;
                                     $asset->instanceid = $item->instanceid;
                                     $asset->status = $result->rgDescriptions->{$handle}->descriptions[0]->value;
                                     if ($result->rgDescriptions->{$handle}->cache_expiration) {
                                         $asset->cache_expiration = 1;
                                     } else {
                                         $asset->cache_expiration = 0;
                                     }
                                     $assets[$item->id] = $asset;
                                     unset($asset);
                                 }
                             }
                             if ($assets) {
                                 setSession('myAssets' . $mid, json_encode($assets), false);
                                 //save assets to session for future validation
                                 foreach ($assets as $asset) {
                                     if ($asset->cache_expiration == 0) {
                                         $response['target_h']['#assets'] .= '<div class="assetsItem" id="i' . $asset->assetId . '" data-name="' . urlencode($asset->market_name) . '" ';
                                         if (!$match->blocked) {
                                             $response['target_h']['#assets'] .= ' ondblclick="addAsset(\'' . $asset->assetId . '\');" ';
                                         }
                                         $response['target_h']['#assets'] .= '>' . '<img src="http://steamcommunity-a.akamaihd.net/economy/image/' . $asset->icon_url . '" alt="icon">' . '</div>' . '<div class="assetsInfo none" id="help_i' . $asset->assetId . '">' . '<div class="text">' . $asset->name . '<br/>' . "\n" . 'Price: <span id="pi' . $asset->assetId . '">0</span><br/>' . "\n" . '' . $asset->status . '<br/>' . "\n" . '</div>' . '</div>';
                                     }
                                 }
                             } else {
                                 setSession('myAssets', '');
                                 $response['error'] = Lang::translate("MATCH_INVENTORY_EMPTY_INVENTORY");
                             }
                         } else {
                             $response['error'] = Lang::translate("MATCH_INVENTORY_EMPTY_INVENTORY");
                         }
                     } else {
                         $response['error'] = Lang::translate("MATCH_INVENTORY_EMPTY_MATCH_ID");
                     }
                 } else {
                     $response['target_h']['#assets'] = "";
                 }
             } else {
                 $response['error'] = Lang::translate("MATCH_INVENTORY_LOAD_ERROR");
             }
         }
     }
     echo json_encode($response);
     exit;
 }
Exemple #29
0
 /**
  * Edit Media in the Database
  * @return 
  */
 public function EditMedia()
 {
     $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;
     }
     $sourceId = $this->GetOption('sourceId', 1);
     // Other properties
     $uri = Kit::GetParam('uri', _POST, _URI);
     $direction = Kit::GetParam('direction', _POST, _WORD, 'none');
     $text = Kit::GetParam('ta_text', _POST, _HTMLSTRING);
     $css = Kit::GetParam('ta_css', _POST, _HTMLSTRING);
     $scrollSpeed = Kit::GetParam('scrollSpeed', _POST, _INT, 2);
     $updateInterval = Kit::GetParam('updateInterval', _POST, _INT, 360);
     $copyright = Kit::GetParam('copyright', _POST, _STRING);
     $numItems = Kit::GetParam('numItems', _POST, _STRING);
     $takeItemsFrom = Kit::GetParam('takeItemsFrom', _POST, _STRING);
     $durationIsPerItem = Kit::GetParam('durationIsPerItem', _POST, _CHECKBOX);
     $fitText = Kit::GetParam('fitText', _POST, _CHECKBOX);
     $itemsSideBySide = Kit::GetParam('itemsSideBySide', _POST, _CHECKBOX);
     // DataSet Specific Options
     $itemsPerPage = Kit::GetParam('itemsPerPage', _POST, _INT);
     $upperLimit = Kit::GetParam('upperLimit', _POST, _INT);
     $lowerLimit = Kit::GetParam('lowerLimit', _POST, _INT);
     $filter = Kit::GetParam('filter', _POST, _STRINGSPECIAL);
     $ordering = Kit::GetParam('ordering', _POST, _STRING);
     // If we have permission to change it, then get the value from the form
     if ($this->auth->modifyPermissions) {
         $this->duration = Kit::GetParam('duration', _POST, _INT, 0);
     }
     // Validation
     if ($text == '') {
         $this->response->SetError('Please enter some text');
         $this->response->keepOpen = true;
         return $this->response;
     }
     if ($sourceId == 1) {
         // Feed
         // Validate the URL
         if ($uri == "" || $uri == "http://") {
             trigger_error(__('Please enter a Link for this Ticker'), E_USER_ERROR);
         }
     } else {
         if ($sourceId == 2) {
             // Make sure we havent entered a silly value in the filter
             if (strstr($filter, 'DESC')) {
                 trigger_error(__('Cannot user ordering criteria in the Filter Clause'), E_USER_ERROR);
             }
             if (!is_numeric($upperLimit) || !is_numeric($lowerLimit)) {
                 trigger_error(__('Limits must be numbers'), E_USER_ERROR);
             }
             if ($upperLimit < 0 || $lowerLimit < 0) {
                 trigger_error(__('Limits cannot be lower than 0'), E_USER_ERROR);
             }
             // Check the bounds of the limits
             if ($upperLimit < $lowerLimit) {
                 trigger_error(__('Upper limit must be higher than lower limit'), E_USER_ERROR);
             }
         }
     }
     if ($this->duration == 0) {
         $this->response->SetError('You must enter a duration.');
         $this->response->keepOpen = true;
         return $this->response;
     }
     if ($numItems != '') {
         // Make sure we have a number in here
         if (!is_numeric($numItems)) {
             $this->response->SetError(__('The value in Number of Items must be numeric.'));
             $this->response->keepOpen = true;
             return $this->response;
         }
     }
     if ($updateInterval < 0) {
         trigger_error(__('Update Interval must be greater than or equal to 0'), E_USER_ERROR);
     }
     // Any Options
     $this->SetOption('xmds', true);
     $this->SetOption('direction', $direction);
     $this->SetOption('copyright', $copyright);
     $this->SetOption('scrollSpeed', $scrollSpeed);
     $this->SetOption('updateInterval', $updateInterval);
     $this->SetOption('uri', $uri);
     $this->SetOption('numItems', $numItems);
     $this->SetOption('takeItemsFrom', $takeItemsFrom);
     $this->SetOption('durationIsPerItem', $durationIsPerItem);
     $this->SetOption('fitText', $fitText);
     $this->SetOption('itemsSideBySide', $itemsSideBySide);
     $this->SetOption('upperLimit', $upperLimit);
     $this->SetOption('lowerLimit', $lowerLimit);
     $this->SetOption('filter', $filter);
     $this->SetOption('ordering', $ordering);
     $this->SetOption('itemsPerPage', $itemsPerPage);
     // Text Template
     $this->SetRaw('<template><![CDATA[' . $text . ']]></template><css><![CDATA[' . $css . ']]></css>');
     // 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', 'ticker');
     if ($this->showRegionOptions) {
         // We want to load a new form
         $this->response->loadForm = true;
         $this->response->loadFormUri = "index.php?p=timeline&layoutid={$layoutid}&regionid={$regionid}&q=RegionOptions";
     }
     return $this->response;
 }
<?php

require 'controller.php';
require 'session.php';
$email = $_POST['email'];
$password = $_POST['password'];
$type = $_POST['type'];
if ($type == 'admin') {
    $message = adminLogin($email, $password);
} else {
    $message = login($email, $password);
}
if ($message) {
    $response = setSession($email, $type, $message);
    echo $response;
} else {
    echo false;
}