Browse Source

Fixed a bug with admin login

pecesama 16 years ago
parent
commit
918668ccb5
3 changed files with 27 additions and 14 deletions
  1. 1 0
      admin/index.php
  2. 6 4
      classes/user.class.php
  3. 20 10
      entry.php

+ 1 - 0
admin/index.php View File

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

+ 6 - 4
classes/user.class.php View File

@@ -27,16 +27,18 @@ class user extends Conexion_Mysql {
27 27
 		$this->conf = new configuration();
28 28
 	}
29 29
 
30
-	function isAdmin() {
31
-
30
+	function isAdmin() {		
31
+		
32 32
 		if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
33 33
 			return true;
34 34
 		}
35 35
 
36
-		if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") {
36
+		if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") {		
37
+		
37 38
 			if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
38 39
 				return true;
39 40
 			}
41
+		
40 42
 		}
41 43
 
42 44
 		return false;
@@ -79,7 +81,7 @@ class user extends Conexion_Mysql {
79 81
 		}
80 82
 	}
81 83
 
82
-	function isAuthenticated(){
84
+	function isAuthenticated() {
83 85
 		return $this->isAdmin();
84 86
 	}
85 87
 

+ 20 - 10
entry.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+ob_start();
2 3
  if(!defined('entry') || !entry) die('Not a valid page');
3 4
 /*
4 5
  * Created on Sep 15, 2007
@@ -24,6 +25,10 @@
24 25
  * classes/imgsize.php
25 26
  */
26 27
 
28
+error_reporting (E_ALL);
29
+ini_set('display_errors', '1');
30
+
31
+ 
27 32
 // PHP settings specific to Gelato
28 33
 ini_set('pcre.backtrack_limit', '10000');
29 34
 // Globals to be used throughout the application
@@ -31,12 +36,14 @@ define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);
31 36
 $installed = true;
32 37
 $configFile = Absolute_Path.'config.php';
33 38
 
34
-if(strpos($_SERVER['REQUEST_URI'],'/admin'))$dir = "../"; else $dir = "";
39
+$dir = (strpos($_SERVER['REQUEST_URI'],'/admin')) ? "../" : "";
40
+
35 41
 if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php'){
36
-	header("Location: {$dir}install.php");exit;
37
-}else{
38
-	include(Absolute_Path.'classes/install.class.php');
39
-	$install = new Install();
42
+	header("Location: {$dir}install.php");
43
+	exit;
44
+} else {	
45
+	include(Absolute_Path.'classes/install.class.php');	
46
+	$install = new Install();	
40 47
 	if(!$install->is_gelato_installed()){
41 48
 		if(basename($_SERVER['PHP_SELF'])!='install.php'){
42 49
 				header("Location: {$dir}install.php");exit;
@@ -45,8 +52,9 @@ if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php')
45 52
 	}
46 53
 }
47 54
 
48
-if($installed)
55
+if($installed) {
49 56
 	require($configFile);
57
+}
50 58
 
51 59
 require_once("classes/configuration.class.php");
52 60
 require_once("classes/textile.class.php");
@@ -62,16 +70,18 @@ require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
62 70
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php');
63 71
 
64 72
 if($installed){
73
+
65 74
 	// Globals to be used throughout the application
66 75
 	$user = new user();
67 76
 	$tumble = new gelato();
68 77
 	$conf = new configuration();
69 78
 	$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
70
-
79
+	
71 80
 	session_start();
72
-
73
-	$feeds = new feeds();
74
-	$feeds->updateFeeds();
81
+	
82
+	$feeds = new feeds();	
83
+	$feeds->updateFeeds();	
75 84
 	unset($feeds);
76 85
 }
77 86
 ?>
87
+