function web_statistics()
 {
     $content_template = $this->load_template($this->_template_root . 'web_statistics.xml');
     $sm = vivvo_lite_site::get_instance();
     $db =& $sm->get_db();
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Categories.class.php';
     $cat_list = new Categories_list();
     $content_template->assign('website_categories', strval($cat_list->get_count()));
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Tags.class.php';
     $tag_list = new Tags_list();
     $content_template->assign('website_tags', strval($tag_list->get_count()));
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Articles.class.php';
     $articles_list = new Articles_list();
     $content_template->assign('website_articles', strval($articles_list->get_count()));
     $content_template->assign('website_articles_active', strval($articles_list->get_count(array('search_status' => 1))));
     $res = $db->query('SELECT sum(times_read) as times_view FROM ' . VIVVO_DB_PREFIX . 'articles_stats');
     if (!PEAR::isError($res)) {
         if ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
             $times_view = $row['times_view'];
         }
     }
     $content_template->assign('website_articles_view', intval($times_view));
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Comments.class.php';
     $comments_list = new Comments_list();
     $content_template->assign('website_comments', strval($comments_list->get_count()));
     $user_mng = $sm->get_user_manager();
     $user_list = $user_mng->get_user_list();
     $content_template->assign('system_staff', strval($user_list->get_count(array('search_user_type' => 'staff'))));
     return $content_template->get_output();
 }
Esempio n. 2
0
 /**
  * Delete category image
  *
  * @param	integer	$category_id
  * @return	boolean	true on success or false on fail
  */
 function delete_image($category_id)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('category_deleteImage', array(&$category_id))) {
         return vivvo_hooks_manager::get_status();
     }
     $sm = vivvo_lite_site::get_instance();
     if ($sm->user) {
         if ($sm->user->is_admin()) {
             $category_list = new Categories_list();
             $category = $category_list->get_category($category_id);
             if ($category !== false) {
                 $fm = $sm->get_file_manager();
                 if ($category->image != '') {
                     if ($fm->delete_fs(VIVVO_FS_ROOT . VIVVO_FS_FILES_DIR . $category->image)) {
                         $category->set_image('');
                         $this->_post_master->set_data_object($category);
                         if ($this->_post_master->sql_update()) {
                             admin_log($sm->user->get_username(), 'Edited category #' . $category_id);
                             return true;
                         } else {
                             $this->set_error_code(2117);
                             return false;
                         }
                     }
                 }
             } else {
                 $this->set_error_code(2118);
                 return false;
             }
         } else {
             $this->set_error_code(2119);
             return false;
         }
     } else {
         $this->set_error_code(2120);
         return false;
     }
 }