$userDetails['sess_id'] = $_COOKIE['PHPSESSID']; $userDetails['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($userDetails); exit(json_encode(array('status' => 'ok', 'userid' => $userquery->userid, 'sess_id' => $_COOKIE['PHPSESSID'], 'details' => $userDetails))); } break; case "getuser": case "check_auth": case "is_logged_in": case "checkauth": case "isloggedin": $userid = userid(); if (!userid()) { exit(json_encode(array('status' => 'failed', 'msg' => 'User is not logged in', 'session' => $_COOKIE['PHPSESSID']))); } else { $uDetails = array('username', 'userid', 'email', 'total_videos', 'total_photos', 'total_collections', 'total_groups'); $userDetails = array(); foreach ($uDetails as $ud) { $userDetails[$ud] = $userquery->udetails[$ud]; } $userDetails['sess_id'] = $_COOKIE['PHPSESSID']; $userDetails['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($userDetails); exit(json_encode($userDetails)); } break; case "logout": $userquery->logout(); if (cb_get_functions('logout')) { cb_call_functions('logout'); } setcookie('is_logout', 'yes', time() + 3600, '/'); }
/** * Function used to get videos * this function has all options * that you need to fetch videos * please see docs.clip-bucket.com for more details */ function get_videos($params) { global $db; $limit = $params['limit']; $order = $params['order']; $cond = ""; $superCond = ""; if (!has_access('admin_access', TRUE)) { $params['admin_access'] = false; $superCond = $cond .= " " . "video.status" . "='Successful' AND \n\t\t\t" . "video.active" . "='yes' AND " . "video.broadcast" . " !='unlisted' "; } else { $params['admin_access'] = true; if ($params['active']) { $cond .= " " . "video.active" . "='" . $params['active'] . "'"; } if ($params['status']) { if ($cond != '') { $cond .= " AND "; } $cond .= " " . "video.status" . "='" . $params['status'] . "'"; } if ($params['broadcast']) { if ($cond != '') { $cond .= " AND "; } $cond .= " " . "video.broadcast" . "='" . $params['broadcast'] . "'"; } } //Setting Category Condition $all = false; if (!is_array($params['category'])) { if (strtolower($params['category']) == 'all') { $all = true; } } if ($params['category'] && !$all) { if ($cond != '') { $cond .= ' AND '; } $cond .= " ("; if (!is_array($params['category'])) { $cats = explode(',', $params['category']); } else { $cats = $params['category']; } $count = 0; foreach ($cats as $cat_params) { $count++; if ($count > 1) { $cond .= " OR "; } $cond .= " " . "video.category" . " LIKE '%#{$cat_params}#%' "; } $cond .= ")"; } //date span if ($params['date_span']) { if ($cond != '') { $cond .= ' AND '; } if ($params['date_span_column']) { $column = $params['date_span_column']; } else { $column = 'date_added'; } $cond .= " " . cbsearch::date_margin($column, $params['date_span']); } //uid if ($params['user'] || $params['userid']) { if ($params['userid']) { $params['user'] = $params['userid']; } if (!is_array($params['user'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.userid" . "='" . $params['user'] . "'"; } else { if ($cond != '') { $cond .= ' AND ('; } $uQu = 0; foreach ($params['user'] as $user) { if ($uQu > 0) { $cond .= ' OR '; } $cond .= " " . "video.userid" . "='" . $user . "'"; $uQu++; } $cond .= " ) "; } } //non-uid to exclude user videos from related if ($params['nonuser']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.userid" . " <> '" . $params['nonuser'] . "' "; } $tag_n_title = ''; //Tags if ($params['tags']) { //checking for commas ;) $tags = explode(",", $params['tags']); if (count($tags) > 0) { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $total = count($tags); $loop = 1; foreach ($tags as $tag) { $tag_n_title .= " " . 'video.tags' . " LIKE '%" . $tag . "%'"; if ($loop < $total) { $tag_n_title .= " OR "; } $loop++; } } else { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $tag_n_title .= " " . 'video.tags' . " LIKE '%" . $params['tags'] . "%'"; } } //TITLE if ($params['title']) { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $tag_n_title .= " " . 'video.title' . " LIKE '%" . $params['title'] . "%'"; } if ($tag_n_title) { if ($cond != '') { $cond .= ' AND '; } $cond .= " ({$tag_n_title}) "; } //FEATURED if ($params['featured']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.featured" . " = '" . $params['featured'] . "' "; } //VIDEO ID if ($params['videoid']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.videoid" . " = '" . $params['videoid'] . "' "; } //VIDEO ID if ($params['videoids']) { if (is_array($params['videoids'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= ' ( '; $curVid = 0; foreach ($params['videoids'] as $vid) { if (is_numeric($vid)) { if ($curVid > 0) { $cond .= " OR "; } $cond .= " " . "video.videoid" . " = '" . $vid . "' "; } $curVid++; } $cond .= ' ) '; } } //VIDEO KEY if ($params['videokey']) { if (!is_array($params['videokey'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.videokey" . " = '" . $params['videokey'] . "' "; } else { if ($cond != '') { $cond .= ' AND ('; } $vkeyQue = 0; foreach ($params['videokey'] as $videokey) { if ($vkeyQue > 0) { $cond .= ' OR '; } $cond .= " " . "video.videokey" . " = '" . $videokey . "' "; $vkeyQue++; } $cond .= " ) "; } } //Exclude Vids if ($params['exclude']) { if (!is_array($params['exclude'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } else { foreach ($params['exclude'] as $exclude) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $exclude . "' "; } } } //Duration if ($params['duration']) { $duration_op = $params['duration_op']; if (!$duration_op) { $duration_op = "="; } if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.duration' . " " . $duration_op . " '" . $params['duration'] . "' "; } if ($params['has_mobile']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.has_mobile' . "='" . $params['has_mobile'] . "'"; } //Filename if ($params['filename']) { if (!is_array($params['filename'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.file_name' . " <> '" . $params['filename'] . "' "; } else { if ($cond != '') { $cond .= ' AND ('; } else { $cond .= " ( "; } $fileNameQue = 0; foreach ($params['filename'] as $filename) { if ($fileNameQue > 0) { $cond .= ' OR '; } $cond .= " " . "video.file_name" . " = '" . $filename . "' "; $fileNameQue++; } $cond .= " ) "; } } if ($params['cond']) { if ($params['cond_and']) { if ($cond != '') { $cond .= ' AND '; } } $cond .= " " . $params['cond']; } $functions = cb_get_functions('get_videos'); if ($functions) { foreach ($functions as $func) { $array = array('params' => $params, 'cond' => $cond); if (function_exists($func['func'])) { $returned = $func['func']($array); if ($returned) { $cond = $returned; } } } } if (!$params['count_only'] && !$params['show_related']) { $userFields = array('userid', 'email', 'username'); foreach ($userFields as $ufield) { $ufieldq .= ",users." . $ufield; } //$meta_query = $this->create_meta_query(); $fields_arr = array('video' => get_video_fields(), 'users' => get_user_fields()); $fields = tbl_fields($fields_arr); $query = " SELECT " . $fields . " FROM " . tbl('video') . " AS video "; $query .= " LEFT JOIN " . tbl('users') . " AS users "; $query .= " ON video.userid = users.userid "; $limit_query = ""; $order_query = ""; if ($limit) { $limit_query = " LIMIT " . $limit; } if ($order) { $order_query = " ORDER BY " . $order; } if ($cond) { $query .= " WHERE " . $cond; } $query .= $order_query; $query .= $limit_query; $start = microtime(true); $action_data = call_actions('get_videos', $query); if ($action_data) { $result = $action_data; } else { $result = db_select($query); } $end = microtime(true); } if ($params['show_related']) { $cond = ""; if ($superCond) { $cond = $superCond . " AND "; } $cond .= "MATCH(" . "video.title,video.tags" . ") \n\t\t\tAGAINST ('" . cbsearch::set_the_key($params['title']) . "' IN BOOLEAN MODE) "; if ($params['exclude']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } $query = " SELECT " . $fields . " FROM " . tbl('video') . " AS video "; $query .= " LEFT JOIN " . tbl('users') . " AS users "; $query .= " ON video.userid = users.userid "; if ($cond) { $query .= " WHERE " . $cond; } if ($limit) { $limit_query = " LIMIT " . $limit; } if ($order) { $order_query = " ORDER BY " . $order; } $query .= $order_query; $query .= $limit_query; $action_data = call_actions('get_videos', $query); if ($action_data) { $result = $action_data; } else { $result = db_select($query); } if ($db->num_rows == 0) { $cond = ""; if ($superCond) { $cond = $superCond . " AND "; } //Try Finding videos via tags $cond .= "MATCH(" . "video.title,video.tags" . ") \n\t\t\t\tAGAINST ('" . cbsearch::set_the_key($params['tags']) . "' IN BOOLEAN MODE) "; if ($params['exclude']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } $query = " SELECT " . $fields . " FROM " . tbl('video') . " AS video "; $query .= " LEFT JOIN " . tbl('users') . " AS users "; $query .= " ON video.userid = users.userid "; if ($cond) { $query .= " WHERE " . $cond; } if ($limit) { $limit_query = " LIMIT " . $limit; } if ($order) { $order_query = " ORDER BY " . $order; } $query .= $order_query; $query .= $limit_query; $action_data = call_actions('get_videos', $query); if ($action_data) { $result = $action_data; } else { $result = db_select($query); } } } $result = apply_filters($result, 'get_videos'); if (!$action_data && $result) { call_actions('select_videos', array('query' => $query, 'results' => $result)); } if ($params['pr']) { pr($result, true); } if ($params['count_only']) { return $result = $db->count(tbl('video') . " AS video ", 'videoid', $cond); } if ($params['assign']) { assign($params['assign'], $result); } else { return $result; } }
/** * this is for pak player */ function fb_embed_video($params) { $fb_embed_funcs = cb_get_functions('fb_embed_video'); if ($fb_embed_funcs) { foreach ($fb_embed_funcs as $func) { if (function_exists($func['func'])) { return $func['func']($params); } } } $vdetails = $params['video']; $config = urlencode(BASEURL . "/player/pak_player/embed_player.php?vid=" . $vdetails['videoid'] . "&json=true&autoplay=yes"); if (!config('pak_license')) { $embed_src = BASEURL . '/player/pak_player/pakplayer.swf?config=' . $config; } else { $embed_src = BASEURL . '/player/pak_player/pakplayer.unlimited.swf?config=' . $config; } return $embed_src; }
function get_mature_thumb($object, $size = null, $output = null) { /* Calling custom function */ $funcs = cb_get_functions('mature_thumb'); if (is_array($funcs)) { foreach ($funcs as $func) { if (function_exists($func['func'])) { $thumb = $func['func']($object, $size, $output); if ($thumb) { return $thumb; } } } } if ($size == 'big') { $size = '-big'; } else { $size = null; } $name = "unsafe" . $size . ".png"; $path = BASEURL . '/images/' . $name; $attrs['class'] = 'cb-mature-thumb'; if ($output) { return cb_output_img_tag($path, $attrs); } else { return $path; } }
echo $msg; break; case "cl": case "collection": $id = $_POST['id']; $cbcollection->action->add_to_fav($id); //updateObjectStats('fav','collection',$id); // Increment in total favs if (msg()) { $msg = msg_list(); $msg = '<div class="msg">' . $msg[0] . '</div>'; } if (error()) { $msg = error_list(); $msg = '<div class="error">' . $msg[0] . '</div>'; } $funcs = cb_get_functions('favorite_collection'); if ($funcs) { foreach ($funcs as $func) { $func['func']($id); } } echo $msg; break; } break; case 'flag_object': $type = strtolower($_POST['type']); switch ($type) { case 'v': case 'video': default:
/** * Used to delete photo */ function delete_photo($id, $oprhan = FALSE) { global $db; if ($this->photo_exists($id)) { $photo = $this->get_photo($id); $del_photo_funcs = cb_get_functions('delete_photo'); if (is_array($del_photo_funcs)) { foreach ($del_photo_funcs as $func) { if (function_exists($func['func'])) { $func['func']($photo); } } } if ($orphan == FALSE) { //removing from collection $this->collection->remove_item($photo['photo_id'], $photo['collection_id']); } //now removing photo files $this->delete_photo_files($photo); //finally removing from Database $this->delete_from_db($photo); //Decrementing User Photos $db->update(tbl("users"), array("total_photos"), array("|f|total_photos-1"), " userid='" . $photo['userid'] . "'"); //Removing Photo Comments $db->delete(tbl("comments"), array("type", "type_id"), array("p", $photo['photo_id'])); //Removing Photo From Favortes $db->delete(tbl("favorites"), array("type", "id"), array("p", $photo['photo_id'])); } else { e(lang("photo_not_exists")); } }
} } } } } //Login User if (isset($_POST['login'])) { $username = $_POST['username']; $username = mysql_clean(clean($username)); $password = mysql_clean(clean($_POST['password'])); $remember = false; if ($_POST['rememberme']) { $remember = true; } if ($userquery->login_user($username, $password, $remember)) { if (cb_get_functions('login_success')) { cb_call_functions('login_success'); } if ($_COOKIE['pageredir']) { redirect_to($_COOKIE['pageredir']); } else { redirect_to(cblink(array('name' => 'my_account'))); } } } //Checking Ban Error if (!isset($_POST['login']) && !isset($_POST['signup'])) { if (@$_GET['ban'] == true) { $msg = lang('usr_ban_err'); } }
/** * Function used to get video link * @param ARRAY video details */ function video_link($vdetails, $type = NULL) { global $myquery; #checking what kind of input we have if (is_array($vdetails)) { if (empty($vdetails['title'])) { #check for videoid if (empty($vdetails['videoid']) && empty($vdetails['vid']) && empty($vdetails['videokey'])) { return BASEURL; } else { if (!empty($vdetails['videoid'])) { $vid = $vdetails['videoid']; } elseif (!empty($vdetails['vid'])) { $vid = $vdetails['vid']; } elseif (!empty($vdetails['videokey'])) { $vid = $vdetails['videokey']; } else { return BASEURL; } } } } else { if (is_numeric($vdetails)) { $vid = $vdetails; } else { return BASEURL; } } #checking if we have vid , so fetch the details if (!empty($vid)) { $vdetails = get_video_details($vid); } //calling for custom video link functions $functions = cb_get_functions('video_link'); if ($functions) { foreach ($functions as $func) { $array = array('vdetails' => $vdetails, 'type' => $type); if (function_exists($func['func'])) { $returned = $func['func']($array); if ($returned) { $link = $returned; return $link; break; } } } } $plist = ""; if (SEO == 'yes') { if ($vdetails['playlist_id']) { $plist = '?&play_list=' . $vdetails['playlist_id']; } $vdetails['title'] = strtolower($vdetails['title']); switch (config('seo_vido_url')) { default: $link = BASEURL . '/video/' . $vdetails['videokey'] . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist; break; case 1: $link = BASEURL . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . '_v' . $vdetails['videoid'] . $plist; break; case 2: $link = BASEURL . '/video/' . $vdetails['videoid'] . '/' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist; break; case 3: $link = BASEURL . '/video/' . $vdetails['videoid'] . '_' . SEO(clean(str_replace(' ', '-', $vdetails['title']))) . $plist; break; } } else { if ($vdetails['playlist_id']) { $plist = '&play_list=' . $vdetails['playlist_id']; } $link = BASEURL . '/watch_video.php?v=' . $vdetails['videokey'] . $plist; } if (!$type || $type == 'link') { return $link; } elseif ($type == 'download') { return BASEURL . '/download.php?v=' . $vdetails['videokey']; } }
/** * Function used to get videos * this function has all options * that you need to fetch videos * please see docs.clip-bucket.com for more details */ function get_videos($params) { global $db, $cb_columns; $limit = $params['limit']; $order = $params['order']; $cond = ""; $superCond = ""; if (!has_access('admin_access', TRUE)) { $superCond = " " . "video.status" . "='Successful' AND\r\n\t\t\t" . "video.active" . "='yes' AND " . "video.broadcast" . " !='unlisted' "; } else { if ($params['active']) { $cond .= " " . "video.active" . "='" . $params['active'] . "'"; } if ($params['status']) { if ($cond != '') { $cond .= " AND "; } $cond .= " " . "video.status" . "='" . $params['status'] . "'"; } if ($params['broadcast']) { if ($cond != '') { $cond .= " AND "; } $cond .= " " . "video.broadcast" . "='" . $params['broadcast'] . "'"; } } //Setting Category Condition $all = false; if (!is_array($params['category'])) { if (strtolower($params['category']) == 'all') { $all = true; } } if ($params['category'] && !$all) { if ($cond != '') { $cond .= ' AND '; } $cond .= " ("; if (!is_array($params['category'])) { $cats = explode(',', $params['category']); } else { $cats = $params['category']; } $count = 0; foreach ($cats as $cat_params) { $count++; if ($count > 1) { $cond .= " OR "; } $cond .= " " . "video.category" . " LIKE '%#{$cat_params}#%' "; } $cond .= ")"; } //date span if ($params['date_span']) { if ($cond != '') { $cond .= ' AND '; } if ($params['date_span_column']) { $column = $params['date_span_column']; } else { $column = 'date_added'; } $cond .= " " . cbsearch::date_margin($column, $params['date_span']); } //uid if ($params['user']) { if (!is_array($params['user'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.userid" . "='" . $params['user'] . "'"; } else { if ($cond != '') { $cond .= ' AND ('; } $uQu = 0; foreach ($params['user'] as $user) { if ($uQu > 0) { $cond .= ' OR '; } $cond .= " " . "video.userid" . "='" . $user . "'"; $uQu++; } $cond .= " ) "; } } //non-uid to exclude user videos from related if ($params['nonuser']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.userid" . " <> '" . $params['nonuser'] . "' "; } //padding videos in mass_embed pllugin if ($params['mass_embed_status']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.mass_embed_status" . " = '" . $params['mass_embed_status'] . "' "; } $tag_n_title = ''; //Tags if ($params['tags']) { //checking for commas ;) $tags = explode(",", $params['tags']); if (count($tags) > 0) { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $total = count($tags); $loop = 1; foreach ($tags as $tag) { $tag_n_title .= " " . 'video.tags' . " LIKE '%" . $tag . "%'"; if ($loop < $total) { $tag_n_title .= " OR "; } $loop++; } } else { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $tag_n_title .= " " . 'video.tags' . " LIKE '%" . $params['tags'] . "%'"; } } //TITLE if ($params['title']) { if ($tag_n_title != '') { $tag_n_title .= ' OR '; } $tag_n_title .= " " . 'video.title' . " LIKE '%" . $params['title'] . "%'"; } if ($tag_n_title) { if ($cond != '') { $cond .= ' AND '; } $cond .= " ({$tag_n_title}) "; } //FEATURED if ($params['featured']) { //exit($params['featured']); if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.featured" . " = '" . $params['featured'] . "' "; } //VIDEO ID if ($params['videoid']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . "video.videoid" . " = '" . $params['videoid'] . "' "; } //VIDEO ID if ($params['videoids']) { if (is_array($params['videoids'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= ' ( '; $curVid = 0; foreach ($params['videoids'] as $vid) { if (is_numeric($vid)) { if ($curVid > 0) { $cond .= " OR "; } $cond .= " " . "video.videoid" . " = '" . $vid . "' "; } $curVid++; } $cond .= ' ) '; } } //VIDEO KEY if ($params['videokey']) { if (!is_array($params['videokey'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . tbl("video.videokey") . " = '" . $params['videokey'] . "' "; } else { if ($cond != '') { $cond .= ' AND ('; } $vkeyQue = 0; foreach ($params['videokey'] as $videokey) { if ($vkeyQue > 0) { $cond .= ' OR '; } $cond .= " " . tbl("video.videokey") . " = '" . $videokey . "' "; $vkeyQue++; } $cond .= " ) "; } } //Exclude Vids if ($params['exclude']) { if (!is_array($params['exclude'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } else { foreach ($params['exclude'] as $exclude) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $exclude . "' "; } } } //Duration if ($params['duration']) { $duration_op = $params['duration_op']; if (!$duration_op) { $duration_op = "="; } if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.duration' . " " . $duration_op . " '" . $params['duration'] . "' "; } //Filename if ($params['filename']) { if (!is_array($params['filename'])) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.file_name' . " <> '" . $params['filename'] . "' "; } else { if ($cond != '') { $cond .= ' AND ('; } $fileNameQue = 0; foreach ($params['filename'] as $filename) { if ($fileNameQue > 0) { $cond .= ' OR '; } $cond .= " " . "video.file_name" . " = '" . $filename . "' "; $fileNameQue++; } $cond .= " ) "; } } if ($params['cond']) { if ($params['cond_and']) { if ($cond != '') { $cond .= ' AND '; } } $cond .= " " . $params['cond']; } $functions = cb_get_functions('get_videos'); if ($functions) { foreach ($functions as $func) { $array = array('params' => $params, 'cond' => $cond); if (function_exists($func['func'])) { $returned = $func['func']($array); if ($returned) { $cond = $returned; } } } } $fields = array('video' => get_video_fields(), 'users' => $cb_columns->object('users')->temp_change('featured', 'user_featured')->get_columns()); $fields = tbl_fields($fields); if (!$params['count_only'] && !$params['show_related']) { $query = "SELECT {$fields} FROM " . cb_sql_table('video'); $query .= " LEFT JOIN " . cb_sql_table('users') . " ON video.userid = users.userid"; if (!empty($superCond)) { if ($cond !== "") { $cond .= " AND " . $superCond; } else { $cond .= $superCond; } } if ($cond) { $query .= " WHERE " . $cond; } $query .= $order ? " ORDER BY " . $order : false; $query .= $limit ? " LIMIT " . $limit : false; #pr( $query, true ); $result = select($query); #if(!empty($cond)) # $cond .= " AND "; #$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'),$cond." ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order); //echo $db->db_query; } global $cbsearch; if ($params['show_related']) { $cond = ""; if ($superCond) { $cond = $superCond . " AND "; } $cond .= "MATCH(" . "video.title,video.tags" . ")\r\n\t\t\tAGAINST ('" . $params['title'] . "' IN BOOLEAN MODE) "; if ($params['exclude']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } $query = " SELECT " . $fields . " FROM " . cb_sql_table('video'); $query .= " LEFT JOIN " . cb_sql_table('users'); $query .= " ON video.userid = users.userid "; if ($cond) { $query .= " WHERE " . $cond; } $query .= $order ? " ORDER BY " . $order : false; $query .= $limit ? " LIMIT " . $limit : false; $result = select($query); #$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'), #$cond." AND ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order); if ($db->num_rows == 0) { $cond = ""; if ($superCond) { $cond = $superCond . " AND "; } //Try Finding videos via tags $cond .= "MATCH(" . "video.title,video.tags" . ")\r\n\t\t\t\tAGAINST ('" . $params['tags'] . "' IN BOOLEAN MODE) "; if ($params['exclude']) { if ($cond != '') { $cond .= ' AND '; } $cond .= " " . 'video.videoid' . " <> '" . $params['exclude'] . "' "; } $query = " SELECT " . $fields . " FROM " . cb_sql_table('video'); $query .= " LEFT JOIN " . cb_sql_table('users'); $query .= " ON video.userid = users.userid "; if ($cond) { $query .= " WHERE " . $cond; } $query .= $order ? " ORDER BY " . $order : false; $query .= $limit ? " LIMIT " . $limit : false; $result = select($query); #$result = $db->select(tbl('video,users'),tbl('video.*,users.userid,users.username'), #$cond." AND ".tbl("video.userid")." = ".tbl("users.userid"),$limit,$order); } assign($params['assign'], $result); } if ($params['pr']) { pr($result, true); } if ($params['count_only']) { return $result = $db->count(cb_sql_table('video'), 'videoid', $cond); } if ($params['assign']) { assign($params['assign'], apply_filters($result, 'get_video')); } else { return apply_filters($result, 'get_video'); } }
$result['is_rating'] = true; $cbvid->show_video_rating($result); $funcs = cb_get_functions('rate_collection'); if ($funcs) { foreach ($funcs as $func) { $func['func']($id); } } break; case "user": $rating = $_POST['rating'] * 2; $id = $_POST['id']; $result = $userquery->rate_user($id, $rating); $result['is_rating'] = true; $cbvid->show_video_rating($result); $funcs = cb_get_functions('rate_user'); if ($funcs) { foreach ($funcs as $func) { $func['func']($id); } } break; } break; case "create_playlist": $array = array('name', 'description', 'tags', 'playlist_type', 'privacy', 'allow_comments', 'allow_rating', 'type'); $type = post('type'); $input = array(); foreach ($array as $ar) { $input[$ar] = mysql_clean(post($ar)); }
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved. | @ Author : ArslanHassan | @ Software : ClipBucket , © PHPBucket.com | $Id: signup.php 596 2011-04-21 14:41:57Z ahzulfi $ ************************************************************* */ define("THIS_PAGE", "signup"); define("PARENT_PAGE", "signup"); require 'includes/config.inc.php'; if ($userquery->login_check('', true)) { redirect_to(BASEURL); } /** * Function used to call all signup functions */ if (cb_get_functions('signup_page')) { cb_call_functions('signup_page'); } /** * Signing up new user */ if (!config('allow_registeration')) { assign('allow_registeration', lang('usr_reg_err')); // } if (isset($_POST['signup'])) { if (!config('allow_registeration')) { e(lang('usr_reg_err')); } else { $signup = $userquery->signup_user($_POST, true); if ($signup) {
function is_photo_viewable($pid) { global $db, $cbphoto; if (!is_array($pid)) { $photo = $cbphoto->get_photo($pid); } else { $photo = $pid; } if (!$photo) { e(lang('photo_not_exists')); if (!has_access('admin_access', true)) { return false; } else { return true; } } else { if ($photo['active'] == 'no') { e(lang('Photo is not active. Please Admin for details')); if (!has_access('admin_access', true)) { return false; } else { return true; } } else { if ($photo['is_mature'] == 'yes' && !userid()) { assign('title', $photo['photo_title']); assign('object', $photo); template_files(STYLES_DIR . '/global/blocks/mature_content.html', false, false); } else { $funcs = cb_get_functions('view_photo'); if (is_array($funcs)) { foreach ($funcs as $func) { if (function_exists($func['func'])) { $data = $func['func']($photo); if ($data) { return $data; } } } } return true; } } } }
/** * Function used to check video is playlable or not * @param vkey,vid */ function video_playable($id) { global $cbvideo, $userquery; if (isset($_POST['watch_protected_video'])) { $video_password = mysql_clean(post('video_password')); } else { $video_password = ''; } if (!is_array($id)) { $vdo = $cbvideo->get_video($id); } else { $vdo = $id; } $uid = userid(); if (!$vdo) { e(lang("class_vdo_del_err")); return false; } elseif ($vdo['status'] != 'Successful') { e(lang("this_vdo_not_working")); if (!has_access('admin_access', TRUE)) { return false; } else { return true; } } elseif ($vdo['broadcast'] == 'private' && !$userquery->is_confirmed_friend($vdo['userid'], userid()) && !is_video_user($vdo) && !has_access('video_moderation', true) && $vdo['userid'] != $uid) { e(lang('private_video_error')); return false; } elseif ($vdo['active'] == 'pen') { e(lang("video_in_pending_list")); if (has_access('admin_access', TRUE) || $vdo['userid'] == userid()) { return true; } else { return false; } } elseif ($vdo['broadcast'] == 'logged' && !userid() && !has_access('video_moderation', true) && $vdo['userid'] != $uid) { e(lang('not_logged_video_error')); return false; } elseif ($vdo['active'] == 'no') { e(lang("vdo_iac_msg")); if (!has_access('admin_access', TRUE)) { return false; } else { return true; } } elseif ($vdo['video_password'] && $vdo['broadcast'] == 'unlisted' && $vdo['video_password'] != $video_password && !has_access('video_moderation', true) && $vdo['userid'] != $uid) { if (!$video_password) { e(lang("video_pass_protected")); } else { e(lang("invalid_video_password")); } template_files("blocks/watch_video/video_password.html", false, false); } else { $funcs = cb_get_functions('watch_video'); if ($funcs) { foreach ($funcs as $func) { $data = $func['func']($vdo); if ($data) { return $data; } } } return true; } }
/** * function used to get remote url function */ function get_remote_url_function() { $funcs = cb_get_functions('remote_url_function'); if ($funcs) { foreach ($funcs as $func) { $val = $func['func'](); if ($val) { return $val; } } } return 'check_remote_url()'; }