示例#1
0
 /**
  * Function used to load collections fields
  */
 function load_required_fields($default = NULL)
 {
     if ($default == NULL) {
         $default = $_POST;
     }
     $name = $default['collection_name'];
     $description = $default['collection_description'];
     $tags = $default['collection_tags'];
     //$type = $default['type'];
     if (is_array($default['category'])) {
         $cat_array = array($default['category']);
     } else {
         preg_match_all('/#([0-9]+)#/', $default['category'], $m);
         $cat_array = array($m[1]);
     }
     $reqFileds = array('name' => array('title' => lang("collection_name"), 'type' => 'textfield', 'name' => 'collection_name', 'id' => 'collection_name', 'value' => cleanForm($name), 'db_field' => 'collection_name', 'required' => 'yes', 'invalid_err' => lang("collect_name_er")), 'desc' => array('title' => lang("collection_description"), 'type' => 'textarea', 'name' => 'collection_description', 'id' => 'colleciton_desciption', 'value' => cleanForm($description), 'db_field' => 'collection_description', 'required' => 'yes', 'anchor_before' => 'before_desc_compose_box', 'invalid_err' => lang("collect_descp_er")), 'tags' => array('title' => lang("collection_tags"), 'type' => 'textfield', 'name' => 'collection_tags', 'id' => 'collection_tags', 'value' => cleanForm(genTags($tags)), 'hint_2' => lang("collect_tag_hint"), 'db_field' => 'collection_tags', 'required' => 'yes', 'invalid_err' => lang("collect_tag_er"), 'validate_function' => 'genTags'), 'cat' => array('title' => lang("collect_category"), 'type' => 'checkbox', 'name' => 'category[]', 'id' => 'category', 'value' => array('category', $cat_array), 'db_field' => 'category', 'required' => 'yes', 'validate_function' => 'validate_collection_category', 'invalid_err' => lang('collect_cat_er'), 'display_function' => 'convert_to_categories', 'category_type' => 'collections'));
     return $reqFileds;
 }
示例#2
0
         $itemsArray['pagination'] = Fetch("blocks/new_pagination.html");
         foreach ($items as $item) {
             assign('object', $item);
             assign('display_type', 'view_collection');
             assign('type', $type);
             $itemsArray['content'] .= Fetch("blocks/collection.html");
         }
         echo json_encode($itemsArray);
     } else {
         echo json_encode(array("error" => TRUE));
     }
     break;
 case "add_collection":
     $name = $_POST['collection_name'];
     $desc = $_POST['collection_description'];
     $tags = genTags($_POST['collection_tags']);
     $cat = $_POST['category'];
     $type = "photos";
     $CollectParams = array("collection_name" => $name, "collection_description" => $desc, "collection_tags" => $tags, "category" => $cat, "type" => $type, "allow_comments" => "yes", "broadcast" => "public", "public_upload" => "yes");
     $insert_id = $cbcollection->create_collection($CollectParams);
     if (msg()) {
         $msg = msg_list();
         $msg = '<div class="msg">' . $msg[0] . '</div>';
     }
     if (error()) {
         $err = error_list();
         $err = '<div class="error">' . $err[0] . '</div>';
     }
     $ajax['msg'] = $msg;
     $ajax['err'] = $err;
     $ajax['id'] = $insert_id;
示例#3
0
if ($_POST['insertVideo']) {
    $mode = "insert_video";
}
if ($_POST['getForm']) {
    $mode = "get_form";
}
if ($_POST['updateVideo'] == 'yes') {
    $mode = "update_video";
}
switch ($mode) {
    case "insert_video":
        $title = getName($_POST['title']);
        $file_name = $_POST['file_name'];
        $file_directory = createDataFolders();
        //dump($file_directory);
        $vidDetails = array('title' => $title, 'description' => $title, 'tags' => genTags(str_replace(' ', ', ', $title)), 'category' => array($cbvid->get_default_cid()), 'file_name' => $file_name, 'file_directory' => $file_directory, 'userid' => userid(), 'video_version' => '2.7');
        $vid = $Upload->submit_upload($vidDetails);
        // sending curl request to content .ok
        $call_bk = PLUG_URL . "/cb_multiserver/api/call_back.php";
        $ch = curl_init($call_bk);
        $ch_opts = array(CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTPHEADER => array("Expect:"));
        $array = array("update" => TRUE);
        //curl_setopt($ch,CURLOPT_POSTFIELDS,$array);
        $charray = $ch_opts;
        $charray[CURLOPT_POSTFIELDS] = $array;
        curl_setopt_array($ch, $charray);
        curl_exec($ch);
        curl_close($ch);
        // inserting into video views as well
        $query = "INSERT INTO " . tbl("video_views") . " (video_id, video_views, last_updated) VALUES({$vid}, 0, " . time() . ")";
        $db->Execute($query);
示例#4
0
 /**
  * Creating Group Required Fields
  */
 function load_required_fields($default = NULL, $is_update = FALSE)
 {
     if ($default == NULL) {
         $default = $_POST;
     }
     $gptitle = $default['group_name'];
     $gpdescription = $default['group_description'];
     if (is_array($default['category'])) {
         $cat_array = array($default['category']);
     } else {
         preg_match_all('/#([0-9]+)#/', $default['category'], $m);
         $cat_array = array($m[1]);
     }
     $tags = $default['group_tags'];
     $gpurl = $default['group_url'];
     if (!$is_update) {
         $url_form = array('title' => lang('grp_url_title'), 'type' => 'textfield', 'name' => 'group_url', 'id' => 'group_url', 'value' => cleanForm($gpurl), 'hint_1' => '', 'hint_2' => lang('grp_url_msg'), 'db_field' => 'group_url', 'required' => 'yes', 'invalid_err' => lang('grp_url_error'), 'syntax_type' => 'field_text', 'function_error_msg' => lang('user_contains_disallow_err'), 'db_value_check_func' => 'group_url_exists', 'db_value_exists' => false, 'db_value_err' => lang('grp_url_error2'), 'min_length' => 3, 'max_length' => 18);
     } else {
         $url_form = array('title' => lang('grp_url_title'), 'type' => 'textfield', 'name' => 'group_url', 'id' => 'group_url', 'value' => cleanForm($gpurl), 'hint_1' => '', 'hint_2' => lang('grp_url_msg'), 'db_field' => 'group_url', 'required' => 'yes', 'invalid_err' => lang('grp_url_error'), 'syntax_type' => 'field_text', 'function_error_msg' => lang('user_contains_disallow_err'), 'min_length' => 3, 'max_length' => 18);
     }
     $fields = array('name' => array('title' => lang('grp_name_title'), 'type' => "textfield", 'name' => "group_name", 'id' => "group_name", 'value' => $gptitle, 'db_field' => 'group_name', 'required' => 'yes', 'invalid_err' => lang('grp_name_error'), 'max_length' => config('grp_max_title')), 'tags' => array('title' => lang('tag_title'), 'type' => 'textfield', 'name' => 'group_tags', 'id' => 'group_tags', 'value' => genTags($tags), 'hint_1' => '', 'hint_2' => lang('grp_tags_msg1'), 'db_field' => 'group_tags', 'required' => 'yes', 'invalid_err' => lang('grp_tags_error'), 'validate_function' => 'genTags'), 'desc' => array('title' => lang('vdo_desc'), 'type' => 'textarea', 'name' => 'group_description', 'id' => 'group_description', 'value' => cleanForm($gpdescription), 'size' => '35', 'extra_params' => ' rows="4" ', 'db_field' => 'group_description', 'invalid_err' => lang('grp_des_error'), 'required' => 'yes', 'max_length' => config('grp_max_desc')), $url_form, 'cat' => array('title' => lang('grp_cat_tile'), 'type' => 'checkbox', 'name' => 'category[]', 'id' => 'category', 'value' => array('category', $cat_array), 'hint_1' => sprintf(lang('vdo_cat_msg'), ALLOWED_GROUP_CATEGORIES), 'db_field' => 'category', 'required' => 'yes', 'validate_function' => 'validate_group_category', 'invalid_err' => lang('grp_cat_error'), 'display_function' => 'convert_to_categories', 'category_type' => 'group'));
     return $fields;
 }
示例#5
0
 /**
  * Load Required Form
  */
 function load_required_forms($array = NULL)
 {
     if ($array == NULL) {
         $array = $_POST;
     }
     $title = $array['photo_title'];
     $description = $array['photo_description'];
     $tags = $array['photo_tags'];
     $show_collection = $array['is_avatar'] ? 'no' : 'yes';
     if ($array['user']) {
         $p['user'] = $array['user'];
     } else {
         $p['user'] = userid();
     }
     $p['type'] = "photos";
     $collections = $this->collection->get_collections($p);
     if (!$collections) {
         global $cbcollection;
         $collection_details['collection_name'] = $collection_details['collection_description'] = lang('Untitled Collection');
         $collection_details['collection_tags'] = lang('untitled, collection');
         $collection_details['category'] = array($cbcollection->get_default_cid());
         // Update following to have default values
         $collection_details['broadcast'] = 'public';
         $collection_details['allow_comments'] = 'yes';
         $collection_details['public_upload'] = 'no';
         $collection_insert_id = $cbcollection->create_collection($collection_details);
         $collection_details['collection_id'] = $collection_insert_id;
         $collections[0] = $collection_details;
         //pr( $collections, true );
     }
     $cl_array = $this->parse_array($collections);
     $collection = $array['collection_id'];
     $fields = array('name' => array('title' => lang('photo_title'), 'id' => 'photo_title', 'name' => 'photo_title', 'type' => 'textfield', 'value' => cleanForm($title), 'db_field' => 'photo_title', 'required' => 'yes', 'invalid_err' => lang('photo_title_err')), 'desc' => array('title' => lang('photo_caption'), 'id' => 'photo_description', 'name' => 'photo_description', 'type' => 'textarea', 'value' => cleanForm($description), 'db_field' => 'photo_description', 'anchor_before' => 'before_desc_compose_box', 'required' => 'yes', 'invalid_err' => lang('photo_caption_err')), 'tags' => array('title' => lang('photo_tags'), 'id' => 'photo_tags', 'name' => 'photo_tags', 'type' => 'textfield', 'value' => genTags($tags), 'db_field' => 'photo_tags', 'required' => 'yes', 'invalid_err' => lang('photo_tags_err')));
     $fields['collection'] = array('title' => lang('collection'), 'id' => 'collection_id', 'name' => 'collection_id', 'type' => 'dropdown', 'value' => $cl_array, 'db_field' => 'collection_id', 'required' => '', 'checked' => $collection, 'invalid_err' => lang('photo_collection_err'));
     return $fields;
 }
示例#6
0
     if (error()) {
         $response['error'] = error();
     }
     if (msg()) {
         $response['success'] = true;
         $response['id'] = $insert_id;
         $response['file'] = $filename;
         $response['extension'] = $extension;
         $response['file_directory'] = $photo_dir;
     }
     echo json_encode($response);
     break;
 case "update_photo":
     $_POST['photo_title'] = genTags(str_replace(array('_', '-'), ' ', $_POST['photo_title']));
     $_POST['photo_description'] = genTags(str_replace(array('_', '-'), ' ', $_POST['photo_description']));
     $_POST['photo_tags'] = genTags(str_replace(array(' ', '_', '-'), ', ', $_POST['photo_tags']));
     $cbphoto->update_photo();
     if (error()) {
         $error = error('single');
     }
     if (msg()) {
         $success = msg('single');
     }
     $updateResponse['error'] = $error;
     $updateResponse['success'] = $success;
     echo json_encode($updateResponse);
     break;
 case "uploadPhoto":
     $exts = $cbphoto->exts;
     $max_size = 1048576;
     // 2MB in bytes
示例#7
0
 /**
  * FUNCTION USED TO LOAD UPLOAD FORM REQUIRED FIELDS
  * title [Text Field]
  * description [Text Area]
  * tags [Text Field]
  * categories [Check Box]
  */
 function loadRequiredFields($default = NULL)
 {
     global $LANG;
     if ($default == NULL) {
         $default = $_POST;
     }
     $title = $default['title'];
     $desc = $default['description'];
     if (is_array($default['category'])) {
         $cat_array = array($default['category']);
     } else {
         preg_match_all('/#([0-9]+)#/', $default['category'], $m);
         $cat_array = array($m[1]);
     }
     $tags = $default['tags'];
     $uploadFormRequiredFieldsArray = array('title' => array('title' => lang('vdo_title'), 'type' => 'textfield', 'name' => 'title', 'id' => 'title', 'value' => cleanForm($title), 'size' => '45', 'db_field' => 'title', 'required' => 'yes', 'min_length' => config("video_min_title"), 'max_length' => config("video_max_title")), 'desc' => array('title' => lang('vdo_desc'), 'type' => 'textarea', 'name' => 'description', 'id' => 'desc', 'value' => cleanForm($desc), 'size' => '35', 'extra_params' => ' rows="4"', 'db_field' => 'description', 'required' => 'no', 'anchor_after' => 'after_desc_compose_box'), 'cat' => array('title' => lang('vdo_cat'), 'type' => 'checkbox', 'name' => 'category[]', 'id' => 'category', 'value' => array('category', $cat_array), 'hint_1' => sprintf(lang('vdo_cat_msg'), ALLOWED_VDO_CATS), 'db_field' => 'category', 'required' => 'yes', 'validate_function' => 'validate_vid_category', 'invalid_err' => lang('vdo_cat_err3'), 'display_function' => 'convert_to_categories'), 'tags' => array('title' => lang('tag_title'), 'type' => 'textfield', 'name' => 'tags', 'id' => 'tags', 'value' => cleanForm(genTags($tags)), 'hint_1' => '', 'hint_2' => lang('vdo_tags_msg'), 'db_field' => 'tags', 'required' => 'yes', 'validate_function' => 'genTags'));
     //Setting Anchors
     $uploadFormRequiredFieldsArray['desc']['anchor_before'] = 'before_desc_compose_box';
     //Setting Sizes
     return $uploadFormRequiredFieldsArray;
 }
示例#8
0
         $details = $cbphoto->get_photo($insert_id);
         $details["filename"] = $_POST["file_name"];
         $details["ext"] = getExt($_POST["title"]);
         $cbphoto->generate_photos($details);
         //var_dump($details);
         $params = array("details" => $details, "size" => "m");
         //var_dump($params);
         $response['photoPreview'] = get_photo($params);
     }
     //var_dump($response);
     echo json_encode($response);
     break;
 case "update_photo":
     $_POST['photo_title'] = genTags(str_replace(array('_', '-'), ' ', mysql_clean($_POST['photo_title'])));
     $_POST['photo_description'] = genTags(str_replace(array('_', '-'), ' ', mysql_clean($_POST['photo_description'])));
     $_POST['photo_tags'] = genTags(str_replace(array(' ', '_', '-'), ', ', mysql_clean($_POST['photo_tags'])));
     $cbphoto->update_photo();
     if (error()) {
         $error = error('single');
     }
     if (msg()) {
         $success = msg('single');
     }
     $updateResponse['error'] = $error;
     $updateResponse['success'] = $success;
     echo json_encode($updateResponse);
     break;
 case "uploadPhoto":
     $exts = $cbphoto->exts;
     $max_size = 1048576;
     // 2MB in bytes
示例#9
0
 /**
  * Load Required Form
  */
 function load_required_forms($array = NULL)
 {
     if ($array == NULL) {
         $array = $_POST;
     }
     $title = $array['photo_title'];
     $description = $array['photo_description'];
     $tags = $array['photo_tags'];
     if ($array['user']) {
         $p['user'] = $array['user'];
     } else {
         $p['user'] = userid();
     }
     $p['type'] = "photos";
     $collections = $this->collection->get_collections($p);
     $cl_array = $this->parse_array($collections);
     $collection = $array['collection_id'];
     $this->unique = rand(0, 9999);
     $fields = array('name' => array('title' => lang('photo_title'), 'id' => 'photo_title', 'name' => 'photo_title', 'type' => 'textfield', 'value' => cleanForm($title), 'db_field' => 'photo_title', 'required' => 'yes', 'invalid_err' => lang('photo_title_err')), 'desc' => array('title' => lang('photo_caption'), 'id' => 'photo_description', 'name' => 'photo_description', 'type' => 'textarea', 'value' => cleanForm($description), 'db_field' => 'photo_description', 'anchor_before' => 'before_desc_compose_box', 'required' => 'yes', 'invalid_err' => lang('photo_caption_err')), 'tags' => array('title' => lang('photo_tags'), 'id' => 'photo_tags', 'name' => 'photo_tags', 'type' => 'textfield', 'value' => genTags($tags), 'db_field' => 'photo_tags', 'required' => 'yes', 'invalid_err' => lang('photo_tags_err')), 'collection' => array('title' => lang('collection'), 'id' => 'collection_id', 'name' => 'collection_id', 'type' => 'dropdown', 'value' => $cl_array, 'db_field' => 'collection_id', 'required' => '', 'checked' => $collection, 'invalid_err' => lang('photo_collection_err')));
     return $fields;
 }
示例#10
0
//Finish Writing File
fclose($temp_fo);
//var_dump($curlOpt);
sleep(2);
$details = $logDetails;
//file_get_contents($log_file);
//$details = json_decode($details,true);
$targetFileName = $file_name . '.' . $ext;
$Upload->add_conversion_queue($targetFileName);
if (file_exists($log_file)) {
    unlink($log_file);
}
if (file_exists($dummy_file)) {
    unlink($dummy_file);
}
$quick_conv = config('quick_conv');
$use_crons = config('use_crons');
//Inserting data
$title = urldecode(mysql_clean(getName($file)));
$title = $title ? $title : "Untitled";
$vidDetails = array('title' => $title, 'description' => $title, 'duration' => $total, 'tags' => genTags(str_replace(' ', ', ', $title)), 'category' => array($cbvid->get_default_cid()), 'file_name' => $file_name, 'userid' => userid(), 'file_directory' => createDataFolders());
$vid = $Upload->submit_upload($vidDetails);
echo json_encode(array('vid' => $vid));
if ($quick_conv == 'yes' || $use_crons == 'no') {
    //exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
    if (stristr(PHP_OS, 'WIN')) {
        exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php {$targetFileName} sleep");
    } else {
        exec(php_path() . " -q " . BASEDIR . "/actions/video_convert.php {$targetFileName} sleep&> /dev/null &");
    }
}