_binary From 95dd6fd2c3b2ed0fb00af6bac8fdfe0153efc477 Mon Sep 17 00:00:00 2001
From: MALLIKA <keertimaantenneti@keertimaan-tennetis-macbook.local>
Date: Wed, 27 Nov 2013 09:49:00 -0800
Subject: [PATCH] sample 3 , fixed css

---
 configs/createdb.php                       |  12 +-
 controllers/admin_controller.php           | 525 ++++++++++++++++++++++++++---
 css/search.css                             |   5 +
 index.php                                  |   4 +-
 lib/upgrade_functions.php                  |  36 +-
 models/blog_model.php                      | 506 +++++++++++++++++++++++++++
 models/profile_model.php                   |   4 +
 models/source_model.php                    |   9 +-
 models/user_model.php                      |  20 ++
 views/admin_view.php                       |   3 +-
 views/elements/blogpages_element.php       | 131 +++++++
 views/elements/createblogpages_element.php | 108 ++++++
 views/elements/editblogpages_element.php   | 267 +++++++++++++++
 views/elements/managegroups_element.php    |   6 +-
 14 files changed, 1559 insertions(+), 77 deletions(-)
 create mode 100644 models/blog_model.php
 create mode 100644 views/elements/blogpages_element.php
 create mode 100644 views/elements/createblogpages_element.php
 create mode 100644 views/elements/editblogpages_element.php

diff --git a/configs/createdb.php b/configs/createdb.php
index dd3d415..f312e40 100755
--- a/configs/createdb.php
+++ b/configs/createdb.php
@@ -81,12 +81,15 @@ 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, 'root', '".crawlCrypt('')."' ) ";
 $db->execute($sql);
 
+$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
  */
@@ -170,6 +173,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',
@@ -225,7 +232,6 @@ $activities = array(
             "vi-VN" => 'Sắp xếp hoạt động dựa theo hoạch định',
         ))
 );
-
 $i = 1;
 foreach($activities as $activity => $translation_info) {
     // set-up activity
@@ -271,7 +277,7 @@ $db->execute("INSERT INTO MIX_COMPONENTS VALUES(
 $db->execute("INSERT INTO CRAWL_MIXES VALUES (4, 'news')");
 $db->execute("INSERT INTO MIX_GROUPS VALUES(4, 0, 1)");
 $db->execute("INSERT INTO MIX_COMPONENTS VALUES(4, 0, 1, 1,
-    'media:news')");
+    'media:news no:cache')");
 
 $db->execute("INSERT INTO SUBSEARCH VALUES('db_subsearch_images',
     'images','m:2',50)");
diff --git a/controllers/admin_controller.php b/controllers/admin_controller.php
index 8f90eb5..8da158e 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","blog");
     /**
      * Says which activities (roughly methods invoke from the web) this
      * controller will respond to
@@ -83,7 +83,7 @@ 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");
     /**
      * An array of activities which are periodically updated within other
      * activities that they live. For example, within manage crawl,
@@ -216,6 +216,7 @@ class AdminController extends Controller implements CrawlConstants
         } else {
             $activity = "manageAccount";
         }
+
         $allowed = true;
         if(!PROFILE) {
             $allowed_activities = array( array(
@@ -409,7 +410,6 @@ class AdminController extends Controller implements CrawlConstants
         $data['SCRIPT'] =
             "selectUser = elt('select-user'); ".
             "selectUser.onchange = submitViewUserRole;";
-
         $usernames = $this->userModel->getUserList();
         if(isset($_REQUEST['username'])) {
             $username = $this->clean($_REQUEST['username'], "string" );
@@ -446,19 +446,9 @@ class AdminController extends Controller implements CrawlConstants
                 }
             }
 
-            $select_role_ids = array();
-            foreach($data['SELECT_ROLES'] as $role) {
-                $select_role_ids[] = $role['ROLE_ID'];
-            }
-            $available_roles = array();
-            $tmp = array();
-            foreach($all_roles as $role) {
-                if(!in_array($role['ROLE_ID'], $select_role_ids) &&
-                    !isset($tmp[$role['ROLE_ID']])) {
-                    $tmp[$role['ROLE_ID']] = true;
-                    $available_roles[] = $role;
-                }
-            }
+            $available_roles = array_diff_assoc(
+                $all_roles, $data['SELECT_ROLES']);
+
 
             $data['AVAILABLE_ROLES'][-1] =
                 tl('admin_controller_select_rolename');
@@ -491,7 +481,12 @@ class AdminController extends Controller implements CrawlConstants
                             "</h1>')";
                         return $data;
                     }
-
+                    if(isset($_SESSION['USER_ID'])) {
+                        $user = $_SESSION['USER_ID'];
+                    } else {
+                        $user = $_SERVER['REMOTE_ADDR'];
+                    }
+                        $user_id = $_SESSION['USER_ID'];
                     if($this->signinModel->getUserId($username) > 0) {
                         $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
                             tl('admin_controller_username_exists')."</h1>')";
@@ -625,19 +620,8 @@ class AdminController extends Controller implements CrawlConstants
                     $activity['ACTIVITY_NAME'];
             }
 
-            $available_activities = array();
-            $role_activity_ids = array();
-            foreach($data['ROLE_ACTIVITIES'] as $activity) {
-                $role_activity_ids[] = $activity["ACTIVITY_ID"];
-            }
-            $tmp = array();
-            foreach($all_activities as $activity) {
-                if(!in_array($activity["ACTIVITY_ID"], $role_activity_ids) &&
-                    !isset($tmp[$activity["ACTIVITY_ID"]])) {
-                    $tmp[$activity["ACTIVITY_ID"]] = true;
-                    $available_activities[] = $activity;
-                }
-            }
+            $available_activities =
+                array_diff_assoc($all_activities, $data['ROLE_ACTIVITIES']);
             $data['AVAILABLE_ACTIVITIES'][-1] =
                 tl('admin_controller_select_activityname');
 
@@ -770,7 +754,6 @@ class AdminController extends Controller implements CrawlConstants
         $possible_arguments = array("addgroup", "deletegroup",
             "viewgroups", "selectgroup", "adduser", "deleteuser",
             "addrole", "deleterole", "updategroup");
-
         $data["ELEMENT"] = "managegroupsElement";
         $data['SCRIPT'] =
             "selectGroup = elt('select-group'); selectGroup.onchange =".
@@ -887,8 +870,6 @@ class AdminController extends Controller implements CrawlConstants
                     $user_ids[] = $username['USER_ID'];
                 }
             }
-
-
             if(isset($_REQUEST['selectactivity'])) {
                 $select_activity =
                     $this->clean($_REQUEST['selectactivity'], "int" );
@@ -1019,6 +1000,461 @@ class AdminController extends Controller implements CrawlConstants
     }
 
     /**
+     * Used to handle the blogs and pages activity.
+     *
+     * This activity allows users to create blogs, edit blogs and delete blogs.
+     * It allows users to add feeditems to the blogs, edit and delete feeditems
+     * Allows users to add groups to the blogs and set the permissions to access
+     * the blogs
+     * @return array $data information about blogs in the system
+     */
+    function blogPages()
+     {
+        $data["ELEMENT"] = "blogpagesElement";
+        if(isset($_SESSION['USER_ID'])) {
+           $user = $_SESSION['USER_ID'];
+        } else {
+          $user = $_SERVER['REMOTE_ADDR'];
+          }
+        $user = $_SESSION['USER_ID'];
+        if($_SESSION['USER_ID'] == '1') {
+             $groups = $this->groupModel->getGroupList();
+             $isAdmin = true;
+        } else {
+            $isAdmin = false;
+            $groups = $this->groupModel->getGroupListbyUser(
+            $_SESSION['USER_ID']);
+            $length = count($groups);
+            $j = 0;
+            foreach($groups as $group){
+                $groupIds .= $group['GROUP_ID'];
+                if($j < $length - 1){
+                    $groupIds .= ',';
+                }
+                $j++;
+            }
+        }
+        $recentblogs = $this->blogModel->recentBlog($user, $groupIds, $isAdmin);
+        $data['RECENT_BLOGS'] = $recentblogs;
+        $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["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;
+        }
+        if(isset($_REQUEST['selectgroup'])) { 
+          $select_group = $this->clean($_REQUEST['selectgroup'], "string" );
+           $data['SELECT_GROUP'] = $select_group;
+        } else {
+        $select_group = "";
+        }
+        if(!$source_type_flag) break;
+        $must_have = array("title", "description","sourcelocaletag");
+        foreach ($must_have as $clean_me) {
+         $r[$clean_me] = (isset($_REQUEST[$clean_me])) ?
+         $this->clean($_REQUEST[$clean_me], "string" ) : "";
+        if(in_array($clean_me, $must_have) && $r[$clean_me] == "" )break 2;
+        }
+        if(isset($_SESSION['USER_ID'])) {
+            $user = $_SESSION['USER_ID'];
+        } else {
+          $user = $_SERVER['REMOTE_ADDR'];
+        }
+        $user = $_SESSION['USER_ID'];
+        $groupid = $this->groupModel->getGroupId($select_group);
+          $data['SELECT_GROUP'] = $select_group;
+        $this->blogModel->addBlog(
+          $r['title'], $r['description'], $user, 
+          $data['SOURCE_TYPE'],$r['sourcelocaletag'],$select_group);
+        $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+               tl('admin_controller_blog_added').
+                "</h1>');";
+        break;
+
+       case "searchblog":
+           $data["ELEMENT"] = "blogpagesElement";
+           if(isset($_REQUEST['blog'])){
+              $isBlogsEmpty = false;
+              $data['BLOG_TITLE'] = $_REQUEST['blog'];
+           if(!empty($data['BLOG_TITLE'])){
+               $blogs = $this->blogModel->searchBlog($data['BLOG_TITLE'], 
+                        $user, $groupIds, $isAdmin);
+               $data['BLOGS'] = $blogs;
+            if(empty($blogs)){
+              $isBlogsEmpty = true;
+            }
+            }else{
+                $isBlogsEmpty = true;
+            }
+            if($isBlogsEmpty){
+            $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'])) {
+               $timestamp = ($_GET['id']); 
+            if(isset($_REQUEST['title'])) {
+                $title = ($_POST['title']);
+            }
+            $this->blogModel->deleteBlog($timestamp, $title, $user);
+            $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                            tl('admin_controller_blog_deleted').
+                            "</h1>');";
+            $recentblogs = 
+                    $this->blogModel->recentBlog($user, $groupIds, $isAdmin);
+            $data['RECENT_BLOGS'] = $recentblogs;
+            }
+            break;
+
+            case "editblog":
+            if(isset($_REQUEST['id'])) {
+               $timestamp = ($_GET['id']);
+               $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;
+             }
+                 $editblogs= $this->blogModel->editBlog($timestamp);
+                 $blogusers = $this->blogModel->getBlogUsers($editblogs[0]);
+                 $editblogs[0]['BLOG_USERS'] = $blogusers;
+                 $data['EDIT_BLOGS'] = $editblogs;
+                 $title = $editblogs['0']['NAME'];
+            if(isset($_SESSION['USER_ID'])) {
+                 $user = $_SESSION['USER_ID'];
+            } else {
+               $user = $_SERVER['REMOTE_ADDR'];
+            }
+           $user = $_SESSION['USER_ID'];
+           $feeditems=$this->blogModel->getFeed($title, $user);
+                     $data['FEED_ITEMS'] = $feeditems;
+           if(isset($_SESSION['USER_ID'])) {
+             $username = $this->signinModel->getUserName($_SESSION['USER_ID']);
+             $data['USER_NAME'] = $username;
+             $ownerId = $this->blogModel->getBlogOwner($timestamp);
+           if($ownerId == $user || $user == '1'){
+                 $data['IS_OWNER'] = true;
+            }
+            }
+            }
+            break;
+
+            case "editdescription":
+                if(isset($_REQUEST['id'])) {
+                   $timestamp = ($_GET['id']); 
+                   $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->blogModel->getBlogGroup($timestamp);
+             $data['BLOG_GROUP'] = $blog_group;
+            $editblogs= $this->blogModel->editBlog($timestamp);
+            $data['EDIT_BLOGS'] = $editblogs;
+            $data['IS_EDIT_DESC'] = true;
+            }
+            break;
+
+            case "updatedescription":
+               if(isset($_REQUEST['id'])) {
+                        $timestamp = ($_GET['id']);}
+               if(isset($_REQUEST['description'])) {
+                        $description = ($_POST['description']);}
+               if(isset($_REQUEST['title'])) {
+                        $title = ($_POST['title']);}
+                   $updateblogs= $this->blogModel->editDescription($timestamp,
+                                  $title, $description);
+                   $data['EDIT_BLOGS'] = $editblogs;
+                   $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_blog_updated').
+                        "</h1>');";
+                break;
+
+            case "addblogentry":
+             if(isset($_REQUEST['id'])) {
+                 $timestamp = ($_GET['id']); 
+                 $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;
+            }
+             $editblogs= $this->blogModel->editBlog($timestamp);
+              $data['EDIT_BLOGS'] = $editblogs;
+                            $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 = ($_GET['id']); }
+               if(isset($_REQUEST['title'])) {
+                        $title = ($_POST['title']);}
+                if(isset($_REQUEST['description'])) {
+                        $description = ($_POST['description']);}
+                if(isset($_REQUEST['titleentry'])) { ;
+                        $titleentry = ($_POST['titleentry']);}
+                    $feeditems= $this->blogModel->addEntry($timestamp,
+                    $titleentry, $description,$title,$user);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_feed_added').
+                        "</h1>');";
+                break;
+
+            case "editfeed":
+                if(isset($_REQUEST['id'])) {
+                 $timestamp = ($_GET['id']); 
+                 $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;
+                    }
+                    $editblogs= $this->blogModel->editBlog($timestamp);
+                    $data['EDIT_BLOGS'] = $editblogs;
+                    $data['IS_EDIT_FEED'] = true;
+                    if(isset($_REQUEST['fid'])) {
+                        $guid=($_GET['fid']);
+                    }
+                    $feeditems=$this->blogModel->getFeedByGUID($guid);
+                    $data['FEED_ITEMS']=$feeditems;
+                     $ownerId = $this->blogModel->getBlogOwner($timestamp);
+                        if($ownerId == $user || $user == '1'){
+                            $data['IS_OWNER'] = true;
+                        }
+                    }
+            break;
+
+            case "updatefeed":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = ($_GET['id']);}
+                    if(isset($_REQUEST['description'])) {
+                        $description = ($_POST['description']);}
+                     if(isset($_REQUEST['title'])) {
+                        $title = ($_POST['title']); }
+                     if(isset($_REQUEST['fid'])) {
+                        $guid=($_GET['fid']);
+                    }
+                    $updatefeeds= $this->blogModel->
+                            updateFeed($guid,$title, $description);
+                    $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                        tl('admin_controller_feed_updated').
+                        "</h1>');";
+            break;
+            case "deletefeed":
+               if(isset($_REQUEST['id'])) {
+                   $guid = ($_GET['id']); 
+                    $this->blogModel->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(isset($_REQUEST['blogName'])) {
+                $blog_name = $this->clean($_REQUEST['blogName'], "string" );
+                } else {
+                $blog_name = "";
+                }
+                 $this->blogModel->updateBlogUsers($select_user, $blog_name);
+            break;
+
+            case "addbloggroup":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = ($_GET['id']); }
+                    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->blogModel->addGroup($timestamp,$select_group);
+                        $data['SCRIPT'] .= "doMessage('<h1 class=\"red\" >".
+                            tl('admin_controller_group_added').
+                            "</h1>');";
+            break;
+
+            case "deletebloggroup":
+                    if(isset($_REQUEST['id'])) {
+                        $timestamp = ($_GET['id']); }
+                   if(isset($_REQUEST['gid'])) {
+                        $groupid=($_GET['gid']);
+                    }
+                        $this->blogModel->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
@@ -1158,17 +1594,6 @@ class AdminController extends Controller implements CrawlConstants
             $url_parts = explode("{}", $url);
             $crawl_params[self::VIDEO_SOURCES][] = $url_parts[0];
         }
-        if(isset($crawl_params[self::INDEXING_PLUGINS]) &&
-            is_array($crawl_params[self::INDEXING_PLUGINS])) {
-            foreach($crawl_params[self::INDEXING_PLUGINS] as $plugin_prefix) {
-                $plugin_name = $plugin_prefix."Plugin";
-                $plugin = new $plugin_name();
-                if(method_exists($plugin_name, "loadConfiguration")) {
-                    $crawl_params[self::INDEXING_PLUGINS_DATA][$plugin_prefix] =
-                        $plugin->loadConfiguration();
-                }
-            }
-        }
 
         /*
            Write the new crawl parameters to the name server, so
@@ -1344,7 +1769,6 @@ class AdminController extends Controller implements CrawlConstants
                 $seed_info[$property] = $seed_current[$property];
             }
         }
-
         if(!$no_further_changes && isset($_REQUEST['crawl_indexes'])
             && in_array($_REQUEST['crawl_indexes'],
             array_keys($data['available_crawl_indexes']))) {
@@ -1890,18 +2314,9 @@ class AdminController extends Controller implements CrawlConstants
                 : array();
         foreach($this->indexing_plugins as $plugin) {
             $plugin_name = ucfirst($plugin);
-            $data['INDEXING_PLUGINS'][$plugin_name]['checked'] =
+            $data['INDEXING_PLUGINS'][$plugin_name] =
                 (in_array($plugin_name, $included_plugins)) ?
                 "checked='checked'" : "";
-            $class_name = $plugin_name."Plugin";
-            if(method_exists($class_name, 'configureHandler') &&
-                method_exists($class_name, 'configureView')) {
-                $data['INDEXING_PLUGINS'][$plugin_name]['configure'] = true;
-                $plugin_object = new $class_name();
-                $plugin_object->configureHandler($data);
-            } else {
-                $data['INDEXING_PLUGINS'][$plugin_name]['configure'] = false;
-            }
         }
 
         $profile =  $this->profileModel->getProfile(WORK_DIRECTORY);
diff --git a/css/search.css b/css/search.css
index f7332cf..28a9fc5 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/index.php b/index.php
index dadfe17..78e754a 100755
--- a/index.php
+++ b/index.php
@@ -176,9 +176,9 @@ if(file_exists(APP_DIR."/index.php")) {
  * the data needed to render the scene
  *
  */
-if(file_exists(APP_DIR."/controllers/".$controller_name."_controller.php")) {
+if(file_exists(APP_DIR."/controllers/".$controller_name."_controller.php")) { 
     require_once(APP_DIR."/controllers/".$controller_name."_controller.php");
-} else {
+} else { 
     require_once(BASE_DIR."/controllers/".$controller_name."_controller.php");
 }
 $controller_class = ucfirst($controller_name)."Controller";
diff --git a/lib/upgrade_functions.php b/lib/upgrade_functions.php
index c516268..f259bd5 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,7 @@ 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";
@@ -543,10 +543,10 @@ function upgradeDatabaseVersion17(&$db)
 
     $db->execute("CREATE TABLE GROUPS (GROUP_ID INTEGER PRIMARY KEY
         $auto_increment ,GROUP_NAME VARCHAR(128), CREATED_TIME INT(11),
-           CREATOR_ID INT(11))");
-    $db->execute("CREATE TABLE USER_GROUP (USER_ID INTEGER ,
+           CREATER_ID INT(11))");
+    $db->execute("CREATE TABLE USER_GROUPS (USER_ID INTEGER ,
         GROUP_ID INTEGER,PRIMARY KEY (GROUP_ID, USER_ID) )");
-    $db->execute("CREATE TABLE GROUP_ROLE (GROUP_ID INTEGER ,
+    $db->execute("CREATE TABLE GROUP_ROLES (GROUP_ID INTEGER ,
         ROLE_ID INTEGER)");
 
     addActivityAtId($db, 'db_activity_manage_groups', "manageGroups", 4);
@@ -559,6 +559,32 @@ function upgradeDatabaseVersion17(&$db)
 }
 
 /**
+ * Upgrades a Version 16 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=17 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', "Blogs and Pages", 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/blog_model.php b/models/blog_model.php
new file mode 100644
index 0000000..79d8fb2
--- /dev/null
+++ b/models/blog_model.php
@@ -0,0 +1,506 @@
+<?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 BlogModel 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
+    */
+    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
+    */
+    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 timestamp is the timestamp of the blog
+    *  @param 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 timestamp is the timestamp of the 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 timestamp is the timestamp of the blog
+    *  @param 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
+    */
+    function searchBlog($title, $user, $groupsIds, $isAdmin)
+    {
+        $this->db->selectDB(DB_NAME);
+        if($isAdmin === 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);
+        while($blogs[$i] = $this->db->fetchArray($result)) {
+            $blogs[$i]['EDITABLE'] = true;
+            $i++;
+        }
+        if($isAdmin === 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 ($groupsIds));";
+            $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
+    */
+    function recentBlog($user, $groupIds, $isAdmin)
+    {
+         $this->db->selectDB(DB_NAME);
+         if($isAdmin === true){
+            $sql = "select TIMESTAMP,NAME,TYPE from MEDIA_SOURCE where NAME
+                IN (select NAME from ACCESS)
+                ORDER BY TIMESTAMP DESC LIMIT 5 ";
+         }else {
+            $sql = "select TIMESTAMP,NAME,TYPE from MEDIA_SOURCE where NAME
+                IN (select NAME from ACCESS  where ID = '$user')
+                ORDER BY TIMESTAMP DESC LIMIT 5 ";
+         }
+        $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($isAdmin === false){
+            $sql = "select TIMESTAMP,NAME,TYPE from MEDIA_SOURCE where NAME
+                IN (select NAME from ACCESS  where TYPE = 'group' AND 
+                ID IN ($groupIds)) 
+                ORDER BY TIMESTAMP DESC LIMIT 5 ";
+            $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
+    */
+    function getBlogUsers($blog)
+    {
+        $this->db->selectDB(DB_NAME);
+        $blogName = $blog["NAME"];
+        $sql = "select ID from ACCESS where TYPE = 'group'
+             AND NAME = '$blogName'";
+        $result = $this->db->execute($sql);
+        if($row = $this->db->fetchArray($result)) {
+           $group_id = $row['ID'];
+           $users = array();
+           $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";
+           $i = 0;
+           $result = $this->db->execute($sql);
+           while($users[$i] = $this->db->fetchArray($result)) {
+                $i++;
+           }
+           unset($users[$i]); //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 
+    */
+    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
+    */
+    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 
+    */
+    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);
+        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
+    */
+    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);
+
+        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
+    */
+    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);
+        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
+    */
+    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
+    */
+    function addEntry($timestamp,$titleentry,$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($titleentry)."','".
+                $user."','user')";
+        $this->db->execute($sql);
+        $sql = "INSERT INTO FEED_ITEM(GUID,TITLE,DESCRIPTION,
+                PUBDATE,SOURCE_NAME) VALUES (uuid(),'".
+                $this->db->escapeString($titleentry)."','".
+                $this->db->escapeString($description)."','".
+                $timestampe."','".
+                $this->db->escapeString($title)."')";
+        $this->db->execute($sql);
+    }
+}
+?>
diff --git a/models/profile_model.php b/models/profile_model.php
index 7c2d80e..5b1342b 100644
--- a/models/profile_model.php
+++ b/models/profile_model.php
@@ -317,6 +317,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 16e7293..c49fc52 100755
--- a/models/user_model.php
+++ b/models/user_model.php
@@ -243,10 +243,21 @@ class UserModel extends Model
     function addUser($username, $password)
     {
         $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 1";
+        $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);
     }
 
 
@@ -264,6 +275,15 @@ class UserModel extends Model
         $result = $this->db->execute($sql);
     }
 
+    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'];
+    }
 
     /**
      * Adds a role to a given user
diff --git a/views/admin_view.php b/views/admin_view.php
index 198e912..7489ca0 100755
--- a/views/admin_view.php
+++ b/views/admin_view.php
@@ -55,7 +55,7 @@ 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 +93,6 @@ class AdminView extends View
         $this->activityElement->render($data);
         if(isset($data['ELEMENT'])) {
             $element = $data['ELEMENT'];
-
             $this->$element->render($data);
         }
         if(PROFILE) {
diff --git a/views/elements/blogpages_element.php b/views/elements/blogpages_element.php
new file mode 100644
index 0000000..b2be4cc
--- /dev/null
+++ b/views/elements/blogpages_element.php
@@ -0,0 +1,131 @@
+<?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 serach blog or a page form.
+     *
+     *  @param array $data   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 id="searchBlogForm" method="post" 
+            action='#' >
+        <div  class="top-margin">
+        <input type="hidden" name="a" value="blogPages" />
+        <input type="hidden" name="arg" value="searchblog" />
+        <input type="text" id="urlfield"
+               name="blog" placeholder = 
+                    "<?php e(tl('blogpages_element_search_blog'))?>" 
+                class="extra-wide-field" value='<?php
+                e($data["blog"]); ?>' />
+        <button class="button-box" type="submit" ><?php
+            e(tl('blogpages_element_search'));
+            ?></button>
+        </form>
+        <?php if(!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><td><b>
+            <a href = "<?php e($base_url.'&arg=editblog&id='.
+            $blogs['TIMESTAMP']); ?>"><?php e($blogs['NAME']);?></a>
+            </td>
+            <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 } ?>
+        </div>
+        <?php if(!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 colspan ='3'>
+            <?php e(tl('blogpages_element_action'));?></th></tr><?php
+        foreach($data['RECENT_BLOGS'] as $recentblogs) {
+        ?>
+        <tr><td><b>
+            <a href = "<?php e($base_url.'&arg=editblog&id='.
+            $recentblogs['TIMESTAMP']); ?>">
+            <?php e($recentblogs['NAME']);?></a>
+            </td>
+            <td><?php e($recentblogs['TYPE']); ?></td>
+            <td><?php if($recentblogs['EDITABLE'] === true) {?>
+                <a href="<?php e($base_url.'&arg=deleteblog&id='.
+                $recentblogs['TIMESTAMP']); ?>"><?php
+                e(tl('blogpages_element_deleteblog'));
+            ?></a><?php } ?></tr>
+            <?php
+        } ?>
+        </table>
+        <?php } ?>
+        </form>
+<?php
+    }
+}
+?>
+
+
+
diff --git a/views/elements/createblogpages_element.php b/views/elements/createblogpages_element.php
new file mode 100644
index 0000000..890eac6
--- /dev/null
+++ b/views/elements/createblogpages_element.php
@@ -0,0 +1,108 @@
+<?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
+{
+    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 id="createBlogForm" 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><td><label for="source-type"><b><?php
+            e(tl('createblogpages_element_sourcetype'))?></b></label></td><td>
+            <?php $this->view->optionsHelper->render("source-type",
+            "sourcetype", $data['SOURCE_TYPES'],
+                $blogs['TYPE']);?></td></tr>
+        <tr><td><label for="type-name"><b><?php
+            e(tl('createblogpages_element_typename'))?></b></label></td><td>
+        <input type="text" id="source-name" name="title"
+                value = "<?php e($blogs['NAME']);  ?>"
+                maxlength="80" class="wide-field" /></td></tr>
+        <tr><td><label for="source-locale-tag"><b id="locale-text"><?php
+            e(tl('searchsources_element_locale_tag'))?></b></label></td><td>
+            <?php $this->view->optionsHelper->render("source-locale-tag",
+                "sourcelocaletag", $data['LANGUAGES'],
+                 $data['SOURCE_LOCALE_TAG']); ?></td></tr>
+        </table>
+
+        <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="addblog" />
+
+        <table class="name-table">
+        <tr><td><label for="select-group"><b><?php
+                e(tl('createblogpages_element_add_group'))?></b></label></td>
+            <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($blogs['DESCRIPTION']);
+        ?></textarea>
+        <div class="center slight-pad"><button class="button-box"
+            type="submit"><?php e(tl('createblogpages_element_save_page'));
+            ?></button></div>
+        </div>
+        </form>
+<?php
+    }
+}
+?>
diff --git a/views/elements/editblogpages_element.php b/views/elements/editblogpages_element.php
new file mode 100644
index 0000000..20bd3b7
--- /dev/null
+++ b/views/elements/editblogpages_element.php
@@ -0,0 +1,267 @@
+<?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
+{
+    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'];
+    ?>
+        <?php if(isset($data['EDIT_BLOGS'])) { ?>
+            <div id="transfer">
+            <div class="overlay">
+            <form id ="Blogform" 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
+            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'))?>
+        <?php if($data['IS_OWNER'] === true) { ?>
+        <?php foreach($data['EDIT_BLOGS'] as $editblogs) {?>
+            <font size= '5'>
+            [<a href = "<?php e($base_url.'&arg=editdescription&id='.
+            $editblogs['TIMESTAMP']); ?>"><?php 
+            e(tl('editblogpages_element_edit_settings'));?></a>]</font>
+            <font size= '5'>[<a href="#" onclick='return showOverlay();'><?php 
+            e(tl('editblogpages_element_transfer')); ?></a>]</font><?php } }?>
+            </h2>
+        <?php if(($data['IS_EDIT_DESC'])===true) { ?>
+          <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="blogPages" />
+        <input type="hidden" name="arg" value="addbloggroup" />
+        <tr><td><label for="select-group"><b><?php
+           e(tl('createblogpages_element_add_group'))?></b></label></td>
+        <td><?php $this->view->optionsHelper->render("select-group",
+                    "selectgroup", $data['GROUP_NAMES'],
+                    $data['SELECT_GROUP']); ?></td>
+        </td><td><button class="button-box" type="submit"><?php
+                      e(tl('editblgpages_element_submit')); ?></button>
+                    </td></tr>
+       <?php if(isset($data['BLOG_GROUP'])) {?>
+            <?php if(count($data['BLOG_GROUP'])>0){ ?>
+            <table class="role-table"><?php 
+                foreach($data['BLOG_GROUP'] as $bloggroup) {?>
+            <tr><td><?php e($bloggroup['GROUP_NAME']); ?></td>
+            <td>  <a href="<?php e($base_url.'&arg=deletebloggroup&id='.
+                $bloggroup['TIMESTAMP'].'&gid='.$bloggroup['ID']); ?>"><?php
+                e(tl('editblogpages_element_deleteblog'));
+            ?></a></td></tr><?php }?></table> <?php } } }?> </form>
+
+
+
+        <form id="editBlogForm" method="post" action='#'>
+        <input type="hidden" name="<?php e(CSRF_TOKEN); ?>" value="<?php
+            e($data[CSRF_TOKEN]); ?>" />
+        <input type="hidden" name="a" value="blogPages" />
+        <?php if(($data['IS_EDIT_DESC'])===true) {?>
+        <input type="hidden" name="arg" value="updatedescription" />
+        <?php } ?>
+        <?php if(($data['IS_EDIT_FEED'])===true) { ?>
+        <input type="hidden" name="arg" value="updatefeed" />
+        <?php } ?>
+        <?php if(($data['IS_ADD_BLOG'])===true) { ?>
+        <input type="hidden" name="arg" value="addfeeditem" />
+        <?php } ?>
+
+
+         <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(($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 $editblogs) { ?>
+            <?php $this->view->optionsHelper->render("source-type",
+            "sourcetype", $data['SOURCE_TYPES'],
+                $editblogs['TYPE']);?></td></tr>
+
+            <tr><td><label for="type-name"><b><?php
+            e(tl('editblogpages_element_typename'))?></b></label></td><td>
+            <input type="text" id="source-name" name="title"
+                value = "<?php e($editblogs['NAME']);  ?>"
+                maxlength="80" class="wide-field" /></td></tr>
+
+            <tr><td><label for="source-locale-tag"><b id="locale-text"><?php
+               e(tl('searchsources_element_locale_tag'))?></b></label></td><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($editblogs['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><td><label for="source-type"><b><?php
+            e(tl('editblogpages_element_sourcetype'))?></b></label></td><td>
+        <?php foreach($data['EDIT_BLOGS'] as $editblogs) {?>
+        <p><?php e($editblogs['TYPE']); ?></p></tr>
+        <tr><td><label for="type-name"><b> <?php } ?> <?php
+            e(tl('editblogpages_element_typename'))?></b></label></td><td>
+        <?php foreach($data['EDIT_BLOGS'] as $editblogs) { ?>
+        <p><?php e($editblogs['NAME']);  ?></p></tr>
+        <tr><td><label for="source-locale-tag"><b id="locale-text"><?php
+            e(tl('searchsources_element_locale_tag'))?></b></label></td><td>
+            <p><?php e($data['SOURCE_LOCALE_TAG']); ?></p></tr>
+        <tr><td><label for="descriptionfield"><b><?php
+            e(tl('editblogpages_element_description'));?></b></label></td><td>
+        
+        <?php foreach($data['EDIT_BLOGS'] as $editblogs) {?>
+            <p><?php e($editblogs['DESCRIPTION']);?></p></td><?php } ?>
+       </table>
+             <?php } ?>
+        <?php  if(($data['IS_ADD_BLOG'])===true) {?>
+            <table><tr><div class="top-margin">
+                    <label for="descriptionfield"><b><?php
+            e(tl('editblogpages_element_feeditems'));?></b></label></div>
+            <input type="text" id="source-name" name="titleentry"
+                value = "<?php e($blogs['NAME']);  ?>"
+                maxlength="80" class="wide-field" /></tr></table>
+            <table><tr><textarea class="small-text-area" id="descriptionfield"
+            name="description"><?php e($blogs['DESCRIPTION']);?></textarea></tr>
+            </table>
+        <div class="center slight-pad"><button class="button-box"
+            type="submit"><?php e(tl('editblogpages_element_save_page'));
+            ?></button></div>
+        <?php } ?>
+
+          <?php if(($data['IS_EDIT_FEED'])===true) { ?>
+                
+            <tr><td><label for="type-name"><b><?php
+            e(tl('editblogpages_element_typename'))?></b></label></td><td>
+            <input type="text" id="source-name" name="title"
+                value = "<?php e($data['FEED_ITEMS']['']['title']);  ?>"
+                maxlength="80" class="wide-field" /></td></tr>
+
+                <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 
+            e($data['FEED_ITEMS']['']['description']);?></textarea>
+        <div class="center slight-pad"><button class="button-box"
+            type="submit"><?php e(tl('editblogpages_element_save_page'));
+            ?></button></div>
+        <?php } else if((!$data['IS_ADD_BLOG'])===true){?>
+        [<a href = "<?php e($base_url.'&arg=addblogentry&id='.
+            $editblogs['TIMESTAMP']); ?>"><?php 
+            e(tl('editblogpages_element_add_blogentry'));?></a>]
+        <?php if(count($data['FEED_ITEMS']) > 0) { ?>
+        <div class="top-margin"><label for="descriptionfield"><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 colspan="3"><?php e(tl('editblogpages_element_action'));?></th></tr>
+        <?php foreach($data['FEED_ITEMS'] as $feeditems) {?>
+            <tr><td><?php e($feeditems['title']);?></td>
+            <td><?php e($feeditems['description']); ?></td> 
+
+        <td><?php 
+        if($feeditems['IS_OWNER'] === true || $data['IS_OWNER'] === true) {?>
+                <a href="<?php e($base_url.'&arg=editfeed&id='.
+                $editblogs['TIMESTAMP'].'&fid='.$feeditems['guid']); ?>"><?php
+                e(tl('editblogpages_element_editblog')); ?></a>
+                <?php } ?>
+                </td>
+        <td><?php 
+        if($feeditems['IS_OWNER'] === true || $data['IS_OWNER'] === true) { ?>
+                    <a href="<?php e($base_url.'&arg=deletefeed&id='.
+                    $feeditems['guid']); ?>"><?php 
+                e(tl('editblogpages_element_deleteblog'));?></a>
+                <?php } ?></td></tr>
+            <?php } ?><?php }} }?>
+        </table>
+        </form>
+        <script type="text/javascript">
+        function showOverlay()
+        {
+            elt('transfer').style.visibility = "visible";
+        }
+        function closeOverlay()
+        {
+            elt('transfer').style.visibility = "hidden";
+        }
+        </script>
+    </div>
+<?php
+    }
+}
+?>
diff --git a/views/elements/managegroups_element.php b/views/elements/managegroups_element.php
index e53dbb9..095b261 100644
--- a/views/elements/managegroups_element.php
+++ b/views/elements/managegroups_element.php
@@ -186,16 +186,16 @@ class ManagegroupsElement extends Element
                 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
+                       <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']); ?>
                             </td><td><a href="<?php
-                                e($base_url . $group_user['GROUP_ID']. '&amp;'.
+                                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'))
-- 
1.8.1

