mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
rewrote php session variables
This commit is contained in:
@ -9,13 +9,15 @@ class ControllerCommonError extends Controller {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
$session = Registry::get('session');
|
||||
|
||||
$this->document->title = $this->data['text_error'];
|
||||
|
||||
$this->data['errortitle'] = $this->data['text_error'];
|
||||
|
||||
if(isset($_SESSION['error'])){
|
||||
$this->data['errorstring'] = $_SESSION['error'];
|
||||
unset($_SESSION['error']);
|
||||
if($session->get("error")) {
|
||||
$this->data['errorstring'] = $session->get("error");
|
||||
$session->set("error", "");
|
||||
}
|
||||
else {
|
||||
$this->data['errorstring'] = "this is the errorstring";
|
||||
|
@ -14,6 +14,7 @@ class ControllerLoginGoogle extends Controller {
|
||||
$request = Registry::get('request');
|
||||
|
||||
$db = Registry::get('db');
|
||||
$session = Registry::get('session');
|
||||
|
||||
$this->load->model('user/auth');
|
||||
$this->load->model('user/user');
|
||||
@ -44,19 +45,19 @@ class ControllerLoginGoogle extends Controller {
|
||||
|
||||
if(isset($_GET['code'])) {
|
||||
$client->authenticate();
|
||||
$_SESSION['access_token'] = $client->getAccessToken();
|
||||
$session->set("access_token", $client->getAccessToken());
|
||||
header('Location: ' . GOOGLE_REDIRECT_URL);
|
||||
}
|
||||
|
||||
if(isset($_SESSION['access_token'])) {
|
||||
$client->setAccessToken($_SESSION['access_token']);
|
||||
if($session->get("access_token")) {
|
||||
$client->setAccessToken($session->get("access_token"));
|
||||
}
|
||||
|
||||
|
||||
if($client->getAccessToken()) {
|
||||
$_SESSION['access_token'] = $client->getAccessToken();
|
||||
$session->set("access_token", $client->getAccessToken());
|
||||
|
||||
$token = json_decode($_SESSION['access_token']);
|
||||
$token = json_decode($session->get("access_token"));
|
||||
|
||||
if(isset($token->{'access_token'}) && isset($token->{'refresh_token'})) {
|
||||
$account = $oauth2->userinfo->get();
|
||||
|
@ -9,6 +9,7 @@ class ControllerMessageBulkrestore extends Controller {
|
||||
$this->template = "message/bulkrestore.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -65,7 +66,7 @@ class ControllerMessageBulkrestore extends Controller {
|
||||
$rcpt = $this->model_search_search->get_message_recipients($id);
|
||||
}
|
||||
else {
|
||||
array_push($rcpt, $_SESSION['email']);
|
||||
array_push($rcpt, $session->get("email"));
|
||||
}
|
||||
|
||||
if(count($rcpt) > 0) {
|
||||
|
@ -10,7 +10,7 @@ class ControllerMessageNote extends Controller {
|
||||
$this->template = "message/note.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -20,7 +20,7 @@ class ControllerMessageNote extends Controller {
|
||||
if(isset($this->request->post['note']) && isset($this->request->post['id'])) {
|
||||
|
||||
if($this->model_search_search->check_your_permission_by_id($this->request->post['id']) == 1) {
|
||||
$this->model_search_message->add_message_note($this->request->post['id'], $_SESSION['uid'], urldecode($this->request->post['note']));
|
||||
$this->model_search_message->add_message_note($this->request->post['id'], $session->get("uid"), urldecode($this->request->post['note']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ class ControllerMessageRestore extends Controller {
|
||||
$this->template = "message/restore.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -55,7 +56,7 @@ class ControllerMessageRestore extends Controller {
|
||||
/* send the email to all the recipients of the original email if we are admin or auditor users */
|
||||
|
||||
if(Registry::get('auditor_user') == 0) {
|
||||
array_push($rcpt, $_SESSION['email']);
|
||||
array_push($rcpt, $session->get("email"));
|
||||
}
|
||||
|
||||
$this->data['data'] = $this->data['text_failed_to_restore'];
|
||||
|
@ -9,6 +9,7 @@ class ControllerMessageView extends Controller {
|
||||
$this->template = "message/view.tpl";
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -56,7 +57,7 @@ class ControllerMessageView extends Controller {
|
||||
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['tag'])) {
|
||||
$this->model_search_message->add_message_tag($this->data['id'], $_SESSION['uid'], $this->request->post['tag']);
|
||||
$this->model_search_message->add_message_tag($this->data['id'], $session->get("uid"), $this->request->post['tag']);
|
||||
header("Location: " . $_SERVER['HTTP_REFERER']);
|
||||
exit;
|
||||
}
|
||||
@ -66,8 +67,8 @@ class ControllerMessageView extends Controller {
|
||||
$this->data['attachments'] = $this->model_search_message->get_attachment_list($this->data['piler_id']);
|
||||
|
||||
$this->data['message'] = $this->model_search_message->extract_message($this->data['piler_id'], $this->data['search']);
|
||||
$this->data['message']['tag'] = $this->model_search_message->get_message_tag($this->data['id'], $_SESSION['uid']);
|
||||
$this->data['message']['note'] = $this->model_search_message->get_message_note($this->data['id'], $_SESSION['uid']);
|
||||
$this->data['message']['tag'] = $this->model_search_message->get_message_tag($this->data['id'], $session->get("uid"));
|
||||
$this->data['message']['note'] = $this->model_search_message->get_message_note($this->data['id'], $session->get("uid"));
|
||||
|
||||
$this->data['images'] = array();
|
||||
|
||||
|
@ -8,6 +8,7 @@ class ControllerSearchFolder extends Controller {
|
||||
$this->id = "folder";
|
||||
$this->template = "search/folder.tpl";
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -16,7 +17,7 @@ class ControllerSearchFolder extends Controller {
|
||||
$this->data['folders'] = $this->model_folder_folder->get_folders_for_user();
|
||||
$this->data['extra_folders'] = $this->model_folder_folder->get_extra_folders_for_user();
|
||||
|
||||
$this->data['folders_by_hier'] = $this->model_folder_folder->get_all_folder_ids_hier($_SESSION['uid']);
|
||||
$this->data['folders_by_hier'] = $this->model_folder_folder->get_all_folder_ids_hier($session->get("uid"));
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class ControllerSearchTag extends Controller {
|
||||
$this->layout = "common/layout-empty";
|
||||
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -29,7 +30,7 @@ class ControllerSearchTag extends Controller {
|
||||
for($i=0; $i<count($ids); $i++) { $q .= ",?"; }
|
||||
$q = preg_replace("/^\,/", "", $q);
|
||||
|
||||
$this->model_search_message->bulk_add_message_tag($ids, $_SESSION['uid'], urldecode($this->request->post['tag']), $q);
|
||||
$this->model_search_message->bulk_add_message_tag($ids, $session->get("uid"), urldecode($this->request->post['tag']), $q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class ControllerUserAdd extends Controller {
|
||||
$this->template = "user/add.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$session = Registry::get('session');
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
@ -40,7 +40,7 @@ class ControllerUserAdd extends Controller {
|
||||
if($this->validate() == true){
|
||||
$ret = $this->model_user_user->add_user($this->request->post);
|
||||
|
||||
$_SESSION['last_domain'] = $this->request->post['domain'];
|
||||
$session->set("last_domain", $this->request->post['domain']);
|
||||
|
||||
if($ret == 1){
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
@ -73,6 +73,8 @@ class ControllerUserAdd extends Controller {
|
||||
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
$this->data['last_domain'] = $session->get("last_domain");
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
@ -30,17 +30,21 @@ class ControllerUserSettings extends Controller {
|
||||
$d = $r = '';
|
||||
$auditemails = $auditdomains = $auditgroups = $auditfolders = '';
|
||||
|
||||
$auditemails = implode(", ", $_SESSION['emails']);
|
||||
|
||||
foreach($_SESSION['auditdomains'] as $d) {
|
||||
$auditdomains .= ', '.$d;
|
||||
$auditemails = implode(", ", $session->get("emails"));
|
||||
|
||||
$_auditdomains = $session->get("auditdomains");
|
||||
|
||||
foreach($_auditdomains as $d) {
|
||||
$auditdomains .= ', ' . $d;
|
||||
}
|
||||
$auditdomains = preg_replace("/^,\s/", "", $auditdomains);
|
||||
|
||||
$auditgroups = preg_replace("/\s/", ", ", $this->model_group_group->get_groups_by_uid($_SESSION['uid']));
|
||||
$auditgroups = preg_replace("/\s/", ", ", $this->model_group_group->get_groups_by_uid($session->get("uid")));
|
||||
|
||||
$folders = $session->get("folders");
|
||||
|
||||
foreach ($_SESSION['folders'] as $r) {
|
||||
$auditfolders .= ', '.$r;
|
||||
foreach ($folders as $r) {
|
||||
$auditfolders .= ', ' . $r;
|
||||
}
|
||||
$auditfolders = preg_replace("/^,\s/", "", $auditfolders);
|
||||
|
||||
@ -76,6 +80,8 @@ class ControllerUserSettings extends Controller {
|
||||
|
||||
|
||||
$this->data['page_len'] = get_page_length();
|
||||
$this->data['theme'] = $session->get("theme");
|
||||
$this->data['lang'] = $session->get("lang");
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
Reference in New Issue
Block a user