CVE-2017-5345 (published 2017-01-12T06:59Z)

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.

Severity: MEDIUM
CVSS v2 base score: 6.5 (AV:N/AC:L/Au:S/C:P/I:P/A:P)
CVSS v3 base score: 8.8, HIGH (CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
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.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/semplon/GeniXCMS
commit_details: repo_url: https://github.com/semplon/GeniXCMS
author: Puguh Wijayanto
author_date: 2017-01-09 06:30:09+07:00
msg: 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
repository: repo_url: https://github.com/semplon/GeniXCMS
repo_name: GeniXCMS/GeniXCMS
description: Simple and Lightweight CMS Framework
repo_language: JavaScript
owner: semplon
file_changes: filename: summernote-ext-genixcms.js
change_type: ModificationType.MODIFY
diff: @@ -57,7 +57,7 @@
                     contents: '<i class="fa fa-list-alt"/> File Manager',
                     tooltip: 'elfinder',
                     click: function () {
-                        elfinderDialog();
+                        elfinderDialog($(this).closest('.note-editor').parent().children('.summernote'));
                     }
                 });
                 

programming_language: JavaScript
filename: media.php
change_type: ModificationType.MODIFY
diff: @@ -15,32 +15,7 @@
  * @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">
@@ -54,11 +29,6 @@ if (isset($data['alertDanger'])) {
     </div>
 
     <div class="col-sm-12">
-        <div class="row">
-            <div id="elfinder"></div>
-        </div>
-
-
-
+        <div id="elfinder"></div>
     </div>
 </div>

programming_language: PHP
filename: pages_form.php
change_type: ModificationType.MODIFY
diff: @@ -222,7 +222,9 @@ if (isset($data['post'])) {
                         <div id="myGrid"><?=$content; ?></div>
                         </div>
                         <?php
+
                     }
+                    Hooks::run('page_param_form', $data);
                 ?>
                 </div>
                 <div class="col-sm-4">

programming_language: PHP
filename: posts_form.php
change_type: ModificationType.MODIFY
diff: @@ -196,7 +196,9 @@ if (isset($data['post'])) {
                         <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">

programming_language: PHP
filename: Categories.class.php
change_type: ModificationType.MODIFY
diff: @@ -67,13 +67,19 @@ class Categories
             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'].' ';
@@ -129,7 +135,14 @@ class Categories
                 $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 ';
@@ -330,7 +343,7 @@ 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) {

programming_language: PHP
filename: Comments.class.php
change_type: ModificationType.MODIFY
diff: @@ -178,11 +178,12 @@ class Comments
         $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">

programming_language: PHP
filename: Control.class.php
change_type: ModificationType.MODIFY
diff: @@ -104,8 +104,8 @@ class Control
      */
     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);

programming_language: PHP
filename: saveimage-ajax.control.php
change_type: ModificationType.MODIFY
diff: @@ -14,8 +14,9 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @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');

programming_language: PHP
filename: tags-ajax.control.php
change_type: ModificationType.MODIFY
diff: @@ -14,11 +14,13 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @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) {

programming_language: PHP
filename: version-ajax.control.php
change_type: ModificationType.MODIFY
diff: @@ -15,7 +15,9 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @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());
 

programming_language: PHP
filename: mods.control.php
change_type: ModificationType.MODIFY
diff: @@ -18,9 +18,10 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
  * @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 */

programming_language: PHP
filename: posts.control.php
change_type: ModificationType.MODIFY
diff: @@ -102,6 +102,12 @@ if (User::access(2)) {
                         $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);
@@ -205,9 +211,18 @@ if (User::access(2)) {
                         } 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']);

programming_language: PHP
filename: themes.control.php
change_type: ModificationType.MODIFY
diff: @@ -20,9 +20,10 @@ defined('GX_LIB') or die('Direct Access Not Allowed!');
 
 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'])) {

programming_language: PHP
filename: users.control.php
change_type: ModificationType.MODIFY
diff: @@ -76,7 +76,7 @@ if (User::access(1) || (isset($_GET['id']) && User::id(Session::val('username'))
                     }
 
                     // VALIDATE ALL
-                    if (!User::isExist($_POST['userid'])) {
+                    if (User::isExist($_POST['userid'])) {
                         $alertDanger[] = MSG_USER_EXIST;
                     }
 
@@ -252,7 +252,7 @@ if (User::access(1) || (isset($_GET['id']) && User::id(Session::val('username'))
                             $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'])) {

programming_language: PHP
filename: author.control.php
change_type: ModificationType.ADD
diff: @@ -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 */

programming_language: PHP
filename: cat.control.php
change_type: ModificationType.MODIFY
diff: @@ -74,7 +74,7 @@ if (Categories::exist($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'),

programming_language: PHP
filename: post.control.php
change_type: ModificationType.MODIFY
diff: @@ -54,10 +54,10 @@ $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 {

programming_language: PHP
filename: tag.control.php
change_type: ModificationType.MODIFY
diff: @@ -38,6 +38,9 @@ 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...
 
@@ -90,7 +93,7 @@ if (Tags::exist($name)) {
     $paging = array(
                 'paging' => $paging,
                 'table' => 'posts',
-                'where' => '`type` = \''.$type.'\' ',
+                'where' => '`type` = \''.$type.'\' AND `status` = \'1\' ',
                 'max' => $data['max'],
                 'url' => $url,
                 'type' => Options::v('pagination'),
@@ -98,7 +101,7 @@ if (Tags::exist($name)) {
     $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');

programming_language: PHP
filename: thumb.control.php
change_type: ModificationType.MODIFY
diff: @@ -29,5 +29,10 @@ if (isset($data['thumb']) && $data['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);

programming_language: PHP
filename: Hooks.class.php
change_type: ModificationType.MODIFY
diff: @@ -33,47 +33,49 @@ 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;

programming_language: PHP
filename: Mod.class.php
change_type: ModificationType.MODIFY
diff: @@ -41,7 +41,7 @@ class Mod
 
     public static function modList()
     {
-        //$mod = '';
+        $mod = array();
         $handle = dir(GX_MOD);
         while (false !== ($entry = $handle->read())) {
             if ($entry != '.' && $entry != '..') {
@@ -279,6 +279,13 @@ class Mod
         }
     }
 
+    public static function title($mod)
+    {
+        $data = self::data($mod);
+
+        return $data['name'];
+    }
+
     /*
      * menulist
      *

programming_language: PHP
filename: Posts.class.php
change_type: ModificationType.MODIFY
diff: @@ -465,7 +465,7 @@ class Posts
         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)) {
@@ -489,12 +489,13 @@ class Posts
                         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
             )
@@ -503,7 +504,7 @@ class Posts
             $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) {
@@ -513,11 +514,11 @@ class Posts
                     }
                 }
                 $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);
@@ -525,7 +526,7 @@ class Posts
                             $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 .= '';
                     }

programming_language: PHP
filename: Router.class.php
change_type: ModificationType.MODIFY
diff: @@ -46,30 +46,34 @@ 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;
@@ -149,7 +153,7 @@ class Router
     public static function extract($var, $m)
     {
         // print_r($m);
-        $va = [];
+        $va = array();
         foreach ($var as $k2 => $v2) {
             // print_r($k2);
             if (!is_int($k2)) {

programming_language: PHP
filename: Theme.class.php
change_type: ModificationType.MODIFY
diff: @@ -253,6 +253,13 @@ class Theme
 
         return $list;
     }
+
+    public static function title($mod)
+    {
+        $data = self::data($mod);
+
+        return $data['name'];
+    }
 }
 
 /* End of file Theme.class.php */

programming_language: PHP
filename: Url.class.php
change_type: ModificationType.MODIFY
diff: @@ -367,6 +367,24 @@ class Url
 
         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 */

programming_language: PHP
filename: User.class.php
change_type: ModificationType.MODIFY
diff: @@ -217,11 +217,11 @@ class User
         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 = '';
         }
@@ -230,9 +230,9 @@ class User
         $usr = Db::result($sql);
         $n = Db::$num_rows;
         if ($n > 0) {
-            return false;
-        } else {
             return true;
+        } else {
+            return false;
         }
     }
 

programming_language: PHP
filename: options.php
change_type: ModificationType.MODIFY
diff: @@ -29,7 +29,7 @@ if (User::access(0)) {
             // $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);
                 }

programming_language: PHP
filename: author.php
change_type: ModificationType.ADD
diff: @@ -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>

programming_language: PHP
filename: cat.php
change_type: ModificationType.MODIFY
diff: @@ -41,7 +41,9 @@ $gneex = Gneex::$opt;
                             </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">
@@ -55,7 +57,8 @@ $gneex = Gneex::$opt;
                                 <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>
                                 ";
                         }

programming_language: PHP
filename: style.css
change_type: ModificationType.MODIFY
diff: @@ -43,6 +43,9 @@ 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;
 }
@@ -164,10 +167,8 @@ article .meta {
     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;
 }
 
@@ -514,7 +515,27 @@ pre {
 }
 
 
+.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 */

programming_language: CSS
filename: fullwidth.php
change_type: ModificationType.ADD
diff: @@ -0,0 +1,5 @@
+<?php
+    $gneex = Gneex::$opt;;
+    $post = Gneex::getPost($gneex['fullwidth_page']);
+    echo(Typo::Xclean($post));
+?>

programming_language: PHP
filename: function.php
change_type: ModificationType.MODIFY
diff: @@ -19,6 +19,8 @@ class Gneex
 
             Hooks::attach('header_load_meta', array('Gneex', 'loadCSS'));
             Hooks::attach('admin_footer_action', array('Gneex', 'loadAdminAsset'));
+
+            Hooks::attach('post_param_form', array('Gneex', 'postParam'));
         }
     }
 
@@ -35,7 +37,7 @@ class Gneex
     {
         $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);
@@ -66,6 +68,19 @@ class Gneex
         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'];
@@ -252,6 +267,7 @@ class Gneex
             $.viewMap = {
                 \'blog\' : $([]),
                 \'magazine\' : $(\'#magazine\'),
+                \'fullwidth\' : $(\'#fullwidth\'),
             };
             $.each($.viewMap, function () {
                 this.hide();
@@ -278,6 +294,25 @@ class Gneex
         ';
         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();

programming_language: PHP
filename: index.php
change_type: ModificationType.MODIFY
diff: @@ -69,323 +69,335 @@ if (Gneex::featuredExist()) {
 }
 ?>
 
+
+<?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
+    }
+?>

programming_language: PHP
filename: options.php
change_type: ModificationType.MODIFY
diff: @@ -75,7 +75,7 @@ if (Gneex::checkDB()) {
     $opt = json_decode($opt, true);
 
     if (is_array($opt)) {
-        $o = [];
+        $o = array();
         foreach ($opt as $k => $v) {
             // $o[$k] = urldecode($v);
             $o[$k] = $v;
@@ -147,12 +147,20 @@ if (Gneex::checkDB()) {
                                         <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">

programming_language: PHP
filename: single.php
change_type: ModificationType.MODIFY
diff: @@ -7,8 +7,11 @@
     </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') != '') {
@@ -25,9 +28,10 @@
                                 <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 />';
                             }
@@ -52,7 +56,7 @@
                         
                     </div>
                 </div>
-                <?php Theme::theme('rightside', $data); ?>
+                <?php if($bar == 'yes'|| $bar == '') Theme::theme('rightside', $data); ?>
                 
 
         </div>

programming_language: PHP
filename: info.php
change_type: ModificationType.DELETE
diff: @@ -1,3 +0,0 @@
-<?php
-
-echo phpinfo();

programming_language: unknown
filename: register.php
change_type: ModificationType.MODIFY
diff: @@ -46,7 +46,7 @@ if (isset($_POST['register'])) {
             $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'])) {

programming_language: PHP