rpicms

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

index.php (14266B)


      1 <?php
      2   /**
      3   * Jumbotron Theme for RPICMS
      4   *
      5   * @author Marcel Radzio <info@nordgedanken.de>
      6   * @version  1.0dev 1/12/2014 17:16
      7   */
      8 
      9   ###############################
     10   # include files from root dir #
     11   ###############################
     12   $root_1 = realpath($_SERVER["DOCUMENT_ROOT"]);
     13   $currentdir = getcwd();
     14   $root_2 = str_replace($root_1, '', $currentdir);
     15   $root_3 = explode("/", $root_2);
     16   if ($root_3[1] == 'core') {
     17     echo $root_3[1];
     18     $root = realpath($_SERVER["DOCUMENT_ROOT"]);
     19   }else{
     20     $root = $root_1 . '/' . $root_3[1];
     21   }
     22 
     23   #######################
     24   # flush browser cache #
     25   #######################
     26   header("Cache-Control: no-cache, must-revalidate, no-store");
     27 
     28   ###################
     29   # check variables #
     30   ###################
     31   $error = "0";
     32   $empty_id = empty($_GET["id"]);
     33   $empty_category = empty($_GET["category"]);
     34   $empty_author = empty($_GET["author"]);
     35   if (!$empty_id){
     36     $id = $_GET["id"];
     37   }else{
     38     $id = 1;
     39   }
     40   if (!$empty_category){
     41     $category = $_GET["category"];
     42   }else{
     43     $category = "";
     44   }
     45   if (!$empty_author){
     46     $author = $_GET["author"];
     47   }else{
     48     $author = "";
     49   }
     50 
     51   ##########################
     52   # include required files #
     53   ##########################
     54   include($root . '/core/config/variables.config.php');
     55 
     56   ################
     57   # lang support #
     58   ################
     59   function getBrowserLangs() {
     60     $langs[0] = $langs[1] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
     61     $langs[0] = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     62     foreach($langs[0] as $l) {
     63       $q = explode(';', $l);
     64       $lang = substr($q[0], 0, 2);
     65       $q = (isset($q[1])) ? (float)substr($q[1], 2) : 1;
     66       $result[$lang] = $q;
     67     }
     68     if(isset($result) && is_array($result)) {
     69       arsort($result, SORT_NUMERIC);
     70       return $result;
     71     }
     72       return $result[$langs[1]] = 1;
     73   }
     74 
     75     $langs = getBrowserLangs();
     76     foreach($langs as $prio => $lang) {
     77       if($lang = 'de') {
     78         include('lang/de-DE.php');
     79         break;
     80       } elseif($lang = 'en') {
     81         include('lang/en-US.php');
     82         break;
     83       }
     84        // AND SO ON .................
     85     }
     86 
     87 ?>
     88 <!DOCTYPE html>
     89 <html>
     90   <head>
     91     <meta charset="utf-8">
     92     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     93     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     94     <meta name="description" content="">
     95     <meta name="author" content="">
     96 
     97     <link rel="icon" href="../../core/libs/theme_engine/BootStrap/favicon.ico">
     98     <?php echo "<title>$blog_name</title>";?>
     99 
    100     <!-- Bootstrap core CSS -->
    101     <script src="../../core/libs/theme_engine/jquery/jquery2.1.3.min.js"></script>
    102     <link href="../../core/libs/theme_engine/BootStrap/css/bootstrap.min.css" rel="stylesheet">
    103     <!-- Custom styles for this template -->
    104     <link href="jumbotron.min.css" rel="stylesheet">
    105     <link rel="stylesheet" href="../../core/libs/theme_engine/font-awesome/css/font-awesome.min.css">
    106     <link rel="stylesheet" href="../../core/libs/theme_engine/bootstrap-social/bootstrap-social.min.css">
    107 
    108     <?php include($root . '/core/backend/admin/modules/html_header.php');?>
    109 
    110     <!--[if lt IE 9]><script src="../../core/libs/theme_engine/BootStrap/js/ie8-responsive-file-warning.js"></script><![endif]-->
    111     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    112     <!--[if lt IE 9]>
    113       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    114       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    115     <![endif]-->
    116     <script type="text/javascript">
    117       function Go (select) {
    118         var wert = select.options[select.options.selectedIndex].value;
    119         if (wert == "leer") {
    120           select.form.reset();
    121           parent.frames["unten"].focus();
    122           return;
    123         } else {
    124           if (wert == "ende") {
    125             top.location.href = location.href;
    126           } else {
    127             location.href = wert;
    128 
    129           }
    130         }
    131       }
    132     </script>
    133   </head>
    134   <body>
    135     <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    136       <div class="container">
    137         <div class="navbar-header">
    138           <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
    139             <span class="sr-only">Toggle navigation</span>
    140             <span class="icon-bar"></span>
    141             <span class="icon-bar"></span>
    142             <span class="icon-bar"></span>
    143           </button>
    144           <?php echo '<a class="navbar-brand" href="index.php">'.$blog_name.'</a>';?>
    145         </div>
    146         <div id="navbar" class="navbar-collapse collapse navbar-right">
    147           <div class="navbar-form navbar-right"><?php include($root . '/core/backend/admin/modules/navigation.php');?></div>
    148         </div><!--/.navbar-collapse -->
    149       </div>
    150     </nav>
    151 
    152     <!-- Main jumbotron for a primary marketing message or call to action -->
    153     <div class="jumbotron">
    154       <div class="container">
    155         <?php
    156           $x = 1;
    157           if ($empty_id && $empty_category && $empty_author){
    158             include($root . '/core/backend/blog/posts.php');
    159             while ($x < $post_id_clean+1){
    160               include($root . '/core/config/connect.db.inc.php');
    161               echo "
    162                 <script  type=\"text/javascript\">
    163                   document.title = \"$blog_name | Home\";
    164                 </script>
    165                 <h1>
    166                   <a href='index.php?id=$id' rel='bookmark'> $post_title </a>
    167                 </h1>
    168                 <div>
    169                   <h4>
    170                     <span class='theauthor'><a href='index.php?author=$post_author' rel='author'>$post_author</a></span> | <time>$post_date</time> | <span class='thecategory'><a href='index.php?category=$post_category' rel='category tag'>$post_category</a></span></br>
    171                   </h4>
    172                 </div>
    173                 <div>
    174                   <p>$post_text_short</br></p>
    175                 </div>
    176                 <div>
    177               ";
    178               include($root . '/core/backend/admin/modules/post_footer.php');
    179               echo "
    180                 </div>
    181                 <p>
    182                   <a class='btn btn-primary btn-lg' href='index.php?id=$id' role='button'>$name_more &raquo;</a>
    183                 </p>
    184               ";
    185               $x = $x+1;
    186               $id = $id+1;
    187               next_id_only();
    188             }
    189           }else{
    190             if ($category){
    191               $id = 1;
    192               include($root . '/core/backend/blog/posts.php');
    193               while ($x < $category_id_clean+1){
    194                 include($root . '/core/config/connect.db.inc.php');
    195                 if($post_category != $category){
    196                   $x = $x+1;
    197                   $id = $id+1;
    198                   next_id_category();
    199                 }else{
    200                   echo "
    201                     <script  type=\"text/javascript\">
    202                       document.title = \"$blog_name | $post_category\";
    203                     </script>
    204                     <h1>
    205                       <a href='index.php?id=$id' rel='bookmark'> $post_title </a>
    206                     </h1>
    207                     <div>
    208                       <h4>
    209                         <span class='theauthor'><a href='index.php?author=$post_author' rel='author'>$post_author</a></span> | <time>$post_date</time> | <span class='thecategory'><a href='index.php?category=$post_category' rel='category tag'>$post_category</a></span></br>
    210                       </h4>
    211                     </div>
    212                     <div>
    213                       <p>$post_text_short</br></p>
    214                     </div>
    215                     <div>
    216                   ";
    217                   include($root . '/core/backend/admin/modules/post_footer.php');
    218                   echo "
    219                     </div>
    220                     <p>
    221                       <a class='btn btn-primary btn-lg' href='index.php?id=$id' role='button'>$name_more &raquo;</a>
    222                     </p>
    223                   ";
    224                   $x = $x+1;
    225                   $id = $id+1;
    226                   next_id_category();
    227                 }
    228               }
    229             }else{
    230               if ($author){
    231                 $id = 1;
    232                 include($root . '/core/backend/blog/posts.php');
    233                   while ($x < $author_id_clean+1){
    234                   include($root . '/core/config/connect.db.inc.php');
    235 
    236                   if($post_author != $author){
    237                     $x = $x+1;
    238                     $id = $id+1;
    239                     next_id_author();
    240                   }else{
    241                     echo "
    242                       <script  type=\"text/javascript\">
    243                         document.title = \"$blog_name | $post_author\";
    244                       </script>
    245                       <h1>
    246                         <a href='index.php?id=$id' rel='bookmark'> $post_title </a>
    247                       </h1>
    248                       <div>
    249                         <h4>
    250                           <span class='theauthor'><a href='index.php?author=$post_author' rel='author'>$post_author</a></span> | <time>$post_date</time> | <span class='thecategory'><a href='index.php?category=$post_category' rel='category tag'>$post_category</a></span></br>
    251                         </h4>
    252                       </div>
    253                       <div>
    254                         <p>$post_text_short</br></p>
    255                       <div>
    256                     ";
    257                     include($root . '/core/backend/admin/modules/post_footer.php');
    258                     echo "
    259                       </div>
    260                       <p>
    261                         <a class='btn btn-primary btn-lg' href='index.php?id=$id' role='button'>$name_more &raquo;</a>
    262                       </p>
    263                     ";
    264                     $x = $x+1;
    265                     $id = $id+1;
    266                     next_id_author();
    267                   }
    268                 }
    269               }else{
    270                 include($root . '/core/backend/blog/posts.php');
    271                 echo "
    272                   <script  type=\"text/javascript\">
    273                     document.title = \"$blog_name | $post_title\";
    274                     document.getElementById(\"author\").setAttribute(\"content\", \"$post_author\");
    275                   </script>
    276                   <h1>
    277                     <a href='index.php?id=$id' rel='bookmark'> $post_title </a>
    278                   </h1>
    279                   <div>
    280                     <h4>
    281                       <span class='theauthor'><a href='index.php?author=$post_author' rel='author'>$post_author</a></span> | <time>$post_date</time> | <span class='thecategory'><a href='index.php?category=$post_category' rel='category tag'>$post_category</a></span></br>
    282                     </h4>
    283                   </div>
    284                   <div>
    285                     <p>$post_text</br></p>
    286                   </div>
    287                   <div>
    288                 ";
    289                 include($root . '/core/backend/admin/modules/post_footer.php');
    290                 echo "
    291                   </div>
    292                 ";
    293               }
    294             }
    295           }
    296         ?>
    297       </div>
    298     </div>
    299 
    300     <div class="container">
    301       <!-- Example row of columns -->
    302       <div class="row" style="overflow: hidden; float:left;">
    303         <?php
    304           $dirs = scandir($root . "/themes");
    305           $ausnahmen["1"] = ".htaccess";
    306           $ausnahmen["2"] = ".";
    307           $ausnahmen["3"] = "..";
    308           $dirs = array_diff($dirs, $ausnahmen);
    309 
    310           echo '
    311             <div class="col-md-4" style="padding-bottom: 1000px; margin-bottom: -1000px; float:left;">
    312               <h2>'.$name_themes.'</h2>
    313               <form action=".">
    314                 <p><select size="1" name="Auswahl" onchange="Go(this);" width="100%" class="form-control">
    315                   <option value="leer" selected="selected">[ bitte auswählen! ]</option>
    316                   <option value="leer">------------------------</option>
    317           ';
    318           foreach($dirs as $dir){
    319             $dir_name = ucwords($dir);
    320             echo "
    321               <option value=\"../$dir\">$dir_name</option>
    322             ";
    323           }
    324           echo '
    325                   <option value="leer">------------------------</option>
    326                   <option value="ende">Beenden</option>
    327                 </select></p>
    328               </form>
    329               <p><a class="btn btn-default" href="#" role="button" style="position:relative; margin-bottom:0%;">'.$name_details.' &raquo;</a></p>
    330             </div>
    331             <div class="col-md-4" style="padding-bottom: 1000px; margin-bottom: -1000px;" float:left;>
    332               <h2>'.$name_archiv.'</h2>
    333               <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
    334               <p><a class="btn btn-default" href="#" role="button" style="position:relative; margin-bottom:0%;">'.$name_details.' &raquo;</a></p>
    335             </div>
    336             <div class="col-md-4" style="padding-bottom: 1000px; margin-bottom: -1000px;" float:left;>
    337               <h2>'.$name_meta.'</h2>
    338               <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
    339               <p><a class="btn btn-default" href="#" role="button" style="position:relative; margin-bottom:0%;">'.$name_details.' &raquo;</a></p>
    340           ';
    341           ?>
    342         </div>
    343       </div>
    344 
    345       <hr>
    346 
    347       <footer>
    348         <p>&copy; RpicmsTeam 2014 &amp; 2015</p>
    349         <?php include($root . '/core/backend/admin/modules/footer.php'); ?>
    350       </footer>
    351     </div> <!-- /container -->
    352 
    353 
    354     <!-- Bootstrap core JavaScript
    355     ================================================== -->
    356     <!-- Placed at the end of the document so the pages load faster -->
    357     <script src="../../core/libs/theme_engine/BootStrap/js/bootstrap.min.js"></script>
    358     <?php include($root . '/core/backend/admin/modules/script_footer.php'); ?>
    359   </body>
    360 </html>