_binary From 5d805fa5f6a9e04d6b57090220d988a8bc88a362 Mon Sep 17 00:00:00 2001
From: MALLIKA <keertimaantenneti@keertimaan-tennetis-macbook.local>
Date: Tue, 17 Dec 2013 19:18:16 -0800
Subject: [PATCH] Blogs Pages- bug fixed

---
 configs/config.php                         |   0
 configs/createdb.php                       |  13 +-
 controllers/admin_controller.php           | 547 +++++++++++++++++++++++++-
 controllers/static_controller.php          |  14 +-
 css/search.css                             |   5 +
 lib/upgrade_functions.php                  |  31 +-
 models/blogpage_model.php                  | 610 +++++++++++++++++++++++++++++
 models/profile_model.php                   |   4 +
 models/source_model.php                    |   9 +-
 models/user_model.php                      |  37 +-
 views/admin_view.php                       |   6 +-
 views/elements/blogpages_element.php       | 140 +++++++
 views/elements/createblogpages_element.php | 126 ++++++
 views/elements/editblogpages_element.php   | 338 ++++++++++++++++
 views/elements/managegroups_element.php    | 274 +++++++------
 views/signin_view.php                      |  94 ++---
 views/static_view.php                      |   5 -
 17 files changed, 2029 insertions(+), 224 deletions(-)
 mode change 100644 => 100755 configs/config.php
 create mode 100644 models/blogpage_model.php
 create mode 100755 views/elements/blogpages_element.php
 create mode 100755 views/elements/createblogpages_element.php
 create mode 100755 views/elements/editblogpages_element.php
 mode change 100644 => 100755 views/elements/managegroups_element.php

diff --git a/configs/config.php b/configs/config.php
old mode 100644
new mode 100755
diff --git a/configs/createdb.php b/configs/createdb.php
index cdaabe0..99899d9 100755
--- a/configs/createdb.php
+++ b/configs/createdb.php
@@ -81,13 +81,17 @@ if(!$profile_model->createDatabaseTables($db, $dbinfo)) {
     exit();
 }
 
-$db->execute("INSERT INTO VERSION VALUES (17)");
+$db->execute("INSERT INTO VERSION VALUES (18)");
 
 //default account is root without a password
 $sql ="INSERT INTO USER VALUES (1, 'admin', 'admin','root',
         'root@dev.null',1,'".crawlCrypt('')."','".crawlCrypt('1')."' ) ";
 $db->execute($sql);
 
+//default public group with group id 1
+$sql = "INSERT INTO GROUPS VALUES(1,'public','".time()."','1')";
+$db->execute($sql);
+
 /* we insert 1 by 1 rather than comma separate as sqlite
    does not support comma separated inserts
  */
@@ -172,6 +176,10 @@ $activities = array(
             "ko" => '크롤 관리',
             "vi-VN" => 'Quản lý sự bò',
         )),
+    "blogPages" => array('db_activity_blogs_pages',
+        array(
+            "en-US" => 'Blogs and Pages',
+        )),
     "mixCrawls" => array('db_activity_mix_crawls',
         array(
             "en-US" => 'Mix Crawls',
@@ -247,7 +255,8 @@ foreach($activities as $activity => $translation_info) {
 $new_user_activities = array(
     "manageAccount",
     "manageGroups",
-    "mixCrawls"
+    "mixCrawls",
+    "blogPages"
 );
 
 foreach($new_user_activities as $new_activity) {
diff --git a/controllers/admin_controller.php b/controllers/admin_controller.php
index 1034be6..5251e11 100755
--- a/controllers/admin_controller.php
+++ b/controllers/admin_controller.php
@@ -74,7 +74,7 @@ class AdminController extends Controller implements CrawlConstants
      */
     var $models = array(
         "signin", "user", "activity", "crawl", "role", "locale", "profile",
-        "searchfilters", "source", "machine", "cron", "group");
+        "searchfilters", "source", "machine", "cron", "group", "blogpage");
     /**
      * Says which activities (roughly methods invoke from the web) this
      * controller will respond to
@@ -83,14 +83,15 @@ class AdminController extends Controller implements CrawlConstants
     var $activities = array("signin", "manageAccount", "manageUsers",
         "manageRoles", "manageGroups","manageCrawls","pageOptions",
         "manageClassifiers","resultsEditor", "manageMachines", "manageLocales",
-        "crawlStatus","mixCrawls","machineStatus","searchSources","configure");
+        "crawlStatus","mixCrawls","machineStatus","searchSources","configure",
+        "blogPages");
     /**
      * Says which activities (roughly methods invoke from the web) this
      * controller will respond to
      * @var array
      */
     var $new_user_activities = array("manageAccount", "manageGroups",
-        "mixCrawls");
+        "mixCrawls", "blogPages");
     /**
      * An array of activities which are periodically updated within other
      * activities that they live. For example, within manage crawl,
@@ -1055,6 +1056,546 @@ class AdminController extends Controller implements CrawlConstants
     }
 
     /**
+     * Used to handle the blogs and pages activity.
+     *
+     * This activity allows users to create,edit, and delete blogs.
+     * It allows users to add feeditems to blogs, edit and delete feeditems
+     * Allows users to add groups to blogs and provides access control to blogs
+     * @return array $data information about blogs in the system
+     */
+    function blogPages()
+    {
+        $data["ELEMENT"] = "blogpagesElement";
+        $data['SCRIPT'] = "";
+        if(isset($_SESSION['USER_ID'])) {
+            $user = $_SESSION['USER_ID'];
+        } else {
+            $user = $_SERVER['REMOTE_ADDR'];
+        }
+        $user = $_SESSION['USER_ID'];
+        $group_ids = array();
+        if(isset($_REQUEST['selectgroup'])) {
+            $select_group =
+                 $this->clean($_REQUEST['selectgroup'], "string");
+                 $data['SELECT_GROUP'] = $select_group;
+        } else {
+            $select_group = "";
+        }
+        if($_SESSION['USER_ID'] == '1') {
+             $groups = $this->groupModel->getGroupList();
+             $is_admin = true;
+        } else {
+            $is_admin = false;
+            $groups =
+                $this->groupModel->getGroupListbyUser($_SESSION['USER_ID']);
+            foreach($groups as $group) {
+                array_push($group_ids, $group['GROUP_ID']);
+            }
+        }
+        $recent_blogs =
+            $this->blogpageModel->recentBlog($user, $group_ids, $is_admin);
+        $data['RECENT_BLOGS'] = $recent_blogs;
+        $base_option = tl('admin_controller_select_groupname');
+        $data['GROUP_NAMES'][-1] = $base_option;
+        foreach($groups as $group) {
+            $data['GROUP_NAMES'][$group['GROUP_ID']]= $group['GROUP_NAME'];
+
+            $group_ids[] = $group['GROUP_ID'];
+        }
+        $possible_arguments = array("addblog", "searchblog", "deleteblog",
+            "editblog","editdescription","updatedescription",
+            "addblogentry","addfeeditem","deletefeed","updatefeed",
+            "editfeed","updateblogusers","addbloggroup",
+            "deletebloggroup");
+        if(isset($_REQUEST['arg']) &&
+            in_array($_REQUEST['arg'], $possible_arguments)) {
+            switch($_REQUEST['arg'])
+            {
+                case "addblog":
+                    $data['SOURCE_TYPES'] =
+                        array(-1 => tl('admin_controller_source_type'),
+                        "blog" => tl('admin_controller_blog'),
+                        "page" => tl('admin_controller_page'));
+                    $source_type_flag = false;
+                    if(isset($_REQUEST['sourcetype']) &&
+                        in_array($_REQUEST['sourcetype'],
+                        array_keys($data['SOURCE_TYPES']))) {
+                        $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                        $source_type_flag = true;
+                    } else {
+                        $data['SOURCE_TYPE'] = -1;
+                    }
+                    $locales = $this->localeModel->getLocaleList();
+                    $data["LANGUAGES"] = array();
+                    foreach($locales as $locale) {
+                        $data["LANGUAGES"][$locale['LOCALE_TAG']] =
+                        $locale['LOCALE_NAME'];
+                    }
+                    if(isset($_REQUEST['sourcelocaletag']) &&
+                        in_array($_REQUEST['sourcelocaletag'],
+                        array_keys($data["LANGUAGES"]))) {
+                            $data['SOURCE_LOCALE_TAG'] =
+                                $_REQUEST['sourcelocaletag'];
+                    } else {
+                        $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                    }
+                    $must_have =
+                        array("title", "description", "sourcelocaletag");
+                    $missing_must_have = false;
+                    foreach ($must_have as $clean_me) {
+                        $data[$clean_me] = (isset($_REQUEST[$clean_me])) ?
+                            $this->clean($_REQUEST[$clean_me], "string" ) : "";
+                        if(in_array($clean_me, $must_have)
+                            && $data[$clean_me] == "" ) {
+                            $missing_must_have = true;
+                        }
+                    }
+                    if(!$source_type_flag || $missing_must_have) {
+                        break;
+                    }
+                    if(isset($_SESSION['USER_ID'])) {
+                        $user = $_SESSION['USER_ID'];
+                    } else {
+                        $user = $_SERVER['REMOTE_ADDR'];
+                    }
+                    if($data['SOURCE_TYPE'] == 'page'){
+
+                    $groupid = $this->groupModel->getGroupId($select_group);
+                    if(isset($_REQUEST['selectgroup'])) {
+                        $select_group =
+                        $this->clean($_REQUEST['selectgroup'], "string" );
+                        $data['SELECT_GROUP'] = $select_group;
+                    } else {
+                        $select_group = "";
+                    }
+                    $data['SELECT_GROUP'] = $select_group;
+                        $result = $this->blogpageModel->addPage(
+                            $data['title'], $data['description'],
+                            $data['SOURCE_TYPE'], $data['SOURCE_LOCALE_TAG'],
+                            $user, $select_group);
+                        if($result){
+                            $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                            tl('admin_controller_page_added').
+                            "</h1>');";
+                    }
+                    }else{
+                        $user = $_SESSION['USER_ID'];
+                        $groupid = $this->groupModel->getGroupId($select_group);
+                        $data['SELECT_GROUP'] = $select_group;
+                        $this->blogpageModel->addBlog(
+                            $data['title'], $data['description'], $user,
+                            $data['SOURCE_TYPE'], $data['sourcelocaletag'],
+                            $select_group);
+                        $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                            tl('admin_controller_blog_added').
+                            "</h1>');";
+                    }
+                    $data["ELEMENT"] = "blogpagesElement";
+                    $recent_blogs =
+                        $this->blogpageModel->recentBlog(
+                        $user, $group_ids, $is_admin);
+                    $data['RECENT_BLOGS'] = $recent_blogs;
+                break;
+
+                case "searchblog":
+                    if(!isset($_REQUEST['title'])) { break; }
+
+                    $data["ELEMENT"] = "blogpagesElement";
+                    $data['SELECT_GROUP'] = "";
+                    $data['description'] = "";
+                    $is_blogs_empty = false;
+                    $data['title'] = $this->clean($_REQUEST['title'],
+                        "string");
+                    if($data['title'] != "") {
+                        $blogs =
+                            $this->blogpageModel->searchBlog(
+                                $data['title'],
+                                $user, $group_ids, $is_admin);
+                        $data['BLOGS'] = $blogs;
+                        if(empty($blogs)){ 
+                            $is_blogs_empty = true;
+                        }
+                    } else {
+                        $is_blogs_empty = true;
+                    }
+                    if($is_blogs_empty) {
+                        $data["ELEMENT"] = "createblogpagesElement";
+                        $data['SOURCE_TYPES'] =
+                            array(-1 => tl('admin_controller_source_type'),
+                                "blog" => tl('admin_controller_blog'),
+                                "page" => tl('admin_controller_page')
+                            );
+                        $source_type_flag = false;
+                        if(isset($_REQUEST['sourcetype']) &&
+                            in_array($_REQUEST['sourcetype'],
+                            array_keys($data['SOURCE_TYPES']))) {
+                            $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                            $source_type_flag = true;
+                        } else {
+                            $data['SOURCE_TYPE'] = -1;
+                        }
+                        $locales = $this->localeModel->getLocaleList();
+                        $data["LANGUAGES"] = array();
+                        foreach($locales as $locale) {
+                            $data["LANGUAGES"][$locale['LOCALE_TAG']] =
+                                $locale['LOCALE_NAME'];
+                        }
+                        if(isset($_REQUEST['sourcelocaletag']) && in_array(
+                            $_REQUEST['sourcelocaletag'],
+                            array_keys($data["LANGUAGES"]))
+                            ) {
+                            $data['SOURCE_LOCALE_TAG'] =
+                                $_REQUEST['sourcelocaletag'];
+                        } else {
+                            $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                        }
+                    }
+                break;
+
+                case "deleteblog":
+                    if(!isset($_REQUEST['id'])) { break; }
+
+                    $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    $title = "";
+                    if(isset($_REQUEST['title'])) {
+                        $title = $this->clean($_REQUEST['title'], "string" );
+                    }
+                    $this->blogpageModel->deleteBlog($timestamp, $title, $user);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_blog_deleted').
+                        "</h1>');";
+                    $data['RECENT_BLOGS'] =  $this->blogpageModel->recentBlog(
+                        $user, $group_ids, $is_admin);
+                break;
+
+                case "editblog":
+                    if(!isset($_REQUEST['id'])) { break; }
+
+                    $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    $data["ELEMENT"] = "editblogpagesElement";
+                    $data['SOURCE_TYPES'] = array(
+                            -1 => tl('admin_controller_source_type'),
+                            "blog" => tl('admin_controller_blog'),
+                            "page" => tl('admin_controller_page')
+                        );
+                    $source_type_flag = false;
+                    if(isset($_REQUEST['sourcetype']) && in_array(
+                        $_REQUEST['sourcetype'],
+                        array_keys($data['SOURCE_TYPES']))
+                        ) {
+                        $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                        $source_type_flag = true;
+                    } else {
+                        $data['SOURCE_TYPE'] = -1;
+                    }
+                    $locales = $this->localeModel->getLocaleList();
+                    $data["LANGUAGES"] = array();
+                    foreach($locales as $locale) {
+                        $data["LANGUAGES"][$locale['LOCALE_TAG']]
+                            = $locale['LOCALE_NAME'];
+                    }
+                    if(isset($_REQUEST['sourcelocaletag']) && in_array(
+                        $_REQUEST['sourcelocaletag'],
+                        array_keys($data["LANGUAGES"]))) {
+                        $data['SOURCE_LOCALE_TAG'] =
+                            $_REQUEST['sourcelocaletag'];
+                    } else {
+                        $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                    }
+                    $edit_blogs= $this->blogpageModel->editBlog($timestamp);
+                    $blog_users =
+                    $this->blogpageModel->getBlogUsers($edit_blogs[0]);
+                    $edit_blogs[0]['BLOG_USERS'] = $blog_users;
+                    $data['EDIT_BLOGS'] = $edit_blogs;
+                    $title = $edit_blogs['0']['NAME'];
+                    if(isset($_SESSION['USER_ID'])) {
+                        $user = $_SESSION['USER_ID'];
+                    } else {
+                        $user = $_SERVER['REMOTE_ADDR'];
+                    }
+                    $user = $_SESSION['USER_ID'];
+                    $feed_items=$this->blogpageModel->getFeed($title, $user);
+                    $data['FEED_ITEMS'] = $feed_items;
+                    if(isset($_SESSION['USER_ID'])) {
+                        $username = $this->signinModel->getUserName(
+                            $_SESSION['USER_ID']);
+                        $data['USER_NAME'] = $username;
+                        $owner_id = $this->blogpageModel->
+                            getBlogOwner($timestamp);
+                        if($owner_id == $user || $user == '1'){
+                            $data['IS_OWNER'] = true;
+                        }
+                    }
+                break;
+
+                case "editdescription":
+                    if(!isset($_REQUEST['id'])) { break; }
+                    $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    $data["ELEMENT"] = "editblogpagesElement";
+                    $data['SOURCE_TYPES'] =
+                        array(-1 => tl('admin_controller_source_type'),
+                            "blog" => tl('admin_controller_blog'),
+                            "page" => tl('admin_controller_page'));
+                    $source_type_flag = false;
+                    if(isset($_REQUEST['sourcetype']) && in_array(
+                       $_REQUEST['sourcetype'],
+                       array_keys($data['SOURCE_TYPES']))
+                       ) {
+                       $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                       $source_type_flag = true;
+                    } else {
+                        $data['SOURCE_TYPE'] = -1;
+                    }
+                    $locales = $this->localeModel->getLocaleList();
+                    $data["LANGUAGES"] = array();
+                    foreach($locales as $locale) {
+                        $data["LANGUAGES"][$locale['LOCALE_TAG']] =
+                            $locale['LOCALE_NAME'];
+                    }
+                    if(isset($_REQUEST['sourcelocaletag']) && in_array(
+                        $_REQUEST['sourcelocaletag'],
+                        array_keys($data["LANGUAGES"]))) {
+                        $data['SOURCE_LOCALE_TAG'] =
+                        $_REQUEST['sourcelocaletag'];
+                    } else {
+                        $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                    }
+                    $blog_group = $this->blogpageModel->
+                        getBlogGroup($timestamp);
+                    $data['BLOG_GROUP'] = $blog_group;
+                    $data['EDIT_BLOGS'] =
+                        $this->blogpageModel->editBlog($timestamp);
+                    $data['IS_EDIT_DESC'] = true;
+                break;
+
+                case "updatedescription":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    }
+                    if(isset($_REQUEST['description'])) {
+                        $description =
+                            $this->clean($_REQUEST['description'], "string" );
+                    }
+                    if(isset($_REQUEST['title'])) {
+                        $title = $this->clean($_REQUEST['title'], "string" );
+                    }
+                    $data['EDIT_BLOGS'] =
+                        $this->blogpageModel->editDescription($timestamp,
+                            $title, $description);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_blog_updated') . "</h1>');";
+                    $data["ELEMENT"] = "blogpagesElement";
+                    $recent_blogs =
+                    $this->blogpageModel->
+                        recentBlog($user, $group_ids, $is_admin);
+                    $data['RECENT_BLOGS'] = $recent_blogs;
+                break;
+
+                case "addblogentry":
+                    if(!isset($_REQUEST['id'])) { break; }
+                    $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    $data["ELEMENT"] = "editblogpagesElement";
+                    $data['SOURCE_TYPES'] =
+                        array(-1 => tl('admin_controller_source_type'),
+                        "blog" => tl('admin_controller_blog'),
+                        "page" => tl('admin_controller_page'));
+                        $source_type_flag = false;
+                    if(isset($_REQUEST['sourcetype']) && in_array(
+                        $_REQUEST['sourcetype'],
+                        array_keys($data['SOURCE_TYPES']) )
+                        ) {
+                        $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                        $source_type_flag = true;
+                    } else {
+                        $data['SOURCE_TYPE'] = -1;
+                    }
+                    $locales = $this->localeModel->getLocaleList();
+                    $data["LANGUAGES"] = array();
+                    foreach($locales as $locale) {
+                        $data["LANGUAGES"][$locale['LOCALE_TAG']] =
+                        $locale['LOCALE_NAME'];
+                    }
+                    if(isset($_REQUEST['sourcelocaletag']) &&
+                        in_array($_REQUEST['sourcelocaletag'],
+                        array_keys($data["LANGUAGES"]))) {
+                            $data['SOURCE_LOCALE_TAG'] =
+                            $_REQUEST['sourcelocaletag'];
+                    } else {
+                       $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                    }
+                    $data['EDIT_BLOGS'] =
+                        $this->blogpageModel->editBlog($timestamp);
+                    $data['IS_ADD_BLOG'] = true;
+                break;
+
+                case "addfeeditem":
+                    if(isset($_SESSION['USER_ID'])) {
+                        $user = $_SESSION['USER_ID'];
+                    } else {
+                        $user = $_SERVER['REMOTE_ADDR'];
+                    }
+                    $user = $_SESSION['USER_ID'];
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    }
+                    if(isset($_REQUEST['title'])) {
+                        $title = $this->clean($_REQUEST['title'], "string" );
+                    }
+                    if(isset($_REQUEST['description'])) {
+                        $description =
+                            $this->clean($_REQUEST['description'], "string" );
+                    }
+                    if(isset($_REQUEST['title_entry'])) { ;
+                        $title_entry =
+                            $this->clean($_REQUEST['title_entry'], "string" );
+                    }
+                    $feed_items= $this->blogpageModel->addEntry($timestamp,
+                        $title_entry, $description, $title, $user);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_feed_added').
+                        "</h1>');";
+                break;
+
+                case "editfeed":
+                    if(!isset($_REQUEST['id'])) { break; }
+
+                    $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    $data["ELEMENT"] = "editblogpagesElement";
+                    $data['SOURCE_TYPES'] =
+                        array(-1 => tl('admin_controller_source_type'),
+                        "blog" => tl('admin_controller_blog'),
+                        "page" => tl('admin_controller_page'));
+                    $source_type_flag = false;
+                    if(isset($_REQUEST['sourcetype']) &&
+                        in_array($_REQUEST['sourcetype'],
+                        array_keys($data['SOURCE_TYPES']))) {
+                            $data['SOURCE_TYPE'] = $_REQUEST['sourcetype'];
+                            $source_type_flag = true;
+                    } else {
+                        $data['SOURCE_TYPE'] = -1;
+                    }
+                    $locales = $this->localeModel->getLocaleList();
+                    $data["LANGUAGES"] = array();
+                    foreach($locales as $locale) {
+                        $data["LANGUAGES"][$locale['LOCALE_TAG']] =
+                        $locale['LOCALE_NAME'];
+                    }
+                    if(isset($_REQUEST['sourcelocaletag']) &&
+                        in_array($_REQUEST['sourcelocaletag'],
+                        array_keys($data["LANGUAGES"]))) {
+                            $data['SOURCE_LOCALE_TAG'] =
+                            $_REQUEST['sourcelocaletag'];
+                    } else {
+                        $data['SOURCE_LOCALE_TAG'] = DEFAULT_LOCALE;
+                    }
+                    $data['EDIT_BLOGS'] =
+                        $this->blogpageModel->editBlog($timestamp);
+                    $data['IS_EDIT_FEED'] = true;
+                    if(isset($_REQUEST['fid'])) {
+                        $guid = $this->clean($_REQUEST['fid'], "string" );
+                    }
+                    $feed_items = $this->blogpageModel->getFeedByGUID($guid);
+                    $data['FEED_ITEMS'] = $feed_items;
+                    $owner_id = $this->blogpageModel->getBlogOwner($timestamp);
+                    if($owner_id == $user || $user == '1'){
+                        $data['IS_OWNER'] = true;
+                    }
+                break;
+
+                case "updatefeed":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    }
+                    if(isset($_REQUEST['description'])) {
+                        $description =
+                            $this->clean($_REQUEST['description'], "string" );
+                    }
+                    if(isset($_REQUEST['title'])) {
+                        $title = $this->clean($_REQUEST['title'], "string" );
+                    }
+                    if(isset($_REQUEST['fid'])) {
+                        $guid = $this->clean($_REQUEST['fid'], "string" );
+                    }
+                    $update_feeds= $this->blogpageModel->
+                        updateFeed ($guid,$title, $description);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_feed_updated').
+                        "</h1>');";
+                break;
+
+                case "deletefeed":
+                    if(isset($_REQUEST['id'])) {
+                        $guid = $this->clean($_REQUEST['id'], "string" );
+                        $this->blogpageModel->deleteFeed($guid);
+                        $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                            tl('admin_controller_feed_deleted').
+                            "</h1>');";
+                    }
+                break;
+
+                case "updateblogusers":
+                    if(isset($_REQUEST['selectuser'])) {
+                        $select_user =
+                        $this->clean($_REQUEST['selectuser'], "string" );
+                    } else {
+                        $select_user = "";
+                    }
+                    if($select_user != "" ) {
+                        $userid = $this->signinModel->getUserId($select_user);
+                        $data['SELECT_USER'] = $select_user;
+
+                    }
+                    if(isset($_REQUEST['blogName'])) {
+                        $blog_name =
+                            $this->clean($_REQUEST['blogName'], "string");
+                    } else {
+                        $blog_name = "";
+                    }
+                    $this->blogpageModel->
+                        updateBlogUsers($select_user, $blog_name);
+                    $recent_blogs =
+                    $this->blogpageModel->
+                        recentBlog($user, $group_ids, $is_admin);
+                    $data['RECENT_BLOGS'] = $recent_blogs;
+                break;
+
+                case "addbloggroup":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    }
+                    if(isset($_REQUEST['selectgroup'])) {
+                        $select_group =
+                        $this->clean($_REQUEST['selectgroup'], "string" );
+                        $data['SELECT_GROUP'] = $select_group;
+                    } else {
+                        $select_group = "";
+                    }
+                    $groupid = $this->groupModel->getGroupId($select_group);
+                    $data['SELECT_GROUP'] = $select_group;
+                    $this->blogpageModel->addGroup($timestamp,$select_group);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_group_added').
+                        "</h1>');";
+                break;
+
+                case "deletebloggroup":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = $this->clean($_REQUEST['id'], "string" );
+                    }
+                    if(isset($_REQUEST['gid'])) {
+                        $groupid = $this->clean($_REQUEST['gid'], "string" );
+                    }
+                    $this->blogpageModel->deleteGroup($timestamp,$groupid);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_group_deleted').
+                        "</h1>');";
+                break;
+            }
+        }
+        return $data;
+    }
+
+    /**
      * Used to handle the manage crawl activity.
      *
      * This activity allows new crawls to be started, statistics about old
diff --git a/controllers/static_controller.php b/controllers/static_controller.php
index 6e8de92..884fdab 100644
--- a/controllers/static_controller.php
+++ b/controllers/static_controller.php
@@ -49,7 +49,7 @@ class StaticController extends Controller
      * Says which models to load for this controller.
      * @var array
      */
-    var $models = array();
+    var $models = array("blogpage");
     /**
      * Says which views to load for this controller.
      * @var array
@@ -102,10 +102,16 @@ class StaticController extends Controller
      */
     function show_page()
     {
+        if(isset($_SESSION['USER_ID'])) {
+            $user = $_SESSION['USER_ID'];
+        } else {
+            $user = $_SERVER['REMOTE_ADDR'];
+        }
         $data = array();
         if(isset($_REQUEST['p']) &&
-            in_array($_REQUEST['p'], $this->staticView->pages)) {
-            $data['page'] = $_REQUEST['p'];
+            in_array($_REQUEST['p'], $this->staticView->pages) &&
+            $this->blogpageModel->isPageAccessible($user, $_REQUEST['p'])) {
+                $data['page'] = $_REQUEST['p'];
         } else {
             $data['page'] = "blog";
         }
@@ -120,4 +126,4 @@ class StaticController extends Controller
         return $data;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/css/search.css b/css/search.css
index 599e9ea..d7822e2 100755
--- a/css/search.css
+++ b/css/search.css
@@ -207,6 +207,11 @@ p
     height: 4in;
     width: 100%;
 }
+.small-text-area
+{
+    height: 2.5in;
+    width: 100%;
+}
 
 .mobile .tall-text-area
 {
diff --git a/lib/upgrade_functions.php b/lib/upgrade_functions.php
index c516268..36a15c9 100644
--- a/lib/upgrade_functions.php
+++ b/lib/upgrade_functions.php
@@ -85,7 +85,7 @@ function upgradeDatabaseWorkDirectoryCheck()
         $result = @$model->db->execute($sql);
         if($result !== false) {
             $row = $model->db->fetchArray($result);
-            if(isset($row['ID']) && $row['ID'] >= 17) {
+            if(isset($row['ID']) && $row['ID'] >= 18) {
                 return false;
             } else {
                 return true;
@@ -103,7 +103,8 @@ function upgradeDatabaseWorkDirectoryCheck()
  */
 function upgradeDatabaseWorkDirectory()
 {
-    $versions = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17);
+    $versions = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16,
+                    17, 18);
     $model = new Model();
     $model->db->selectDB(DB_NAME);
     $sql = "SELECT ID FROM VERSION";
@@ -559,6 +560,32 @@ function upgradeDatabaseVersion17(&$db)
 }
 
 /**
+ * Upgrades a Version 17 version of the Yioop! database to a Version 18 version
+ * @param object $db datasource to use to upgrade
+ */
+function upgradeDatabaseVersion18(&$db)
+{
+    $dbinfo = array("DBMS" => DBMS, "DB_HOST" => DB_HOST,
+        "DB_NAME" => DB_NAME, "DB_PASSWORD" => DB_PASSWORD);
+    $auto_increment = $db->autoIncrement($dbinfo);
+    $db->execute("DELETE FROM VERSION WHERE ID < 17");
+    $db->execute("UPDATE VERSION SET ID=18 WHERE ID=17");
+
+    $db->execute("CREATE TABLE ACCESS (NAME VARCHAR(16), ID INTEGER,
+                TYPE VARCHAR(16))");
+    $db->execute("CREATE TABLE BLOG_DESCRIPTION (TIMESTAMP INT(11) UNIQUE,
+                DESCRIPTION VARCHAR(4096))");
+
+    addActivityAtId($db, 'db_activity_blogs_pages', "BlogPages", 6);
+    updateTranslationForStringId($db, 'db_activity_blogs_pages', 'en-US',
+        'Blogs and Pages');
+    updateTranslationForStringId($db, 'db_activity_blogs_pages', 'fr-FR',
+        'les blogs et les pages');
+
+    upgradeLocales();
+}
+
+/**
  * Used to insert a new activity into the database at a given acitivity_id
  *
  * Inserting at an ID rather than at the end is useful since activities are
diff --git a/models/blogpage_model.php b/models/blogpage_model.php
new file mode 100644
index 0000000..df256c0
--- /dev/null
+++ b/models/blogpage_model.php
@@ -0,0 +1,610 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2013  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage model
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2013
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/** Loads the base class */
+require_once BASE_DIR."/models/model.php";
+
+/** IndexShards used to store feed indexes*/
+require_once BASE_DIR."/lib/index_shard.php";
+
+/** For text manipulation of feeds*/
+require_once BASE_DIR."/lib/phrase_parser.php";
+/**
+ * Used to manage data related to video, news, and other search sources
+ * Also, used to manage data about available subsearches seen in SearchView
+ *
+ * @author Mallika Perepa
+ * @package seek_quarry
+ * @subpackage model
+ */
+class BlogpageModel extends Model
+{
+
+    /** Mamimum number of feeds to download in one try */
+    const MAX_FEEDS_ONE_GO = 100;
+    /**
+     * Just calls the parent class constructor
+     */
+    function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     *  Add a blog to the database using provided title,description.
+     *
+     *  @param string $title title of the created blog
+     *  @param string $user user who created the blog
+     *  @param string $description description of the blog
+     *  @param string $source_type whether it is a blog or a page
+     *  @param string $language is the language selected from the list
+     *  @param int $select_group group id added to a blog
+     */
+    function addBlog($title, $description, $user, $source_type,
+                $language = DEFAULT_LOCALE, $select_group)
+    {
+        $this->db->selectDB(DB_NAME);
+        $timestamp= time();
+        $sql = "INSERT INTO MEDIA_SOURCE(TIMESTAMP, NAME, TYPE,
+            LANGUAGE) VALUES ('".$timestamp."','".
+            $this->db->escapeString($title)."','".
+            $this->db->escapeString($source_type)."','".
+            $this->db->escapeString($language)."')";
+            $this->db->execute($sql);
+        $sql = "INSERT INTO ACCESS(NAME,ID, TYPE) VALUES ('".
+            $this->db->escapeString($title)."','".
+            $user."','user')";
+        $this->db->execute($sql);
+        $sql = "INSERT INTO ACCESS(NAME,ID, TYPE) VALUES ('".
+            $this->db->escapeString($title)."','".
+            $select_group."','group')";
+        $this->db->execute($sql);
+        $sql = "INSERT INTO BLOG_DESCRIPTION(TIMESTAMP, DESCRIPTION)
+            VALUES ('".$timestamp."','".
+            $this->db->escapeString($description)."')";
+        $this->db->execute($sql);
+    }
+
+    /**
+     *  Delete a blog from the database using provided string
+     *
+     *  @param string $timestamp  of the blog to be deleted.
+     */
+    function deleteBlog($timestamp)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "DELETE FROM ACCESS WHERE NAME =
+            (SELECT TITLE FROM FEED_ITEM WHERE SOURCE_NAME = 
+            (SELECT NAME FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp') )";
+        $this->db->execute($sql);
+        $sql = "DELETE FROM FEED_ITEM WHERE SOURCE_NAME = 
+             (SELECT NAME FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp') ";
+        $this->db->execute($sql);
+        $sql = "DELETE FROM ACCESS WHERE NAME = 
+            (SELECT NAME from MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp') ";
+        $this->db->execute($sql);
+        $sql = "DELETE FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp';";
+        $this->db->execute($sql);
+        $sql = "DELETE FROM BLOG_DESCRIPTION WHERE TIMESTAMP = '$timestamp';";
+        $this->db->execute($sql);
+    }
+
+    /**
+     *  Delete the feed item of a blog from the database using provided string
+     *  @param string $guid guid is the unique id for the feeditem
+     *  @param string $title title of the feed item
+     */
+    function deleteFeed($guid, $title)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT TITLE FROM FEED_ITEM WHERE GUID = '$guid'";
+            $result = $this->db->execute($sql);
+            $result1=  $this->db->fetchArray($result);
+            $feed_temp = $result1["TITLE"];
+        $sql = "DELETE FROM FEED_ITEM WHERE GUID = '$guid'";
+        $this->db->execute($sql);
+        $sql = "DELETE FROM ACCESS WHERE NAME = '$feed_temp'";
+        $this->db->execute($sql);
+    }
+
+    /**
+     *  Add a group to a blog
+     *  @param string $timestamp is the timestamp of the blog
+     *  @param int $select_group is the groupid to be added to the blog
+     */
+    function addGroup($timestamp, $select_group)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT NAME FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp'";
+            $result = $this->db->execute($sql);
+            $result2=  $this->db->fetchArray($result); 
+            $blog_name = $result2["NAME"];
+        $sql = "INSERT INTO ACCESS( NAME, ID, TYPE) VALUES ('".
+                $this->db->escapeString($blog_name)."','".
+                $select_group ."', 'group')";
+        $blog_group = $this->db->execute($sql);
+    }
+
+    /**
+     *  Get the groups that belong to a blog
+     *  @param string $timestamp is the timestamp of the blog
+     *  @return array $groups list of groups added to a blog
+     */
+    function getBlogGroup($timestamp)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT NAME FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp'";
+            $result = $this->db->execute($sql); 
+            $result2=  $this->db->fetchArray($result); 
+            $blog_name = $result2["NAME"];
+
+        $sql = "SELECT ID FROM ACCESS WHERE NAME = '$blog_name'
+            AND TYPE = 'group'";
+        $group_id = $this->db->execute($sql);
+        $i = 0;
+        while($groups[$i] = $this->db->fetchArray($group_id)) {
+            $groupid = $groups[$i]['ID']; 
+            $sql = "SELECT GROUP_NAME FROM GROUPS WHERE GROUP_ID = '$groupid'";
+                $result4 = $this->db->execute($sql); 
+                $group_name = $this->db->fetchArray($result4);
+                $groups[$i]['GROUP_NAME']= $group_name['GROUP_NAME'];
+                $groups[$i]['TIMESTAMP']= $timestamp;
+                $i++;
+        }
+        unset($groups[$i]); //last one will be null
+        return $groups;
+    }
+
+    /**
+     *  Delete an exsisting group that belonged to a blog
+     *  @param string $timestamp is the timestamp of the blog
+     *  @param int $group_id is the group id of the group to be deleted
+     */
+    function deleteGroup($timestamp, $group_id)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT NAME FROM MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp'";
+            $result = $this->db->execute($sql);
+            $result2=  $this->db->fetchArray($result);
+            $blog_name = $result2["NAME"];
+        $sql = "DELETE FROM ACCESS WHERE NAME = '$blog_name'
+            AND ID = '$group_id' AND TYPE = 'group'";
+        $this->db->execute($sql);
+    }
+
+    /**
+     *  Search for a blog from the database.
+     *  @param string $title title of the blog name to be searching for
+     *  @param string $user id of a user
+     *  @param string $groupsIds id of groups
+     *  @param bool $is_admin if the user is the admin of the blog or not
+     *  @return array $blogs list of all the blogs matched with search title
+     */
+
+    function searchBlog($title, $user, $groups_Ids, $is_admin)
+    {
+        $this->db->selectDB(DB_NAME);
+        if($is_admin === true){
+            $sql = "SELECT TIMESTAMP,NAME,TYPE FROM MEDIA_SOURCE WHERE NAME
+                IN (SELECT NAME FROM ACCESS WHERE NAME LIKE '%$title%')";
+        }else{
+         $sql = "SELECT TIMESTAMP,NAME,TYPE FROM MEDIA_SOURCE WHERE NAME
+            IN (SELECT NAME FROM ACCESS
+            WHERE NAME LIKE '%$title%' AND ID = '$user' AND TYPE = 'user')";
+        }
+        $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $blogs[$i]['EDITABLE'] = true;
+            $i++;
+        }
+        if($is_admin === false){
+            $sql = "SELECT TIMESTAMP,NAME,TYPE from MEDIA_SOURCE WHERE NAME
+                IN (SELECT NAME FROM ACCESS
+                WHERE NAME like '%$title%' AND ID != '$user'
+                AND ID IN ($groups_Ids));";
+            $result = $this->db->execute($sql);
+            while($blogs[$i] = $this->db->fetchArray($result)) {
+                $i++;
+            }
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Look for recent five blogs from the database
+     *  @param string $user user who created the blogs
+     *  @param int $group_ids id's of the groups
+     *  @param bool $is_admin value to see if user is the admin of a blog or not
+     *  @param int $limit number of recent blogs to be displayed
+     *  @return array $blogs lst of 5 most recently update blogs
+     */
+    function recentBlog($user, $group_ids, $is_admin, $limit = 5)
+    {
+        $this->db->selectDB(DB_NAME);
+        if($is_admin === true){
+            $sql = "SELECT TIMESTAMP,NAME,TYPE FROM MEDIA_SOURCE WHERE NAME
+                IN (SELECT NAME FROM ACCESS) AND TYPE = 'blog'
+                ORDER BY TIMESTAMP DESC LIMIT $limit ";
+         }else {
+            $sql = "SELECT TIMESTAMP,NAME,TYPE FROM MEDIA_SOURCE WHERE NAME
+                IN (SELECT NAME FROM ACCESS WHERE ID = '$user'
+                AND TYPE = 'user') AND TYPE = 'blog'
+                ORDER BY TIMESTAMP DESC LIMIT $limit ";
+        }
+        $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $blognames[$i] = $blogs[$i]['NAME'];
+            $blogs[$i]['EDITABLE'] = true;
+            $i++;
+        }
+        if($is_admin === false){
+        $group_string = "'".implode ("','", $group_ids)."'";
+            $sql = "SELECT TIMESTAMP,NAME,TYPE FROM MEDIA_SOURCE WHERE NAME
+                IN (SELECT NAME FROM ACCESS  WHERE TYPE = 'group' AND 
+                ID IN ($group_string)) AND TYPE = 'blog'
+                ORDER BY TIMESTAMP DESC LIMIT $limit ";
+        $result = $this->db->execute($sql); 
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            if(in_array($blogs[$i]['NAME'], $blognames)){
+            unset($blogs[$i]);
+        }
+        $i++;
+            }
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Get the users list to transfer the admin rights
+     *  @param string $blog is the title of the blog
+     *  @return array $users list of users associated with the blog
+     */
+    function getBlogUsers($blog)
+    {
+        $this->db->selectDB(DB_NAME);
+        $blog_name = $blog["NAME"];
+        $sql = "SELECT ID FROM ACCESS WHERE TYPE = 'group'
+            AND NAME = '$blog_name'";
+            $result = $this->db->execute($sql);
+        $i = 0;
+        $k = 0;
+        $result = $this->db->execute($sql);
+        $users = array();
+        $dup_users = array();
+        while($groups_row[$i] = $this->db->fetchArray($result)) {
+            $group_id = $groups_row[$i]['ID'];
+            $group_id = $this->db->escapeString($group_id);
+            $sql = "SELECT UG.USER_ID, U.USER_NAME" .
+                " FROM USER_GROUP UG, USER U, GROUPS G".
+                " WHERE UG.GROUP_ID = '$group_id' 
+                AND UG.USER_ID = U.USER_ID AND" .
+                " G.GROUP_ID = UG.GROUP_ID";
+            $user = $this->db->execute($sql);
+            $j = 0;
+            while($users_row[$j] = $this->db->fetchArray($user)) {
+                $user_name = $users_row[$j]['USER_NAME'];
+                $user_id = $users_row[$j]['USER_ID'];
+                if(!in_array($user_name, $dup_users)){
+                    $users[$k]['USER_NAME'] = $user_name;
+                    $users[$k]['USER_ID'] = $user_id;
+                    $k++;
+                    array_push($dup_users, $user_name);
+                }
+                $j++;
+            }
+            $i++;
+        }
+        unset($users[$k]); //last one will be null
+        return $users;
+    }
+
+    /**
+     *  Update the users list after the transfer the admin rights has been done
+     *  @param string $blog_name is the title of the blog
+     *  @param string $select_user is the new admin of the blog
+     */
+    function updateBlogUsers($select_user, $blog_name)
+    {
+       $this->db->selectDB(DB_NAME);
+       $sql = "UPDATE ACCESS SET ID = '$select_user' 
+            WHERE TYPE = 'user' AND NAME = '$blog_name'";
+       $result = $this->db->execute($sql);
+    }
+
+    /**
+     *  Retrieve the blog details of a blog
+     *  @param string $timestamp timestamp of the blog
+     *  @return array $blogs blog selected to edit the details
+     */
+    function editBlog($timestamp)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT a.NAME,a.TYPE,a.LANGUAGE,a.TIMESTAMP, b.DESCRIPTION FROM
+            MEDIA_SOURCE a JOIN BLOG_DESCRIPTION b ON a.TIMESTAMP =
+            b.TIMESTAMP WHERE a.TIMESTAMP = '$timestamp'";
+        $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $blog_name = $blogs[$i]['NAME'];
+            $sql = "SELECT id FROM ACCESS WHERE NAME = '$blog_name'
+                AND TYPE = 'group'";
+                $blog = $this->db->execute($sql);
+                $row  = $this->db->fetchArray($blog);
+                $group_id = $row['id'];
+                $sql = "SELECT GROUP_NAME FROM GROUPS WHERE
+                    GROUP_ID = '$group_id'";
+            $blog_group = $this->db->execute($sql);
+            $group_name  = $this->db->fetchArray($blog_group);
+            $name = $group_name['GROUP_NAME'];
+            $blogs[$i]['GROUP_NAME'] = $name;
+            $blogs[$i]['id'] = $group_id;
+        $i++;
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Retrieve the owner of a blog
+     *  @param string $timestamp is the timestamp of the blog
+     *  @return int $row['ID'] id of the blog owner
+     */
+    function getBlogOwner($timestamp)
+    {
+       $this->db->selectDB(DB_NAME);
+       $sql = "SELECT ID FROM ACCESS WHERE NAME = (
+            SELECT NAME FROM MEDIA_SOURCE WHERE
+            TIMESTAMP = '$timestamp')";
+        $result = $this->db->execute($sql);
+        if(!$row = $this->db->fetchArray($result) ) {
+            return -1;
+        }
+        return $row['ID'];
+    }
+
+    /**
+     *  Retrieve the feed items of a blog
+     *  @param string $title title of the blog 
+     *  @param int $user id of the user
+     *  @return array $blogs returns feeds of a blog based on title and user id.
+     */
+    function getFeed($title, $user)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT guid,title,description FROM FEED_ITEM
+            WHERE source_name = '".
+            $this->db->escapeString($title)."'";
+            $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+             $sql = "SELECT ID FROM ACCESS WHERE NAME = '".
+                $this->db->escapeString($blogs[$i]['title'])."'";
+                $feed_result = $this->db->execute($sql);
+            if($row = $this->db->fetchArray($feed_result) ) {
+                if ($row['ID'] == $user || $user == 1){
+                    $blogs[$i]['IS_OWNER'] = true; 
+            } else { $blogs[$i]['IS_OWNER'] = false;}
+            }
+            $i++;
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Retrieve the feed items descrption related to a blog
+     *  @param string $guid guid of the description
+     *  @return array $blogs a particular feed item to edit the details
+     */
+    function getFeedByGUID($guid)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT guid,title,description FROM FEED_ITEM WHERE guid = '".
+            $this->db->escapeString($guid)."'";
+        $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $i++;
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Update the blog description after performing edit on a blog
+     *  @param string $description description of the blog
+     *  @param $timestamp timestamp of the blog
+     *  @param $description description of the blog
+     *  @return $blogs blogs to edit the details
+     */
+    function editDescription($timestamp, $title, $description)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT NAME from MEDIA_SOURCE WHERE TIMESTAMP = '$timestamp'";
+            $result=$this->db->execute($sql);
+            $temp =  $this->db->fetchArray($result);
+            $blog_title = $temp["NAME"];
+        $sql = "UPDATE ACCESS SET NAME = '$title' where NAME = '$blog_title'";
+        $result=$this->db->execute($sql);
+        $sql = "UPDATE BLOG_DESCRIPTION SET DESCRIPTION = '".
+            $this->db->escapeString($description)."'
+            WHERE TIMESTAMP ='$timestamp'";
+        $result=$this->db->execute($sql);
+        $sql = "UPDATE MEDIA_SOURCE SET NAME = '$title'
+            WHERE TIMESTAMP = '$timestamp'";
+        $result=$this->db->execute($sql);
+        $sql = "UPDATE FEED_ITEM SET SOURCE_NAME = '$title'
+            WHERE SOURCE_NAME = '$blog_title'";
+        $result = $this->db->execute($sql);
+        $i = 0;
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $i++;
+        }
+        unset($blogs[$i]); //last one will be null
+        return $blogs;
+    }
+
+    /**
+     *  Update the feeditem description after performing edit on feeditem
+     *  @param string $description description of the feeditem
+     *  @param string $guid guid of the feeditem
+     *  @param $title title of the feed item
+     */
+    function updateFeed($guid, $title, $description)
+    {
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT TITLE FROM FEED_ITEM WHERE GUID = '$guid'";
+        $result=$this->db->execute($sql);
+            $temp_title =  $this->db->fetchArray($result);
+            $old_title = $temp_title["TITLE"];
+        $sql = "UPDATE FEED_ITEM SET TITLE = '".
+            $this->db->escapeString($title)."',
+            DESCRIPTION = '".
+                $this->db->escapeString($description)."'
+            WHERE guid ='$guid'";
+        $result=$this->db->execute($sql);
+        $sql = "UPDATE ACCESS SET NAME = '".
+            $this->db->escapeString($title)."'
+            WHERE NAME = '$old_title'";
+        $result=$this->db->execute($sql);
+    }
+
+    /**
+     *  add a feeditem to a blog
+     *  @param string $description description of the feeditem
+     *  @param string $title title of the blog
+     *  @param id $user id of the user
+     *  @param string $title_entry title of the feed item
+     */
+    function addEntry($timestamp, $title_entry, $description, $title,$user)
+    {
+        $this->db->selectDB(DB_NAME);
+        $timestampe = time();
+        $sql = "SELECT NAME FROM MEDIA_SOURCE WHERE timestamp = '$timestamp'";
+        $result = $this->db->execute($sql);
+        $row = $this->db->fetchArray($result);
+        $title = $row['NAME'];
+        $sql = "INSERT INTO ACCESS(NAME,ID, TYPE) VALUES ('".
+            $this->db->escapeString($title_entry)."','".
+            $user."','user')";
+        $this->db->execute($sql);
+        $sql = "INSERT INTO FEED_ITEM(GUID,TITLE,DESCRIPTION,
+            PUBDATE,SOURCE_NAME) VALUES (uuid(),'".
+            $this->db->escapeString($title_entry)."','".
+            $this->db->escapeString($description)."','".
+            $timestampe."','".
+            $this->db->escapeString($title)."')";
+        $this->db->execute($sql);
+    }
+
+    /**
+     * create a page and stores the file with .thtml extension 
+     * in the user's work directory.
+     * @param string $title - title of the page
+     * @param string $description description of the page
+     * @param string $source_type whether it is a blog or a page
+     * @param string $language language of the page
+     * @param int $user id of the user
+     * @param int $select_group id of the group
+     * @return bool file input/output result
+     */
+    function addPage($title, $description, $source_type,
+                        $language, $user, $select_group)
+    {
+        $this->db->selectDB(DB_NAME);
+        $timestamp = time();
+
+        $sql = "INSERT INTO MEDIA_SOURCE(TIMESTAMP, NAME, TYPE,
+                    LANGUAGE) VALUES ($timestamp,'".
+                $this->db->escapeString($title)."','".
+                $this->db->escapeString($source_type)."','".
+                $this->db->escapeString($language)."')";
+        $this->db->execute($sql);
+
+        $sql = "INSERT INTO ACCESS (NAME, ID,TYPE) VALUES ('".
+                $this->db->escapeString($title)."','".
+                $user."','user')";
+        $this->db->execute($sql);
+
+        $sql = "INSERT INTO ACCESS( NAME, ID, TYPE) VALUES ('".
+                $this->db->escapeString($title)."','".
+                $select_group ."', 'group')";
+        $this->db->execute($sql);
+
+        $n = array();
+        $n[] = "title=$title";
+        $n[] = "";
+        $n[] = "description=$description";
+        $n[] = "END_HEAD_VARS";
+        $n[] = "<p>$description</p>";
+        $out = implode("\n", $n);
+        $path = LOCALE_DIR."/".DEFAULT_LOCALE."/pages/$title.thtml";
+        if(file_put_contents($path, $out) !== false) {
+            return true;
+        }
+        return false;
+    }
+    
+    /**
+     * Checks whether a page is accessible to a user
+     * @param int $user_id id of the logged in user
+     * @param string $title title of the page
+     * @return bool returns true if the page is accessible to the user or not
+     */
+    function isPageAccessible($user_id, $title)
+    {
+        if($user_id == 1){
+            return true;
+        }
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT USER_ID FROM USER_GROUP WHERE GROUP_ID IN (SELECT ID
+                FROM ACCESS WHERE NAME = '".
+                $this->db->escapeString($title)."' AND TYPE = 'group')";
+        $result = $this->db->execute($sql);
+        $num_rows = 0;
+        while($row = $this->db->fetchArray($result)) {
+            if($user_id == $row['USER_ID']){
+                return true;
+            }
+        }
+        return false;
+    }
+}
+?>
+
diff --git a/models/profile_model.php b/models/profile_model.php
index b08a118..1148980 100755
--- a/models/profile_model.php
+++ b/models/profile_model.php
@@ -318,6 +318,10 @@ EOT;
                 NAME VARCHAR(16) UNIQUE, TYPE VARCHAR(16),
                 SOURCE_URL VARCHAR(256), THUMB_URL VARCHAR(256),
                 LANGUAGE VARCHAR(7))",
+            "CREATE TABLE ACCESS (NAME VARCHAR(16), ID INTEGER, 
+                TYPE VARCHAR(16))",
+            "CREATE TABLE BLOG_DESCRIPTION (TIMESTAMP INT(11) UNIQUE, 
+                DESCRIPTION VARCHAR(4096))",
             "CREATE TABLE FEED_ITEM (GUID VARCHAR(11) PRIMARY KEY,
                 TITLE VARCHAR(512), LINK VARCHAR(256),
                 DESCRIPTION VARCHAR(4096),
diff --git a/models/source_model.php b/models/source_model.php
index fa452d8..308d0c0 100644
--- a/models/source_model.php
+++ b/models/source_model.php
@@ -55,11 +55,6 @@ class SourceModel extends Model
     /** Mamimum number of feeds to download in one try */
     const MAX_FEEDS_ONE_GO = 100;
 
-    /** Mamimum number of characters in a feed item component such as 
-        description or title
-     */
-    const MAX_ELEMENT_LENGTH = 2000;
-
     /**
      * Just calls the parent class constructor
      */
@@ -357,8 +352,7 @@ class SourceModel extends Model
                     if($feed_element == "link" && $element_text == "") {
                         $element_text = $tag_node->getAttribute("href");
                     }
-                    $item[$db_element] = mb_substr(strip_tags($element_text),
-                        0, self::MAX_ELEMENT_LENGTH);
+                    $item[$db_element] = strip_tags($element_text);
                 }
                 $did_add = $this->addFeedItemIfNew($item,$feed['NAME'], $lang,
                     $age);
@@ -431,6 +425,7 @@ class SourceModel extends Model
                     UrlParser::getHost($item["LINK"])."/",true), 1);
                 $meta_ids = $this->calculateMetas($lang, $item['PUBDATE'],
                     $source_name, $item["GUID"]);
+
                 $prune_shard->addDocumentWords($doc_keys, $item['PUBDATE'],
                     $word_lists, $meta_ids, PhraseParser::$materialized_metas,
                     true, false);
diff --git a/models/user_model.php b/models/user_model.php
index 91e13b6..c1985af 100755
--- a/models/user_model.php
+++ b/models/user_model.php
@@ -233,6 +233,20 @@ class UserModel extends Model
         return $users;
     }
 
+    /**
+     * get a username by user_id
+     *
+     * @param string $user_id id of the user
+     */
+    function getUsername($user_id)
+    {
+        $user_id = $this->db->escapeString($user_id);
+        $this->db->selectDB(DB_NAME);
+        $sql = "SELECT USER_NAME FROM USER WHERE USER_ID=$user_id;";
+        $result = $this->db->execute($sql);
+        $row = $this->db->fetchArray($result);
+        return $row['USER_NAME'];
+    }
 
     /**
      * Add a user with a given username and password to the list of users
@@ -241,13 +255,22 @@ class UserModel extends Model
      * @param string $username  the username of the user to be added
      * @param string $password  the password of the user to be added
      */
-    function addUser( $username,$password)
-    {
-        $this->db->selectDB(DB_NAME);
-        $sql = "INSERT INTO USER(USER_NAME, PASSWORD, ACTIVE) VALUES ('".
-          $this->db->escapeString($username)."', '".
-          crawlCrypt($this->db->escapeString($password))."',1 ) ";
-          $result = $this->db->execute($sql);
+    function addUser($username, $password, $limit = 1)
+     {
+         $this->db->selectDB(DB_NAME);
+         $sql = "INSERT INTO USER(USER_NAME, PASSWORD) VALUES ('".
+             $this->db->escapeString($username)."', '".
+         crawlCrypt($this->db->escapeString($password))."' ) ";
+         $result = $this->db->execute($sql);
+         $sql = "SELECT USER_ID FROM USER WHERE 
+             USER_NAME = '$username' LIMIT $limit";
+         $result = $this->db->execute($sql);
+         if(!$result) return false;
+             $row = $this->db->fetchArray($result);
+         $user_id = $row['USER_ID'];
+         $sql = "INSERT INTO USER_GROUP(USER_ID,GROUP_ID) VALUES('".
+             $this->db->escapeString($user_id)."', '1')";
+         $result = $this->db->execute($sql);
     }
 
     /**
diff --git a/views/admin_view.php b/views/admin_view.php
index 198e912..3b5b069 100755
--- a/views/admin_view.php
+++ b/views/admin_view.php
@@ -55,7 +55,8 @@ class AdminView extends View
         "mixcrawls", "managegroups", "managelocales", "editlocales",
         "crawloptions","editmix", "pageoptions", "manageclassifiers",
         "editclassifier","resultseditor", "searchsources", "managemachines",
-        "machinelog","editstatic", "configure");
+        "machinelog","editstatic", "configure", "blogpages", "editblogpages",
+        "createblogpages");
     /** Names of helper objects that the view uses to help draw itself
      *  @var array
      */
@@ -93,7 +94,6 @@ class AdminView extends View
         $this->activityElement->render($data);
         if(isset($data['ELEMENT'])) {
             $element = $data['ELEMENT'];
-
             $this->$element->render($data);
         }
         if(PROFILE) {
@@ -127,4 +127,4 @@ class AdminView extends View
         }
     }
 }
-?>
+?>
\ No newline at end of file
diff --git a/views/elements/blogpages_element.php b/views/elements/blogpages_element.php
new file mode 100755
index 0000000..dd1047c
--- /dev/null
+++ b/views/elements/blogpages_element.php
@@ -0,0 +1,140 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2013  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage element
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2013
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/**
+ *  Element responsible for displaying the main blog and pages lookup feature
+ *  that someone can modify for their own SeekQuarry/Yioop account.
+ *  For now, you can only change your password
+ *
+ * @author Mallika Perepa
+ * @package seek_quarry
+ * @subpackage element
+ */
+class BlogPagesElement extends Element
+{
+    /**
+     *  Draws a search blog or a page form.
+     *
+     *  @param array $data has a field for the anti-CSRF token
+     */
+    function render($data)
+    {
+        $pre_base_url = "?".CSRF_TOKEN."=".$data[CSRF_TOKEN]."&amp;c=admin";
+        $base_url = $pre_base_url . "&amp;a=blogPages";
+        $localize_url = $pre_base_url . "&amp;a=manageLocales".
+            "&amp;arg=editlocale&amp;selectlocale=".$data['LOCALE_TAG']; ?>
+        <div class="current-activity">
+            <h2><?php e(tl('blogpages_element_lookup_page')); ?></h2>
+            <form method="post" action='#'>
+                <div class="top-margin">
+                    <input type="hidden" name="a" value="blogPages"/>
+                    <input type="hidden" name="arg" value="searchblog"/>
+                    <input type="text" name="title" placeholder=
+                        "<?php e(tl('blogpages_element_search_blog')); ?>"
+                        class="extra-wide-field" value=''/>
+                    <button class="button-box" type="submit"><?php
+                        e(tl('blogpages_element_search'));
+                    ?></button>
+                </div>
+            </form>
+            <?php if(isset($data['BLOGS']) && !empty($data['BLOGS'])){ ?>
+                <h2><?php e(tl('blogpages_element_related_blogs')); ?></h2>
+                <table class="search-sources-table">
+                    <tr><th><?php e(tl('blogpages_element_title'));?></th>
+                        <th><?php e(tl('blogpages_element_sourcetype')); ?></th>
+                        <th><?php e(tl('blogpages_element_action'));?></th>
+                    </tr>
+                    <?php foreach($data['BLOGS'] as $blogs) { ?>
+                    <tr><th>
+                        <a
+                        href = "<?php e($base_url.'&amp;arg=editblog&amp;id='.
+                        $blogs['TIMESTAMP']); ?>"><?php e($blogs['NAME']);?>
+                        </a>
+                        </th>
+                        <td><?php e($blogs['TYPE']); ?></td>
+                        <td><?php if($blogs['EDITABLE'] === true) { ?>
+                            <a href="<?php e($base_url.'&arg=deleteblog&id='.
+                                $blogs['TIMESTAMP']); ?>"><?php
+                                e(tl('blogpages_element_deleteblog'));
+                            ?></a>
+                            <?php } ?>
+                        </td>
+                    </tr>
+                <?php
+                    } ?>
+                </table>
+                <?php
+                }
+
+                if(isset($data['RECENT_BLOGS'])
+                    && !empty($data['RECENT_BLOGS'])) {
+                    ?><h2><?php e(tl('blogpages_element_recent_blogs'))?></h2>
+                    <table class="search-sources-table">
+                        <tr>
+                            <th><?php e(tl('blogpages_element_title'));?></th>
+                            <th><?php 
+                                e(tl('blogpages_element_sourcetype'));?></th>
+                            <th><?php 
+                                e(tl('blogpages_element_action'));?></th>
+                        </tr>
+                        <?php foreach($data['RECENT_BLOGS'] as $recent_blogs) {
+                        ?><tr>
+                            <td>
+                                <a href =
+                                "<?php e($base_url.'&amp;arg=editblog&amp;id='.
+                                $recent_blogs['TIMESTAMP']); ?>">
+                                <?php e($recent_blogs['NAME']);?></a>
+                            </td>
+                            <td><?php e($recent_blogs['TYPE']); ?></td>
+                            <?php $delete_url = $base_url .
+                                '&amp;arg=deleteblog&amp;id=' .
+                                $recent_blogs['TIMESTAMP'];
+                                ?><td> <?php
+                                    if($recent_blogs['EDITABLE'] === true) {
+                                ?><a href="<?php e($delete_url);?>"><?php
+                                e(tl('blogpages_element_deleteblog'));
+                                ?></a><?php
+                                } ?></td>
+                        </tr>
+                        <?php } ?>
+                    </table>
+                <?php } ?>
+            </div>
+            <?php
+        }
+    }
+?>
+
+
diff --git a/views/elements/createblogpages_element.php b/views/elements/createblogpages_element.php
new file mode 100755
index 0000000..2309415
--- /dev/null
+++ b/views/elements/createblogpages_element.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2013  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage element
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2013
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/**
+ *  Element responsible for displaying the blog and pages feature
+ *  that someone can modify for their own SeekQuarry/Yioop account.
+ *  For now, you can only change your password
+ *
+ * @author Mallika Perepa
+ * @package seek_quarry
+ * @subpackage element
+ */
+class CreateBlogPagesElement extends Element
+{
+    /**
+     *  @param array $data
+     */
+    function render($data)
+    {
+        $pre_base_url = "?".CSRF_TOKEN."=".$data[CSRF_TOKEN]."&amp;c=admin";
+        $base_url = $pre_base_url . "&amp;a=blogPages";
+        $localize_url = $pre_base_url . "&amp;a=manageLocales".
+            "&amp;arg=editlocale&amp;selectlocale=".$data['LOCALE_TAG'];
+        ?>
+        <div class="current-activity">
+            <h2> <?php e(tl('createblogpages_element_edit_blogpages')); ?></h2>
+            <form method="post" action='#'>
+                <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
+                        value="<?php e($data[CSRF_TOKEN]); ?>"/>
+                <input type="hidden" name="a" value="blogPages"/>
+                <input type="hidden" name="arg" value="addblog"/>
+                <table class="name-table">
+                    <tr><th><label for="source-type"><?php
+                        e(tl('createblogpages_element_sourcetype')); ?></label>
+                        </th>
+                        <td>
+                            <?php $this->view->optionsHelper->
+                            render("source-type","sourcetype",
+                            $data['SOURCE_TYPES'],
+                            $data['SOURCE_TYPE']); ?>
+                        </td>
+                    </tr>
+                    <tr><th><label for="type-name"><?php
+                        e(tl('createblogpages_element_typename')); ?></label>
+                        </th>
+                        <td><input type="text" id="type-name" name="title"
+                            value = "<?php e($data['title']); ?>"
+                            maxlength="80" class="wide-field"/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th id="locale-text">
+                            <label for="source-locale-tag"><?php
+                                e(tl('searchsources_element_locale_tag'));
+                            ?></label>
+                        </th>
+                        <td>
+                            <?php
+                                $this->view->optionsHelper->
+                                 render("source-locale-tag",
+                                "sourcelocaletag", $data['LANGUAGES'],
+                                $data['SOURCE_LOCALE_TAG']); ?>
+                         </td>
+                    </tr>
+                </table>
+                <table class="name-table">
+                    <tr><th><label for="select-group"><?php
+                        e(tl('createblogpages_element_add_group'))?></label>
+                        </th>
+                        <td>
+                            <?php 
+                            $this->view->optionsHelper->render("select-group",
+                                "selectgroup", $data['GROUP_NAMES'],
+                            $data['SELECT_GROUP']); ?>
+                        </td>
+                    </tr>
+                </table>
+                <div class="top-margin"><label for="descriptionfield"><b><?php
+                    e(tl('createblogpages_element_description'));
+                    ?></b></label>
+                </div>
+                <textarea class="tall-text-area" id="descriptionfield"
+                    name="description"><?php e($data['description']);
+                    ?></textarea>
+                <div class="center slight-pad">
+                    <button class="button-box" type="submit"><?php
+                        e(tl('createblogpages_element_save_page'));?></button>
+                </div>
+            </form>
+        </div>
+    <?php
+    }
+}
+?>
diff --git a/views/elements/editblogpages_element.php b/views/elements/editblogpages_element.php
new file mode 100755
index 0000000..b1a0488
--- /dev/null
+++ b/views/elements/editblogpages_element.php
@@ -0,0 +1,338 @@
+<?php
+/**
+ *  SeekQuarry/Yioop --
+ *  Open Source Pure PHP Search Engine, Crawler, and Indexer
+ *
+ *  Copyright (C) 2009 - 2013  Chris Pollett chris@pollett.org
+ *
+ *  LICENSE:
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ *  END LICENSE
+ *
+ * @author Chris Pollett chris@pollett.org
+ * @package seek_quarry
+ * @subpackage element
+ * @license http://www.gnu.org/licenses/ GPL3
+ * @link http://www.seekquarry.com/
+ * @copyright 2009 - 2013
+ * @filesource
+ */
+
+if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+
+/**
+ *  Element responsible for displaying the user account features
+ *  that someone can modify for their own SeekQuarry/Yioop account.
+ *  For now, you can only change your password
+ *
+ * @author Mallika Perepa
+ * @package seek_quarry
+ * @subpackage element
+ */
+class EditBlogPagesElement extends Element
+{
+    /**
+     *  @param array $data
+     */
+    function render($data)
+    {
+        $pre_base_url = "?".CSRF_TOKEN."=".$data[CSRF_TOKEN]."&amp;c=admin";
+        $base_url = $pre_base_url . "&amp;a=blogPages";
+        $localize_url = $pre_base_url . "&amp;a=manageLocales".
+            "&amp;arg=editlocale&amp;selectlocale=".$data['LOCALE_TAG'];
+        if(isset($data['EDIT_BLOGS'])) { ?>
+        <div id="transfer">
+                <div class="overlay">
+                    <form  method="post" action='#'>
+                        <input type="hidden" name="c" value="admin"/>
+                        <input type="hidden" name="<?php
+                            e(CSRF_TOKEN); ?>" value="<?php
+                            e($data[CSRF_TOKEN]); ?>"/>
+                        <input type="hidden" name="arg"
+                            value="updateblogusers"/>
+                        <input type="hidden" name="blogName" value=
+                            "<?php e($data['EDIT_BLOGS'][0]['NAME']); ?>"/>
+                        <?php
+                        if(isset($data['EDIT_BLOGS'][0]['BLOG_USERS'])) { ?>
+                        <?php
+                        foreach($data['EDIT_BLOGS'][0]['BLOG_USERS'] as $blog)
+                        { ?><input type="radio" name="selectuser"
+                            value="<?php e($blog['USER_ID']); ?>">
+                            <?php e($blog['USER_NAME']); ?><br/><?php } }?><hr/>
+                        <input type="submit"
+                            value="submit"
+                            onclick=
+"return confirm('<?php e(tl('managegroups_element_transfer_admin'))?>');"/>
+                        <input type="button" value="cancel"
+                            onclick="closeOverlay();"/>
+                    </form>
+                </div>
+            </div>
+            <?php
+        } ?><div class="current-activity">
+                <h2><?php e(tl('editblogpages_element_edit_blogpages')); ?></h2>
+            <?php
+            if(isset($data['IS_OWNER']) &&  $data['IS_OWNER'] === true) {
+                foreach($data['EDIT_BLOGS'] as $edit_blog) { ?>[<?php
+                    $edit_url =
+                    $base_url.'&amp;arg=editdescription&amp;id='.
+                    $edit_blog['TIMESTAMP'];
+                    ?><a href = "<?php e($edit_url); ?>"><?php
+                    e(tl('editblogpages_element_edit_settings'));?></a>]
+                    [<a href="#" onclick='return showOverlay();'><?php
+             e(tl('editblogpages_element_transfer')); ?></a>] <?php } } ?>
+            <?php if(isset($data['IS_EDIT_DESC']) &&
+                $data['IS_EDIT_DESC'] === true) { ?>
+                <form method="post" action='#'>
+                    <input type="hidden" name="c" value="admin" />
+                    <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
+                     value="<?php e($data[CSRF_TOKEN]); ?>" />
+                    <input type="hidden" name="a" value="blogPages" />
+                    <input type="hidden" name="arg" value="addbloggroup" />
+                    <table class="name-table">
+                        <tr>
+                            <th><label for="select-group"><?php
+                                e(tl('createblogpages_element_add_group'))
+                                ?></label></th>
+                            <?php if(isset($data['GROUP_NAMES']) ) {
+                            ?><td><?php $this->view->optionsHelper->render(
+                                "select-group",
+                                "selectgroup", $data['GROUP_NAMES'],
+                                isset($data['SELECT_GROUP']));
+                            ?></td>
+                            <td>
+                                <button class="button-box" type="submit"><?php
+                                e(tl('editblgpages_element_submit'));
+                                ?></button>
+                            </td>
+                       <?php }
+                       ?></tr>
+                    </table>
+                    <?php if(isset($data['BLOG_GROUP'])) { ?>
+                        <?php if(count($data['BLOG_GROUP']) > 0) { ?>
+                            <table class = "role-table">
+                            <?php foreach($data['BLOG_GROUP'] as $blog_group){?>
+                                <?php if($blog_group['ID'] != -1) {
+                        ?><tr>
+                            <td><?php e($blog_group['GROUP_NAME']); ?></td>
+                             <?php $delete_url = $base_url.
+                                '&amp;arg=deletebloggroup&amp;id=' .
+                                $blog_group['TIMESTAMP'].'&amp;gid='.
+                                $blog_group['ID']
+                            ?><td>
+                                <a href="<?php e($delete_url); ?>"><?php
+                                    e(tl('editblogpages_element_deleteblog'));
+                                ?></a>
+                            </td>
+                        </tr>
+                        <?php
+                                }
+                            } ?><?php
+                        }
+                    } ?>
+                    </table>
+                </form>
+        <?php } ?>
+        <form method="post" action='#'>
+            <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+                e($data[CSRF_TOKEN]); ?>"/>
+            <input type="hidden" name="a" value="blogPages"/>
+            <input type="hidden" name="c" value="admin"/>
+            <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+                e($data[CSRF_TOKEN]); ?>"/>
+            <input type="hidden" name="a" value="blogPages"/>
+            <?php if(isset($data['IS_EDIT_DESC']) &&
+                $data['IS_EDIT_DESC'] === true) { ?>
+                <input type="hidden" name="arg" value="updatedescription"/>
+            <?php }
+            if(isset($data['IS_EDIT_FEED']) &&
+                $data['IS_EDIT_FEED']===true) { ?>
+                <input type="hidden" name="arg" value="updatefeed"/>
+            <?php }
+            if(isset($data['IS_ADD_BLOG']) &&
+                $data['IS_ADD_BLOG']===true) {
+                ?><input type="hidden" name="arg" value="addfeeditem"/>
+            <?php } if(isset($data['IS_EDIT_DESC']) &&
+                $data['IS_EDIT_DESC']===true) {
+                ?><table class="name-table">
+                    <tr><td><label for="source-type"><b><?php
+                            e(tl('editblogpages_element_sourcetype'))?></b>
+                        </label></td>
+                        <td>
+                        <?php foreach($data['EDIT_BLOGS'] as $edit_blog) { ?>
+                        <?php $this->view->optionsHelper->render("source-type",
+                            "sourcetype", $data['SOURCE_TYPES'],
+                            $edit_blog['TYPE']);?></td></tr>
+                    <tr><th><label for="source-name"><?php
+                        e(tl('editblogpages_element_typename')); ?></label></th>
+                        <td><input type="text" id="source-name" name="title"
+                        value = "<?php e($edit_blog['NAME']); ?>"
+                        maxlength="80" class="wide-field" /></td>
+                    </tr>
+                    <tr><th id="locale-text">
+                            <label for="source-locale-tag"><?php
+                                e(tl('searchsources_element_locale_tag'))
+                            ?></label>
+                        </th>
+                        <td>
+                        <?php $this->view->optionsHelper->render(
+                            "source-locale-tag", "sourcelocaletag",
+                            $data['LANGUAGES'], $data['SOURCE_LOCALE_TAG']); ?>
+                        </td>
+                    </tr>
+                </table>
+                <div><label for="descriptionfield"><b><?php
+                    e(tl('editblogpages_element_description'));
+                    ?></b></label></div>
+                <textarea class="tall-text-area" id="descriptionfield"
+                    name="description"><?php e($edit_blog['DESCRIPTION']);
+                    ?></textarea>
+                <div class="center slight-pad"><button class="button-box"
+                    type="submit"><?php
+                    e(tl('editblogpages_element_save_page')); ?></button></div>
+                <?php
+            }
+        } else {
+            ?><table class="name-table">
+                <tr><th><label><?php
+                    e(tl('editblogpages_element_sourcetype'))?></label>
+                    </th><td><?php foreach($data['EDIT_BLOGS'] as $edit_blog) {
+                    ?><p><?php e($edit_blog['TYPE']); ?></p><?php } ?></td>
+                </tr>
+                <tr><th><label><?php
+                    e(tl('editblogpages_element_typename')); ?></label></th>
+                    <td><?php foreach($data['EDIT_BLOGS'] as $edit_blog) {
+                        ?><p><?php e($edit_blog['NAME']); ?></p>
+                    </td>
+                </tr>
+                <tr><th id="locale-text"><label><?php
+                    e(tl('searchsources_element_locale_tag'))?></label></th>
+                    <td>
+                        <p><?php e($data['SOURCE_LOCALE_TAG']); ?></p>
+                    </td>
+                </tr>
+                <tr><th><label><?php
+                        e(tl('editblogpages_element_description'));?></label>
+                    </th>
+                    <td><?php foreach($data['EDIT_BLOGS'] as $edit_blog) {
+                        ?><p><?php e($edit_blog['DESCRIPTION']);?></p>
+                    <?php } ?></td>
+                </tr><?php } ?></table>
+
+            <?php
+            if(isset($data['IS_ADD_BLOG']) && $data['IS_ADD_BLOG']===true) {
+                ?><div class="top-margin">
+                <label for="source-name">
+                    <b><?php e(tl('editblogpages_element_feeditems'));?></b>
+                </label>
+                <input type="text" id="source-name" name="title_entry"
+                    value = "" maxlength="80" class="wide-field"/>
+                <br/><br/>
+                <textarea class="small-text-area" id="descriptionfield"
+                    name="description"></textarea>
+                <div class="center slight-pad">
+                    <button class="button-box" type="submit"><?php
+                        e(tl('editblogpages_element_save_page'));
+                    ?></button>
+                </div>
+            </div>
+            <?php
+            } ?>
+
+            <?php if(isset($data['IS_EDIT_FEED']) &&
+                $data['IS_EDIT_FEED']===true) { ?>
+                <table class="name-table">
+                <tr><th><label for="source-name"><?php
+                e(tl('editblogpages_element_feed_title')); ?></label></th><td>
+                <input type="text" id="source-name" name="title"
+                    value = "<?php if(isset($data['FEED_ITEMS'])
+                    ){e($data['FEED_ITEMS'][0]['title']);}else{e('');} ?>"
+                    maxlength="80" class="wide-field" /></td></tr></table>
+                <div class="top-margin"><label for="descriptionfield"><b><?php
+                  e(tl('editblogpages_element_feeditems'));?></b></label></div>
+                <textarea class="tall-text-area" id="descriptionfield"
+                    name="description"><?php if(isset($data['FEED_ITEMS'])){
+                    e($data['FEED_ITEMS'][0]['description']); }
+                    else { e("");}?></textarea>
+                <div class="center slight-pad"><button class="button-box"
+                    type="submit"><?php
+                    e(tl('editblogpages_element_save_page'));
+                    ?></button></div>
+            <?php
+            } else if (!isset($data['IS_ADD_BLOG']) ||
+                $data['IS_ADD_BLOG'] !== true) {
+            ?>[<a href = "<?php e($base_url.'&amp;arg=addblogentry&amp;id='.
+                  $edit_blog['TIMESTAMP']); ?>"><?php
+                  e(tl('editblogpages_element_add_blogentry'));?></a>]
+            <?php if(isset($data['FEED_ITEMS']) &&
+                count($data['FEED_ITEMS']) > 0) { ?>
+                <div class="top-margin"><label><b>
+                    <?php e(tl('editblogpages_element_feeditems'));?></b>
+                    </label>
+                </div>
+                <table class="search-sources-table">
+                    <tr>
+                        <th><?php e(tl('editblogpages_element_title'));?></th>
+                        <th><?php e(tl('editblogpages_element_description'));
+                        ?></th>
+                        <th><?php e(tl('editblogpages_element_action'));?></th>
+                    </tr>
+                    <?php foreach($data['FEED_ITEMS'] as $feed_items) {
+                    ?><tr>
+                        <td><?php e($feed_items['title']);?></td>
+                        <td><?php e($feed_items['description']); ?></td>
+                        <td>
+                            <?php if($feed_items['IS_OWNER'] === true || (
+                            isset($data['IS_OWNER']) &&
+                            $data['IS_OWNER'] === true)) { ?><?php
+                                $edit_blog_url = $base_url .
+                                '&amp;arg=editfeed&amp;id='.
+                                $edit_blog['TIMESTAMP'].'&amp;fid=' .
+                                $feed_items['guid']; 
+                                ?><a href="<?php e($edit_blog_url); ?>"><?php
+                                e(tl('editblogpages_element_editblog')); ?></a>
+                         <?php } ?></td>
+                        <td>
+                            <?php if($feed_items['IS_OWNER'] === true ||
+                            $data['IS_OWNER'] === true) { ?><?php 
+                                $delete_url = $base_url.
+                                '&amp;arg=deletefeed&amp;id=' .
+                                $feed_items['guid'];
+                                ?><a href="<?php e($delete_url); ?>"><?php
+                                e(tl('editblogpages_element_deleteblog'));
+                                ?></a>
+                        <?php } ?></td>
+                    </tr>
+                    <?php } ?></table>
+                <?php
+                }
+            }
+        }
+        ?></form></div>
+        <script type="text/javascript">
+        function showOverlay()
+        {
+            elt('transfer').style.visibility = "visible";
+        }
+        function closeOverlay()
+        {
+            elt('transfer').style.visibility = "hidden";
+        }
+        </script>
+    <?php
+    }
+}
+?>
diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
old mode 100644
new mode 100755
index e53dbb9..9167330
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -35,7 +35,7 @@ if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
 
 /**
  * Used to draw the admin screen on which admin users can create groups, delete
- * groups and add and delete users and roles to a group 
+ * groups and add and delete users and roles to a group
  *
  * @author Mallika Perepa
  * @package seek_quarry
@@ -45,7 +45,7 @@ class ManagegroupsElement extends Element
 {
     /**
      * Renders the screen in which groups can be created, deleted, and added or
-     * deleted 
+     * deleted
      *
      * @param array $data  contains antiCSRF token, as well as data on
      *      available groups or which user is in what group
@@ -54,158 +54,154 @@ class ManagegroupsElement extends Element
     {
         if(isset($data['GROUP_USERS'])) { ?>
             <div id="transfer">
-
             <div class="overlay">
-
-            <form id ="groupform" method="post" action='#'>
-            <input type="hidden" name="c" value="admin"/>
-            <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
-                e($data[CSRF_TOKEN]); ?>"/>
-            <input type="hidden" name="arg" value="updategroup" />
-            <?php
-            foreach($data['GROUP_USERS'] as $group_user) { ?>
-                <input type="radio" name="selectuser" value="<?php
-                    e($group_user['USER_ID']); ?>"><?php
-                    e($group_user['USER_NAME']); ?><br/>
+                <form id ="groupform" method="post" action='#'>
+                    <input type="hidden" name="c" value="admin"/>
+                    <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
+                        value="<?php e($data[CSRF_TOKEN]); ?>"/>
+                    <input type="hidden" name="arg" value="updategroup" />
                 <?php
-            }
-            ?><hr/>
-            <input type="submit" value="submit" onclick="return confirm('<?php
+                foreach($data['GROUP_USERS'] as $group_user) { ?>
+                    <input type="radio" name="selectuser" value="<?php
+                        e($group_user['USER_ID']); ?>"><?php
+                        e($group_user['USER_NAME']); ?><br/>
+                <?php
+                }?><hr/>
+             <input type="submit" value="submit" onclick="return confirm('<?php
                 e(tl('managegroups_element_transfer_admin'))?>');"/>
-            <input type="button" value="cancel" onclick="closeOverlay();"/>
-            </form>
+                <input type="button" value="cancel" onclick="closeOverlay();"/>
+                </form>
             </div>
             </div>
             <?php
         } ?>
 
         <div class="current-activity" >
-
-        <h2><?php e(tl('managegroups_element_add_group'))?></h2>
-
-        <form id="addGroupForm" method="post" action='#'>
-        <input type="hidden" name="c" value="admin" />
-        <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
-            e($data[CSRF_TOKEN]); ?>" />
-        <input type="hidden" name="a" value="manageGroups" />
-        <input type="hidden" name="arg" value="addgroup" />
-        <table class="name-table">
-            <tr>
-            <td><label for="group-name"><?php
-                e(tl('managegroups_element_groupname'))?></label></td>
-            <td><input type="text" id="group-name" name="groupname"
-                    maxlength="80" class="narrow-field"/>
-            </td>
-            <td class="center"><button class="button-box" type="submit"><?php
-                e(tl('managegroups_element_submit')); ?></button>
-            </td>
-            </tr>
-        </table>
-        </form>
+            <h2><?php e(tl('managegroups_element_add_group'))?></h2>
+            <form id="addGroupForm" method="post" action='#'>
+                <input type="hidden" name="c" value="admin" />
+                <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+                    e($data[CSRF_TOKEN]); ?>" />
+                <input type="hidden" name="a" value="manageGroups" />
+                <input type="hidden" name="arg" value="addgroup" />
+                <table class="name-table">
+                    <tr>
+                        <td><label for="group-name"><?php
+                            e(tl('managegroups_element_groupname'))?></label>
+                        </td>
+                        <td><input type="text" id="group-name" name="groupname"
+                            maxlength="80" class="narrow-field"/>
+                        </td>
+                        <td class="center"><button class="button-box"
+                            type="submit"><?php
+                            e(tl('managegroups_element_submit')); ?></button>
+                        </td>
+                    </tr>
+                </table>
+            </form>
 
         <h2><?php e(tl('managegroups_element_delete_group'))?></h2>
-
-        <form id="deleteGroupForm" method="post" action='#'
-            onsubmit="return confirm('<?php 
-                e(tl('managegroups_element_delete_groupname'))?>');">
-        <input type="hidden" name="c" value="admin" />
-        <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
-            e($data[CSRF_TOKEN]); ?>" />
-        <input type="hidden" name="a" value="manageGroups" />
-        <input type="hidden" name="arg" value="deletegroup" />
-        <table class="name-table">
-        <tr>
-        <td><label for="delete-groupname"><?php
-                e(tl('manageusers_element_delete_groupname'))?></label>
-        </td>
-        <td><?php $this->view->optionsHelper->render(
-            "delete-groupname", "selectgroup", 
-            $data['DELETE_GROUP_NAMES'], "-1"); ?>
-        </td>
-        <td><button class="button-box" type="submit"><?php
-                e(tl('managegroups_element_submit')); ?></button>
-        </td>
-        </tr>
-        </table>
-        </form>
-
+            <form id="deleteGroupForm" method="post" action='#'
+                onsubmit="return confirm('<?php
+                    e(tl('managegroups_element_delete_groupname'))?>');">
+                <input type="hidden" name="c" value="admin" />
+                <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+                    e($data[CSRF_TOKEN]); ?>" />
+                <input type="hidden" name="a" value="manageGroups" />
+                <input type="hidden" name="arg" value="deletegroup" />
+                <table class="name-table">
+                    <tr>
+                        <td><label for="delete-groupname"><?php
+                            e(tl('manageusers_element_delete_groupname'));
+                            ?></label>
+                        </td>
+                        <td><?php $this->view->optionsHelper->render(
+                            "delete-groupname", "selectgroup",
+                            $data['DELETE_GROUP_NAMES'], "-1"); ?>
+                        </td>
+                        <td><button class="button-box" type="submit"><?php
+                            e(tl('managegroups_element_submit')); ?></button>
+                        </td>
+                    </tr>
+                </table>
+            </form>
         <h2><?php e(tl('managegroups_element_view_groups'))?></h2>
-
-        <form id="viewGroupForm" method="get" action='#' >
-        <input type="hidden" name="c" value="admin" />
-        <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
-            e($data[CSRF_TOKEN]); ?>" />
-        <input type="hidden" name="a" value="manageGroups" />
-        <input type="hidden" name="arg" value="viewgroups" />
-        <table class="name-table">
-          <tr>
-            <td><label for="select-group"><?php
-                e(tl('managegroups_element_select_group'))?></label>
-            </td>
-            <td><?php $this->view->optionsHelper->render(
-                    "select-group","selectgroup", $data['GROUP_NAMES'],
-                    $data['SELECT_GROUP']); ?>
-            </td>
-          </tr>
-        </table>
-        </form>
-
-        <?php
-        if(isset($data['USER_NAMES'])) {
-            if(count($data['USER_NAMES']) > 0) { ?>
-                <form id="adduserForm" method="get" action='#'>
+            <form id="viewGroupForm" method="get" action='#' >
                 <input type="hidden" name="c" value="admin" />
-                <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
-                    value="<?php e($data[CSRF_TOKEN]); ?>" />
+                <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+                    e($data[CSRF_TOKEN]); ?>" />
                 <input type="hidden" name="a" value="manageGroups" />
-                <input type="hidden" name="arg" value="adduser" />
-                <input type="hidden" name="selectgroup" 
-                    value="<?php e($data['SELECT_GROUP']); ?>" />
+                <input type="hidden" name="arg" value="viewgroups" />
                 <table class="name-table">
-                <tr>
-                <td><label for="select-user"><?php
-                        e(tl('managegroups_element_add_user')); ?></label>
-                </td>
-                <td><?php
-                $this->view->optionsHelper->render(
-                    "select-user","selectuser", $data['USER_NAMES'],
-                    $data['SELECT_USER']); ?>
-                </td>
-                <td><button class="button-box" type="submit"><?php
-                e(tl('managegroups_element_submit')); ?></button></td>
-                </tr>
+                    <tr>
+                        <td><label for="select-group"><?php
+                            e(tl('managegroups_element_select_group'))?></label>
+                        </td>
+                        <td><?php $this->view->optionsHelper->render(
+                            "select-group","selectgroup", $data['GROUP_NAMES'],
+                             $data['SELECT_GROUP']); ?>
+                        </td>
+                    </tr>
                 </table>
+            </form>
+        <?php
+        if(isset($data['USER_NAMES'])) {
+            if(count($data['USER_NAMES']) > 0) { ?>
+                <form id="adduserForm" method="get" action='#'>
+                    <input type="hidden" name="c" value="admin" />
+                    <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
+                        value="<?php e($data[CSRF_TOKEN]); ?>" />
+                    <input type="hidden" name="a" value="manageGroups" />
+                    <input type="hidden" name="arg" value="adduser" />
+                    <input type="hidden" name="selectgroup"
+                        value="<?php e($data['SELECT_GROUP']); ?>" />
+                    <table class="name-table">
+                        <tr>
+                            <td><label for="select-user"><?php
+                                e(tl('managegroups_element_add_user'));
+                                ?></label>
+                            </td>
+                            <td><?php
+                                $this->view->optionsHelper->
+                                    render("select-user","selectuser",
+                                    $data['USER_NAMES'],
+                                    $data['SELECT_USER']); ?>
+                            </td>
+                            <td><button class="button-box" type="submit"><?php
+                                e(tl('managegroups_element_submit'));
+                                ?></button></td>
+                        </tr>
+                    </table>
                 </form>
                 <?php
             } ?>
-
             <?php
             if(isset($data['GROUP_USERS'])) { ?>
                 <table class="role-table">
                 <?php
                 foreach($data['GROUP_USERS'] as $group_user) {
                     if($_SESSION['USER_ID'] != $group_user['USER_ID']
-                    && $_SESSION['USER_ID'] != $group_user['CREATOR_ID']) { ?>
-                       <tr><td><?php $group_user['USER_NAME'] ?></td></tr><?php
-                    } else {
+                        && $_SESSION['USER_ID'] != $group_user['CREATOR_ID']) {
+                    ?><tr><td><?php e($group_user['USER_NAME']) ?></td></tr>
+                    <?php } else {
                         $base_url = "?c=admin&amp;".CSRF_TOKEN."=".
                             $data[CSRF_TOKEN]."&amp;a=manageGroups".
                             "&amp;arg=deleteuser";
-                        if($group_user['USER_ID']!= $group_user['CREATOR_ID']) {
+                       if($group_user['USER_ID']!= $group_user['CREATOR_ID']) {
                             ?>
-                            <tr><td><?php e($group_user['USER_NAME']); ?>
+                    <tr><td><?php e($group_user['USER_NAME']); ?>
                             </td><td><a href="<?php
-                                e($base_url . $group_user['GROUP_ID']. '&amp;'.
-                                    'selectuser='.$group_user['USER_ID']); ?>"
-                                onclick="return confirm('<?php
+        e($base_url . '&amp;'.'selectgroup='.$group_user['GROUP_ID']. '&amp;'.
+                        'selectuser='.$group_user['USER_ID']); ?>"
+                  onclick="return confirm('<?php
                                 e(tl('managegroups_element_delete_groupuser'))
                                 ?>');" ><?php
-                                e(tl('managegroups_element_delete')) ?></a>
+                   e(tl('managegroups_element_delete')) ?></a>
                             </td></tr><?php
                         } else { ?>
                             <tr><td> <?php e($group_user['USER_NAME']); ?></td>
-                                <td><a href='#' onclick='return showOverlay();'
-                                    ><?php
+                                <td><a href='#'
+                                    onclick='return showOverlay();'><?php
                                     e(tl('managegroups_element_transfer'));
                                 ?></a></td>
                             </tr><?php
@@ -218,27 +214,29 @@ class ManagegroupsElement extends Element
             if(isset($data['GROUP_ROLES'])) {
                 if(count($data['ROLE_NAMES'])>0 && $data['ROLE_NAMES'] != -1){?>
                     <form id="addGroupRoleForm" method="get" action='#' >
-                    <input type="hidden" name="c" value="admin" />
-                    <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
+                        <input type="hidden" name="c" value="admin" />
+                        <input type="hidden" name="<?php e(CSRF_TOKEN); ?>"
                         value="<?php e($data[CSRF_TOKEN]); ?>" />
-                    <input type="hidden" name="a" value="manageGroups" />
-                    <input type="hidden" name="arg" value="addrole" />
-                    <input type="hidden" name="selectgroup"
+                        <input type="hidden" name="a" value="manageGroups" />
+                        <input type="hidden" name="arg" value="addrole" />
+                        <input type="hidden" name="selectgroup"
                         value="<?php e($data['SELECT_GROUP']);?>" />
-                    <table class="name-table">
-                      <tr>
-                        <td><label for="add-role"><?php
-                            e(tl('managegroups_element_add_group_role'));
-                            ?></label></td>
-                        <td><?php
-                            $this->view->optionsHelper->render("add-role",
-                                "selectrole", $data['ROLE_NAMES'],
-                                $data['SELECT_ROLE']); ?>
-                        </td>
-                        <td><button class="button-box" type="submit"><?php
-                            e(tl('managegroups_element_submit')); ?></button>
-                        </td></tr>
-                    </table>
+                        <table class="name-table">
+                            <tr>
+                                <td><label for="add-role"><?php
+                                e(tl('managegroups_element_add_group_role'));
+                                ?></label></td>
+                                <td><?php
+                                    $this->view->optionsHelper->
+                                        render("add-role",
+                                    "selectrole", $data['ROLE_NAMES'],
+                                    $data['SELECT_ROLE']); ?>
+                                </td>
+                                <td><button class="button-box" type="submit">
+                                    <?php e(tl('managegroups_element_submit'));
+                                    ?></button>
+                                </td></tr>
+                        </table>
                     </form>
                     <?php
                 }
diff --git a/views/signin_view.php b/views/signin_view.php
index 842be15..2069b64 100755
--- a/views/signin_view.php
+++ b/views/signin_view.php
@@ -56,60 +56,48 @@ class SigninView extends View
      *  @param array $data  contains the anti CSRF token
      *  the view
      */
-    function renderView($data)
-    {
-        $logo = "resources/yioop.png";
-        if(MOBILE) {
-            $logo = "resources/m-yioop.png";
-        }
-        ?>
-        <div class="landing non-search">
-            <h1 class="logo"><a href="./?<?php
-                e(CSRF_TOKEN."=".$data[CSRF_TOKEN]) ?>"><img
-                src="<?php e($logo); ?>" alt="Yioop!"/></a>
-                <span> - <?php e(tl('signin_view_signin')); ?></span></h1>
-            <form class="user_settings" method="post" action="#">
-                <div class="login">
-                <table>
-                    <tr>
-                        <td class="table-label" ><b><label for="username"><?php
-                        e(tl('signin_view_username')); ?></label>:</b></td>
-                        <td class="table-input"><input id="username" type="text"
-                            class="narrow-field" maxlength="80" name="u"/></td>
-                        <td></td>
-                    </tr>
-                    <tr>
-                        <td class="table-label" ><b><label for="password"><?php
-                            e(tl('signin_view_password')); ?></label>:</b></td>
-                        <td class="table-input"><input id="password"
-                            type="password" class="narrow-field"
-                            maxlength="80" name="p" /></td>
-                        <td><input type="hidden"
-                            name="<?php e(CSRF_TOKEN);?>" value="<?php
-                            e($data[CSRF_TOKEN]); ?>" />
-                        </td>
-                    </tr>
-                    <tr><td>&nbsp;</td><td class="center">
-                        <button  type="submit" name="c" value="admin"><?php
-                        e(tl('signin_view_login')); ?></button>
-                        </td><td>&nbsp;</td>
-                    </tr>
-                </table>
-            </div>
-        </form>
+    function renderView($data) {
+    $logo = "resources/yioop.png";
+    if(MOBILE) {
+        $logo = "resources/m-yioop.png";
+    }
+?>
+<div class="landing non-search">
+<h1 class="logo"><a href="./?<?php e(CSRF_TOKEN."=".$data[CSRF_TOKEN])
+        ?>"><img src="<?php e($logo); ?>" alt="Yioop!"
+        /></a><span> - <?php e(tl('signin_view_signin')); ?></span></h1>
+<form class="user_settings" method="post" action="#">
+<div class="login">
+    <table>
+    <tr>
+    <td class="table-label" ><b><label for="username"><?php
+        e(tl('signin_view_username')); ?></label>:</b></td><td
+            class="table-input"><input id="username" type="text"
+            class="narrow-field" maxlength="80" name="u"/>
+    </td><td></td></tr>
+    <tr>
+    <td class="table-label" ><b><label for="password"><?php
+        e(tl('signin_view_password')); ?></label>:</b></td><td
+        class="table-input"><input id="password" type="password"
+        class="narrow-field" maxlength="80" name="p" /></td>
+    <td><input type="hidden" name="<?php e(CSRF_TOKEN);?>" value="<?php
+        e($data[CSRF_TOKEN]); ?>" />
+    </td>
+    </tr>
+    <tr><td>&nbsp;</td><td class="center">
+    <button  type="submit" name="c" value="admin"><?php
+        e(tl('signin_view_login')); ?></button>
+    </td><td>&nbsp;</td></tr>
+    </table>
+</div>
+</form>
 
-        <div class="signin-exit"><a href="."><?php
-            e(tl('signin_view_return_yioop')); ?></a>
-            <?php if(ANONYMOUS_ACCOUNT) {
-                ?><br/><a href="./?c=register&amp;<?php
-                e(CSRF_TOKEN."=".$data[CSRF_TOKEN])?>&amp;"><?php
-                e(tl('signin_view_create_account')); ?></a>
-            <?php }
-        ?></div>
-    </div>
-        <div class='landing-spacer'></div>
+<div class="signin-exit"><a href="."><?php
+    e(tl('signin_view_return_yioop')); ?></a></div>
+</div>
 
-        <?php
+<div class='landing-spacer'></div>
+<?php
     }
 }
-?>
+?>
\ No newline at end of file
diff --git a/views/static_view.php b/views/static_view.php
index cd23a34..cdd599f 100644
--- a/views/static_view.php
+++ b/views/static_view.php
@@ -45,11 +45,6 @@ if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
 class StaticView extends View
 {
 
-    /** This view is makes use of the localized static page overview.thtml
-     *  @var array
-     */
-    var $pages = array('privacy', 'blog', 'bot', "404", "409");
-
     /** Names of element objects that the view uses to display itself
      *  @var array
      */
-- 
1.8.1

