示例#1
0
 /**
  * Setting links up in my account
  */
 function setting_up_collections()
 {
     global $userquery, $Cbucket;
     $per = $userquery->get_user_level(userid());
     // Adding My Account Links
     if (isSectionEnabled('collections')) {
         $userquery->user_account[lang('Collections')] = array(lang('add_new_collection') => "manage_collections.php?mode=add_new", lang('manage_collections') => "manage_collections.php", lang('manage_favorite_collections') => "manage_collections.php?mode=favorite");
     }
     // Adding Search Type
     if (isSectionEnabled('collections')) {
         $Cbucket->search_types['collections'] = "cbcollection";
     }
     // Adding Collection links in Admin Area
     $menu = array('title' => lang('Collections Manager'), 'icon' => 'icon-th', 'id' => 'collections-manager', 'access' => 'collection_moderation');
     $sub_menu = array('collections-manager' => array(array('title' => lang('Manage Collections'), 'link' => 'collection_manager.php'), array('title' => lang('Manage Categories'), 'link' => 'collection_category.php'), array('title' => lang('Flagged Collections'), 'link' => 'flagged_collections.php')));
     add_admin_menu($menu);
     add_admin_sub_menus($sub_menu);
     // Adding Collection links in Cbucket Class
     $Cbucket->links['collections'] = array('collections.php', 'collections/');
     $Cbucket->links['manage_collections'] = array('manage_collections.php', 'manage_collections.php');
     $Cbucket->links['edit_collection'] = array('manage_collections.php?mode=edit_collection&cid=', 'manage_collections.php?mode=edit_collection&cid=');
     $Cbucket->links['manage_items'] = array('manage_collections.php?mode=manage_items&cid=%s&type=%s', 'manage_collections.php?mode=manage_items&cid=%s&type=%s');
     $Cbucket->links['user_collections'] = array('user_content.php?object_group=content&object=collections&user='******'user_content.php?object_group=content&object=collections&user='******'user_fav_collections'] = array('user_content.php?object_group=content&object=collections&content_type=favorite&user='******'user_content.php?object_group=content&object=collections&content_type=favorite&user=');
 }
示例#2
0
 /**
  * Function used to add feed in user feed file
  * @param array
  * action => upload,joined,comment,created
  * object => video, photo, group
  * object_id => id of object
  * object_details => details of object
  * uid => user id
  * udetails => user details array
  */
 function addFeed($feed)
 {
     if (!isSectionEnabled('feeds')) {
         return false;
     }
     global $userquery;
     $uid = $feed['uid'];
     if (!$uid) {
         return false;
     }
     $ufeed = array();
     //Verifying feed action and object
     $action = $this->action($feed['action']);
     $object = $this->getObject($feed['object']);
     if (!$action || !$object) {
         return false;
     }
     //Setting user feed array
     $ufeed['action'] = $action;
     $ufeed['object'] = $object;
     $ufeed['object_id'] = $feed['object_id'];
     $ufeed['userid'] = $uid;
     $ufeed['time'] = time();
     //Unsetting feed array
     unset($feed);
     //Getting user feed file
     $feedFile = $this->getFeedFile($uid);
     //Convering feed using json
     $feed = json_encode($ufeed);
     //Creating unique md5 of feed
     $feedmd5 = md5($feed);
     $ufeed['md5'] = $feedmd5;
     //Recreating Feed
     $feed = json_encode($ufeed);
     //Appending feed in a file
     $file = fopen($feedFile, 'a+');
     fwrite($file, $feed);
     fclose($file);
     //Tada <{^-^}>
 }
示例#3
0
 /**
  * __Constructor of CBVideo
  */
 function init()
 {
     global $Cbucket, $cb_columns;
     $this->cat_tbl = 'video_categories';
     $this->section_tbl = 'video';
     $this->use_sub_cats = TRUE;
     $this->init_actions();
     $this->init_collections();
     if (config('vid_cat_height')) {
     }
     $this->cat_thumb_height = config('vid_cat_height');
     if (config('vid_cat_width')) {
     }
     $this->cat_thumb_width = config('vid_cat_width');
     if (isSectionEnabled('videos')) {
         $Cbucket->search_types['videos'] = "cbvid";
     }
     $Cbucket->clipbucket_footer[] = 'check_cbvideo';
     $this->video_delete_functions[] = 'delete_video_from_collection';
     $basic_fields = array('videoid', 'videokey', 'userid', 'title', 'server_ip', 'description', 'tags', 'category', 'file_directory', 'active', 'date_added', 'broadcast', 'rating', 'file_server_path', 'files_thumbs_path', 'file_thumbs_count', 'duration', 'has_hq', 'has_mobile', 'views', 'file_name', 'rated_by', 'default_thumb', 'comments_count', 'last_viewed', 'featured', 'featured_date', 'status');
     $cb_columns->object('videos')->register_columns($basic_fields);
     #$this->basic_fields_setup();
 }
示例#4
0
 /**
  * Setting links up in my account Edited on 12 march 2014 for collections links
  */
 function setting_up_collections()
 {
     global $userquery, $Cbucket;
     $per = $userquery->get_user_level(userid());
     // Adding My Account Links
     if (isSectionEnabled('collections')) {
         $userquery->user_account[lang('Collections')] = array(lang('add_new_collection') => cblink(array('name' => 'manage_collections', 'extra_params' => 'mode=add_new')), lang('manage_collections') => cblink(array('name' => 'manage_collections')), lang('manage_favorite_collections') => cblink(array('name' => 'manage_collections', 'extra_params' => 'mode=favorite')));
     }
     // Adding Search Type
     //if(isSectionEnabled('collections'))
     //$Cbucket->search_types['collections'] = "cbcollection";
     // Adding Collection links in Admin Area
     if ($per['collection_moderation'] == "yes") {
         $Cbucket->AdminMenu['Collections'] = array(lang('Manage Collections') => 'collection_manager.php', lang('Manage Categories') => 'collection_category.php', lang('Flagged Collections') => 'flagged_collections.php');
     }
     // Adding Collection links in Cbucket Class
     $Cbucket->links['collections'] = array('collections.php', 'collections/');
     $Cbucket->links['manage_collections'] = array('manage_collections.php', 'manage_collections.php');
     $Cbucket->links['edit_collection'] = array('manage_collections.php?mode=edit_collection&amp;cid=', 'manage_collections.php?mode=edit_collection&amp;cid=');
     $Cbucket->links['manage_items'] = array('manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s', 'manage_collections.php?mode=manage_items&amp;cid=%s&amp;type=%s');
     $Cbucket->links['user_collections'] = array('user_collections.php?mode=uploaded&user='******'user_collections.php?mode=uploaded&user='******'user_fav_collections'] = array('user_collections.php?mode=favorite&user='******'user_collections.php?mode=favorite&user=');
 }
示例#5
0
 /**
  * Constructor function to set values of tables
  */
 function CBGroups()
 {
     global $Cbucket;
     $this->cat_tbl = 'group_categories';
     $this->gp_tbl = 'groups';
     $this->gp_mem_tbl = 'group_members';
     //We will using CB Commenting system as posts
     //$this->gp_post_tbl = 'group_posts';
     $this->gp_topic_tbl = 'group_topics';
     $this->gp_invite_tbl = 'group_invitations';
     $this->gp_vdo_tbl = 'group_videos';
     //Adding Actions such Report, share,fav etc
     $this->action = new cbactions();
     $this->action->type = 'g';
     $this->action->name = 'group';
     $this->action->obj_class = 'cbgroup';
     $this->action->check_func = 'group_exists';
     $this->action->type_tbl = $this->gp_tbl;
     $this->action->type_id_field = 'group_id';
     if (isSectionEnabled('groups')) {
         $Cbucket->search_types['groups'] = "cbgroup";
     }
 }
示例#6
0
 /**
  * Function used to rate video
  */
 function rate_video($id, $rating)
 {
     global $db, $myquery, $userquery;
     if (!is_numeric($rating) || $rating <= 9) {
         $rating = 0;
     }
     if ($rating >= 10) {
         $rating = 10;
     }
     $rating_details = $this->get_video_rating($id);
     $voter_id = $rating_details['voter_ids'];
     $new_by = $rating_details['rated_by'];
     $newrate = $rating_details['rating'];
     if (phpversion < '5.2.0') {
         global $json;
     }
     $js = $json;
     $Oldvoters = explode('|', $voter_id);
     if (is_array($Oldvoters) && count($Oldvoters) > 2) {
         foreach ($Oldvoters as $voter) {
             if ($voter) {
                 $voters[$voter] = array("userid" => $voter, "time" => now(), "method" => 'old');
             }
         }
     } else {
         if (!empty($js)) {
             $voters = $js->json_decode($voter_id, TRUE);
         } else {
             $voters = json_decode($voter_id, TRUE);
         }
     }
     if (!empty($voters)) {
         $already_voted = array_key_exists(userid(), $voters);
     }
     if (!userid()) {
         e(lang("please_login_to_rate"));
     } elseif (userid() == $rating_details['userid'] && !config('own_video_rating')) {
         e(lang("you_cant_rate_own_video"));
     } elseif (!empty($already_voted) && !1) {
         e(lang("you_hv_already_rated_vdo"));
     } elseif (!config('video_rating') || $rating_details['allow_rating'] != 'yes') {
         e(lang("vid_rate_disabled"));
     } else {
         $voters[userid()] = array("userid" => userid(), "username" => username(), "time" => now(), "rating" => $rating);
         $total_voters = count($voters);
         if (!empty($js)) {
             $voters = $js->json_encode($voters);
         } else {
             $voters = json_encode($voters);
         }
         $t = $rating_details['rated_by'] * $rating_details['rating'];
         //$new_by = $rating_details['rated_by'] + 1;
         $new_by = $total_voters;
         $newrate = ($t + $rating) / $new_by;
         if ($newrate > 10) {
             $newrate = 10;
         }
         $newrate = round($newrate + 0.49, 0);
         $db->update(tbl($this->dbtbl['video']), array("rating", "rated_by", "voter_ids"), array($newrate, $new_by, "|no_mc|{$voters}"), " videoid='{$id}'");
         $userDetails = array("object_id" => $id, "type" => "video", "time" => now(), "rating" => $rating, "userid" => userid(), "username" => username());
         /* Updating user details */
         update_user_voted($userDetails);
         $like_array = array('userid' => userid(), 'type' => 'v', 'object_id' => $id);
         if ($rating > 1) {
             $myquery->add_like($like_array);
         } else {
             $myquery->add_dislike($like_array);
         }
         if (isSectionEnabled('feeds')) {
             //ADding feed
             global $cbfeeds;
             if ($rating > 1) {
                 $object = $this->get_content($id);
                 $user = $userquery->udetails;
                 $feed_array = array('userid' => userid(), 'user' => $user, 'object' => $object, 'object_id' => $id, 'object_type' => 'video', 'is_activity' => 'yes', 'action' => 'like_video');
                 $cbfeeds->add_feed($feed_array);
             } else {
                 $feed_array = array('userid' => userid(), 'object_id' => $id, 'object_type' => 'video', 'is_activity' => 'yes', 'action' => 'like_video');
                 $cbfeeds->delete_feed($feed_array);
             }
         }
         e(lang("thnx_for_voting"), "m");
     }
     $result = array('rating' => $newrate, 'ratings' => $new_by, 'total' => 10, 'id' => $id, 'type' => 'video', 'disable' => 'disabled');
     return $result;
     /*
      Following code is unused
      $niddle = "|";
      $niddle .= userid();
      $niddle .= "|";
      $flag = strstr($voter_id, $niddle);
     
      //checking if raings are allowed or not
      $vid_rating = config('video_rating');
     
      if(!userid())
      e(lang("please_login_to_rate"));
      elseif(userid()==$rating_details['userid'] && !config('own_video_rating'))
      e(lang("you_cant_rate_own_video"));
      elseif(!empty($flag))
      e(lang("you_hv_already_rated_vdo"));
      elseif(!config('video_rating') || $rating_details['allow_rating'] !='yes' )
      e(lang("vid_rate_disabled"));
      else
      {
      if(empty($voter_id))
      $voter_id .= "|";
      $voter_id .= userid();
      $voter_id .= "|";
      $t = $rating_details['rated_by'] * $rating_details['rating'];
      $new_by = $rating_details['rated_by'] + 1;
      $newrate = ($t + $rating) / $new_by;
     
      $db->update(tbl($this->dbtbl['video']),array("rating","rated_by","voter_ids"),array($newrate,$new_by,$voter_id)," videoid='$id'");
      e(lang("thnx_for_voting"),"m");
      }
     
      $result = array('rating'=>$newrate,'ratings'=>$new_by,'total'=>10,'id'=>$id,'type'=>'video','disable'=>'disabled');
      return $result;
     */
 }
示例#7
0
 | @ Author   : ArslanHassan									
 | @ Software : ClipBucket , © PHPBucket.com					
 *****************************************************************
*/
define('THIS_PAGE', 'search_result');
require 'includes/config.inc.php';
$pages->page_redir();
$page = mysql_clean($_GET['page']);
$type = mysql_clean(strtolower($_GET['type']));
$type = $type ? $type : 'videos';
$chkType = $type;
//Checking if search for specific section is allowed or not
if ($type == 'users') {
    $chkType = 'channels';
}
isSectionEnabled($chkType, true);
$search = cbsearch::init_search($type);
$search->key = mysql_clean($_GET['query']);
if (!is_array($_GET['category'])) {
    $_GET['category'] = mysql_clean($_GET['category']);
}
if ($type != 'videos') {
    $search->category = $_GET['category'];
} else {
    $child_ids = array();
    if ($_GET['category']) {
        foreach ($_GET['category'] as $category) {
            $childs = $cbvid->get_sub_categories(mysql_clean($category));
            if ($childs) {
                foreach ($childs as $child) {
                    $child_ids[] = $child['category_id'];
示例#8
0
$Cbucket->addJS('amplify/amplify.request.min.js');
$Cbucket->addJS('amplify/amplify.store.min.js');
$Cbucket->addJS('amplify_requests.js');
//Assigning JS Files
Assign('jsArray', $Cbucket->JSArray);
//Assigning Module Files
Assign('module_list', $Cbucket->moduleList);
//Checking Website is closed or not
if (config('closed') && THIS_PAGE != 'ajax' && !$in_bg_cron && THIS_PAGE != 'cb_install') {
    if (!has_access("admin_access", TRUE)) {
        e($row['closed_msg'], "w");
        template("global_header.html");
        template("message.html");
        exit;
    } else {
        e(lang("ATTENTION: THIS WEBSITE IS IN OFFLINE MODE"), "w");
    }
}
//Configuring Uploader
uploaderDetails();
register_filter('photo_action_links', 'cbphoto_pm_action_link_filter');
attach_photo_pm_handlers();
if (!IN_MODULE) {
    isSectionEnabled(PARENT_PAGE, true);
}
//setting quicklist
assign('total_quicklist', $cbvid->total_quicklist());
//Adding Template functions
if ($Cbucket->template_details['php_file']) {
    include $Cbucket->template_details['php_file'];
}
示例#9
0
     }
     break;
 case 'recently_added':
     if (!isSectionEnabled('videos') || !$userquery->perm_check('view_videos', false, true)) {
         exit;
     }
     $videos = get_videos(array('limit' => config('videos_items_hme_page'), 'order' => 'date_added DESC'));
     if ($videos) {
         foreach ($videos as $video) {
             assign('video', $video);
             Template('blocks/video.html');
         }
     }
     break;
 case 'featured_videos':
     if (!isSectionEnabled('videos') || !$userquery->perm_check('view_videos', false, true)) {
         exit;
     }
     $videos = get_videos(array('limit' => config('videos_items_hme_page'), 'featured' => 'yes', 'order' => 'featured_date DESC'));
     if ($videos) {
         foreach ($videos as $video) {
             assign('video', $video);
             Template('blocks/video.html');
         }
     }
     break;
 case 'rating':
     switch ($_POST['type']) {
         case "video":
             $rating = $_POST['rating'] * 2;
             $id = $_POST['id'];
示例#10
0
/**
 * This function returns the provided menu. If no name is passed
 * navigation menu will load automatically.
 * 
 * @global object $Cbucket
 * @param array $params
 * @return string 
 */
function cbMenu($params = NULL)
{
    global $Cbucket;
    $name = $params['name'];
    if (!$name) {
        $name = 'navigation';
    }
    $menu = get_menu($name);
    $params['show_icons'] = $params['show_icons'] ? $params['show_icons'] : 'yes';
    if ($menu) {
        foreach ($menu as $item) {
            $continue = true;
            if ($item['section'] && !isSectionEnabled($item['section'])) {
                $continue = false;
            }
            if ($continue == true) {
                $selected = current_page(array('page' => $item['section']));
                $icon = '';
                $output .= '<li';
                $output .= " id='" . SEO(strtolower($name)) . "-" . $item['id'] . "' ";
                $classes = $params['class'] ? $params['class'] : '';
                if ($selected) {
                    $classes .= ' active';
                }
                $output .= " class='{$classes}'  ";
                if ($item['icon'] && $params['show_icons'] == 'yes') {
                    $icon = "<i class='" . $item['icon'] . "'></i> ";
                }
                $output .= "" . $params['extra_params'] ? $params['extra_params'] : '' . ">";
                $output .= "<a href='" . $item['link'] . "' target='" . $item['target'] . "'>" . $icon . $item['title'] . "</a>";
                $output .= "</li>";
            }
        }
        if ($params['assign']) {
            assign($params['assign'], $output);
        } else {
            return $output;
        }
    }
    //pr( $menu , true );
    //return $Cbucket->cbMenu($params);
}
示例#11
0
 /**
  * Setting other things
  */
 function setting_other_things()
 {
     global $userquery, $Cbucket;
     // Search type
     if (isSectionEnabled('photos')) {
         $Cbucket->search_types['photos'] = "cbphoto";
     }
     // My account links
     $accountLinks = array();
     $accountLinks = array(lang('manage_photos') => "manage_photos.php", lang('manage_favorite_photos') => "manage_photos.php?mode=favorite", lang('Manage Avatars') => "manage_photos.php?mode=avatars", lang('manage_my_album') => "manage_photos.php?mode=my_album");
     if (isSectionEnabled('photos')) {
         $userquery->user_account[lang('Photos')] = $accountLinks;
     }
     //Setting Cbucket links
     $Cbucket->links['photos'] = array('photos.php', 'photos/');
     $Cbucket->links['manage_photos'] = array('manage_photos.php', 'manage_photos.php');
     $Cbucket->links['edit_photo'] = array('edit_photo.php?photo=', 'edit_photo.php?photo=');
     $Cbucket->links['photo_upload'] = array('photo_upload.php', 'photo_upload');
     $Cbucket->links['manage_favorite_photos'] = array('manage_photos.php?mode=favorite', 'manage_photos.php?mode=favorite');
     $Cbucket->links['manage_orphan_photos'] = array('manage_photos.php?mode=orphan', 'manage_photos.php?mode=orphan');
     $Cbucket->links['user_photos'] = array('user_content.php?object_group=content&object=photos&user='******'user_content.php?object_group=content&object=photos&user='******'user_fav_photos'] = array('user_content.php?object_group=content&object=photos&content_type=favorite&user='******'user_content.php?object_group=content&object=photos&content_type=favorite&user='******'navigation', lang('Photos'), cblink(array("name" => "photos")), "photos", "icon-picture icon-white");
     // Adding photo upload options
     register_upload_option(array('object' => 'photos', 'title' => lang('Upload from computer'), 'description' => lang('Upload photos from your computer. Supported formats are <i>' . implode(', ', $this->exts) . '</i>'), 'function' => 'load_photo_plupload_block'));
     $plupload_js_files = array(MODULES_URL . '/uploader/plupload/plupload.js', MODULES_URL . '/uploader/plupload/plupload.html5.js', MODULES_URL . '/uploader/plupload/plupload.flash.js');
     add_js($plupload_js_files, 'photo_upload');
 }
示例#12
0
 /**
  * Confirms if section is enabled or not
  * @param array $content
  * @param array $key_details
  * @return boolean
  */
 function _confirm_section_enabled($content, $key_details)
 {
     if ($section = array_find('is_section', $key_details)) {
         if (strpos($section, "|") !== false) {
             $section_key = end(explode("|", $section));
         } else {
             $section_key = $key_details[0];
         }
         if (!isSectionEnabled($section_key)) {
             return true;
         }
         return false;
     }
 }
示例#13
0
 /**
  * My Account links
  */
 function my_account_links()
 {
     $array[lang('account')] = array(lang('my_account') => 'myaccount.php', lang('block_users') => 'edit_account.php?mode=block_users', lang('user_change_pass') => 'edit_account.php?mode=change_password', lang('user_change_email') => 'edit_account.php?mode=change_email', lang('com_manage_subs') => 'edit_account.php?mode=subscriptions');
     $array[lang('user_channel_profiles')] = array(lang('account_settings') => 'edit_account.php?mode=account', lang('user_profile_settings') => 'edit_account.php?mode=profile', lang('change_avatar') => 'edit_account.php?mode=avatar_bg', lang('change_bg') => 'edit_account.php?mode=avatar_bg');
     if (isSectionEnabled('videos')) {
         $array[lang('videos')] = array(lang('uploaded_videos') => 'manage_videos.php', lang('user_fav_videos') => 'manage_videos.php?mode=favorites');
     }
     if (isSectionEnabled('groups')) {
         $array[lang('groups')] = array(lang('grp_groups_title') => 'manage_groups.php', lang('user_create_group') => cblink(array('name' => 'create_group')), lang('grp_joined_groups') => 'manage_groups.php?mode=joined');
     }
     if (isSectionEnabled('playlists')) {
         $array[lang('playlists')] = array(lang('manage_playlists') => 'manage_playlists.php', lang('video_playlists') => 'manage_playlists.php?mode=manage_video_playlist');
         global $cbvid;
         $builtin_playlists = $cbvid->builtin_playlists;
         if ($builtin_playlists) {
             foreach ($builtin_playlists as $playlist) {
                 $pid = $playlist['playlist_id'];
                 $category = $playlist['category'];
                 $name = lang($category);
                 $array[lang('playlists')][$category] = 'manage_playlists.php?' . 'mode=edit_playlist' . '&pid=' . $pid . '&category=' . $category;
             }
         }
     }
     $array[lang('messages')] = array(lang('inbox') => 'private_message.php?mode=inbox', lang('notifications') => 'private_message.php?mode=notification', lang('sent') => 'private_message.php?mode=sent', lang('title_crt_new_msg') => cblink(array('name' => 'compose_new')));
     if (isSectionEnabled('channels')) {
         $array[lang('contacts')] = array(lang('com_manage_contacts') => 'manage_contacts.php?mode=manage', lang('add_contact_list') => 'manage_contacts.php?mode=new_group');
     }
     if (count($this->user_account) > 0) {
         foreach ($this->user_account as $key => $acc) {
             if (array_key_exists($key, $array)) {
                 foreach ($acc as $title => $link) {
                     $array[$key][$title] = $link;
                 }
             } else {
                 $array[$key] = $acc;
             }
         }
         //$array = array_merge($array,$this->user_account);
     }
     return $array;
 }
示例#14
0
 /**
  * Setting other things
  */
 function setting_other_things()
 {
     global $userquery, $Cbucket;
     // Search type
     if (isSectionEnabled('photos')) {
         $Cbucket->search_types['photos'] = "cbphoto";
     }
     // My account links
     $accountLinks = array();
     $accountLinks = array(lang('manage_photos') => "manage_photos.php", lang('manage_favorite_photos') => "manage_photos.php?mode=favorite", lang('manage_my_album') => "manage_photos.php?mode=my_album");
     if (isSectionEnabled('photos')) {
         $userquery->user_account[lang('Photos')] = $accountLinks;
     }
     //Setting Cbucket links
     $Cbucket->links['photos'] = array('photos.php', 'photos/');
     $Cbucket->links['manage_photos'] = array('manage_photos.php', 'manage_photos.php');
     $Cbucket->links['edit_photo'] = array('edit_photo.php?photo=', 'edit_photo.php?photo=');
     $Cbucket->links['photo_upload'] = array('photo_upload.php', 'photo_upload');
     $Cbucket->links['manage_favorite_photos'] = array('manage_photos.php?mode=favorite', 'manage_photos.php?mode=favorite');
     $Cbucket->links['manage_orphan_photos'] = array('manage_photos.php?mode=orphan', 'manage_photos.php?mode=orphan');
     $Cbucket->links['user_photos'] = array('user_photos.php?mode=uploaded&amp;user='******'user_photos.php?mode=uploaded&amp;user='******'user_fav_photos'] = array('user_photos.php?mode=favorite&amp;user='******'user_photos.php?mode=favorite&amp;user=');
     // Setting Home Tab
 }
示例#15
0
 /**
  * function used to add an activity...
  */
 function like_feed($array)
 {
     global $userquery;
     if (!userid()) {
         return false;
     }
     $likes_data = $this->get_likes($array['feed_id']);
     $likes = json_decode($likes_data['likes'], true);
     $feed_id = $array['feed_id'];
     if ($array['liked'] == 'yes') {
         $likes_fields = array('userid', 'username', 'fullname');
         $user_fields = array();
         foreach ($likes_fields as $like_field) {
             $user_fields[$like_field] = $userquery->udetails[$like_field];
         }
         $likes[$userquery->udetails['userid']] = $user_fields;
     } else {
         unset($likes[$userquery->udetails['userid']]);
     }
     $total_likes = count($likes);
     db_update(tbl('feeds'), array('likes_count' => $total_likes, 'likes' => json_encode($likes)), " feed_id='{$feed_id}' ");
     /*
     
               $like_array = array(
               'userid' => userid(),
               'type' => 'feed',
               'object_id' => $id,
               );
     
               ?if ($rating > 1)
               {
               $myquery->add_like($like_array);
               }
               else
               {
               $myquery->add_dislike($like_array);
               } */
     if (isSectionEnabled('feeds')) {
         $feed = $this->get_feed($feed_id);
         if ($array['liked'] == 'yes') {
             $object = $feed['object'];
             $object = json_decode($object, true);
             $type = $feed['object_type'];
             $id = $feed['object_id'];
             if ($feed['content']) {
                 $content = $feed['content'];
                 if ($content) {
                     $content = json_decode($content, true);
                 }
                 $content['on'] = $object;
                 $content['on']['type'] = $type;
                 $content['on']['id'] = $id;
                 $object = $content;
                 $type = $feed['content_type'];
                 $id = $feed['content_id'];
             }
             $user = $userquery->udetails;
             $feed_array = array('userid' => userid(), 'message' => $feed['message'], 'user' => $user, 'object' => $object, 'object_id' => $id, 'object_type' => $type, 'content_id' => $feed['feed_id'], 'content_type' => $feed['action'], 'is_activity' => 'yes', 'action' => 'like_post');
             $this->add_feed($feed_array);
             if (1) {
                 //Adding like post notification
                 $ntif_params = array('action' => 'liked_post', 'feed_id' => $feed['feed_id'], 'object_id' => $id, 'object_type' => $type, 'object' => $object, 'actor_id' => userid(), 'userid' => $feed['userid'], 'actor' => get_content('user', $userquery->udetails));
                 $this->addNotification($ntif_params);
             }
         } else {
             $feed_array = array('feed_id' => $feed['feed_id'], 'userid' => userid(), 'action' => 'like_post');
             $this->delete_feed($feed_array);
         }
     }
     $result = array('total_likes' => $total_likes, 'likes_count' => $total_likes, 'likes' => $likes, 'liked' => $array['liked']);
     return $result;
 }
示例#16
0
 function cbMenu($params = NULL)
 {
     $this->head_menu($params);
     if (!$params['tag']) {
         //$params['tag'] = 'li';
         if (!$params['class']) {
             $params['class'] = '';
         }
     }
     if (!isset($params['getSubTab'])) {
         $params['getSubTab'] = '';
     }
     if (!isset($params['parentTab'])) {
         $params['parentTab'] = '';
     }
     if (!isset($params['selectedTab'])) {
         $params['selectedTab'] = '';
     }
     $headMenu = $this->head_menu;
     $custom = isset($this->custom_menu) ? $this->custom_menu : false;
     if (is_array($custom)) {
         $headMenu = array_merge($headMenu, $custom);
     }
     /* Excluding tabs from menu */
     if (isset($params['exclude'])) {
         if (is_array($params['exclude'])) {
             $exclude = $params['exclude'];
         } else {
             $exclude = explode(",", $params['exclude']);
         }
         foreach ($headMenu as $key => $hm) {
             foreach ($exclude as $ex) {
                 $ex = trim($ex);
                 if (strtolower(trim($hm['name'])) == strtolower($ex)) {
                     unset($headMenu[$key]);
                 }
             }
         }
     }
     $main_menu = array();
     foreach ($headMenu as $menu) {
         if (isSectionEnabled($menu['this'])) {
             $selected = current_page(array("page" => $menu['this']));
             if ($selected) {
                 $menu['active'] = true;
             }
             $main_menu[] = $menu;
         }
     }
     $output = "";
     //if(($params['tag']))
     //		$output .= "<".$params['tag'].">";
     foreach ($main_menu as $menu) {
         $selected = getArrayValue($menu, 'active');
         $output .= "<li ";
         $output .= "id = 'cb" . $menu['name'] . "Tab'";
         $output .= " class = '";
         if ($params['class']) {
             $output .= $params['class'];
         }
         if ($selected) {
             $output .= " selected";
         }
         $output .= "'";
         if (isset($params['extra_params'])) {
             $output .= $params['extra_params'];
         }
         $output .= ">";
         $output .= "<a href='" . $menu['link'] . "'>";
         $output .= $menu['name'] . "</a>";
         $output .= "</li>";
     }
     //if(($params['tag']))
     //		$output .= "</".$params['tag'].">";
     if (SMARTY_VERSION < 3) {
         if ($params['echo']) {
             echo $output;
         } else {
             return $output;
         }
     } else {
         if (isset($params['echo'])) {
             echo $output;
         } else {
             return $main_menu;
         }
     }
 }
    function content_55e44453a38184_88672607($_smarty_tpl)
    {
        if ($_smarty_tpl->tpl_vars['block_type']->value == '' || $_smarty_tpl->tpl_vars['block_type']->value == 'normal') {
            ?>
        <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" id="user-<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['userid'];
            ?>
">
            <hr>
            <div class="cb-user-thumb pull-left">
                <a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
">
                    <img src="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->getuserthumb($_smarty_tpl->tpl_vars['user']->value);
            ?>
" class="img-circle full-width">
                </a>
            </div>
            <div class="col-md-10">
                <div class="pull-left">
                    <h4><a class="show" href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
</a></h4>
                    <ul class="list-unstyled">
                        <?php 
            if (isSectionEnabled('videos')) {
                ?>
                        <li class="label label-primary" style="display: inline"><?php 
                echo number_format($_smarty_tpl->tpl_vars['user']->value['total_videos']);
                ?>
 <?php 
                echo smarty_lang(array('code' => "videos"), $_smarty_tpl);
                ?>
</li>
                        <?php 
            }
            ?>
                        <?php 
            if (isSectionEnabled('photos')) {
                ?>
                        <li class="label label-info" style="display: inline"><?php 
                echo number_format($_smarty_tpl->tpl_vars['user']->value['total_photos']);
                ?>
 <?php 
                echo smarty_lang(array('code' => "photos"), $_smarty_tpl);
                ?>
</li>
                        <?php 
            }
            ?>
                        <li class="label label-info" style="display: inline"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['profile_hits']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "views"), $_smarty_tpl);
            ?>
</li>
                        <li class="label label-danger" style="display: inline"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['subscribers']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "subscribers"), $_smarty_tpl);
            ?>
</li>
                        <!--<li><?php 
            echo smarty_lang(array('code' => "last_active"), $_smarty_tpl);
            ?>
 : <?php 
            echo nicetime($_smarty_tpl->tpl_vars['user']->value['last_active']);
            ?>
</li>-->
                    </ul>
                </div>
  </div>

        </div>

<?php 
        }
        if ($_smarty_tpl->tpl_vars['block_type']->value == 'groups_show') {
            ?>
<div class="clearfix" id="user-<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['userid'];
            ?>
">
    <div class="cb-user-thumb pull-left">
        <a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
">
            <img src="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->getuserthumb($_smarty_tpl->tpl_vars['user']->value);
            ?>
" class="full-width">
        </a>
    </div>
    <div class="user-detail-block">
        <div class="clearfix">
            <h4><a class="show" href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
</a></h4>
            <div class="clearfix info-box">
				<div class="pull-left small"><span class="bg-eye"></span>&nbsp;<span><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['profile_hits']);
            ?>
 <?php 
            echo smarty_lang(array('code' => 'views'), $_smarty_tpl);
            ?>
</span></div>
				<div class="pull-right small"><span class="bg-videocam"></span>&nbsp;<span><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_videos']);
            ?>
 <?php 
            echo smarty_lang(array('code' => 'Videos'), $_smarty_tpl);
            ?>
</span></div>
			</div>
			<div class="clearfix">
				<div class="pull-left small"><span class="bg-photos"></span>&nbsp;<span><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_photos']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "photos"), $_smarty_tpl);
            ?>
</span></div>
				<div class="pull-right small"><span class="fa fa-users fa-lg"></span>&nbsp;&nbsp;&nbsp;&nbsp;<?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['subscribers']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "subscribers"), $_smarty_tpl);
            ?>
</div>
			</div>
            <!--<ul class="list-unstyled ">
                <?php 
            if (isSectionEnabled('videos')) {
                ?>
                <li class="label " style="display: inline"><?php 
                echo number_format($_smarty_tpl->tpl_vars['user']->value['total_videos']);
                ?>
 <?php 
                echo smarty_lang(array('code' => "videos"), $_smarty_tpl);
                ?>
</li>
                <?php 
            }
            ?>
                <?php 
            if (isSectionEnabled('photos')) {
                ?>
                <li class="label " style="display: inline"><?php 
                echo number_format($_smarty_tpl->tpl_vars['user']->value['total_photos']);
                ?>
 <?php 
                echo smarty_lang(array('code' => "photos"), $_smarty_tpl);
                ?>
</li>
                <?php 
            }
            ?>
                <li class="label" style="display: inline"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['profile_hits']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "views"), $_smarty_tpl);
            ?>
</li>
                <li class="label" style="display: inline"><?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['subscribers']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "subscribers"), $_smarty_tpl);
            ?>
</li>
                *<li><?php 
            echo smarty_lang(array('code' => "last_active"), $_smarty_tpl);
            ?>
 : <?php 
            echo nicetime($_smarty_tpl->tpl_vars['user']->value['last_active']);
            ?>
</li>-->
            <!--</ul>-->






        </div>
    </div>
    <!-- <div class="user_icon">
        <a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
">
        <img class="opacity_low" src="<?php 
            echo $_smarty_tpl->tpl_vars['imageurl']->value;
            ?>
/user_next_icon.png" width="25" height="25" />
        </a>
    </div> -->
</div>
<?php 
        }
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['block_type']->value == 'small') {
            ?>
	<div class="col-md-2" id="user-<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['userid'];
            ?>
" align="center">
		<a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
</a>
		<a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
">
			<img src="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->getuserthumb($_smarty_tpl->tpl_vars['user']->value);
            ?>
" class="img-thumbnail" class="user_mid_thumb">
		</a>
	</div>
<?php 
        }
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['block_type']->value == 'medium') {
            ?>
	<div class="user_block_med" id="user-<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['userid'];
            ?>
">
		<div class="thumb_container_medium" >
			<a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
">
				<img src="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->getuserthumb($_smarty_tpl->tpl_vars['user']->value);
            ?>
" class="img-thumbnail" class="user_thumb_medium">
			</a>
		</div>
		<div class="prof_title"><a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
</a></div>
		<?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['total_videos']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "videos"), $_smarty_tpl);
            ?>
 <?php 
            echo number_format($_smarty_tpl->tpl_vars['user']->value['profile_hits']);
            ?>
 <?php 
            echo smarty_lang(array('code' => "views"), $_smarty_tpl);
            ?>

	</div>
<?php 
        }
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['block_type']->value == "friends") {
            ?>
	<div class="pull-left marginLeft group_thumb_member" id="user-<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['userid'];
            ?>
">
		<a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
" title="<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
">
			<img class="group_thumb " src="<?php 
            echo avatar(array('details' => $_smarty_tpl->tpl_vars['user']->value, 'size' => 'small'), $_smarty_tpl);
            ?>
" alt="<?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
" />
		</a>
	</div>
<?php 
        }
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['block_type']->value == "topic_view") {
            ?>
	<div class="topicStarterAvatar moveL">
		<i class="topicStarterAvatarBG" style="background:url(<?php 
            echo avatar(array('details' => $_smarty_tpl->tpl_vars['user']->value), $_smarty_tpl);
            ?>
) center no-repeat; width:56px; height:56px;"><a href="<?php 
            echo $_smarty_tpl->tpl_vars['userquery']->value->profile_link($_smarty_tpl->tpl_vars['user']->value);
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['user']->value['username'];
            ?>
</a></i>
	</div>
<?php 
        }
    }