Fixed a bug with admin login

master
pecesama 2008-10-24 05:58:24 +00:00
parent 510091bc10
commit 918668ccb5
3 changed files with 27 additions and 14 deletions

View File

@ -13,6 +13,7 @@ if(!defined('entry'))define('entry', true);
?> ?>
<?php <?php
require('../entry.php'); require('../entry.php');
global $user, $conf, $tumble; global $user, $conf, $tumble;
$template = new plantillas("admin"); $template = new plantillas("admin");

View File

@ -34,9 +34,11 @@ class user extends Conexion_Mysql {
} }
if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") { if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") {
if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"])) && (isset($_SESSION['authenticated']) && $_SESSION['authenticated']==true)) { if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"])) && (isset($_SESSION['authenticated']) && $_SESSION['authenticated']==true)) {
return true; return true;
} }
} }
return false; return false;
@ -79,7 +81,7 @@ class user extends Conexion_Mysql {
} }
} }
function isAuthenticated(){ function isAuthenticated() {
return $this->isAdmin(); return $this->isAdmin();
} }

View File

@ -1,4 +1,5 @@
<?php <?php
ob_start();
if(!defined('entry') || !entry) die('Not a valid page'); if(!defined('entry') || !entry) die('Not a valid page');
/* /*
* Created on Sep 15, 2007 * Created on Sep 15, 2007
@ -24,6 +25,10 @@
* classes/imgsize.php * classes/imgsize.php
*/ */
error_reporting (E_ALL);
ini_set('display_errors', '1');
// PHP settings specific to Gelato // PHP settings specific to Gelato
ini_set('pcre.backtrack_limit', '10000'); ini_set('pcre.backtrack_limit', '10000');
// Globals to be used throughout the application // Globals to be used throughout the application
@ -31,10 +36,12 @@ define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);
$installed = true; $installed = true;
$configFile = Absolute_Path.'config.php'; $configFile = Absolute_Path.'config.php';
if(strpos($_SERVER['REQUEST_URI'],'/admin'))$dir = "../"; else $dir = ""; $dir = (strpos($_SERVER['REQUEST_URI'],'/admin')) ? "../" : "";
if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php'){ if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php'){
header("Location: {$dir}install.php");exit; header("Location: {$dir}install.php");
}else{ exit;
} else {
include(Absolute_Path.'classes/install.class.php'); include(Absolute_Path.'classes/install.class.php');
$install = new Install(); $install = new Install();
if(!$install->is_gelato_installed()){ if(!$install->is_gelato_installed()){
@ -45,8 +52,9 @@ if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php')
} }
} }
if($installed) if($installed) {
require($configFile); require($configFile);
}
require_once("classes/configuration.class.php"); require_once("classes/configuration.class.php");
require_once("classes/textile.class.php"); require_once("classes/textile.class.php");
@ -62,6 +70,7 @@ require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php'); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php');
if($installed){ if($installed){
// Globals to be used throughout the application // Globals to be used throughout the application
$user = new user(); $user = new user();
$tumble = new gelato(); $tumble = new gelato();
@ -75,3 +84,4 @@ if($installed){
unset($feeds); unset($feeds);
} }
?> ?>