rpicms

A CMS for the Raspberry Pi
git clone git://archive.git.mtrnord.blog/RpicmsTeam/rpicms.git
Log | Files | Refs | README | LICENSE

commit d38f82f11dc337a63b32eca7625859b9624a7892
parent 93b0982e80c5a2955c274b6406e7165e6a66ac21
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sat, 13 Dec 2014 20:56:51 +0100

new clean path's on the way :D

Diffstat:
Mcore/backend/admin/blog/newpost.php | 35++++-------------------------------
Mcore/backend/blog/posts.php | 10+++++++++-
Mthemes/jumbotron/index.php | 22+++++++++++++---------
3 files changed, 26 insertions(+), 41 deletions(-)

diff --git a/core/backend/admin/blog/newpost.php b/core/backend/admin/blog/newpost.php @@ -3,41 +3,14 @@ # flush browser cache # ####################### header("Cache-Control: no-cache, must-revalidate, no-store"); + +############################### +# include files from root dir # +############################### $root_1 = realpath($_SERVER["DOCUMENT_ROOT"]); $currentdir = getcwd(); $root_2 = str_replace($root_1, '', $currentdir); $root = explode("/", $root_2); include($root_1 . '/' . $root[1] . '/core/config/variables.config.php'); -################ -# lang support # -################ -function getBrowserLangs() { - $langs[0] = $langs[1] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); - $langs[0] = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); - foreach($langs[0] as $l) { - $q = explode(';', $l); - $lang = substr($q[0], 0, 2); - $q = (isset($q[1])) ? (float)substr($q[1], 2) : 1; - $result[$lang] = $q; - } - if(isset($result) && is_array($result)) { - arsort($result, SORT_NUMERIC); - return $result; - } - return $result[$langs[1]] = 1; -} - -$langs = getBrowserLangs(); -foreach($langs as $prio => $lang) { - if($lang = 'de') { - include('lang/de-DE.php'); - break; - } elseif($lang = 'en') { - include('lang/en-US.php'); - break; - } - // AND SO ON ................. -} - ?> \ No newline at end of file diff --git a/core/backend/blog/posts.php b/core/backend/blog/posts.php @@ -7,7 +7,15 @@ * @author Marcel Radzio <info@nordgedanken.de> * @version 1.0dev 1/12/2014 17:16 */ - include('../../core/config/connect.db.inc.php'); +############################### +# include files from root dir # +############################### +$root_1 = realpath($_SERVER["DOCUMENT_ROOT"]); +$currentdir = getcwd(); +$root_2 = str_replace($root_1, '', $currentdir); +$root = explode("/", $root_2); + + include($root_1 . '/' . $root[1] . '../../core/config/connect.db.inc.php'); //Check if Database connection established if (mysqli_connect_errno()) { printf("Verbindung fehlgeschlagen: %s\n", mysqli_connect_error()); diff --git a/themes/jumbotron/index.php b/themes/jumbotron/index.php @@ -74,21 +74,24 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> - <link rel="icon" href="../../core/libs/theme_engine/BootStrap/favicon.ico"> - <?php + echo '<link rel="icon" href="' . $root_1 . '/' . $root[1] . '/core/libs/theme_engine/BootStrap/favicon.ico">'; + echo "<title>$blog_name</title>"; ?> <!-- Bootstrap core CSS --> - <link href="../../core/libs/theme_engine/BootStrap/css/bootstrap.min.css" rel="stylesheet"> - + <?php + echo '<link href="' . $root_1 . '/' . $root[1] . '/core/libs/theme_engine/BootStrap/css/bootstrap.min.css" rel="stylesheet">'; + ?> <!-- Custom styles for this template --> <link href="jumbotron.css" rel="stylesheet"> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> - <!--[if lt IE 9]><script src="../../core/libs/theme_engine/BootStrap/js/ie8-responsive-file-warning.js"></script><![endif]--> - <script src="../../core/libs/theme_engine/BootStrap/js/ie-emulation-modes-warning.js"></script> + <?php + echo '<!--[if lt IE 9]><script src="' . $root_1 . '/' . $root[1] . '/core/libs/theme_engine/BootStrap/js/ie8-responsive-file-warning.js"></script><![endif]-->'; + echo '<script src="' . $root_1 . '/' . $root[1] . 'core/libs/theme_engine/BootStrap/js/ie-emulation-modes-warning.js"></script>'; + ?> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> @@ -129,7 +132,9 @@ ?> </div> <div id="navbar" class="navbar-collapse collapse"> - <form class="navbar-form navbar-right" role="form" action="../../core/backend/admin/user/login_check.php" method="post"> + <?php + echo'<form class="navbar-form navbar-right" role="form" action="' . $root_1 . '/' . $root[1] . 'core/backend/admin/user/login_check.php" method="post">'; + ?> <div class="form-group"> <input type="email" placeholder="Email" class="form-control" name="username" required="required" title="Please insert a valid Email (example@email.com)" x-moz-errormessage="Please insert a valid Email (example@email.com)"> </div> @@ -149,9 +154,8 @@ $x = 1; if ($empty_id && $empty_category && $empty_author){ #$id = 1; - include('../../core/backend/blog/posts.php'); + include($root_1 . '/' . $root[1] . 'core/backend/blog/posts.php'); while ($x < $post_id_clean+1){ - include('../../core/config/connect.db.inc.php'); echo " <h1> <a href='index.php?id=$id' rel='bookmark'> $post_title </a>