home *** CD-ROM | disk | FTP | other *** search
/ grafika-wolowiec.cba.pl / grafika-wolowiec.cba.pl.tar / grafika-wolowiec.cba.pl / admin / blog.php next >
PHP Script  |  2014-01-24  |  3KB  |  67 lines

  1. <?php
  2.     require_once("header.php");
  3.     @include_once("../res/blog.inc.php");
  4. ?>
  5. <div id="imAdminPage">
  6.     <div id="imBody">
  7.         <div class="imContent">
  8.             <!-- Show the available categories -->
  9.             <script>
  10.             function showCategory( obj ) {
  11.                 var cat = $( obj ).val();
  12.                 if ( cat !== "" )
  13.                     window.top.location.href = '<?php echo basename($_SERVER['PHP_SELF']) ?>?category=' + cat;
  14.                 else
  15.                     window.top.location.href = '<?php echo basename($_SERVER['PHP_SELF']) ?>';
  16.             }
  17.  
  18.             function showPost( obj, objcat ) {
  19.                 var post = $( obj ).val(),
  20.                     cat = $( objcat ).val();
  21.                 if ( post !== "" && cat !== "" )
  22.                     window.top.location.href = '<?php echo basename($_SERVER['PHP_SELF']) ?>?category=' + cat + '&post=' + post;
  23.                 else
  24.                     window.top.location.href = '<?php echo basename($_SERVER['PHP_SELF']) ?>';    
  25.             }
  26.             </script>
  27.             <select name="category" id="category" onchange="showCategory(this)">
  28.                 <option value=""><?php echo l10n("admin_category_select", "Select a category:")?></option>
  29. <?php foreach($imSettings['blog']['posts_cat'] as $category => $posts): ?>
  30.                 <option value="<?php echo $category ?>"<?php echo $category == @$_GET['category'] ? " selected" : "" ?>><?php echo str_replace("_", " ", $category) ?></option>
  31. <?php endforeach; ?>
  32.             </select>
  33. <?php if (isset($_GET['category'])): ?>
  34.             <select name="post" id="post" onchange="showPost(this, '#category')">
  35.                 <option value=""><?php echo l10n("admin_post_select", "Select a post:")?></option>
  36. <?php foreach($imSettings['blog']['posts_cat'][$_GET['category']] as $post): ?>
  37.                 <option value="<?php echo $post ?>"<?php echo $post == @$_GET['post'] ? " selected" : "" ?>><?php echo $imSettings['blog']['posts'][$post]['title'] ?></option>
  38. <?php endforeach; ?>
  39.             </select>
  40. <?php endif; ?>
  41. <?php 
  42.     if (isset($_GET['category']) && isset($_GET['post']))
  43.     {
  44.         $data = $imSettings['blog'];
  45.         $topic = new ImTopic($data['file_prefix'] . 'pc' . $_GET['post'], "../");
  46.         $topic->setPostUrl('blog.php?category=' . $_GET['category'] . '&post=' . $_GET['post']);
  47.         switch($data['sendmode'])
  48.         {
  49.             case "file":
  50.                 $topic->loadXML($data['folder']);
  51.             break;
  52.             case "db":
  53.                 $topic->loadDb($data['dbhost'], $data['dbuser'], $data['dbpassword'], $data['dbname'], $data['dbtable']);
  54.             break;
  55.         }
  56.         if (count($topic->comments->getAll()))
  57.         {
  58.             $topic->showSummary($data['comment_type'] != "comment", TRUE);
  59.         }
  60.         $topic->showAdminComments($data['comment_type'] != "comment", $data['comments_order']);
  61.     }
  62. ?>
  63.         </div>
  64.     </div>
  65. </div>
  66. <?php require_once("footer.php"); ?>
  67.