CVE-2017-5345: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (CWE-89)
value: SQL injection vulnerability in inc/lib/Control/Ajax/tags-ajax.control.php in GeniXCMS 0.0.8 allows remote authenticated editors to execute arbitrary SQL commands via the term parameter to the default URI.
CWE description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
CVSS v3 base score: 8.8
Published: 2017-01-12T06:59Z
Repository: https://github.com/semplon/GeniXCMS
Language: PHP
Files changed: assets/js/plugins/summernote-ext-genixcms.js, gxadmin/inc/media.php, gxadmin/inc/pages_form.php, gxadmin/inc/posts_form.php, inc/lib/Categories.class.php, inc/lib/Comments.class.php, inc/lib/Control.class.php, inc/lib/Control/Ajax/saveimage-ajax.control.php, inc/lib/Control/Ajax/tags-ajax.control.php, inc/lib/Control/Ajax/version-ajax.control.php, inc/lib/Control/Backend/mods.control.php, inc/lib/Control/Backend/posts.control.php, inc/lib/Control/Backend/themes.control.php, inc/lib/Control/Backend/users.control.php, inc/lib/Control/Frontend/author.control.php, inc/lib/Control/Frontend/cat.control.php, inc/lib/Control/Frontend/post.control.php, inc/lib/Control/Frontend/tag.control.php, inc/lib/Control/Frontend/thumb.control.php, inc/lib/Hooks.class.php, inc/lib/Mod.class.php, inc/lib/Posts.class.php, inc/lib/Router.class.php, inc/lib/Theme.class.php, inc/lib/Url.class.php, inc/lib/User.class.php, inc/themes/default/options.php, inc/themes/gneex/author.php, inc/themes/gneex/cat.php, inc/themes/gneex/css/style.css, inc/themes/gneex/fullwidth.php, inc/themes/gneex/function.php, inc/themes/gneex/index.php, inc/themes/gneex/options.php, inc/themes/gneex/single.php, register.php
Commit date: 2017-01-09 06:30:09 +0700
Commit message: Add Post Param at Hooks
Filter Categories for Tags
Change $url position to correct location at Comments.class.php
Add Author Pages
#60 Security Fix Issue
Change Ajax URL Router format
Change Ajax, Mods router scrapper

Diff: diff --git a/assets/js/plugins/summernote-ext-genixcms.js b/assets/js/plugins/summernote-ext-genixcms.js
index e0000857..a8f44f5d 100644
--- a/assets/js/plugins/summernote-ext-genixcms.js
+++ b/assets/js/plugins/summernote-ext-genixcms.js
@@ -55,11 +55,11 @@
                 // create button
                 var button = ui.button({
                     contents: '<i class="fa fa-list-alt"/> File Manager',
                     tooltip: 'elfinder',
                     click: function () {
-                        elfinderDialog();
+                        elfinderDialog($(this).closest('.note-editor').parent().children('.summernote'));
                     }
                 });
                 
                 // create jQuery object from button instance.
                 var $elfinder = button.render();
diff --git a/gxadmin/inc/media.php b/gxadmin/inc/media.php
index 827fc052..92edd718 100644
--- a/gxadmin/inc/media.php
+++ b/gxadmin/inc/media.php
@@ -13,36 +13,11 @@
  *
  * @author Puguh Wijayanto <psw@metalgenix.com>
  * @copyright 2014-2016 Puguh Wijayanto
  * @license http://www.opensource.org/licenses/mit-license.php MIT
  */
-if (isset($data['alertSuccess'])) {
-    
-    echo '<div class="alert alert-success" >
-    <button type="button" class="close" data-dismiss="alert">
-        <span aria-hidden="true">&times;</span>
-        <span class="sr-only">'.CLOSE.'</span>
-    </button>';
-    foreach ($data['alertSuccess'] as $alert) {
-        
-        echo "$alert\n";
-    }
-    echo '</div>';
-}
-if (isset($data['alertDanger'])) {
-    
-    echo '<div class="alert alert-danger" >
-    <button type="button" class="close" data-dismiss="alert">
-        <span aria-hidden="true">&times;</span>
-        <span class="sr-only">'.CLOSE.'</span>
-    </button>';
-    foreach ($data['alertDanger'] as $alert) {
-        
-        echo "$alert\n";
-    }
-    echo '</div>';
-}
+
 ?>
 <div class="row">
     <div class="col-md-12">
         <?=Hooks::run('admin_page_notif_action', $data);?>
     </div>
@@ -52,13 +27,8 @@ if (isset($data['alertDanger'])) {
         </h1>
         <hr />
     </div>
 
     <div class="col-sm-12">
-        <div class="row">
-            <div id="elfinder"></div>
-        </div>
-
-
-
+        <div id="elfinder"></div>
     </div>
 </div>
diff --git a/gxadmin/inc/pages_form.php b/gxadmin/inc/pages_form.php
index cc87babc..4192fd2a 100644
--- a/gxadmin/inc/pages_form.php
+++ b/gxadmin/inc/pages_form.php
@@ -220,11 +220,13 @@ if (isset($data['post'])) {
                         <label for="content"><?=CONTENT; ?></label> <a href="#" id="toggleEditor" class="btn btn-danger btn-xs pull-right"><i class="fa fa-desktop"></i> Editor</a>
                         <textarea name="content" class="form-control content editor" id="content" rows="20"><?=$content; ?></textarea>
                         <div id="myGrid"><?=$content; ?></div>
                         </div>
                         <?php
+
                     }
+                    Hooks::run('page_param_form', $data);
                 ?>
                 </div>
                 <div class="col-sm-4">
                     <div class="panel panel-default">
                         <div class="panel-heading">
diff --git a/gxadmin/inc/posts_form.php b/gxadmin/inc/posts_form.php
index e6d8fe62..59527d0a 100644
--- a/gxadmin/inc/posts_form.php
+++ b/gxadmin/inc/posts_form.php
@@ -194,11 +194,13 @@ if (isset($data['post'])) {
                     <div class="form-group">
                         <label for="content"><?=CONTENT; ?></label>
                         <textarea name="content" class="form-control hidden content editor" id="content" rows="" ><?=$content; ?></textarea>
                     </div>
                 <?php
+
                 }
+                Hooks::run('post_param_form', $data);
                 ?>
                 </div>
                 <div class="col-md-4">
                     <div class="panel panel-default">
                         <div class="panel-heading">
diff --git a/inc/lib/Categories.class.php b/inc/lib/Categories.class.php
index 3ef8b812..5435960a 100644
--- a/inc/lib/Categories.class.php
+++ b/inc/lib/Categories.class.php
@@ -65,17 +65,23 @@ class Categories
             $name = $vars['name'];
             $where = 'WHERE ';
             if (isset($vars['parent'])) {
                 $where .= " `parent` = '".$vars['parent']."' ";
             } else {
-                $where .= '1 ';
+                $where .= '';
             }
             if (isset($vars['type'])) {
-                $where .= " AND `type` = '".$vars['type']."' ";
+                if ($vars['type'] == 'tag') {
+                    $where .= " `type` = '{$vars['type']}' AND ";
+                } else {
+                    $where .= " `type` = '{$vars['type']}' AND `type` != 'tag' AND ";
+                }
+
             } else {
-                $where .= '';
+                $where .= " `type` != 'tag' AND ";
             }
+            $where .= '1 ';
             $order_by = 'ORDER BY ';
             if (isset($vars['order_by'])) {
                 $order_by .= ' '.$vars['order_by'].' ';
             } else {
                 $order_by .= ' `name` ';
@@ -127,11 +133,18 @@ class Categories
             $where = 'WHERE ';
             if (isset($vars['parent'])) {
                 $where .= " `parent` = '{$vars['parent']}' AND ";
             }
             if (isset($vars['type'])) {
-                $where .= " `type` = '{$vars['type']}' AND ";
+                if ($vars['type'] == 'tag') {
+                    $where .= " `type` = '{$vars['type']}' AND ";
+                } else {
+                    $where .= " `type` = '{$vars['type']}' AND `type` != 'tag' AND ";
+                }
+
+            } else {
+                $where .= " `type` != 'tag' AND ";
             }
             $where .= '1 ';
             $order_by = 'ORDER BY ';
             if (isset($vars['order_by'])) {
                 $order_by .= " {$vars['order_by']} ";
@@ -328,11 +341,11 @@ class Categories
     }
 
     public static function exist($cat)
     {
         $cat = Typo::int($cat);
-        $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}' AND `type` = 'post'";
+        $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}'";
         $q = Db::result($sql);
         // echo Db::$num_rows;
         if (Db::$num_rows > 0) {
             return true;
         } else {
diff --git a/inc/lib/Comments.class.php b/inc/lib/Comments.class.php
index ea49ca4b..8c8a7bb2 100644
--- a/inc/lib/Comments.class.php
+++ b/inc/lib/Comments.class.php
@@ -176,15 +176,16 @@ class Comments
         $post_id = $data['posts'][0]->id;
         $where = "AND `post_id` = '{$post_id}' AND `status` = '1' AND `parent` = '{$parent}' ";
         $order = ($parent > 0) ? 'ASC' : 'DESC';
         $sql = sprintf('SELECT * FROM `comments` WHERE 1 %s ORDER BY `date` %s LIMIT %d, %d', $where, $order, $offset, $max);
         $cmn = Db::result($sql);
-        $url = isset($v->url) ? $v->url : '#';
+
         $html = '<div class="col-md-12">
         <ul class="media-list">';
         if (DB::$num_rows > 0) {
             foreach ($cmn as $c => $v) {
+                $url = isset($v->url) ? $v->url : '#';
                 $avatar = Image::getGravatar($v->email, 60);
                 $html .= '
 						  <li class="media">
 						    <div class="media-left">
 						      <a href="'.$url.'">
diff --git a/inc/lib/Control.class.php b/inc/lib/Control.class.php
index 43031b7b..9ebcbed4 100644
--- a/inc/lib/Control.class.php
+++ b/inc/lib/Control.class.php
@@ -102,12 +102,12 @@ class Control
      * Add New SMART URL handler for better and simple router.
      * @since 0.0.7
      */
     public static function frontend()
     {
-        $arr = ['ajax', 'post', 'page', 'cat', 'mod', 'sitemap', 'rss',
-                    'account', 'search', 'author', 'tag', 'thumb', 'default'];
+        $arr = array('ajax', 'post', 'page', 'cat', 'mod', 'sitemap', 'rss',
+                    'account', 'search', 'author', 'tag', 'thumb', 'default');
         if (SMART_URL) {
             if (isset($_REQUEST) && $_REQUEST != '' && count($_REQUEST) > 0) {
                 (SMART_URL && isset($_GET)) ? self::route($arr) : self::get($arr);
             } else {
                 self::route($arr);
diff --git a/inc/lib/Control/Ajax/saveimage-ajax.control.php b/inc/lib/Control/Ajax/saveimage-ajax.control.php
index 160e2539..0a89bd9a 100644
--- a/inc/lib/Control/Ajax/saveimage-ajax.control.php
+++ b/inc/lib/Control/Ajax/saveimage-ajax.control.php
@@ -12,12 +12,13 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @link http://genixcms.org
  * @author Puguh Wijayanto <psw@metalgenix.com>
  * @copyright 2014-2016 Puguh Wijayanto
  * @license http://www.opensource.org/licenses/mit-license.php MIT
  */
-
-if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
+$data = Router::scrap($param);
+$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
+if (isset($token) && Token::isExist($token) ) {
     if (User::access(2)) {
         // A list of permitted file extensions
         $allowed = array('png', 'jpg', 'jpeg', 'gif');
         if (isset($_FILES['file']) && $_FILES['file']['error'] == 0) {
             $extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
diff --git a/inc/lib/Control/Ajax/tags-ajax.control.php b/inc/lib/Control/Ajax/tags-ajax.control.php
index 1ebd6539..e2e8fc03 100644
--- a/inc/lib/Control/Ajax/tags-ajax.control.php
+++ b/inc/lib/Control/Ajax/tags-ajax.control.php
@@ -12,15 +12,17 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @link http://genixcms.org
  * @author Puguh Wijayanto <psw@metalgenix.com>
  * @copyright 2014-2016 Puguh Wijayanto
  * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
-
-if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
+$data = Router::scrap($param);
+$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
+if (isset($token) && Token::isExist($token) ) {
     if (User::access(2)) {
+        $term = Typo::cleanX($_GET['term']);
         $tags = Db::result(
-            "SELECT * FROM `cat` WHERE `type` = 'tag' AND `name` LIKE '".$_GET['term']."%' ORDER BY `name` ASC"
+            "SELECT * FROM `cat` WHERE `type` = 'tag' AND `name` LIKE '".$term."%' ORDER BY `name` ASC"
         );
         $tag = array();
         foreach ($tags as $t) {
             $tag2[] = array(
                 'label' => $t->name,
diff --git a/inc/lib/Control/Ajax/version-ajax.control.php b/inc/lib/Control/Ajax/version-ajax.control.php
index 5e6d62c2..a91eb0aa 100644
--- a/inc/lib/Control/Ajax/version-ajax.control.php
+++ b/inc/lib/Control/Ajax/version-ajax.control.php
@@ -13,11 +13,13 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @author Puguh Wijayanto <psw@metalgenix.com>
  * @copyright 2014-2016 Puguh Wijayanto
  * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
 
-if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
+$data = Router::scrap($param);
+$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
+if (isset($token) && Token::isExist($token) ) {
     if (User::access(2)) {
         $v = trim(System::latestVersion());
 
         // print_r($v);
         $v2 = str_replace('.', '', $v);
diff --git a/inc/lib/Control/Backend/mods.control.php b/inc/lib/Control/Backend/mods.control.php
index 30e1583e..e63bfe7a 100644
--- a/inc/lib/Control/Backend/mods.control.php
+++ b/inc/lib/Control/Backend/mods.control.php
@@ -16,12 +16,13 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @author Puguh Wijayanto <psw@metalgenix.com>
  * @copyright 2014-2016 Puguh Wijayanto
  * @license http://www.opensource.org/licenses/mit-license.php MIT
  */
 
-$data['sitetitle'] = MODULES;
+$mod = Typo::cleanX($_GET['mod']);
+$data['sitetitle'] = Mod::title($mod);
 Theme::admin('header', $data);
-Mod::options($_GET['mod']);
+Mod::options($mod);
 Theme::admin('footer');
 
 /* End of file mods.control.php */
 /* Location: ./inc/lib/Control/Backend/mods.control.php */
diff --git a/inc/lib/Control/Backend/posts.control.php b/inc/lib/Control/Backend/posts.control.php
index 37583d0c..6cf7de88 100644
--- a/inc/lib/Control/Backend/posts.control.php
+++ b/inc/lib/Control/Backend/posts.control.php
@@ -100,10 +100,16 @@ if (User::access(2)) {
                             // print_r($multilang);
                         }
                         $tags = Typo::cleanX($_POST['tags']);
                         Posts::addParam('tags', $tags, $post_id);
                         Tags::add($tags);
+                        if (isset($_POST['param'])){
+                            foreach ($_POST['param'] as $k => $v) {
+                                Posts::addParam($k, $v, $post_id);
+                            }
+                        }
+
 
                         $data['alertSuccess'][] = POST." {$title} ".MSG_POST_ADDED;
                         Hooks::run('post_submit_add_action', $_POST);
                         Token::remove($_POST['token']);
                     }
@@ -203,13 +209,22 @@ if (User::access(2)) {
                         if (!Posts::existParam('tags', $_GET['id'])) {
                             Posts::addParam('tags', $tags, $_GET['id']);
                         } else {
                             Posts::editParam('tags', $tags, $_GET['id']);
                         }
-
                         Tags::add($tags);
 
+                        if (isset($_POST['param'])){
+                            foreach ($_POST['param'] as $k => $v) {
+                                if (!Posts::existParam($k, $_GET['id'])) {
+                                    Posts::addParam($k, $v, $_GET['id']);
+                                } else {
+                                    Posts::editParam($k, $v, $_GET['id']);
+                                }
+                            }
+                        }
+
                         $data['alertSuccess'][] = POST." {$title} ".MSG_POST_UPDATED;
                         Hooks::run('post_submit_edit_action', $_POST);
                         Token::remove($_POST['token']);
                     }
 
diff --git a/inc/lib/Control/Backend/themes.control.php b/inc/lib/Control/Backend/themes.control.php
index 25f666d1..5055e940 100644
--- a/inc/lib/Control/Backend/themes.control.php
+++ b/inc/lib/Control/Backend/themes.control.php
@@ -18,13 +18,14 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @license http://www.opensource.org/licenses/mit-license.php MIT
  */
 
 if (User::access(0)) {
     if (isset($_GET['view']) && $_GET['view'] == 'options') {
-        $data['sitetitle'] = THEMES;
+        $theme = Options::v('themes');
+        $data['sitetitle'] = Theme::title($theme);
         Theme::admin('header', $data);
-        Theme::options(Options::v('themes'));
+        Theme::options($theme);
         Theme::admin('footer');
     } else {
         if (isset($_POST['upload'])) {
             if (!Token::isExist($_POST['token'])) {
                 $alertDanger[] = TOKEN_NOT_EXIST;
diff --git a/inc/lib/Control/Backend/users.control.php b/inc/lib/Control/Backend/users.control.php
index b857344f..07c84bcc 100644
--- a/inc/lib/Control/Backend/users.control.php
+++ b/inc/lib/Control/Backend/users.control.php
@@ -74,11 +74,11 @@ if (User::access(1) || (isset($_GET['id']) && User::id(Session::val('username'))
                         // VALIDATE ALL
                         $alertDanger[] = TOKEN_NOT_EXIST;
                     }
 
                     // VALIDATE ALL
-                    if (!User::isExist($_POST['userid'])) {
+                    if (User::isExist($_POST['userid'])) {
                         $alertDanger[] = MSG_USER_EXIST;
                     }
 
                     if (!User::isEmail($_POST['email'])) {
                         $alertDanger[] = MSG_USER_EMAIL_EXIST;
@@ -250,11 +250,11 @@ if (User::access(1) || (isset($_GET['id']) && User::id(Session::val('username'))
                         if (!isset($_POST['pass2']) || $_POST['pass2'] == '') {
                             // VALIDATE ALL
                             $alertDanger[] = PASS2_CANNOT_EMPTY;
                         }
 
-                        if (!User::isExist($_POST['userid'])) {
+                        if (User::isExist($_POST['userid'])) {
                             $alertDanger[] = MSG_USER_EXIST;
                         }
                         if (!User::isSame($_POST['pass1'], $_POST['pass2'])) {
                             $alertDanger[] = MSG_USER_PWD_MISMATCH;
                         }
diff --git a/inc/lib/Control/Frontend/author.control.php b/inc/lib/Control/Frontend/author.control.php
new file mode 100644
index 00000000..b2787c6d
--- /dev/null
+++ b/inc/lib/Control/Frontend/author.control.php
@@ -0,0 +1,99 @@
+<?php
+
+defined('GX_LIB') or die('Direct Access Not Allowed!');
+/*
+ * GeniXCMS - Content Management System
+ *
+ * PHP Based Content Management System and Framework
+ *
+ * @since 0.0.1 build date 20141006
+ *
+ * @version 1.0.0
+ *
+ * @link https://github.com/semplon/GeniXCMS
+ * @link http://genixcms.org
+ *
+ * @author Puguh Wijayanto <psw@metalgenix.com>
+ * @copyright 2014-2016 Puguh Wijayanto
+ * @license http://www.opensource.org/licenses/mit-license.php MIT
+ */
+
+$post = '';
+$data = Router::scrap($param);
+$data['p_type'] = 'author';
+
+//$cat = Db::escape(Typo::Xclean($_GET['cat']));
+$author = (SMART_URL) ? $data['author'] : Typo::cleanX(Typo::strip($_GET['author']));
+$data['max'] = Options::v('post_perpage');
+//echo User::isExist($author);
+if (User::isExist($author)) {
+    if (SMART_URL) {
+        if (isset($data['paging'])) {
+            $paging = $data['paging'];
+        }
+        $type = isset($data['type']) ? $data['type']: '';
+    } else {
+        if (isset($_GET['paging'])) {
+            $paging = Typo::int($_GET['paging']);
+        }
+        $type = isset($_GET['type']) ? $_GET['type']: '';
+    }
+
+    if ($type != '') {
+        $where = " AND `type` = '{$type}' ";
+    } else {
+        $where = '';
+    }
+    //$paging = (SMART_URL) ? $data['paging'] : Typo::int(is_int($_GET['paging']));
+    if (isset($paging) && $paging != '') {
+        if ($paging > 0) {
+            $offset = ($paging - 1) * $data['max'];
+        } else {
+            $offset = 0;
+        }
+//        echo $offset;
+        $pagingtitle = " - Page {$paging}";
+    } else {
+        $offset = 0;
+        $paging = 1;
+        $pagingtitle = '';
+    }
+//    echo $paging;
+    $data['sitetitle'] = 'Post by : '.$author.$pagingtitle;
+    $data['posts'] = Db::result(
+        sprintf(
+            "SELECT * FROM `posts`
+                        WHERE `author` = '%s' %s
+                        AND `status` = '1'
+                        ORDER BY `date`
+                        DESC LIMIT %d, %d",
+            $author,
+            $where,
+            $offset,
+            $data['max']
+        )
+    );
+    $data['num'] = Db::$num_rows;
+//    echo $data['num'];
+    $data['posts'] = Posts::prepare($data['posts']);
+    // print_r($data['posts']);
+    $url = Url::author($author, $type);
+    $paging = array(
+                    'paging' => $paging,
+                    'table' => 'posts',
+                    'where' => '`author` = \''.$author.'\' AND `status` = \'1\' '.$where,
+                    'max' => $data['max'],
+                    'url' => $url,
+                    'type' => Options::v('pagination'),
+                );
+    $data['paging'] = Paging::create($paging, SMART_URL);
+    Theme::theme('header', $data);
+    Theme::theme('author', $data);
+    Theme::footer($data);
+    exit;
+} else {
+    Control::error('404');
+    exit;
+}
+/* End of file cat.control.php */
+/* Location: ./inc/lib/Control/Frontend/cat.control.php */
diff --git a/inc/lib/Control/Frontend/cat.control.php b/inc/lib/Control/Frontend/cat.control.php
index 302f867a..d6044bd1 100644
--- a/inc/lib/Control/Frontend/cat.control.php
+++ b/inc/lib/Control/Frontend/cat.control.php
@@ -72,11 +72,11 @@ if (Categories::exist($cat)) {
     // print_r($data['posts']);
     $url = Url::cat($cat);
     $paging = array(
                     'paging' => $paging,
                     'table' => 'posts',
-                    'where' => '`type` = \''.$type.'\' AND `cat` = \''.$cat.'\'',
+                    'where' => '`type` = \''.$type.'\' AND `cat` = \''.$cat.'\' AND `status` = \'1\' ',
                     'max' => $data['max'],
                     'url' => $url,
                     'type' => Options::v('pagination'),
                 );
     $data['paging'] = Paging::create($paging, SMART_URL);
diff --git a/inc/lib/Control/Frontend/post.control.php b/inc/lib/Control/Frontend/post.control.php
index 904514ee..41dc4afd 100644
--- a/inc/lib/Control/Frontend/post.control.php
+++ b/inc/lib/Control/Frontend/post.control.php
@@ -52,14 +52,14 @@ $data['posts'] = Db::result(
 $num_rows = Db::$num_rows;
 
 $data['posts'] = Posts::prepare($data['posts']);
 // print_r($data['posts']);
 if ($num_rows > 0) {
-    $theme = ($data['p_type'] == 'post') ? 'single' : $data['p_type'];
+    $theme = Theme::exist($data['p_type']) ? $data['p_type']: 'single';
     Theme::theme('header', $data);
     Theme::theme($theme, $data);
-    Theme::footer();
+    Theme::footer($data);
     Stats::addViews($post_id);
 
 } else {
     Control::error('404');
     exit;
diff --git a/inc/lib/Control/Frontend/tag.control.php b/inc/lib/Control/Frontend/tag.control.php
index b6cd9c68..28517b51 100644
--- a/inc/lib/Control/Frontend/tag.control.php
+++ b/inc/lib/Control/Frontend/tag.control.php
@@ -36,10 +36,13 @@ Tags::id(
     )
 );
 $type = Categories::type($tag);
 $name = Tags::name($tag);
 $slug = Tags::slug($tag);
+$data['name'] = $name;
+$data['tag'] = $tag;
+
 if (Tags::exist($name)) {
     # code...
 
     $data['max'] = Options::v('post_perpage');
 
@@ -88,19 +91,19 @@ if (Tags::exist($name)) {
 
     $url = Url::tag($tag);
     $paging = array(
                 'paging' => $paging,
                 'table' => 'posts',
-                'where' => '`type` = \''.$type.'\' ',
+                'where' => '`type` = \''.$type.'\' AND `status` = \'1\' ',
                 'max' => $data['max'],
                 'url' => $url,
                 'type' => Options::v('pagination'),
             );
     $data['paging'] = Paging::create($paging, SMART_URL);
     Theme::theme('header', $data);
     Theme::theme('tag', $data);
-    Theme::footer();
+    Theme::footer($data);
     exit;
 } else {
     Control::error('404');
 }
 
diff --git a/inc/lib/Control/Frontend/thumb.control.php b/inc/lib/Control/Frontend/thumb.control.php
index baf0c64c..bd4dabed 100644
--- a/inc/lib/Control/Frontend/thumb.control.php
+++ b/inc/lib/Control/Frontend/thumb.control.php
@@ -27,7 +27,12 @@ if (isset($data['thumb']) && $data['thumb'] != '' ) {
 } elseif( isset($_GET['thumb']) && $_GET['thumb'] != '') {
     $thumb = isset($_GET['thumb'])  ? $_GET['thumb']: '';
     $type = isset($_GET['type'])  ? $_GET['type'] :'';
     $size = isset($_GET['size'])  ? $_GET['size'] : '';
     $align = isset($_GET['align'])  ? $_GET['align'] : '';
+} else {
+    $thumb = '';
+    $type = '';
+    $size = '';
+    $align = '';
 }
 Image::thumbFly($thumb, $type, $size, $align);
diff --git a/inc/lib/Hooks.class.php b/inc/lib/Hooks.class.php
index 4e986419..d0ba55a3 100644
--- a/inc/lib/Hooks.class.php
+++ b/inc/lib/Hooks.class.php
@@ -31,51 +31,53 @@ class Hooks
     }
 
     public static function load()
     {
         $hooks = array(
-                'init' => array(), // init the system
-                'header_pre_action' => array(), // action before load header
-                'site_title_filter' => array(), // filter website title
-                'site_desc_filter' => array(),
-                'site_key_filter' => array(),
-                'header_load_meta' => array(),
-                'footer_load_lib' => array(),
-                'post_title_filter' => array(),
-                'post_meta_filter' => array(),
-                'post_content_filter' => array(),
-                'post_author_filter' => array(),
-                'post_date_filter' => array(),
-                'post_category_filter' => array(),
-                'post_submit_add_action' => array(), // on submit
-                'post_sqladd_action' => array(), // on sql add
-                'post_submit_edit_action' => array(), // on submit
-                'post_sqledit_action' => array(), // on sql add
-                'post_submit_title_filter' => array(),
-                'post_submit_content_filter' => array(),
-                'post_submit_category_filter' => array(),
-                'post_delete_action' => array(), // on delete
-                'post_sqldel_action' => array(), // on sql delete
-                'user_submit_add_action' => array(),
-                'user_sqladd_action' => array(),
-                'user_submit_edit_action' => array(),
-                'user_sqledit_action' => array(),
-                'user_delete_action' => array(),
-                'user_sqldel_action' => array(),
-                'user_reg_action' => array(),
-                'user_login_action' => array(),
-                'user_logout_action' => array(),
-                'user_activation_action' => array(),
-                'admin_page_notif_action' => array(),
-                'admin_page_top_action' => array(),
-                'admin_page_bottom_action' => array(),
-                'admin_page_dashboard_action' => array(),
-                'admin_page_dashboard_statslist_action' => array(),
-                'admin_footer_action' => array(),
-                'module_install_action' => array(),
-                'theme_install_action' => array(),
-                'mod_control' => array(),
+            'init' => array(), // init the system
+            'header_pre_action' => array(), // action before load header
+            'site_title_filter' => array(), // filter website title
+            'site_desc_filter' => array(),
+            'site_key_filter' => array(),
+            'header_load_meta' => array(),
+            'footer_load_lib' => array(),
+            'post_title_filter' => array(),
+            'post_meta_filter' => array(),
+            'post_content_filter' => array(),
+            'post_author_filter' => array(),
+            'post_date_filter' => array(),
+            'post_category_filter' => array(),
+            'post_submit_add_action' => array(), // on submit
+            'post_sqladd_action' => array(), // on sql add
+            'post_submit_edit_action' => array(), // on submit
+            'post_sqledit_action' => array(), // on sql add
+            'post_submit_title_filter' => array(),
+            'post_submit_content_filter' => array(),
+            'post_submit_category_filter' => array(),
+            'post_delete_action' => array(), // on delete
+            'post_sqldel_action' => array(), // on sql delete
+            'post_param_form' => array(),
+            'page_param_form' => array(),
+            'user_submit_add_action' => array(),
+            'user_sqladd_action' => array(),
+            'user_submit_edit_action' => array(),
+            'user_sqledit_action' => array(),
+            'user_delete_action' => array(),
+            'user_sqldel_action' => array(),
+            'user_reg_action' => array(),
+            'user_login_action' => array(),
+            'user_logout_action' => array(),
+            'user_activation_action' => array(),
+            'admin_page_notif_action' => array(),
+            'admin_page_top_action' => array(),
+            'admin_page_bottom_action' => array(),
+            'admin_page_dashboard_action' => array(),
+            'admin_page_dashboard_statslist_action' => array(),
+            'admin_footer_action' => array(),
+            'module_install_action' => array(),
+            'theme_install_action' => array(),
+            'mod_control' => array(),
             );
 
         return $hooks;
     }
 
diff --git a/inc/lib/Mod.class.php b/inc/lib/Mod.class.php
index 51728250..875cb065 100644
--- a/inc/lib/Mod.class.php
+++ b/inc/lib/Mod.class.php
@@ -39,11 +39,11 @@ class Mod
         }
     }
 
     public static function modList()
     {
-        //$mod = '';
+        $mod = array();
         $handle = dir(GX_MOD);
         while (false !== ($entry = $handle->read())) {
             if ($entry != '.' && $entry != '..') {
                 $dir = GX_MOD.$entry;
                 if (is_dir($dir) == true) {
@@ -277,10 +277,17 @@ class Mod
         } else {
             return false;
         }
     }
 
+    public static function title($mod)
+    {
+        $data = self::data($mod);
+
+        return $data['name'];
+    }
+
     /*
      * menulist
      *
      *
      */
diff --git a/inc/lib/Posts.class.php b/inc/lib/Posts.class.php
index a78455d0..68cf9434 100644
--- a/inc/lib/Posts.class.php
+++ b/inc/lib/Posts.class.php
@@ -463,11 +463,11 @@ class Posts
         $tag = implode(', ', $tag);
 
         return $title.' : '.$tag;
     }
 
-    public static function related($id, $num, $cat, $type = 'list')
+    public static function related($id, $num, $cat, $mode = 'list')
     {
         $id = Typo::int($id);
         if (self::existParam('tags', $id)) {
             $tag = self::getParam('tags', $id);
             $tag = explode(',', $tag);
@@ -487,47 +487,48 @@ class Posts
                         JOIN `posts_param` AS B
                         ON A.`id` = B.`post_id`
                         WHERE (A.`cat` = '%d' %s)
                         AND A.`id` != '%d'
                         AND A.`status` = '1'
-                        AND A.`type` = 'post'
+                        AND A.`type` = '%s'
                         ORDER BY
                         RAND() LIMIT %d, %d",
                 $cat,
                 $where_tag,
                 $id,
+                $post_type,
                 0,
                 $num
             )
         );
         if (isset($post['error'])) {
             $related = 'No Related Post(s)';
         } else {
             $related = '';
-            if ($type == 'list') {
+            if ($mode == 'list') {
                 $related .= '<ul class="list-group related">';
                 foreach ($post as $p) {
                     if ($p->id != $id) {
                         $related .= '<li class="list-group-item"><a href="'.Url::post($p->id)."\">$p->title</a></li>";
                     } else {
                         $related .= '';
                     }
                 }
                 $related .= '</ul>';
-            } elseif ($type == 'box') {
+            } elseif ($mode == 'box') {
                 $related .= '<ul class="list-group related clearfix">';
                 foreach ($post as $p) {
                     if ($p->id != $id) {
-                        $title = (strlen($p->title) > 40) ? substr($p->title, 0, 38).'...' : $p->title;
+                        $title = (strlen($p->title) > 34) ? substr($p->title, 0, 34).'...' : $p->title;
                         $img = self::getImage(Typo::Xclean($p->content));
                         if ($img != '') {
                             $img = Url::thumb($img, 'square', 200);
                         } else {
                             $img = Url::thumb('assets/images/noimage.png', '', 200);
                         }
                         $related .= '<li class="list-unstyled col-sm-3 col-md-3 clearfix"><a href="'.Url::post($p->id).'">
-                        <img src="'.$img.'" class="img-responsive center-block">'.$title.'</a><br /><br /></li>';
+                        <img src="'.$img.'" class="img-responsive center-block">'.$title.'</a></li>';
                     } else {
                         $related .= '';
                     }
                 }
                 $related .= '</ul>';
diff --git a/inc/lib/Router.class.php b/inc/lib/Router.class.php
index 12246818..0b48f6a5 100644
--- a/inc/lib/Router.class.php
+++ b/inc/lib/Router.class.php
@@ -44,34 +44,38 @@ class Router
      * )
      */
     public static function map()
     {
         self::$_route = array(
-        'thumb/type/(.*)/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '4', 'type' => '1', 'size' => '2', 'align' => '3'),
-        'thumb/type/(.*)/size/([0-9]+)/(.*)' => array('thumb' => '3', 'type' => '1', 'size' => '2'),
-        'thumb/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '3', 'size' => '1', 'align' => '2'),
-        'category/([0-9]+)/(.*)/paging/([0-9]+)/' => array('cat' => '1', 'paging' => '3'),
-        'category/([0-9]+)/(.*)/' => array('cat' => '1'),
-        'tag/(.*)/paging/([0-9]+)/' => array('tag' => '1', 'paging' => '3'),
-        'tag/(.*)/' => array('tag' => '1'),
-        '([a-z]+)/mod/(.*)'.GX_URL_PREFIX => array('mod' => '2', 'lang' => '1'),
-        // '/(.[a-z]+)/(.+)'.GX_URL_PREFIX => array('page' => '2', 'lang' => '1'),
-        'mod/(.*)'.GX_URL_PREFIX => array('mod' => '1'),
-        // '/(.+)'.GX_URL_PREFIX => array('page' => '1'),
-        'paging/([0-9]+)/' => array('default', 'paging' => '1'),
-        'error/([0-9]+)/' => array('error' => '1'),
-        '([a-z]+)/(.*)'.GX_URL_PREFIX => array('post' => '2', 'lang' => '1'),
-        '(.*)'.GX_URL_PREFIX => array('post' => '1'),
-        'ajax/(.*)/(.*)' => array('ajax' => '1', 'token' => '2'),
-        'thumb/size/([0-9]+)/(.*)' => array('thumb' => '2', 'size' => '1'),
-        'thumb/type/(.*)/(.*)' => array('thumb' => '2', 'type' => '1'),
-        'thumb/align/(.*)/(.*)' => array('thumb' => '2', 'align' => '1'),
-        'thumb/(.*)' => array('thumb' => '1'),
-        'error/' => array('error'),
-        'sitemap/' => array('sitemap'),
-        'rss/' => array('rss'),
-        '/' => array('default'),
+            'thumb/type/(.*)/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '4', 'type' => '1', 'size' => '2', 'align' => '3'),
+            'thumb/type/(.*)/size/([0-9]+)/(.*)' => array('thumb' => '3', 'type' => '1', 'size' => '2'),
+            'thumb/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '3', 'size' => '1', 'align' => '2'),
+            'category/([0-9]+)/(.*)/paging/([0-9]+)/' => array('cat' => '1', 'paging' => '3'),
+            'category/([0-9]+)/(.*)/' => array('cat' => '1'),
+            'tag/(.*)/paging/([0-9]+)/' => array('tag' => '1', 'paging' => '3'),
+            'tag/(.*)/' => array('tag' => '1'),
+            '([a-z]+)/mod/(.*)'.GX_URL_PREFIX => array('mod' => '2', 'lang' => '1'),
+            // '/(.[a-z]+)/(.+)'.GX_URL_PREFIX => array('page' => '2', 'lang' => '1'),
+            'mod/(.*)'.GX_URL_PREFIX => array('mod' => '1'),
+            // '/(.+)'.GX_URL_PREFIX => array('page' => '1'),
+            'paging/([0-9]+)/' => array('default', 'paging' => '1'),
+            'error/([0-9]+)/' => array('error' => '1'),
+            '([a-z]+)/(.*)'.GX_URL_PREFIX => array('post' => '2', 'lang' => '1'),
+            '(.*)'.GX_URL_PREFIX => array('post' => '1'),
+            'ajax/(.*)/(.*)' => array('ajax' => '1', 'token' => '2'),
+            'thumb/size/([0-9]+)/(.*)' => array('thumb' => '2', 'size' => '1'),
+            'thumb/type/(.*)/(.*)' => array('thumb' => '2', 'type' => '1'),
+            'thumb/align/(.*)/(.*)' => array('thumb' => '2', 'align' => '1'),
+            'thumb/(.*)' => array('thumb' => '1'),
+            'author/(.*)/(.*)/paging/([0-9]+)/' => array('author' => '1', 'type' => '2', 'paging' => '3'),
+            'author/(.*)/paging/([0-9]+)/' => array('author' => '1', 'paging' => '2'),
+            'author/(.*)/(.*)/' => array('author' => '1', 'type' => '2'),
+            'author/(.*)/' => array('author' => '1'),
+            'error/' => array('error'),
+            'sitemap/' => array('sitemap'),
+            'rss/' => array('rss'),
+            '/' => array('default'),
         );
 
         return self::$_route;
     }
 
@@ -147,11 +151,11 @@ class Router
      * @return array
      */
     public static function extract($var, $m)
     {
         // print_r($m);
-        $va = [];
+        $va = array();
         foreach ($var as $k2 => $v2) {
             // print_r($k2);
             if (!is_int($k2)) {
                 $va[] = [$k2 => $m[$v2]];
             } elseif (is_int($k2)) {
diff --git a/inc/lib/Theme.class.php b/inc/lib/Theme.class.php
index fe3409b4..57bf027b 100644
--- a/inc/lib/Theme.class.php
+++ b/inc/lib/Theme.class.php
@@ -251,9 +251,16 @@ class Theme
             }
         }
 
         return $list;
     }
+
+    public static function title($mod)
+    {
+        $data = self::data($mod);
+
+        return $data['name'];
+    }
 }
 
 /* End of file Theme.class.php */
 /* Location: ./inc/lib/Theme.class.php */
diff --git a/inc/lib/Url.class.php b/inc/lib/Url.class.php
index b7b7416c..e5e6f67b 100644
--- a/inc/lib/Url.class.php
+++ b/inc/lib/Url.class.php
@@ -365,9 +365,27 @@ class Url
     {
         $theme = Options::v('themes');
 
         return Site::$url.'inc/themes/'.$theme.'/';
     }
+
+    public static function author($vars, $type='')
+    {
+        switch (SMART_URL) {
+            case true:
+                $type = ($type != '') ? $type.'/': '';
+                $inFold = (Options::v('permalink_use_index_php') == 'on') ? 'index.php/' : '';
+                $url = Site::$url.$inFold.'author/'.$vars.'/'.$type;
+                break;
+
+            default:
+                $type = ($type != '') ? '&type='.$type: '';
+                $url = Site::$url."?author={$vars}$type";
+                break;
+        }
+
+        return $url;
+    }
 }
 
 /* End of file Url.class.php */
 /* Location: ./inc/lib/Url.class.php */
diff --git a/inc/lib/User.class.php b/inc/lib/User.class.php
index a571ac7c..4e344ff7 100644
--- a/inc/lib/User.class.php
+++ b/inc/lib/User.class.php
@@ -215,26 +215,26 @@ class User
         $pass = substr($hash, 5, 8);
 
         return $pass;
     }
 
-    public static function isExist($user)
+    public static function isExist($user, $except='')
     {
-        if (isset($_GET['act']) && $_GET['act'] == 'edit') {
-            $id = Typo::int($_GET['id']);
-            $where = "AND `id` != '{$id}' ";
+        if ($except != '') {
+            $id = Typo::int($except);
+            $where = "AND `userid` != '{$id}' ";
         } else {
             $where = '';
         }
         $user = sprintf('%s', Typo::cleanX($user));
         $sql = sprintf("SELECT `userid` FROM `user` WHERE `userid` = '%s' %s ", $user, $where);
         $usr = Db::result($sql);
         $n = Db::$num_rows;
         if ($n > 0) {
-            return false;
-        } else {
             return true;
+        } else {
+            return false;
         }
     }
 
     public static function isSame($p1, $p2)
     {
diff --git a/inc/themes/default/options.php b/inc/themes/default/options.php
index cfa66a98..993d8863 100644
--- a/inc/themes/default/options.php
+++ b/inc/themes/default/options.php
@@ -27,11 +27,11 @@ if (User::access(0)) {
 
             $opt = Options::get('mdo_theme_options');
             // $opt = utf8_encode($opt);
             $opt = json_decode($opt, true);
             if (is_array($opt)) {
-                $o = [];
+                $o = array();
                 foreach ($opt as $k => $v) {
                     $o[$k] = urldecode($v);
                 }
             } else {
                 $o['mdo_analytics'] = '';
diff --git a/inc/themes/gneex/author.php b/inc/themes/gneex/author.php
new file mode 100644
index 00000000..13ea9c1a
--- /dev/null
+++ b/inc/themes/gneex/author.php
@@ -0,0 +1,82 @@
+<?php
+$gneex = Gneex::$opt;
+?>
+    <section id="innerslide">
+        
+        <div class="bg-slide">
+            
+        </div>
+
+    </section>
+
+    <section id="blog">
+        <div class="container">
+            
+            <div class="col-md-8">
+                <h2 class="category-title"><?=$data['author'];?></h2>
+                <hr />
+                <div class=" blog-lists clearfix">
+                <?php
+                if (Gneex::opt('adsense') != '') {
+                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
+                } else {
+                    echo '<div class="col-md-12">&nbsp;</div>';
+                }
+                ?>
+                <?php
+                if ($data['num'] > 0) {
+                    foreach ($data['posts'] as $p) {
+                        if ($gneex['category_layout'] == 'magazine') {
+                            # code...
+                            $img = Posts::getImage(Posts::content($p->content));
+                            if ($img != '') {
+                                $im = '<img src="'.Url::thumb($img, '', 300).'" class="img-responsive">';
+                            } else {
+                                $im = '<img src="'.Url::thumb('assets/images/noimage.png', '', 300).'" class="img-responsive">';
+                            }
+                            echo '
+                            <article class="blog-post magazine col-md-12 clearfix">
+                            <div class="col-sm-4 col-md-4">
+                            '.$im.'
+                            </div>
+                            <div class="col-sm-8 col-md-8">
+                                <h3><a href="'.Url::post($p->id).'">'.$p->title.'</a></h3>
+                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')."
+                                 in <a href=\"".Url::cat($p->cat)."\">".Categories::name($p->cat)."</a>
+                                by <a href=\"".Url::author($p->author)."\">{$p->author}</a></small><br /><br /></div>
+                                ".substr(Typo::strip(Posts::content($p->content)), 0, 350).'
+                            </div>
+                            <div class="col-sm-12 col-md-12 clearfix">
+                                <hr />
+                            </div>
+                            </article>
+                                ';
+                        } else {
+                            echo '
+                            <article class="blog-post col-md-12">
+                                <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
+                                <hr />
+                                ".Posts::format($p->content, $p->id).'
+                                <div class="blog-footer">posted in '.Categories::name($p->cat).', 
+                                at '.Date::format($p->date)." by <a href=\"".Url::author($p->author)."\">{$p->author}</a></div>
+                            </article>
+                                ";
+                        }
+                    }
+                } else {
+                    echo 'No Post to Show';
+                }
+                ?>
+                <?php
+                if (Gneex::opt('adsense') != '') {
+                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
+                }
+                ?>
+                </div>
+                <?=$data['paging'];?>
+            </div>
+            <?php Theme::theme('rightside', $data); ?>
+                
+
+        </div>
+    </section>
diff --git a/inc/themes/gneex/cat.php b/inc/themes/gneex/cat.php
index bdcd110c..54b3b214 100644
--- a/inc/themes/gneex/cat.php
+++ b/inc/themes/gneex/cat.php
@@ -39,11 +39,13 @@ $gneex = Gneex::$opt;
                             <div class="col-sm-4 col-md-4">
                             '.$im.'
                             </div>
                             <div class="col-sm-8 col-md-8">
                                 <h3><a href="'.Url::post($p->id).'">'.$p->title.'</a></h3>
-                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')." by <a href=\"#\">{$p->author}</a></small><br /><br /></div>
+                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')." 
+                                in <a href=\"".Url::cat($p->cat)."\">".Categories::name($p->cat)."</a>
+                                by <a href=\"".Url::author($p->author)."\">{$p->author}</a></small><br /><br /></div>
                                 ".substr(Typo::strip(Posts::content($p->content)), 0, 350).'
                             </div>
                             <div class="col-sm-12 col-md-12 clearfix">
                                 <hr />
                             </div>
@@ -53,11 +55,12 @@ $gneex = Gneex::$opt;
                             echo '
                             <article class="blog-post col-md-12">
                                 <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
                                 <hr />
                                 ".Posts::format($p->content, $p->id).'
-                                <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date)." by <a href=\"#\">{$p->author}</a></div>
+                                <div class="blog-footer">posted in '.Categories::name($p->cat).', 
+                                at '.Date::format($p->date)." by <a href=\"".Url::author($p->author)."\">{$p->author}</a></div>
                             </article>
                                 ";
                         }
                     }
                 } else {
diff --git a/inc/themes/gneex/css/style.css b/inc/themes/gneex/css/style.css
index f4d79092..7bf44d5d 100644
--- a/inc/themes/gneex/css/style.css
+++ b/inc/themes/gneex/css/style.css
@@ -41,10 +41,13 @@ article h2 {
 
 article .meta {
     font-family: 'Rasa', serif;
     font-size: 1.2em;
 }
+article .content img {
+    box-shadow: 1px 1px 3px rgba(0,0,0,.4);
+}
 .container {
     max-width: 1280px;
 }
 #header {
     width: 100%;
@@ -162,14 +165,12 @@ article .meta {
 
 #front-text h2 span {
     color: #fff;
     font-size: 1.4em;
     font-weight: bold;
-    text-transform: uppercase;
     line-height: 58px;
     letter-spacing: -.001em;
-    background-color: rgba(0,0,0,.7);
     font-family: 'Arial', sans-serif;
 }
 
 .front-textbox {
     /*background-color: rgba(0,0,0,.7);*/
@@ -512,11 +513,31 @@ article img.pull-right {
 pre {
     white-space: pre-wrap;
 }
 
 
+.related {
+    text-align: left;
+    font-size: .9em;
+}
 
+.circle {
+    -webkit-border-radius: 50%!important;
+    -moz-border-radius: 50%!important;
+    border-radius: 50%!important;
+    text-align: center;
+    vertical-align: middle;
+    color: #fefefe;
+    padding: 11%;
+    background-color: #aaa;
+    width: 150px;
+    height: 150px;
+    float: none;
+    margin-left: auto;
+    margin-right: auto;
+    font-size: 4em;
+}
 
 
 /* MEDIA QUERIES */
 /* Smartphones (portrait and landscape) ----------- */
 @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
diff --git a/inc/themes/gneex/fullwidth.php b/inc/themes/gneex/fullwidth.php
new file mode 100644
index 00000000..3663a844
--- /dev/null
+++ b/inc/themes/gneex/fullwidth.php
@@ -0,0 +1,5 @@
+<?php
+    $gneex = Gneex::$opt;;
+    $post = Gneex::getPost($gneex['fullwidth_page']);
+    echo(Typo::Xclean($post));
+?>
diff --git a/inc/themes/gneex/function.php b/inc/themes/gneex/function.php
index c7907f07..305da612 100644
--- a/inc/themes/gneex/function.php
+++ b/inc/themes/gneex/function.php
@@ -17,10 +17,12 @@ class Gneex
                 Hooks::attach('footer_load_lib', array('Gneex', 'loadAnalytics'));
             }
 
             Hooks::attach('header_load_meta', array('Gneex', 'loadCSS'));
             Hooks::attach('admin_footer_action', array('Gneex', 'loadAdminAsset'));
+
+            Hooks::attach('post_param_form', array('Gneex', 'postParam'));
         }
     }
 
     public static function checkDB()
     {
@@ -33,11 +35,11 @@ class Gneex
 
     public static function parseDB()
     {
         $opt = Options::get('gneex_options');
         $opt = json_decode($opt, true);
-        $o = [];
+        $o = array();
         if (is_array($opt)) {
             foreach ($opt as $k => $v) {
                 $o[$k] = Typo::jsonDeFormat($v);
             }
         }
@@ -64,10 +66,23 @@ class Gneex
         $q = Db::result($sql);
 
         return $q[0]->content;
     }
 
+    public static function optionPost($type, $post='')
+    {
+        $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `title` ASC";
+        $q = Db::result($sql);
+        $opt = '<option></option>';
+        foreach ($q as $k => $v) {
+            $sel = ($post != '' && $post == $v->id) ? 'selected': '';
+            $opt .= "<option value='{$v->id}' {$sel}>{$v->title}</option>";
+        }
+
+        return $opt;
+    }
+
     public static function featuredExist()
     {
         $feat = self::$opt['featured_posts'];
         if ($feat != '') {
             return true;
@@ -250,10 +265,11 @@ class Gneex
             });
             
             $.viewMap = {
                 \'blog\' : $([]),
                 \'magazine\' : $(\'#magazine\'),
+                \'fullwidth\' : $(\'#fullwidth\'),
             };
             $.each($.viewMap, function () {
                 this.hide();
             });
             var e = document.getElementById("frontpageSelector");
@@ -276,8 +292,27 @@ class Gneex
             });
         </script>
         ';
         System::adminAsset(Site::minifyJS($js));
     }
+
+    public static function postParam($data)
+    {
+//        print_r($data);
+        $bar = Posts::getParam('sidebar', $data[0]['post'][0]->id);
+//        echo $bar;
+        $yes = ($bar == 'yes') ? 'selected': '';
+        $no = ($bar == 'no') ? 'selected': '';
+        $form = '<div class="row">
+                <div class="col-sm-4">
+                    <label>Show/Hide Sidebar</label>
+                    <select name="param[sidebar]" class="form-control">
+                        <option value="yes" '.$yes.'>Show Sidebar</option>
+                        <option value="no" '.$no.'>Hide Sidebar</option>
+                    </select>
+                </div>
+                </div>';
+        echo $form;
+    }
 }
 
 new Gneex();
diff --git a/inc/themes/gneex/index.php b/inc/themes/gneex/index.php
index 05c36f96..fafc0fbf 100644
--- a/inc/themes/gneex/index.php
+++ b/inc/themes/gneex/index.php
@@ -67,325 +67,337 @@ if (Gneex::featuredExist()) {
     </section>
 <?php
 }
 ?>
 
+
+<?php
+if ($gneex['front_layout'] == 'magazine') {
+    # code...
+    ?>
     <section id="blog">
         <div class="container">
             <div class="col-md-8">
                 <?php
-                if ($gneex['front_layout'] == 'magazine') {
-                    # code...
-                ?>
+                $cat = $gneex['panel_1'];
+                if (isset($cat) && $cat != ''){
+                $post = Posts::getPostCat($cat, 8); ?>
 
-                <?php
-                    $cat = $gneex['panel_1'];
-                    $post = Posts::getPostCat($cat, 8); ?>
-                
                 <div class="panel panel-one">
                     <div class="panel-heading">
-                    <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
+                        <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                     </div>
                     <div class="panel-body">
                         <div class="row">
                             <div class="col-sm-4">
-                            <?php
-                            if (!isset($post['error'])) {
-                                $content = Posts::content($post[0]->content);
-                                $title = Posts::title($post[0]->id);
-                                $img = Gneex::getImage($content);
-                                if ($img != '') {
-                                    $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
-                                } else {
-                                    $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
-                                }
-                                echo '
-                                    <a href="'.Url::post($post[0]->id)."\">
-                                    <div class=\"horizontal-list\">
-                                        {$im}
-                                    </div>
-                                    <div class=\"\">
-                                        <h4 >{$title}</h4>
-                                    </div>
-                                    </a>
-                                ";
-                                unset($post[0]);
-                            } ?>
-                            </div>
-                            <div class="col-sm-8">
-                            <ul class="list-unstyled">
                                 <?php
-                                foreach ($post as $p => $v) {
+                                if (!isset($post['error'])) {
+                                    $content = Posts::content($post[0]->content);
+                                    $title = Posts::title($post[0]->id);
+                                    $img = Gneex::getImage($content);
+                                    if ($img != '') {
+                                        $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
+                                    } else {
+                                        $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
+                                    }
                                     echo '
-                                    <li>
-                                    <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
-                                    </li>
-                                    ';
-                                } ?> 
-                            </ul>
-                            
+                                <a href="' . Url::post($post[0]->id) . "\">
+                                <div class=\"horizontal-list\">
+                                    {$im}
+                                </div>
+                                <div class=\"\">
+                                    <h4 >{$title}</h4>
+                                </div>
+                                </a>
+                            ";
+                                    unset($post[0]);
+                                } ?>
+                            </div>
+                            <div class="col-sm-8">
+                                <ul class="list-unstyled">
+                                    <?php
+                                    foreach ($post as $p => $v) {
+                                        echo '
+                                <li>
+                                <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
+                                </li>
+                                ';
+                                    } ?>
+                                </ul>
+
                             </div>
                         </div>
-                        
+
                     </div>
                 </div>
+                <?php }?>
 
                 <?php
                 if (Gneex::opt('adsense') != '') {
-                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
+                    echo '<div class="row"><div class="col-md-12">' . Gneex::opt('adsense') . '</div></div><hr />';
                 } ?>
 
 
                 <div class="row">
-                    
-                    <div class="col-sm-6">
-                        <?php
-                        $cat = $gneex['panel_2'];
-                        $post = Posts::getPostCat($cat, 6); ?>
-                        
+
+
+                <?php
+                $cat = $gneex['panel_2'];
+                if (isset($cat) && $cat != ''){
+                    $col2 = !empty($gneex['panel_3']) ? '6': '12';
+                    $post = Posts::getPostCat($cat, 6); ?>
+                    <div class="col-sm-<?=$col2;?>">
                         <div class="panel panel-two">
                             <div class="panel-heading">
-                            <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
+                                <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                             </div>
                             <div class="panel-body">
                                 <div class="row">
                                     <div class="col-md-12">
-                                    <?php
-                                    if (!isset($post['error'])) {
-                                        $content = Posts::content($post[0]->content);
-                                        $title = Posts::title($post[0]->id);
-                                        $img = Gneex::getImage($content);
-                                        if ($img != '') {
-                                            $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
-                                        } else {
-                                            $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
-                                        }
-                                        echo '
-                                            <a href="'.Url::post($post[0]->id)."\">
-                                            <div class=\"vertical-list\">
-                                                {$im}
-                                            </div>
-                                            <div class=\"\">
-                                                <h4 >{$title}</h4>
-                                            </div>
-                                            </a>
-                                        ";
-                                        unset($post[0]);
-                                    } ?>
-                                    </div>
-                                    <div class="col-md-12">
-                                    <ul class="list-unstyled">
                                         <?php
-                                        foreach ($post as $p => $v) {
+                                        if (!isset($post['error'])) {
+                                            $content = Posts::content($post[0]->content);
+                                            $title = Posts::title($post[0]->id);
+                                            $img = Gneex::getImage($content);
+                                            if ($img != '') {
+                                                $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
+                                            } else {
+                                                $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
+                                            }
                                             echo '
-                                            <li>
-                                            <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
-                                            </li>
-                                            ';
-                                        } ?> 
-                                    </ul>
-                                    
+                                        <a href="' . Url::post($post[0]->id) . "\">
+                                        <div class=\"vertical-list\">
+                                            {$im}
+                                        </div>
+                                        <div class=\"\">
+                                            <h4 >{$title}</h4>
+                                        </div>
+                                        </a>
+                                    ";
+                                            unset($post[0]);
+                                        } ?>
+                                    </div>
+                                    <div class="col-md-12">
+                                        <ul class="list-unstyled">
+                                            <?php
+                                            foreach ($post as $p => $v) {
+                                                echo '
+                                        <li>
+                                        <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
+                                        </li>
+                                        ';
+                                            } ?>
+                                        </ul>
+
                                     </div>
                                 </div>
-                                
+
                             </div>
                         </div>
 
                     </div>
-                    
-                    <div class="col-sm-6">
-                        <?php
-                        $cat = $gneex['panel_3'];
-                        $post = Posts::getPostCat($cat, 6); ?>
-                        
+                <?php } ?>
+
+                <?php
+                $cat = $gneex['panel_3'];
+                if (isset($cat) && $cat != ''){
+                    $col3 = !empty($gneex['panel_2']) ? '6': '12';
+                    $post = Posts::getPostCat($cat, 6); ?>
+                    <div class="col-sm-<?=$col3;?>">
                         <div class="panel panel-three">
                             <div class="panel-heading">
-                            <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
+                                <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                             </div>
                             <div class="panel-body">
                                 <div class="row">
                                     <div class="col-md-12">
-                                    <?php
-                                    if (!isset($post['error'])) {
-                                        $content = Posts::content($post[0]->content);
-                                        $title = Posts::title($post[0]->id);
-                                        $img = Gneex::getImage($content);
-                                        if ($img != '') {
-                                            $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
-                                        } else {
-                                            $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
-                                        }
-                                        echo '
-                                            <a href="'.Url::post($post[0]->id)."\">
-                                            <div class=\"vertical-list\">
-                                                {$im}
-                                            </div>
-                                            <div class=\"\">
-                                                <h4 >{$title}</h4>
-                                            </div>
-                                            </a>
-                                        ";
-                                        unset($post[0]);
-                                    } ?>
-                                    </div>
-                                    <div class="col-md-12">
-                                    <ul class="list-unstyled">
                                         <?php
-                                        foreach ($post as $p => $v) {
+                                        if (!isset($post['error'])) {
+                                            $content = Posts::content($post[0]->content);
+                                            $title = Posts::title($post[0]->id);
+                                            $img = Gneex::getImage($content);
+                                            if ($img != '') {
+                                                $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
+                                            } else {
+                                                $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
+                                            }
                                             echo '
-                                            <li>
-                                            <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
-                                            </li>
-                                            ';
-                                        } ?> 
-                                    </ul>
-                                    
+                                        <a href="' . Url::post($post[0]->id) . "\">
+                                        <div class=\"vertical-list\">
+                                            {$im}
+                                        </div>
+                                        <div class=\"\">
+                                            <h4 >{$title}</h4>
+                                        </div>
+                                        </a>
+                                    ";
+                                            unset($post[0]);
+                                        } ?>
+                                    </div>
+                                    <div class="col-md-12">
+                                        <ul class="list-unstyled">
+                                            <?php
+                                            foreach ($post as $p => $v) {
+                                                echo '
+                                        <li>
+                                        <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
+                                        </li>
+                                        ';
+                                            } ?>
+                                        </ul>
+
                                     </div>
                                 </div>
-                                
+
                             </div>
                         </div>
 
                     </div>
-                </div>
-
+                <?php } ?>
 
+                </div>
 
 
                 <?php
                 if (Gneex::opt('adsense') != '') {
-                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
+                    echo '<div class="row"><div class="col-md-12">' . Gneex::opt('adsense') . '</div></div><hr />';
                 } ?>
-        
+
 
                 <?php
                 $cat = $gneex['panel_4'];
-                    $post = Posts::getPostCat($cat, 4);
-                    echo '<h4>'.Categories::name($cat).'</h4>'; ?>
-                <hr />
+                if (isset($cat) && $cat != ''){
+                $post = Posts::getPostCat($cat, 4);
+                echo '<h4>' . Categories::name($cat) . '</h4>'; ?>
+                <hr/>
                 <div class="row">
-                
-                <ul class="list-featured">
-                    <?php
-
-
-                    foreach ($post as $p) {
-                        $content = Posts::content($p->content);
-                        $title = Posts::title($p->id);
-                        $img = Gneex::getImage($content);
-                        if ($img != '') {
-                            $im = '<img src="'.Url::thumb($img).'" class="img-responsive">';
-                        } else {
-                            $im = '<img src="'.Url::thumb('assets/images/noimage.png').'" class="img-responsive">';
-                        }
-
-                        echo '<li class="col-sm-3">
-                                    <a href="'.Url::post($p->id)."\">
-                                    {$im}
-                                    <div class=\"featured-text\">
-                                        <h4 >{$title}</h4>
-                                    </div>
-                                    </a>
-                                </li>";
-                    } ?>
-                    
-                </ul>
-                </div>
 
+                    <ul class="list-featured">
+                        <?php
 
-                
 
+                        foreach ($post as $p) {
+                            $content = Posts::content($p->content);
+                            $title = Posts::title($p->id);
+                            $img = Gneex::getImage($content);
+                            if ($img != '') {
+                                $im = '<img src="' . Url::thumb($img) . '" class="img-responsive">';
+                            } else {
+                                $im = '<img src="' . Url::thumb('assets/images/noimage.png') . '" class="img-responsive">';
+                            }
+
+                            echo '<li class="col-sm-3">
+                                <a href="' . Url::post($p->id) . "\">
+                                {$im}
+                                <div class=\"featured-text\">
+                                    <h4 >{$title}</h4>
+                                </div>
+                                </a>
+                            </li>";
+                        } ?>
+
+                    </ul>
+                </div>
+                <?php } ?>
 
                 <?php
                 $cat = $gneex['panel_5'];
-                    $post = Posts::getPostCat($cat, 8);
-                    $postig = $post[0]; ?>
-                
+                if (isset($cat) && $cat != ''){
+                $post = Posts::getPostCat($cat, 8);
+                $postig = $post[0]; ?>
+
                 <div class="panel panel-five">
                     <div class="panel-heading">
-                    <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
+                        <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                     </div>
                     <div class="panel-body">
                         <div class="row">
                             <div class="col-sm-8">
-                            <ul class="list-unstyled">
-                                <?php
-                                unset($post[0]);
-                                foreach ($post as $p => $v) {
-                                    echo '
-                                    <li>
-                                    <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
-                                    </li>
-                                    ';
-                                } ?> 
-                            </ul>
-                            
+                                <ul class="list-unstyled">
+                                    <?php
+                                    unset($post[0]);
+                                    foreach ($post as $p => $v) {
+                                        echo '
+                                <li>
+                                <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
+                                </li>
+                                ';
+                                    } ?>
+                                </ul>
+
                             </div>
                             <div class="col-sm-4">
-                            <?php
-                            if (!isset($post['error'])) {
-                                $content = Posts::content($postig->content);
-                                $title = Posts::title($postig->id);
-                                $img = Gneex::getImage($content);
-                                if ($img != '') {
-                                    $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
-                                } else {
-                                    $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
-                                }
-                                echo '
-                                    <a href="'.Url::post($postig->id)."\">
-                                    <div class=\"horizontal-list\">
-                                        {$im}
-                                    </div>
-                                    <div class=\"\">
-                                        <h4 >{$title}</h4>
-                                    </div>
-                                    </a>
-                                ";
-                            } ?>
+                                <?php
+                                if (!isset($post['error'])) {
+                                    $content = Posts::content($postig->content);
+                                    $title = Posts::title($postig->id);
+                                    $img = Gneex::getImage($content);
+                                    if ($img != '') {
+                                        $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
+                                    } else {
+                                        $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
+                                    }
+                                    echo '
+                                <a href="' . Url::post($postig->id) . "\">
+                                <div class=\"horizontal-list\">
+                                    {$im}
+                                </div>
+                                <div class=\"\">
+                                    <h4 >{$title}</h4>
+                                </div>
+                                </a>
+                            ";
+                                } ?>
                             </div>
-                            
+
                         </div>
-                        
+
                     </div>
                 </div>
-                
-                
+                <?php } ?>
 
-                
-                <?php
-                } else {
+            </div> <!-- col-md-8 blog-lists end -->
+            <?php Theme::theme('rightside', $data); ?>
+
+
+        </div>
+    </section>
+        <?php
+    } elseif ($gneex['front_layout'] == 'fullwidth') {
+        Theme::inc('fullwidth', $data);
+    } else {
                     ?>
-                    
-                    <!-- start blog layout -->
-
-                    <div class=" blog-lists clearfix">
-                    <?php
-                    if ($data['num'] > 0) {
-                        foreach ($data['posts'] as $p) {
-                            echo '
-                            <article class="blog-post col-md-12">
-                                <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
-                                <hr />
-                                ".Posts::format($p->content, $p->id).'
-                                <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date, 'd M Y H:i')." by <a href=\"#\">{$p->author}</a></div>
-                            </article>
-                                ";
-                        }
-                    } else {
-                        echo 'No Post to Show';
-                    } ?>
-                    
-                    </div>
-                    <?=$data['paging']; ?>
+    <section id="blog">
+        <div class="container">
+            <div class="col-md-8">
+                <!-- start blog layout -->
 
+                <div class=" blog-lists clearfix">
+                <?php
+                if ($data['num'] > 0) {
+                    foreach ($data['posts'] as $p) {
+                        echo '
+                        <article class="blog-post col-md-12">
+                            <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
+                            <hr />
+                            ".Posts::format($p->content, $p->id).'
+                            <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date, 'd M Y H:i')." by <a href=\"#\">{$p->author}</a></div>
+                        </article>
+                            ";
+                    }
+                } else {
+                    echo 'No Post to Show';
+                } ?>
 
-                    <!-- end blog layout -->
-                    <?php
-                }
-            ?>
+                </div>
+                <?=$data['paging']; ?>
             </div> <!-- col-md-8 blog-lists end -->
-            <?php Theme::theme('rightside', $data); ?>
-                
+        <?php Theme::theme('rightside', $data); ?>
+
 
         </div>
-    </section>
\ No newline at end of file
+    </section>
+
+        <!-- end blog layout -->
+        <?php
+    }
+?>
diff --git a/inc/themes/gneex/options.php b/inc/themes/gneex/options.php
index 6cee705f..b5508dd4 100644
--- a/inc/themes/gneex/options.php
+++ b/inc/themes/gneex/options.php
@@ -73,11 +73,11 @@ if (Gneex::checkDB()) {
     // var_dump($opt);
 
     $opt = json_decode($opt, true);
 
     if (is_array($opt)) {
-        $o = [];
+        $o = array();
         foreach ($opt as $k => $v) {
             // $o[$k] = urldecode($v);
             $o[$k] = $v;
         }
     } ?>
@@ -145,16 +145,24 @@ if (Gneex::checkDB()) {
                                     <div class="form-group">
                                         <label>Choose Layout</label>
                                         <select name="front_layout" class="form-control" id="frontpageSelector">
                                             <option value="blog" <?=($o['front_layout'] == 'blog') ? 'selected' : ''; ?>>Blog</option>
                                             <option value="magazine" <?=($o['front_layout'] == 'magazine') ? 'selected' : ''; ?>>Magazine</option>
+                                            <option value="fullwidth" <?=($o['front_layout'] == 'fullwidth') ? 'selected' : ''; ?>>Full Width</option>
                                         </select>
                                         <small>choose the layout style for the frontpage</small>
                                     </div>
                                 </div>
                             </div>
                         </div>
+                        <div id="fullwidth">
+                            <div class="col-md-12">
+                                <select name="fullwidth_page" class="form-control">
+                                    <?=Gneex::optionPost('page', $o['fullwidth_page']);?>
+                                </select>
+                            </div>
+                        </div>
                         <div id="magazine">
                             <div class="col-md-6">
                                 <div class="form-group">
                                     <label>Panel 1 <span class="label label-danger">magazine</span></label>
                                     <?php
diff --git a/inc/themes/gneex/single.php b/inc/themes/gneex/single.php
index 211f08a7..a656bcf5 100644
--- a/inc/themes/gneex/single.php
+++ b/inc/themes/gneex/single.php
@@ -5,12 +5,15 @@
         </div>
 
     </section>
     <section id="blog">
         <div class="container">
-            
-                <div class="col-md-8">
+            <?php
+            $bar = Posts::getParam('sidebar', $data['posts'][0]->id);
+            $cols = ($bar == 'yes'|| $bar == '') ? '8': '12';
+            ?>
+                <div class="col-md-<?=$cols;?>">
                     <div class=" blog-lists clearfix">
                     <?php
                     if (Gneex::opt('adsense') != '') {
                         echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
                     }
@@ -23,13 +26,14 @@
                             );
                             echo '
                                 <article class="blog-post col-md-12">
                                     <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
                                     
-                                    <span class=\"meta\">posted in <a href=\"".Url::cat($p->cat).'">'.Categories::name($p->cat).'</a>, at '.Date::format($p->date).' by '.$p->author.'</span>
+                                    <span class=\"meta\">posted in <a href=\"".Url::cat($p->cat).'">'.Categories::name($p->cat).'</a>, 
+                                    at '.Date::format($p->date).' by <a href="'.Url::author($p->author).'">'.$p->author.'</a></span>
                                     <hr />
-                                    '.Posts::content($p->content, $p->id).'<hr />';
+                                    <div class="content">'.Posts::content($p->content, $p->id).'</div><hr />';
                             if (Gneex::opt('adsense') != '') {
                                 echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
                             }
                             echo '
                                     
@@ -50,10 +54,10 @@
                     }
                     ?>
                         
                     </div>
                 </div>
-                <?php Theme::theme('rightside', $data); ?>
+                <?php if($bar == 'yes'|| $bar == '') Theme::theme('rightside', $data); ?>
                 
 
         </div>
     </section>
diff --git a/info.php b/info.php
deleted file mode 100644
index 2c6ebd25..00000000
--- a/info.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-echo phpinfo();
diff --git a/register.php b/register.php
index 514996b8..9aa72cc0 100644
--- a/register.php
+++ b/register.php
@@ -44,11 +44,11 @@ if (isset($_POST['register'])) {
         }
         if (!Xaptcha::verify($_POST['g-recaptcha-response'])) {
             $alertDanger[] = 'Your Captcha is not correct.';
         }
     }
-    if (!User::isExist($_POST['userid'])) {
+    if (User::isExist($_POST['userid'])) {
         $alertDanger[] = MSG_USER_EXIST;
     }
     if (!User::isSame($_POST['pass1'], $_POST['pass1'])) {
         $alertDanger[] = MSG_USER_PWD_MISMATCH;
     }

Vulnerable code:                         elfinderDialog();
if (isset($data['alertSuccess'])) {
    
    echo '<div class="alert alert-success" >
    <button type="button" class="close" data-dismiss="alert">
        <span aria-hidden="true">&times;</span>
        <span class="sr-only">'.CLOSE.'</span>
    </button>';
    foreach ($data['alertSuccess'] as $alert) {
        
        echo "$alert\n";
    }
    echo '</div>';
}
if (isset($data['alertDanger'])) {
    
    echo '<div class="alert alert-danger" >
    <button type="button" class="close" data-dismiss="alert">
        <span aria-hidden="true">&times;</span>
        <span class="sr-only">'.CLOSE.'</span>
    </button>';
    foreach ($data['alertDanger'] as $alert) {
        
        echo "$alert\n";
    }
    echo '</div>';
}
        <div class="row">
            <div id="elfinder"></div>
        </div>



                $where .= '1 ';
                $where .= " AND `type` = '".$vars['type']."' ";
                $where .= '';
                $where .= " `type` = '{$vars['type']}' AND ";
        $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}' AND `type` = 'post'";
        $url = isset($v->url) ? $v->url : '#';
        $arr = ['ajax', 'post', 'page', 'cat', 'mod', 'sitemap', 'rss',
                    'account', 'search', 'author', 'tag', 'thumb', 'default'];

if (isset($_GET['token']) && Token::isExist($_GET['token'])) {

if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
            "SELECT * FROM `cat` WHERE `type` = 'tag' AND `name` LIKE '".$_GET['term']."%' ORDER BY `name` ASC"
if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
$data['sitetitle'] = MODULES;
Mod::options($_GET['mod']);

        $data['sitetitle'] = THEMES;
        Theme::options(Options::v('themes'));
                    if (!User::isExist($_POST['userid'])) {
                        if (!User::isExist($_POST['userid'])) {
                    'where' => '`type` = \''.$type.'\' AND `cat` = \''.$cat.'\'',
    $theme = ($data['p_type'] == 'post') ? 'single' : $data['p_type'];
    Theme::footer();
                'where' => '`type` = \''.$type.'\' ',
    Theme::footer();
                'init' => array(), // init the system
                'header_pre_action' => array(), // action before load header
                'site_title_filter' => array(), // filter website title
                'site_desc_filter' => array(),
                'site_key_filter' => array(),
                'header_load_meta' => array(),
                'footer_load_lib' => array(),
                'post_title_filter' => array(),
                'post_meta_filter' => array(),
                'post_content_filter' => array(),
                'post_author_filter' => array(),
                'post_date_filter' => array(),
                'post_category_filter' => array(),
                'post_submit_add_action' => array(), // on submit
                'post_sqladd_action' => array(), // on sql add
                'post_submit_edit_action' => array(), // on submit
                'post_sqledit_action' => array(), // on sql add
                'post_submit_title_filter' => array(),
                'post_submit_content_filter' => array(),
                'post_submit_category_filter' => array(),
                'post_delete_action' => array(), // on delete
                'post_sqldel_action' => array(), // on sql delete
                'user_submit_add_action' => array(),
                'user_sqladd_action' => array(),
                'user_submit_edit_action' => array(),
                'user_sqledit_action' => array(),
                'user_delete_action' => array(),
                'user_sqldel_action' => array(),
                'user_reg_action' => array(),
                'user_login_action' => array(),
                'user_logout_action' => array(),
                'user_activation_action' => array(),
                'admin_page_notif_action' => array(),
                'admin_page_top_action' => array(),
                'admin_page_bottom_action' => array(),
                'admin_page_dashboard_action' => array(),
                'admin_page_dashboard_statslist_action' => array(),
                'admin_footer_action' => array(),
                'module_install_action' => array(),
                'theme_install_action' => array(),
                'mod_control' => array(),
        //$mod = '';
    public static function related($id, $num, $cat, $type = 'list')
                        AND A.`type` = 'post'
            if ($type == 'list') {
            } elseif ($type == 'box') {
                        $title = (strlen($p->title) > 40) ? substr($p->title, 0, 38).'...' : $p->title;
                        <img src="'.$img.'" class="img-responsive center-block">'.$title.'</a><br /><br /></li>';
        'thumb/type/(.*)/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '4', 'type' => '1', 'size' => '2', 'align' => '3'),
        'thumb/type/(.*)/size/([0-9]+)/(.*)' => array('thumb' => '3', 'type' => '1', 'size' => '2'),
        'thumb/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '3', 'size' => '1', 'align' => '2'),
        'category/([0-9]+)/(.*)/paging/([0-9]+)/' => array('cat' => '1', 'paging' => '3'),
        'category/([0-9]+)/(.*)/' => array('cat' => '1'),
        'tag/(.*)/paging/([0-9]+)/' => array('tag' => '1', 'paging' => '3'),
        'tag/(.*)/' => array('tag' => '1'),
        '([a-z]+)/mod/(.*)'.GX_URL_PREFIX => array('mod' => '2', 'lang' => '1'),
        // '/(.[a-z]+)/(.+)'.GX_URL_PREFIX => array('page' => '2', 'lang' => '1'),
        'mod/(.*)'.GX_URL_PREFIX => array('mod' => '1'),
        // '/(.+)'.GX_URL_PREFIX => array('page' => '1'),
        'paging/([0-9]+)/' => array('default', 'paging' => '1'),
        'error/([0-9]+)/' => array('error' => '1'),
        '([a-z]+)/(.*)'.GX_URL_PREFIX => array('post' => '2', 'lang' => '1'),
        '(.*)'.GX_URL_PREFIX => array('post' => '1'),
        'ajax/(.*)/(.*)' => array('ajax' => '1', 'token' => '2'),
        'thumb/size/([0-9]+)/(.*)' => array('thumb' => '2', 'size' => '1'),
        'thumb/type/(.*)/(.*)' => array('thumb' => '2', 'type' => '1'),
        'thumb/align/(.*)/(.*)' => array('thumb' => '2', 'align' => '1'),
        'thumb/(.*)' => array('thumb' => '1'),
        'error/' => array('error'),
        'sitemap/' => array('sitemap'),
        'rss/' => array('rss'),
        '/' => array('default'),
        $va = [];
    public static function isExist($user)
        if (isset($_GET['act']) && $_GET['act'] == 'edit') {
            $id = Typo::int($_GET['id']);
            $where = "AND `id` != '{$id}' ";
            return false;
        } else {
                $o = [];
                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')." by <a href=\"#\">{$p->author}</a></small><br /><br /></div>
                                <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date)." by <a href=\"#\">{$p->author}</a></div>
    text-transform: uppercase;
    background-color: rgba(0,0,0,.7);
        $o = [];
                if ($gneex['front_layout'] == 'magazine') {
                    # code...
                ?>
                <?php
                    $cat = $gneex['panel_1'];
                    $post = Posts::getPostCat($cat, 8); ?>
                
                    <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
                            <?php
                            if (!isset($post['error'])) {
                                $content = Posts::content($post[0]->content);
                                $title = Posts::title($post[0]->id);
                                $img = Gneex::getImage($content);
                                if ($img != '') {
                                    $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
                                } else {
                                    $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
                                }
                                echo '
                                    <a href="'.Url::post($post[0]->id)."\">
                                    <div class=\"horizontal-list\">
                                        {$im}
                                    </div>
                                    <div class=\"\">
                                        <h4 >{$title}</h4>
                                    </div>
                                    </a>
                                ";
                                unset($post[0]);
                            } ?>
                            </div>
                            <div class="col-sm-8">
                            <ul class="list-unstyled">
                                foreach ($post as $p => $v) {
                                    <li>
                                    <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
                                    </li>
                                    ';
                                } ?> 
                            </ul>
                            
                        
                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
                    
                    <div class="col-sm-6">
                        <?php
                        $cat = $gneex['panel_2'];
                        $post = Posts::getPostCat($cat, 6); ?>
                        
                            <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
                                    <?php
                                    if (!isset($post['error'])) {
                                        $content = Posts::content($post[0]->content);
                                        $title = Posts::title($post[0]->id);
                                        $img = Gneex::getImage($content);
                                        if ($img != '') {
                                            $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
                                        } else {
                                            $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
                                        }
                                        echo '
                                            <a href="'.Url::post($post[0]->id)."\">
                                            <div class=\"vertical-list\">
                                                {$im}
                                            </div>
                                            <div class=\"\">
                                                <h4 >{$title}</h4>
                                            </div>
                                            </a>
                                        ";
                                        unset($post[0]);
                                    } ?>
                                    </div>
                                    <div class="col-md-12">
                                    <ul class="list-unstyled">
                                        foreach ($post as $p => $v) {
                                            <li>
                                            <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
                                            </li>
                                            ';
                                        } ?> 
                                    </ul>
                                    
                                
                    
                    <div class="col-sm-6">
                        <?php
                        $cat = $gneex['panel_3'];
                        $post = Posts::getPostCat($cat, 6); ?>
                        
                            <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
                                    <?php
                                    if (!isset($post['error'])) {
                                        $content = Posts::content($post[0]->content);
                                        $title = Posts::title($post[0]->id);
                                        $img = Gneex::getImage($content);
                                        if ($img != '') {
                                            $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
                                        } else {
                                            $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
                                        }
                                        echo '
                                            <a href="'.Url::post($post[0]->id)."\">
                                            <div class=\"vertical-list\">
                                                {$im}
                                            </div>
                                            <div class=\"\">
                                                <h4 >{$title}</h4>
                                            </div>
                                            </a>
                                        ";
                                        unset($post[0]);
                                    } ?>
                                    </div>
                                    <div class="col-md-12">
                                    <ul class="list-unstyled">
                                        foreach ($post as $p => $v) {
                                            <li>
                                            <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
                                            </li>
                                            ';
                                        } ?> 
                                    </ul>
                                    
                                
                </div>

                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
        
                    $post = Posts::getPostCat($cat, 4);
                    echo '<h4>'.Categories::name($cat).'</h4>'; ?>
                <hr />
                
                <ul class="list-featured">
                    <?php


                    foreach ($post as $p) {
                        $content = Posts::content($p->content);
                        $title = Posts::title($p->id);
                        $img = Gneex::getImage($content);
                        if ($img != '') {
                            $im = '<img src="'.Url::thumb($img).'" class="img-responsive">';
                        } else {
                            $im = '<img src="'.Url::thumb('assets/images/noimage.png').'" class="img-responsive">';
                        }

                        echo '<li class="col-sm-3">
                                    <a href="'.Url::post($p->id)."\">
                                    {$im}
                                    <div class=\"featured-text\">
                                        <h4 >{$title}</h4>
                                    </div>
                                    </a>
                                </li>";
                    } ?>
                    
                </ul>
                </div>
                
                    $post = Posts::getPostCat($cat, 8);
                    $postig = $post[0]; ?>
                
                    <h3 class="panel-title"><?=Categories::name($cat); ?></h3>
                            <ul class="list-unstyled">
                                <?php
                                unset($post[0]);
                                foreach ($post as $p => $v) {
                                    echo '
                                    <li>
                                    <h5><a href="'.Url::post($v->id).'">'.$v->title.'</a></h5>
                                    </li>
                                    ';
                                } ?> 
                            </ul>
                            
                            <?php
                            if (!isset($post['error'])) {
                                $content = Posts::content($postig->content);
                                $title = Posts::title($postig->id);
                                $img = Gneex::getImage($content);
                                if ($img != '') {
                                    $im = '<img src="'.Url::thumb($img, 'large').'" class="img-responsive">';
                                } else {
                                    $im = '<img src="'.Url::thumb('assets/images/noimage.png', 'large').'" class="img-responsive">';
                                }
                                echo '
                                    <a href="'.Url::post($postig->id)."\">
                                    <div class=\"horizontal-list\">
                                        {$im}
                                    </div>
                                    <div class=\"\">
                                        <h4 >{$title}</h4>
                                    </div>
                                    </a>
                                ";
                            } ?>
                            
                        
                
                
                
                <?php
                } else {
                    
                    <!-- start blog layout -->

                    <div class=" blog-lists clearfix">
                    <?php
                    if ($data['num'] > 0) {
                        foreach ($data['posts'] as $p) {
                            echo '
                            <article class="blog-post col-md-12">
                                <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
                                <hr />
                                ".Posts::format($p->content, $p->id).'
                                <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date, 'd M Y H:i')." by <a href=\"#\">{$p->author}</a></div>
                            </article>
                                ";
                        }
                    } else {
                        echo 'No Post to Show';
                    } ?>
                    
                    </div>
                    <?=$data['paging']; ?>
                    <!-- end blog layout -->
                    <?php
                }
            ?>
            <?php Theme::theme('rightside', $data); ?>
                
    </section>
        $o = [];
            
                <div class="col-md-8">
                                    <span class=\"meta\">posted in <a href=\"".Url::cat($p->cat).'">'.Categories::name($p->cat).'</a>, at '.Date::format($p->date).' by '.$p->author.'</span>
                                    '.Posts::content($p->content, $p->id).'<hr />';
                <?php Theme::theme('rightside', $data); ?>
<?php

echo phpinfo();
    if (!User::isExist($_POST['userid'])) {
Fixed code:                         elfinderDialog($(this).closest('.note-editor').parent().children('.summernote'));

        <div id="elfinder"></div>

                    Hooks::run('page_param_form', $data);

                Hooks::run('post_param_form', $data);
                $where .= '';
                if ($vars['type'] == 'tag') {
                    $where .= " `type` = '{$vars['type']}' AND ";
                } else {
                    $where .= " `type` = '{$vars['type']}' AND `type` != 'tag' AND ";
                }

                $where .= " `type` != 'tag' AND ";
            $where .= '1 ';
                if ($vars['type'] == 'tag') {
                    $where .= " `type` = '{$vars['type']}' AND ";
                } else {
                    $where .= " `type` = '{$vars['type']}' AND `type` != 'tag' AND ";
                }

            } else {
                $where .= " `type` != 'tag' AND ";
        $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}'";

                $url = isset($v->url) ? $v->url : '#';
        $arr = array('ajax', 'post', 'page', 'cat', 'mod', 'sitemap', 'rss',
                    'account', 'search', 'author', 'tag', 'thumb', 'default');
$data = Router::scrap($param);
$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
if (isset($token) && Token::isExist($token) ) {
$data = Router::scrap($param);
$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
if (isset($token) && Token::isExist($token) ) {
        $term = Typo::cleanX($_GET['term']);
            "SELECT * FROM `cat` WHERE `type` = 'tag' AND `name` LIKE '".$term."%' ORDER BY `name` ASC"
$data = Router::scrap($param);
$token = (SMART_URL) ? $data['token'] : Typo::cleanX($_GET['token']);
if (isset($token) && Token::isExist($token) ) {
$mod = Typo::cleanX($_GET['mod']);
$data['sitetitle'] = Mod::title($mod);
Mod::options($mod);
                        if (isset($_POST['param'])){
                            foreach ($_POST['param'] as $k => $v) {
                                Posts::addParam($k, $v, $post_id);
                            }
                        }

                        if (isset($_POST['param'])){
                            foreach ($_POST['param'] as $k => $v) {
                                if (!Posts::existParam($k, $_GET['id'])) {
                                    Posts::addParam($k, $v, $_GET['id']);
                                } else {
                                    Posts::editParam($k, $v, $_GET['id']);
                                }
                            }
                        }

        $theme = Options::v('themes');
        $data['sitetitle'] = Theme::title($theme);
        Theme::options($theme);
                    if (User::isExist($_POST['userid'])) {
                        if (User::isExist($_POST['userid'])) {
<?php

defined('GX_LIB') or die('Direct Access Not Allowed!');
/*
 * GeniXCMS - Content Management System
 *
 * PHP Based Content Management System and Framework
 *
 * @since 0.0.1 build date 20141006
 *
 * @version 1.0.0
 *
 * @link https://github.com/semplon/GeniXCMS
 * @link http://genixcms.org
 *
 * @author Puguh Wijayanto <psw@metalgenix.com>
 * @copyright 2014-2016 Puguh Wijayanto
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */

$post = '';
$data = Router::scrap($param);
$data['p_type'] = 'author';

//$cat = Db::escape(Typo::Xclean($_GET['cat']));
$author = (SMART_URL) ? $data['author'] : Typo::cleanX(Typo::strip($_GET['author']));
$data['max'] = Options::v('post_perpage');
//echo User::isExist($author);
if (User::isExist($author)) {
    if (SMART_URL) {
        if (isset($data['paging'])) {
            $paging = $data['paging'];
        }
        $type = isset($data['type']) ? $data['type']: '';
    } else {
        if (isset($_GET['paging'])) {
            $paging = Typo::int($_GET['paging']);
        }
        $type = isset($_GET['type']) ? $_GET['type']: '';
    }

    if ($type != '') {
        $where = " AND `type` = '{$type}' ";
    } else {
        $where = '';
    }
    //$paging = (SMART_URL) ? $data['paging'] : Typo::int(is_int($_GET['paging']));
    if (isset($paging) && $paging != '') {
        if ($paging > 0) {
            $offset = ($paging - 1) * $data['max'];
        } else {
            $offset = 0;
        }
//        echo $offset;
        $pagingtitle = " - Page {$paging}";
    } else {
        $offset = 0;
        $paging = 1;
        $pagingtitle = '';
    }
//    echo $paging;
    $data['sitetitle'] = 'Post by : '.$author.$pagingtitle;
    $data['posts'] = Db::result(
        sprintf(
            "SELECT * FROM `posts`
                        WHERE `author` = '%s' %s
                        AND `status` = '1'
                        ORDER BY `date`
                        DESC LIMIT %d, %d",
            $author,
            $where,
            $offset,
            $data['max']
        )
    );
    $data['num'] = Db::$num_rows;
//    echo $data['num'];
    $data['posts'] = Posts::prepare($data['posts']);
    // print_r($data['posts']);
    $url = Url::author($author, $type);
    $paging = array(
                    'paging' => $paging,
                    'table' => 'posts',
                    'where' => '`author` = \''.$author.'\' AND `status` = \'1\' '.$where,
                    'max' => $data['max'],
                    'url' => $url,
                    'type' => Options::v('pagination'),
                );
    $data['paging'] = Paging::create($paging, SMART_URL);
    Theme::theme('header', $data);
    Theme::theme('author', $data);
    Theme::footer($data);
    exit;
} else {
    Control::error('404');
    exit;
}
/* End of file cat.control.php */
/* Location: ./inc/lib/Control/Frontend/cat.control.php */
                    'where' => '`type` = \''.$type.'\' AND `cat` = \''.$cat.'\' AND `status` = \'1\' ',
    $theme = Theme::exist($data['p_type']) ? $data['p_type']: 'single';
    Theme::footer($data);
$data['name'] = $name;
$data['tag'] = $tag;

                'where' => '`type` = \''.$type.'\' AND `status` = \'1\' ',
    Theme::footer($data);
} else {
    $thumb = '';
    $type = '';
    $size = '';
    $align = '';
            'init' => array(), // init the system
            'header_pre_action' => array(), // action before load header
            'site_title_filter' => array(), // filter website title
            'site_desc_filter' => array(),
            'site_key_filter' => array(),
            'header_load_meta' => array(),
            'footer_load_lib' => array(),
            'post_title_filter' => array(),
            'post_meta_filter' => array(),
            'post_content_filter' => array(),
            'post_author_filter' => array(),
            'post_date_filter' => array(),
            'post_category_filter' => array(),
            'post_submit_add_action' => array(), // on submit
            'post_sqladd_action' => array(), // on sql add
            'post_submit_edit_action' => array(), // on submit
            'post_sqledit_action' => array(), // on sql add
            'post_submit_title_filter' => array(),
            'post_submit_content_filter' => array(),
            'post_submit_category_filter' => array(),
            'post_delete_action' => array(), // on delete
            'post_sqldel_action' => array(), // on sql delete
            'post_param_form' => array(),
            'page_param_form' => array(),
            'user_submit_add_action' => array(),
            'user_sqladd_action' => array(),
            'user_submit_edit_action' => array(),
            'user_sqledit_action' => array(),
            'user_delete_action' => array(),
            'user_sqldel_action' => array(),
            'user_reg_action' => array(),
            'user_login_action' => array(),
            'user_logout_action' => array(),
            'user_activation_action' => array(),
            'admin_page_notif_action' => array(),
            'admin_page_top_action' => array(),
            'admin_page_bottom_action' => array(),
            'admin_page_dashboard_action' => array(),
            'admin_page_dashboard_statslist_action' => array(),
            'admin_footer_action' => array(),
            'module_install_action' => array(),
            'theme_install_action' => array(),
            'mod_control' => array(),
        $mod = array();
    public static function title($mod)
    {
        $data = self::data($mod);

        return $data['name'];
    }

    public static function related($id, $num, $cat, $mode = 'list')
                        AND A.`type` = '%s'
                $post_type,
            if ($mode == 'list') {
            } elseif ($mode == 'box') {
                        $title = (strlen($p->title) > 34) ? substr($p->title, 0, 34).'...' : $p->title;
                        <img src="'.$img.'" class="img-responsive center-block">'.$title.'</a></li>';
            'thumb/type/(.*)/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '4', 'type' => '1', 'size' => '2', 'align' => '3'),
            'thumb/type/(.*)/size/([0-9]+)/(.*)' => array('thumb' => '3', 'type' => '1', 'size' => '2'),
            'thumb/size/([0-9]+)/align/(.*)/(.*)' => array('thumb' => '3', 'size' => '1', 'align' => '2'),
            'category/([0-9]+)/(.*)/paging/([0-9]+)/' => array('cat' => '1', 'paging' => '3'),
            'category/([0-9]+)/(.*)/' => array('cat' => '1'),
            'tag/(.*)/paging/([0-9]+)/' => array('tag' => '1', 'paging' => '3'),
            'tag/(.*)/' => array('tag' => '1'),
            '([a-z]+)/mod/(.*)'.GX_URL_PREFIX => array('mod' => '2', 'lang' => '1'),
            // '/(.[a-z]+)/(.+)'.GX_URL_PREFIX => array('page' => '2', 'lang' => '1'),
            'mod/(.*)'.GX_URL_PREFIX => array('mod' => '1'),
            // '/(.+)'.GX_URL_PREFIX => array('page' => '1'),
            'paging/([0-9]+)/' => array('default', 'paging' => '1'),
            'error/([0-9]+)/' => array('error' => '1'),
            '([a-z]+)/(.*)'.GX_URL_PREFIX => array('post' => '2', 'lang' => '1'),
            '(.*)'.GX_URL_PREFIX => array('post' => '1'),
            'ajax/(.*)/(.*)' => array('ajax' => '1', 'token' => '2'),
            'thumb/size/([0-9]+)/(.*)' => array('thumb' => '2', 'size' => '1'),
            'thumb/type/(.*)/(.*)' => array('thumb' => '2', 'type' => '1'),
            'thumb/align/(.*)/(.*)' => array('thumb' => '2', 'align' => '1'),
            'thumb/(.*)' => array('thumb' => '1'),
            'author/(.*)/(.*)/paging/([0-9]+)/' => array('author' => '1', 'type' => '2', 'paging' => '3'),
            'author/(.*)/paging/([0-9]+)/' => array('author' => '1', 'paging' => '2'),
            'author/(.*)/(.*)/' => array('author' => '1', 'type' => '2'),
            'author/(.*)/' => array('author' => '1'),
            'error/' => array('error'),
            'sitemap/' => array('sitemap'),
            'rss/' => array('rss'),
            '/' => array('default'),
        $va = array();

    public static function title($mod)
    {
        $data = self::data($mod);

        return $data['name'];
    }

    public static function author($vars, $type='')
    {
        switch (SMART_URL) {
            case true:
                $type = ($type != '') ? $type.'/': '';
                $inFold = (Options::v('permalink_use_index_php') == 'on') ? 'index.php/' : '';
                $url = Site::$url.$inFold.'author/'.$vars.'/'.$type;
                break;

            default:
                $type = ($type != '') ? '&type='.$type: '';
                $url = Site::$url."?author={$vars}$type";
                break;
        }

        return $url;
    }
    public static function isExist($user, $except='')
        if ($except != '') {
            $id = Typo::int($except);
            $where = "AND `userid` != '{$id}' ";
        } else {
            return false;
                $o = array();
<?php
$gneex = Gneex::$opt;
?>
    <section id="innerslide">
        
        <div class="bg-slide">
            
        </div>

    </section>

    <section id="blog">
        <div class="container">
            
            <div class="col-md-8">
                <h2 class="category-title"><?=$data['author'];?></h2>
                <hr />
                <div class=" blog-lists clearfix">
                <?php
                if (Gneex::opt('adsense') != '') {
                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
                } else {
                    echo '<div class="col-md-12">&nbsp;</div>';
                }
                ?>
                <?php
                if ($data['num'] > 0) {
                    foreach ($data['posts'] as $p) {
                        if ($gneex['category_layout'] == 'magazine') {
                            # code...
                            $img = Posts::getImage(Posts::content($p->content));
                            if ($img != '') {
                                $im = '<img src="'.Url::thumb($img, '', 300).'" class="img-responsive">';
                            } else {
                                $im = '<img src="'.Url::thumb('assets/images/noimage.png', '', 300).'" class="img-responsive">';
                            }
                            echo '
                            <article class="blog-post magazine col-md-12 clearfix">
                            <div class="col-sm-4 col-md-4">
                            '.$im.'
                            </div>
                            <div class="col-sm-8 col-md-8">
                                <h3><a href="'.Url::post($p->id).'">'.$p->title.'</a></h3>
                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')."
                                 in <a href=\"".Url::cat($p->cat)."\">".Categories::name($p->cat)."</a>
                                by <a href=\"".Url::author($p->author)."\">{$p->author}</a></small><br /><br /></div>
                                ".substr(Typo::strip(Posts::content($p->content)), 0, 350).'
                            </div>
                            <div class="col-sm-12 col-md-12 clearfix">
                                <hr />
                            </div>
                            </article>
                                ';
                        } else {
                            echo '
                            <article class="blog-post col-md-12">
                                <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
                                <hr />
                                ".Posts::format($p->content, $p->id).'
                                <div class="blog-footer">posted in '.Categories::name($p->cat).', 
                                at '.Date::format($p->date)." by <a href=\"".Url::author($p->author)."\">{$p->author}</a></div>
                            </article>
                                ";
                        }
                    }
                } else {
                    echo 'No Post to Show';
                }
                ?>
                <?php
                if (Gneex::opt('adsense') != '') {
                    echo '<div class="row"><div class="col-md-12">'.Gneex::opt('adsense').'</div></div><hr />';
                }
                ?>
                </div>
                <?=$data['paging'];?>
            </div>
            <?php Theme::theme('rightside', $data); ?>
                

        </div>
    </section>
                                <div class="blog-meta"><small>published at '.Date::format($p->date, 'd M Y')." 
                                in <a href=\"".Url::cat($p->cat)."\">".Categories::name($p->cat)."</a>
                                by <a href=\"".Url::author($p->author)."\">{$p->author}</a></small><br /><br /></div>
                                <div class="blog-footer">posted in '.Categories::name($p->cat).', 
                                at '.Date::format($p->date)." by <a href=\"".Url::author($p->author)."\">{$p->author}</a></div>
article .content img {
    box-shadow: 1px 1px 3px rgba(0,0,0,.4);
}
.related {
    text-align: left;
    font-size: .9em;
}
.circle {
    -webkit-border-radius: 50%!important;
    -moz-border-radius: 50%!important;
    border-radius: 50%!important;
    text-align: center;
    vertical-align: middle;
    color: #fefefe;
    padding: 11%;
    background-color: #aaa;
    width: 150px;
    height: 150px;
    float: none;
    margin-left: auto;
    margin-right: auto;
    font-size: 4em;
}
<?php
    $gneex = Gneex::$opt;;
    $post = Gneex::getPost($gneex['fullwidth_page']);
    echo(Typo::Xclean($post));
?>

            Hooks::attach('post_param_form', array('Gneex', 'postParam'));
        $o = array();
    public static function optionPost($type, $post='')
    {
        $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `title` ASC";
        $q = Db::result($sql);
        $opt = '<option></option>';
        foreach ($q as $k => $v) {
            $sel = ($post != '' && $post == $v->id) ? 'selected': '';
            $opt .= "<option value='{$v->id}' {$sel}>{$v->title}</option>";
        }

        return $opt;
    }

                \'fullwidth\' : $(\'#fullwidth\'),

    public static function postParam($data)
    {
//        print_r($data);
        $bar = Posts::getParam('sidebar', $data[0]['post'][0]->id);
//        echo $bar;
        $yes = ($bar == 'yes') ? 'selected': '';
        $no = ($bar == 'no') ? 'selected': '';
        $form = '<div class="row">
                <div class="col-sm-4">
                    <label>Show/Hide Sidebar</label>
                    <select name="param[sidebar]" class="form-control">
                        <option value="yes" '.$yes.'>Show Sidebar</option>
                        <option value="no" '.$no.'>Hide Sidebar</option>
                    </select>
                </div>
                </div>';
        echo $form;
    }

<?php
if ($gneex['front_layout'] == 'magazine') {
    # code...
    ?>
                $cat = $gneex['panel_1'];
                if (isset($cat) && $cat != ''){
                $post = Posts::getPostCat($cat, 8); ?>
                        <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                                if (!isset($post['error'])) {
                                    $content = Posts::content($post[0]->content);
                                    $title = Posts::title($post[0]->id);
                                    $img = Gneex::getImage($content);
                                    if ($img != '') {
                                        $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
                                    } else {
                                        $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
                                    }
                                <a href="' . Url::post($post[0]->id) . "\">
                                <div class=\"horizontal-list\">
                                    {$im}
                                </div>
                                <div class=\"\">
                                    <h4 >{$title}</h4>
                                </div>
                                </a>
                            ";
                                    unset($post[0]);
                                } ?>
                            </div>
                            <div class="col-sm-8">
                                <ul class="list-unstyled">
                                    <?php
                                    foreach ($post as $p => $v) {
                                        echo '
                                <li>
                                <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
                                </li>
                                ';
                                    } ?>
                                </ul>


                <?php }?>
                    echo '<div class="row"><div class="col-md-12">' . Gneex::opt('adsense') . '</div></div><hr />';


                <?php
                $cat = $gneex['panel_2'];
                if (isset($cat) && $cat != ''){
                    $col2 = !empty($gneex['panel_3']) ? '6': '12';
                    $post = Posts::getPostCat($cat, 6); ?>
                    <div class="col-sm-<?=$col2;?>">
                                <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                                        if (!isset($post['error'])) {
                                            $content = Posts::content($post[0]->content);
                                            $title = Posts::title($post[0]->id);
                                            $img = Gneex::getImage($content);
                                            if ($img != '') {
                                                $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
                                            } else {
                                                $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
                                            }
                                        <a href="' . Url::post($post[0]->id) . "\">
                                        <div class=\"vertical-list\">
                                            {$im}
                                        </div>
                                        <div class=\"\">
                                            <h4 >{$title}</h4>
                                        </div>
                                        </a>
                                    ";
                                            unset($post[0]);
                                        } ?>
                                    </div>
                                    <div class="col-md-12">
                                        <ul class="list-unstyled">
                                            <?php
                                            foreach ($post as $p => $v) {
                                                echo '
                                        <li>
                                        <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
                                        </li>
                                        ';
                                            } ?>
                                        </ul>


                <?php } ?>

                <?php
                $cat = $gneex['panel_3'];
                if (isset($cat) && $cat != ''){
                    $col3 = !empty($gneex['panel_2']) ? '6': '12';
                    $post = Posts::getPostCat($cat, 6); ?>
                    <div class="col-sm-<?=$col3;?>">
                                <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                                        if (!isset($post['error'])) {
                                            $content = Posts::content($post[0]->content);
                                            $title = Posts::title($post[0]->id);
                                            $img = Gneex::getImage($content);
                                            if ($img != '') {
                                                $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
                                            } else {
                                                $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
                                            }
                                        <a href="' . Url::post($post[0]->id) . "\">
                                        <div class=\"vertical-list\">
                                            {$im}
                                        </div>
                                        <div class=\"\">
                                            <h4 >{$title}</h4>
                                        </div>
                                        </a>
                                    ";
                                            unset($post[0]);
                                        } ?>
                                    </div>
                                    <div class="col-md-12">
                                        <ul class="list-unstyled">
                                            <?php
                                            foreach ($post as $p => $v) {
                                                echo '
                                        <li>
                                        <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
                                        </li>
                                        ';
                                            } ?>
                                        </ul>


                <?php } ?>
                </div>
                    echo '<div class="row"><div class="col-md-12">' . Gneex::opt('adsense') . '</div></div><hr />';

                if (isset($cat) && $cat != ''){
                $post = Posts::getPostCat($cat, 4);
                echo '<h4>' . Categories::name($cat) . '</h4>'; ?>
                <hr/>
                    <ul class="list-featured">
                        <?php
                        foreach ($post as $p) {
                            $content = Posts::content($p->content);
                            $title = Posts::title($p->id);
                            $img = Gneex::getImage($content);
                            if ($img != '') {
                                $im = '<img src="' . Url::thumb($img) . '" class="img-responsive">';
                            } else {
                                $im = '<img src="' . Url::thumb('assets/images/noimage.png') . '" class="img-responsive">';
                            }

                            echo '<li class="col-sm-3">
                                <a href="' . Url::post($p->id) . "\">
                                {$im}
                                <div class=\"featured-text\">
                                    <h4 >{$title}</h4>
                                </div>
                                </a>
                            </li>";
                        } ?>

                    </ul>
                </div>
                <?php } ?>
                if (isset($cat) && $cat != ''){
                $post = Posts::getPostCat($cat, 8);
                $postig = $post[0]; ?>

                        <h3 class="panel-title"><?= Categories::name($cat); ?></h3>
                                <ul class="list-unstyled">
                                    <?php
                                    unset($post[0]);
                                    foreach ($post as $p => $v) {
                                        echo '
                                <li>
                                <h5><a href="' . Url::post($v->id) . '">' . $v->title . '</a></h5>
                                </li>
                                ';
                                    } ?>
                                </ul>

                                <?php
                                if (!isset($post['error'])) {
                                    $content = Posts::content($postig->content);
                                    $title = Posts::title($postig->id);
                                    $img = Gneex::getImage($content);
                                    if ($img != '') {
                                        $im = '<img src="' . Url::thumb($img, 'large') . '" class="img-responsive">';
                                    } else {
                                        $im = '<img src="' . Url::thumb('assets/images/noimage.png', 'large') . '" class="img-responsive">';
                                    }
                                    echo '
                                <a href="' . Url::post($postig->id) . "\">
                                <div class=\"horizontal-list\">
                                    {$im}
                                </div>
                                <div class=\"\">
                                    <h4 >{$title}</h4>
                                </div>
                                </a>
                            ";
                                } ?>


                <?php } ?>
            </div> <!-- col-md-8 blog-lists end -->
            <?php Theme::theme('rightside', $data); ?>


        </div>
    </section>
        <?php
    } elseif ($gneex['front_layout'] == 'fullwidth') {
        Theme::inc('fullwidth', $data);
    } else {
    <section id="blog">
        <div class="container">
            <div class="col-md-8">
                <!-- start blog layout -->
                <div class=" blog-lists clearfix">
                <?php
                if ($data['num'] > 0) {
                    foreach ($data['posts'] as $p) {
                        echo '
                        <article class="blog-post col-md-12">
                            <h2><a href="'.Url::post($p->id)."\">$p->title</a></h2>
                            <hr />
                            ".Posts::format($p->content, $p->id).'
                            <div class="blog-footer">posted in '.Categories::name($p->cat).', at '.Date::format($p->date, 'd M Y H:i')." by <a href=\"#\">{$p->author}</a></div>
                        </article>
                            ";
                    }
                } else {
                    echo 'No Post to Show';
                } ?>
                </div>
                <?=$data['paging']; ?>
        <?php Theme::theme('rightside', $data); ?>

    </section>

        <!-- end blog layout -->
        <?php
    }
?>
        $o = array();
                                            <option value="fullwidth" <?=($o['front_layout'] == 'fullwidth') ? 'selected' : ''; ?>>Full Width</option>
                        <div id="fullwidth">
                            <div class="col-md-12">
                                <select name="fullwidth_page" class="form-control">
                                    <?=Gneex::optionPost('page', $o['fullwidth_page']);?>
                                </select>
                            </div>
                        </div>
            <?php
            $bar = Posts::getParam('sidebar', $data['posts'][0]->id);
            $cols = ($bar == 'yes'|| $bar == '') ? '8': '12';
            ?>
                <div class="col-md-<?=$cols;?>">
                                    <span class=\"meta\">posted in <a href=\"".Url::cat($p->cat).'">'.Categories::name($p->cat).'</a>, 
                                    at '.Date::format($p->date).' by <a href="'.Url::author($p->author).'">'.$p->author.'</a></span>
                                    <div class="content">'.Posts::content($p->content, $p->id).'</div><hr />';
                <?php if($bar == 'yes'|| $bar == '') Theme::theme('rightside', $data); ?>
    if (User::isExist($_POST['userid'])) {