Ver código fonte

"Add/Edit my posts" link if isAdmin at home

pecesama 18 anos atrás
pai
commit
a46159f7e6
4 arquivos alterados com 19 adições e 3 exclusões
  1. 2 1
      admin/index.php
  2. 2 2
      classes/user.class.php
  3. 10 0
      index.php
  4. 5 0
      themes/tumblr/template_isadmin.htm

+ 2 - 1
admin/index.php Ver arquivo

@@ -65,7 +65,8 @@ if ($user->isAdmin()) {
65 65
 						<li id="subactive"><a href="#" id="subcurrent">Manage</a></li>
66 66
 					</ul>
67 67
 				</li>
68
-				<li><a href="admin.php">Manage users</a></li>
68
+				<li><a href="<?=$conf->urlGelato;?>/admin/admin.php">Manage users</a></li>
69
+				<li><a href="<?=$conf->urlGelato;?>/">Take me to the tumblelog</a></li>				
69 70
 				<li><a href="close.php" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Logoff</a></li>
70 71
 			</ul>
71 72
 		</div>

+ 2 - 2
classes/user.class.php Ver arquivo

@@ -22,9 +22,9 @@ class user extends Conexion_Mysql {
22 22
 	function isAdmin() {
23 23
 		if(isset($_COOKIE["gelato_cookie"]) && $_COOKIE["gelato_cookie"] && $_COOKIE["gelato_cookie"]!="") {
24 24
 			$galleta = explode(",",$_COOKIE["gelato_cookie"]);
25
-			if ($this->validaUsuario($galleta[1],$galleta[2])) {
25
+			if ($this->validateUser($galleta[1],$galleta[2])) {
26 26
 				$_SESSION["user_id"]=$galleta[0];
27
-				$_SESSION["usuario_login"]=$galleta[1];
27
+				$_SESSION["user_login"]=$galleta[1];
28 28
 			} else {
29 29
 				$_SESSION["user_id"]="";
30 30
 				$_SESSION["user_login"]="";

+ 10 - 0
index.php Ver arquivo

@@ -15,7 +15,9 @@
15 15
 	include("classes/gelato.class.php");	
16 16
 	include("classes/templates.class.php");
17 17
 	include("classes/pagination.php");
18
+	include("classes/user.class.php");
18 19
 		
20
+	$user = new user();
19 21
 	$conf = new configuration();
20 22
 	$tumble = new gelato();
21 23
 	$template = new plantillas($conf->template);
@@ -48,6 +50,14 @@
48 50
 	$template->cargarPlantilla($input, $output, "template_header");
49 51
 	$template->mostrarPlantilla();
50 52
 	
53
+	if ($user->isAdmin()) {	
54
+		$input = array("{User}", "{URL_Tumble}");
55
+		$output = array($_SESSION["user_login"], $conf->urlGelato);
56
+		
57
+		$template->cargarPlantilla($input, $output, "template_isadmin");
58
+		$template->mostrarPlantilla();
59
+	}
60
+	
51 61
 	if (!$id_post) {
52 62
 
53 63
 		$limit=$conf->postLimit;

+ 5 - 0
themes/tumblr/template_isadmin.htm Ver arquivo

@@ -0,0 +1,5 @@
1
+	<div style="padding:4px; border:solid 2px #bbb; display:inline; background-color:#ddd; position:absolute; top:3px; right:3px;">
2
+		<b>Hi, {User}.</b>&nbsp;&nbsp;
3
+		<a target="_top" href="{URL_Tumble}/admin/index.php">Add/Edit my posts</a>&nbsp;&nbsp;
4
+		<a target="_top" href="{URL_Tumble}/admin/close.php">Sign out</a>
5
+	</div>