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
 ?>
13
 ?>
14
 <?php
14
 <?php
15
 require('../entry.php');
15
 require('../entry.php');
16
+
16
 global $user, $conf, $tumble;
17
 global $user, $conf, $tumble;
17
 $template = new plantillas("admin");
18
 $template = new plantillas("admin");
18
 
19
 

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

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

+ 20 - 10
entry.php View File

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