function install_editors_pick() { global $db; $db->Execute("CREATE TABLE IF NOT EXISTS " . tbl('editors_picks') . " (\n `pick_id` int(225) NOT NULL AUTO_INCREMENT,\n `videoid` int(225) NOT NULL,\n `sort` bigint(5) NOT NULL DEFAULT '1',\n `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (`pick_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); //inserting new announcment $db->Execute("INSERT INTO " . tbl('global_announcement') . " (announcement) VALUES ('')"); }
function the_form() { global $db; $key_check = $db->_select('SELECT the_key FROM ' . tbl("the_captcha")); $the_key = $key_check[0]['the_key']; $site_key = $the_key; echo '<div class="g-recaptcha" data-sitekey=' . $site_key . '></div>'; }
function install_cb_captcha() { global $db; $db->Execute('CREATE TABLE IF NOT EXISTS ' . tbl("the_captcha") . ' ( `the_key` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8;;'); //inserting new announcment $db->Execute("INSERT INTO " . tbl('the_captcha') . " (the_key) VALUES ('')"); }
function install_global_announcement() { global $db; $db->Execute('CREATE TABLE IF NOT EXISTS ' . tbl("global_announcement") . ' ( `announcement` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8;;'); //inserting new announcment $db->Execute("INSERT INTO " . tbl('global_announcement') . " (announcement) VALUES ('')"); }
function install_terminator() { global $db; $db->Execute('CREATE TABLE IF NOT EXISTS ' . tbl("terminator") . ' ( `terminate_vids` text NOT NULL, `terminate_users` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8;;'); $db->Execute("INSERT INTO " . tbl('terminator') . " (terminate_vids) VALUES ('')"); $db->Execute("INSERT INTO " . tbl('terminator') . " (terminate_users) VALUES ('')"); }
/** * Function used to count total notifications */ function count_total_notification($item = false) { global $db; $type = $this->type; $results = $db->count(tbl('notifications'), "*"); echo $db->query; if ($db->num_rows > 0) { return $results; } else { return false; } }
/** * Created by JetBrains PhpStorm. * User: Fawaz * Date: 8/28/13 * Time: 12:17 PM * To change this template use File | Settings | File Templates. */ function get_website_configurations() { $query = "SELECT name, value FROM " . tbl('config'); $results = select($query); $data = array(); if ($results) { foreach ($results as $config) { $data[$config['name']] = $config['value']; } } return $data; }
function install_customfield() { global $db; $db->Execute('CREATE TABLE IF NOT EXISTS ' . tbl("custom_field") . ' ( `custom_field_list_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `field_name` text NOT NULL, `field_title` text NOT NULL, `field_type` text NOT NULL, `db_field` text NOT NULL, `default_value` text NOT NULL, `customfields_flag` text NOT NULL, `date_added` DATETIME NOT NULL ) ENGINE=MyISAM;'); //inserting new announcement //$db->Execute("INSERT INTO ".tbl('custom_field')." (field_name,field_title,) VALUES ('Hello World!')"); }
/** * Function used add fields in upload form */ function load_form_fields() { global $db; $results = $db->select(tbl("custom_fields"), "*"); if (count($results[0]) > 0) { foreach ($results as $result) { $name = $result['custom_field_name']; foreach ($result as $field => $value) { $field_array[$name][substr($field, 13, strlen($field))] = $value; } } } if (count($field_array) > 0) { return false; } return $field_array; }
/** * Funcion used to call functions * when video is going to dwnload * ie in download.php */ function call_download_video_function($vdo) { global $db; $funcs = get_functions('download_video_functions'); if (is_array($funcs) && count($funcs) > 0) { foreach ($funcs as $func) { if (function_exists($func)) { $func($vdo); } } } //Updating Video Downloads $db->update(tbl("video"), array("downloads"), array("|f|downloads+1"), "videoid = '" . $vdo['videoid'] . "'"); //Updating User Download if (userid()) { $db->update(tbl("users"), array("total_downloads"), array("|f|total_downloads+1"), "userid = '" . userid() . "'"); } }
function send_video_notification($videoId) { global $myquery, $db; #checking if we have vid , so fetch the details if (!empty($videoId)) { $vdetails = $myquery->get_video_details($videoId); } $title = $vdetails['title']; // Put your private key's passphrase here: $passphrase = 'janjuajanjua'; //////////////////////////////////////////////////////////////////////////////// $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'E:\\wamp\\www\\clipbucket_bug1\\api\\apns-dev.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); // Open a connection to the APNS server $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); if (!$fp) { exit("Failed to connect: {$err} {$errstr}" . PHP_EOL); } echo 'Connected to APNS' . PHP_EOL; $token_result = $db->select(tbl('token'), 'token'); if ($token_result) { foreach ($token_result as $token_value) { // Create the pahanyload body $payload['aps'] = array('alert' => "'" . $title . "' has been Featured.", 'sound' => 'default'); $payload['details'] = array('type' => 'featured', 'videoId' => $videoId, 'title' => $title); $output = json_encode($payload); // Build the binary notification $msg = chr(0) . pack('n', 32) . pack('H*', $token_value['token']) . pack('n', strlen($output)) . $output; // Send it to the server $result = fwrite($fp, $msg, strlen($msg)); } if (!$result) { echo 'Messages not delivered' . PHP_EOL; } else { echo 'Messages successfully delivered' . PHP_EOL; } } else { return json_encode(array('err' => lang(error('single')))); } // Close the connection to the server fclose($fp); }
/** * Function used to insert log * @param VARCHAR $type, type of action * @param ARRAY $details_array , action details array */ function insert($type, $details_array) { global $db, $userquery; $a = $details_array; $ip = $_SERVER['REMOTE_ADDR']; $agent = $_SERVER['HTTP_USER_AGENT']; $userid = getArrayValue($a, 'userid'); $username = $a['username']; $useremail = getArrayValue($a, 'useremail'); $userlevel = getArrayValue($a, 'userlevel'); $action_obj_id = getArrayValue($a, 'action_obj_id'); $action_done_id = getArrayValue($a, 'action_done_id'); $userid = $userid ? $userid : $userquery->udetails['userid']; $username = $username ? $username : $userquery->udetails['username']; $useremail = $useremail ? $useremail : $userquery->udetails['email']; $userlevel = $userlevel ? $userlevel : getArrayValue($userquery->udetails, 'level'); $success = $a['success']; $details = getArrayValue($a, 'details'); $db->insert(tbl('action_log'), array('action_type', 'action_username', 'action_userid', 'action_useremail', 'action_ip', 'date_added', 'action_success', 'action_details', 'action_userlevel', 'action_obj_id', 'action_done_id'), array($type, $username, $userid, $useremail, $ip, NOW(), $success, $details, $userlevel, $action_obj_id, $action_done_id)); }
/** * function send emails */ function send_emails($id) { global $db, $userquery, $cbemail; if (!is_array($id)) { $email = $this->get_email($id); } else { $email = $id; } if ($email['status'] == 'completed') { return false; } $settings = json_decode($email['configs'], true); $users = $email['users']; $total = $email['total']; //Creating limit $start_index = $email['start_index']; $limit = $start_index . ',' . $settings['loop_size']; //Creating condition $condition = ""; //Levels $level_query = ""; $levels = $settings['level']; if ($levels) { foreach ($levels as $level) { if ($level_query) { $level_query .= " OR "; } $level_query .= " level='{$level}' "; } if ($condition) { $condition .= " AND "; } $condition = $level_query = " ( " . $level_query . ") "; } //Categories $cats_query = ""; $cats = $settings['cat']; if ($cats) { foreach ($cats as $cat) { if ($cats_query) { $cats_query .= " OR "; } $cats_query .= " category='{$cat}' "; } $cats_query = " ( " . $cats_query . ") "; if ($condition) { $condition .= " AND "; } $condition .= $cats_query; } //Ative users if ($settings['active'] != 'any') { if ($condition) { $condition .= " AND "; } if ($settings['active'] == 'yes') { $condition .= "\tusr_status = 'Ok' "; } if ($settings['active'] == 'no') { $condition .= "\tusr_status = 'ToActivate' "; } } //Banned users if ($settings['ban'] != 'any') { if ($condition) { $condition .= " AND "; } if ($settings['ban'] == 'yes') { $condition .= "\tban_status = 'yes' "; } if ($settings['ban'] == 'no') { $condition .= "\tban_status = 'no' "; } } if (!$users) { $users = $db->select(tbl("users"), "*", $condition, $limit, " userid ASC "); if (!$total) { $total = $db->count(tbl("users"), "userid", $condition); } $sent = $email['sent']; $send_msg = array(); foreach ($users as $user) { $var = array('{username}' => $user['username'], '{userid}' => $user['userid'], '{email}' => $user['email'], '{datejoined}' => $user['doj'], '{avcode}' => $user['avcode'], '{avlink}' => BASEURL . '/activation.php?av_username='******'username'] . '&avcode=' . $user['avcode']); $subj = $cbemail->replace($email['email_subj'], $var); $msg = nl2br($cbemail->replace($email['email_msg'], $var)); $send_message = ""; //Now Finally Sending Email cbmail(array('to' => $user['email'], 'from' => $email['email_from'], 'subject' => $subj, 'content' => $msg)); $sent++; $send_msg[] = $user['userid'] . ": Email has been sent to <strong><em>" . $user['username'] . "</em></strong>"; } $sent_to = $start_index + $settings['loop_size']; if ($sent_to > $total) { $sent_to = $total; } e(sprintf(lang("Sending email from %s to %s"), $start_index + 1, $sent_to), "m"); $start_index = $start_index + $settings['loop_size']; if ($sent == $total || $sent > $total) { $status = 'completed'; } else { $status = 'sending'; } $db->update(tbl('mass_emails'), array('sent', 'total', 'start_index', 'status', 'last_update'), array($sent, $total, $start_index, $status, now()), " id='" . $email['id'] . "' "); return $send_msg; } }
$total = count($_POST['check_queue']); for ($i = 0; $i <= $total; $i++) { $myquery->queue_action("delete", $_POST['check_queue'][$i]); } e("Selected items have been deleted", "m"); } if (isset($_POST['processed'])) { $total = count($_POST['check_queue']); for ($i = 0; $i <= $total; $i++) { $myquery->queue_action("processed", $_POST['check_queue'][$i]); } e("Selected items have been set changed to processed", "m"); } if (isset($_POST['pending'])) { $total = count($_POST['check_queue']); for ($i = 0; $i <= $total; $i++) { $myquery->queue_action("pending", $_POST['check_queue'][$i]); } e("Selected items have been set changed to processed", "m"); } //Getting List of Conversion Queue $page = mysql_clean($_GET['page']); $get_limit = create_query_limit($page, RESULTS); $queue_list = $myquery->get_conversion_queue(NULL, $get_limit); assign('queues', $queue_list); $total_rows = get_videos($vcount); $total_pages = count_pages($db->count(tbl('conversion_queue'), "cqueue_id"), RESULTS); $pages->paginate($total_pages, $page); subtitle("Conversion Queue Manager"); template_files("cb_conversion_queue.html"); display_it();
*************************************************************** */ //including config file.. require '../includes/admin_config.php'; $userquery->admin_login_check(); $pages->page_redir(); /* Assigning page and subpage */ if (!defined('MAIN_PAGE')) { define('MAIN_PAGE', 'Tool Box'); } if (!defined('SUB_PAGE')) { define('SUB_PAGE', 'ReIndexer'); } $vtbl = tbl("video"); $utbl = tbl("users"); $gtbl = tbl("groups"); function p_r($array) { echo "<pre>"; print_r($array); echo "</pre>"; } $start_index = $_GET['start_index'] ? $_GET['start_index'] : 0; $loop_size = $_GET['loop_size']; $loop_size = $loop_size ? $loop_size : 5; assign('loop_size', $loop_size); $next_index = $start_index + $loop_size; assign('next_index', $next_index); //Reindex Videos if (isset($_GET['index_vids'])) { $videos = get_videos(array("active" => "yes", "status" => "Successful", "limit" => $start_index . "," . $loop_size));
/** * Function used to check embed video * if video is embeded , it will check its code * if everthing goes ok , it will change its status to successfull * @param VID */ function remote_video_check($vid) { global $myquery, $db; if (is_array($vid)) { $vdetails = $vid; } else { $vdetails = $myquery->get_video_details($vid); } if (!empty($vdetails['remote_play_url']) && $vdetails['remote_play_url'] != ' ' && $vdetails['remote_play_url'] != 'none') { $db->update(tbl("video"), array("status"), array('Successful'), " videoid='{$vid}'"); } }
include '../../includes/admin_config.php'; include 'ofc-library/open-flash-chart.php'; $days = 10; $last_week = time() - 86400 * $days + 86400; $the_last_week = date('M d', $last_week); $title = new title("ClipBucket Daily Activity " . $the_last_week . " - " . date("M d")); $title->set_style("{font-size:14px;font-family:Century Gothic;font-weight:bold}"); $vid_stats = $data['video_stats']; $vid_stats = json_decode($vid_stats); $year = array(); //Getting This Weeks Data for ($i = 0; $i < $days; $i++) { if ($i < $days - 1) { $date_pattern = date("Y-m-d", $last_week + $i * 86400); //echo "date_added LIKE '%$date_pattern%'"; $data = $db->select(tbl("stats"), "*", " date_added LIKE '%{$date_pattern}%' ", 1); $data = $data[0]; $datas[] = $data; } $year[] = date("M d", $last_week + $i * 86400); } for ($i = 0; $i < $days; $i++) { $day[$i]['video'] = json_decode($datas[$i]['video_stats']); $day[$i]['users'] = json_decode($datas[$i]['user_stats']); $day[$i]['groups'] = json_decode($datas[$i]['group_stats']); } $max = 1; for ($i = 0; $i < $days; $i++) { if ($i == $days - 1) { $vid_uploads[] = $cbvid->get_videos(array("count_only" => true, "date_span" => "today")) + 0; $user_signups[] = $userquery->get_users(array("count_only" => true, "date_span" => "today")) + 0;
/** * Function used to get new messages */ function get_new_messages($uid = NULL, $type = 'pm') { if (!$uid) { $uid = userid(); } global $db; switch ($type) { case 'pm': default: $count = $db->count(tbl($this->tbl), "message_id", " message_to LIKE '%#{$uid}#%' AND message_box='in' AND message_type='pm' AND \tmessage_status='unread'"); break; case 'notification': default: $count = $db->count(tbl($this->tbl), "message_id", " message_to LIKE '%#{$uid}#%' AND message_box='in' AND message_type='notification' AND message_status='unread'"); break; } if ($count > 0) { return $count; } else { return "0"; } }
foreach ($videos as $video) { $log = get_file_details($video['file_name']); if ($log && $_POST['fix_duration']) { //$duration = $log['output_duration']; //if(!$duration) // $duration = $log['duration']; $duration = parse_duration(LOGS_DIR . '/' . $video['file_name'] . '.log'); if (!$duration) { e("Can't do anything about \"" . $video['title'] . "\""); } else { $db->update(tbl('video'), array('duration'), array($duration), "videoid='" . $video['videoid'] . "'"); $fixed_array[$video['file_name']] = 'yes'; e("Succesfully updated duration of \"" . $video['title'] . "\" to " . SetTime($duration), 'm'); } } if (!$log && $_POST['mark_failed']) { $db->update(tbl("video"), array("status", "failed_reason"), array('Failed', "Unable to get video duration"), " file_name='" . $video['file_name'] . "'"); e("\"" . $video['title'] . "\" status has been changed to Failed", "m"); } if (!$log && $_POST['mark_delete']) { $db->update(tbl("video"), array("status", "failed_reason"), array('Failed', "Unable to get video duration"), " file_name='" . $video['file_name'] . "'"); $cbvideo->delete_video($video['videoid']); } } $videos = get_videos($params); } subtitle("Repair videos duration"); assign('videos', $videos); assign('fixed_array', $fixed_array); template_files('repair_vid_duration.html'); display_it();
/** * Funtion cused to get list of countries */ function get_countries($type = iso2) { global $db; $results = $db->select(tbl("countries"), "*"); switch ($type) { case id: foreach ($results as $result) { $carray[$result['country_id']] = $result['name_en']; } break; case iso2: foreach ($results as $result) { $carray[$result['iso2']] = $result['name_en']; } break; case iso3: foreach ($results as $result) { $carray[$result['iso3']] = $result['name_en']; } break; default: foreach ($results as $result) { $carray[$result['country_id']] = $result['name_en']; } break; } return $carray; }
/** * Count ads in a placement */ function count_ads_in_placement($place) { global $db; return $db->count(tbl("ads_data"), "ad_id", " ad_placement='{$place}'"); }
$cbphoto->delete_photo($id); if (error()) { $response = array('error' => error()); } echo json_encode($response); break; case "inline_exif_setting": $pid = mysql_clean($_POST['pid']); $val = $_POST['exif']; if (empty($pid) || !$cbphoto->photo_exists($pid)) { $response = array('error' => lang('Photo does not exist')); } if (strtolower($val) != 'yes' || strtolower($val) != 'no') { $response = array('error' => lang('Invalid value provided')); } if ($db->update(tbl('photos'), array('view_exif'), array($val), " photo_id = '" . $pid . "' ")) { $response = array('success' => 'Exif privacy setting updated.'); } else { $response = array('error' => 'Unable to update setting. Please try again'); } echo json_encode($response); break; case "get_colors": $pid = mysql_clean($_POST['id']); $colors = get_photo_meta_value($pid, 'colors'); if ($colors) { $colors = json_decode($colors, true); assign('colors', $colors); assign('photo', $cbphoto->get_photo($pid, true)); $template = Fetch('/global/colors.html', STYLES_DIR); $response = array('success' => true, 'template' => $template);
function un_install_customfield() { global $db; $db->Execute('DROP TABLE ' . tbl("custom_field")); }
<?php /** * File used to change admin password manually * Usage : change username and password in from their default values * to your account username and your password, upload this file on your * root directory of clipbucket where index.php is found so e.g http://clipbucket.com/admin_change_pass.php * you will see a confirmation message that your account password has been changed. * * for help and support pelase visti forums.clip-bucket.com or report issues on code.google.com/p/clipbucket/issues */ include "includes/config.inc.php"; //Username of account you want to changge password $username = '******'; //Set password $password = '******'; // -- DO NOT GO INSIDE DEEP RED PHP -- // $user = $userquery->get_user_details($username); if (!$user) { e("User does not exist"); } else { $pass = pass_code($password); $db->update(tbl('users'), array('password'), array($pass), "username='******'"); e("Password for your account has been changed, please delete this file", "m"); } display_it();
/** * Function used to move editors pick */ function move_epick($id, $order) { global $db; if (!is_video_in_editors_pick($id)) { e("Video doesnt exist in editor's picks"); } else { if (!is_numeric($order) || $order < 1) { $order = 1; } $db->update(tbl("editors_picks"), array("sort"), array($order), " videoid='" . $id . "'"); } }
function un_install_editors_pick() { global $db; $db->Execute('DROP TABLE ' . tbl("editors_picks")); $db->Execute("ALTER TABLE " . tbl('video') . " DROP `in_editor_pick` "); }
function kick($id) { global $db; //Getting little details from sessions such that //some lower class user can kick admins out ;) $results = $db->select(tbl("sessions") . " LEFT JOIN (" . tbl("users") . ") ON \n\t\t(" . tbl("sessions") . ".session_user="******"users") . ".userid)", tbl("sessions") . ".*,\n\t\t" . tbl("users") . ".level", "session_id='" . $id . "'"); $results = $results[0]; if ($results['level'] == 1) { e("You cannot kick administrators"); return false; } $db->delete(tbl($this->tbl), array("session_id"), array($id)); return true; }
if (!defined('MAIN_PAGE')) { define('MAIN_PAGE', 'Advertisement'); } if (!defined('SUB_PAGE')) { define('SUB_PAGE', 'Manage Placements'); } //Removing Placement if (isset($_GET['remove'])) { $placement = mysql_clean($_GET['remove']); $msg = $ads_query->RemovePlacement($placement); } //Adding Placement if (isset($_POST['AddPlacement'])) { $placement_name = mysql_clean($_POST['placement_name']); $placement_code = mysql_clean($_POST['placement_code']); $array = array($placement_name, $placement_code); $msg = $ads_query->AddPlacement($array); } //Getting List Of Placement $sql = "SELECT * FROM " . tbl("ads_placements"); $ads_placements = db_select($sql); $total_placements = $db->num_rows; //Getting total Ads in each placement for ($id = 0; $id <= $total_placements; $id++) { $ads_placements[$id]['total_ads'] = $adsObj->count_ads_in_placement($ads_placements[$id]['placement']); } Assign('ads_placements', $ads_placements); //pr($ads_placements,true); subtitle("Add Advertisment Placement"); template_files('ads_add_placements.html'); display_it();
<?php //Insert Recaptcha field in configurations $db->delete(tbl("config"), array("name"), array("reCaptcha_public_key")); $db->delete(tbl("config"), array("name"), array("reCaptcha_private_key"));
/** * This file is used to install Embed Video Mod */ function uninstall_embed_video_mode() { global $db; $db->Execute("ALTER TABLE `" . tbl('video') . "` DROP `embed_code` "); }