Пример #1
0
function categoryEdit()
{
    $page = new page();
    $categ = new category();
    if (isset($_GET['cid']) and $_GET['cid'] != 0) {
        $id = $_GET['cid'];
    } else {
        $id = 0;
    }
    $editthis = $categ->get($id);
    $msg = $page->processCategory();
    $get_all_categories = $categ->getAlltree($editthis['par_id']);
    $page->printCategoryForm($get_all_categories, $editthis['name'], $id, $msg);
}
Пример #2
0
 public function categories()
 {
     if (!$this->user->is_logged_in()) {
         redirect("/user/main/userLogin", 'location');
     } else {
         $category = new category(-1);
         $data['objects'] = $category->get();
         $data['id_user'] = $this->user->get_id();
         $this->show->set_user_backend();
         $this->show->user_backend('show_category_objects', $data);
     }
 }
 public function fix_shardAction()
 {
     $category = new category();
     $categories = $category->select($count, array('filter' => array('shard' => true)));
     echo 'Total categories: ' . $count . '<br>';
     if (is_array($categories) && count($categories)) {
         foreach ($categories as $category) {
             echo 'Fix shard: ' . $category->get('category') . '<br>';
             $category->fix_shard($category->get('id'));
             //sleeup(1);
         }
     }
     die('ok');
 }
Пример #4
0
 private function watch_cat($data)
 {
     if ($this->user['SiteRank'] >= 4) {
         if (isset($data['cat'])) {
             $watchingStatus = false;
             $key = 0;
             $watchersCSV = '';
             // Get category data
             $category = category::get($data['cat']);
             // Parse watching
             $watchers = explode(',', $category['watching']);
             // Check array
             if (($key = array_search($this->user['Username'], $watchers)) !== false) {
                 unset($watchers[$key]);
                 $watchersCSV = implode(',', $watchers);
             } else {
                 // Add user to watching
                 $watchingStatus = true;
                 array_push($watchers, $this->user['Username']);
                 $watchersCSV = implode(',', $watchers);
             }
             // Update DB
             category::watch($category['id'], $watchersCSV);
             json::resp(array('success' => true, 'watching' => $watchingStatus));
         }
     }
 }