Fixes a bug when admin links followed on images and video pages, a=chris
Fixes a bug when admin links followed on images and video pages, a=chris
diff --git a/error.php b/error.php
index bca62d21d..4e417efdd 100755
--- a/error.php
+++ b/error.php
@@ -41,6 +41,28 @@ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
if(!defined('BASE_DIR')) {
define("BASE_DIR", $pathinfo["dirname"].'/');
}
+
+/**
+ * shorthand for echo
+ *
+ * @param string $text string to send to the current output
+ */
+if(!function_exists("e")) {
+ function e($text)
+ {
+ echo $text;
+ }
+}
+//check if mobile css and formatting should be used or not
+$agent = $_SERVER['HTTP_USER_AGENT'];
+$is_admin = strcmp($controller_name, "admin") == 0;
+if((stristr($agent, "mobile") || stristr($agent, "fennec")) &&
+ !stristr($agent, "ipad") ) {
+ define("MOBILE", true);
+} else {
+ define("MOBILE", false);
+}
+
/**
* Load the configuration file
*/
@@ -80,15 +102,5 @@ $controller = new StaticController();
$controller->processRequest();
-/**
- * shorthand for echo
- *
- * @param string $text string to send to the current output
- */
-if(!function_exists("e")) {
- function e($text)
- {
- echo $text;
- }
-}
+
?>
diff --git a/images.php b/images.php
index 994315c6d..7fd69bf2f 100755
--- a/images.php
+++ b/images.php
@@ -42,5 +42,10 @@
if(!isset($_REQUEST['num'])) {
$_REQUEST['num']= 50;
}
+ if(isset($_REQUEST['c']) && $_REQUEST['c'] != 'search') {
+ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
+ require_once($pathinfo["dirname"]."/error.php");
+ exit();
+ }
require_once("index.php");
?>
diff --git a/video.php b/video.php
index dca6f03ef..beb8d0985 100755
--- a/video.php
+++ b/video.php
@@ -39,5 +39,10 @@
* Set that want only video results
*/
define("MEDIA", "Video");
+ if(isset($_REQUEST['c']) && $_REQUEST['c'] != 'search') {
+ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
+ include($pathinfo["dirname"]."/error.php");
+ exit();
+ }
require_once("index.php");
?>
diff --git a/views/elements/signin_element.php b/views/elements/signin_element.php
index 753f2aa97..fbf8ed27d 100755
--- a/views/elements/signin_element.php
+++ b/views/elements/signin_element.php
@@ -57,7 +57,7 @@ class SigninElement extends Element
<ul>
<?php
if(WEB_ACCESS) {
- ?> <li><a href="?c=settings&YIOOP_TOKEN=<?php
+ ?> <li><a href="./?c=settings&YIOOP_TOKEN=<?php
e($data['YIOOP_TOKEN'])?>&l=<?php
e(getLocaleTag());
e((isset($data['its'])) ? '&its='.$data['its'] : '');
@@ -66,13 +66,13 @@ class SigninElement extends Element
}
if(SIGNIN_LINK) {
if(!isset($_SESSION['USER_ID'])) {
- ?><li><a href="?c=admin"><?php
+ ?><li><a href="./?c=admin"><?php
e(tl('signin_element_signin')); ?></a></li><?php
} else {
- ?><li><a href="?c=admin&YIOOP_TOKEN=<?php
+ ?><li><a href="./?c=admin&YIOOP_TOKEN=<?php
e($data['YIOOP_TOKEN'])?>"><?php
e(tl('signin_element_admin')); ?></a></li><?php
- ?><li><a href="?c=search&a=signout"><?php
+ ?><li><a href="./?c=search&a=signout"><?php
e(tl('signin_element_signout')); ?></a></li>
<?php
}