Browse Source

replaced All

$_SESSION['user']
$_SESSION[config("site.url")]['user']
to prevent login Bug on multiple Installations
pull/55/head
Matthias Vogel 11 years ago
parent
commit
a257c1c2ea
5 changed files with 17 additions and 17 deletions
  1. +6
    -6
      system/admin/admin.php
  2. +2
    -2
      system/admin/views/edit-profile.html.php
  3. +6
    -6
      system/htmly.php
  4. +2
    -2
      system/includes/functions.php
  5. +1
    -1
      system/includes/session.php

+ 6
- 6
system/admin/admin.php View File

@ -19,7 +19,7 @@ function session($user, $pass, $str = null) {
if(file_exists($user_file)) { if(file_exists($user_file)) {
if($pass === $user_pass) { if($pass === $user_pass) {
$_SESSION['user'] = $user;
$_SESSION[config("site.url")]['user'] = $user;
header('location: admin'); header('location: admin');
} }
else { else {
@ -322,7 +322,7 @@ function get_feed($feed_url, $credit, $message=null) {
$tags = strip_tags(preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($entry->category))); $tags = strip_tags(preg_replace(array('/[^a-zA-Z0-9,.\-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($entry->category)));
$title = rtrim($entry->title, ' \,\.\-'); $title = rtrim($entry->title, ' \,\.\-');
$title = ltrim($title, ' \,\.\-'); $title = ltrim($title, ' \,\.\-');
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($title))); $url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($title)));
if ($credit == 'yes') { if ($credit == 'yes') {
$source = $entry->link; $source = $entry->link;
@ -341,8 +341,8 @@ function get_feed($feed_url, $credit, $message=null) {
// Get recent posts by user // Get recent posts by user
function get_recent_posts() { function get_recent_posts() {
if (isset($_SESSION['user'])) {
$posts = get_profile($_SESSION['user'], 1, 5);
if (isset($_SESSION[config("site.url")]['user'])) {
$posts = get_profile($_SESSION[config("site.url")]['user'], 1, 5);
if(!empty($posts)) { if(!empty($posts)) {
echo '<table class="post-list">'; echo '<table class="post-list">';
echo '<tr class="head"><th>Title</th><th>Published</th><th>Tag</th><th>Operations</th></tr>'; echo '<tr class="head"><th>Title</th><th>Published</th><th>Tag</th><th>Operations</th></tr>';
@ -372,7 +372,7 @@ function get_recent_posts() {
// Get all static pages // Get all static pages
function get_recent_pages() { function get_recent_pages() {
if (isset($_SESSION['user'])) {
if (isset($_SESSION[config("site.url")]['user'])) {
$posts = get_static_post(null); $posts = get_static_post(null);
if(!empty($posts)) { if(!empty($posts)) {
krsort($posts); krsort($posts);
@ -402,7 +402,7 @@ function get_recent_pages() {
// Get all available zip files // Get all available zip files
function get_backup_files () { function get_backup_files () {
if (isset($_SESSION['user'])) {
if (isset($_SESSION[config("site.url")]['user'])) {
$files = get_zip_files(); $files = get_zip_files();
if(!empty($files)) { if(!empty($files)) {
krsort($files); krsort($files);


+ 2
- 2
system/admin/views/edit-profile.html.php View File

@ -1,7 +1,7 @@
<?php <?php
if(isset($_SESSION['user'])) {
$user = $_SESSION['user'];
if(isset($_SESSION[config("site.url")]['user'])) {
$user = $_SESSION[config("site.url")]['user'];
} }
$filename = 'content/' . $user . '/author.md'; $filename = 'content/' . $user . '/author.md';


+ 6
- 6
system/htmly.php View File

@ -156,7 +156,7 @@ get('/:year/:month/:name/edit', function($year, $month, $name){
if(login()) { if(login()) {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user); $role = user('role', $user);
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
@ -242,7 +242,7 @@ get('/:year/:month/:name/delete', function($year, $month, $name){
if(login()) { if(login()) {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user); $role = user('role', $user);
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
@ -357,7 +357,7 @@ get('/edit/profile', function(){
// Get edited data for static page // Get edited data for static page
post('/edit/profile', function() { post('/edit/profile', function() {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$title = from($_REQUEST, 'title'); $title = from($_REQUEST, 'title');
$content = from($_REQUEST, 'content'); $content = from($_REQUEST, 'content');
if(!empty($title) && !empty($content)) { if(!empty($title) && !empty($content)) {
@ -387,7 +387,7 @@ post('/edit/profile', function() {
get('/admin/posts', function () { get('/admin/posts', function () {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user); $role = user('role', $user);
if(login()) { if(login()) {
@ -449,7 +449,7 @@ get('/admin/mine', function(){
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$profile = $_SESSION['user'];
$profile = $_SESSION[config("site.url")]['user'];
$page = from($_GET, 'page'); $page = from($_GET, 'page');
$page = $page ? (int)$page : 1; $page = $page ? (int)$page : 1;
@ -729,7 +729,7 @@ post('/add/post', function(){
$tag = from($_REQUEST, 'tag'); $tag = from($_REQUEST, 'tag');
$url = from($_REQUEST, 'url'); $url = from($_REQUEST, 'url');
$content = from($_REQUEST, 'content'); $content = from($_REQUEST, 'content');
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
if(!empty($title) && !empty($tag) && !empty($content)) { if(!empty($title) && !empty($tag) && !empty($content)) {
if(!empty($url)) { if(!empty($url)) {
add_post($title, $tag, $url, $content, $user); add_post($title, $tag, $url, $content, $user);


+ 2
- 2
system/includes/functions.php View File

@ -894,7 +894,7 @@ function get_thumbnail($text) {
// Return edit tab on post // Return edit tab on post
function tab($p) { function tab($p) {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user); $role = user('role', $user);
if(isset($p->author)) { if(isset($p->author)) {
if ($user === $p->author || $role === 'admin') { if ($user === $p->author || $role === 'admin') {
@ -1669,7 +1669,7 @@ function head_contents($title, $description, $canonical) {
// Return toolbar // Return toolbar
function toolbar() { function toolbar() {
$user = $_SESSION['user'];
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user); $role = user('role', $user);
$base = site_url(); $base = site_url();


+ 1
- 1
system/includes/session.php View File

@ -4,7 +4,7 @@ session_start();
function login() { function login() {
if(isset($_SESSION['user']) && !empty($_SESSION['user'])) {
if(isset($_SESSION[config("site.url")]['user']) && !empty($_SESSION[config("site.url")]['user'])) {
return true; return true;
} }
else { else {


Loading…
Cancel
Save