/** * 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; }
function form_val($string) { return cleanForm($string); }
if (!isset($url)) { $url = ""; } if (!isset($reindex)) { $reindex = ""; } if (isset($adv)) { $_SESSION['index_advanced'] = $adv; } indexscreen($url, $reindex); break; case add_site: addsiteform(); break; case clean: cleanForm(); break; } if ($db_con && $success && $tables) { $stats = getStatistics(); echo "<div >\n <p class='stats'>\n <br />\n <span class='em'>Database " . $dba_act . " with table prefix '{$mysql_table_prefix}' contains: </span>\n <br /><br />\n " . $stats['sites'] . " sites <b>+</b> " . $stats['links'] . " page links <b>+</b> " . $stats['categories'] . " categories <b>+</b> " . $stats['keywords'] . " keywords\n "; if ($index_media == '1') { echo " <strong>+</strong> " . $stats['media'] . " media links.\n "; if ($debug == "2") { // show free disk space $bytes = ''; $bytes = @disk_free_space("."); if ($bytes) { $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB'); $base = 1024; $class = min((int) log($bytes, $base), count($si_prefix) - 1);
/** * 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; }
/** * Function used to use to initialize search object for video section * op=>operator (AND OR) */ function init_search() { $this->search = new cbsearch(); $this->search->db_tbl = "video"; $this->search->columns = array(array('field' => 'title', 'type' => 'LIKE', 'var' => '%{KEY}%'), array('field' => 'tags', 'type' => 'LIKE', 'var' => '%{KEY}%', 'op' => 'OR'), array('field' => 'broadcast', 'type' => '!=', 'var' => 'unlisted', 'op' => 'AND', 'value' => 'static'), array('field' => 'status', 'type' => '=', 'var' => 'Successful', 'op' => 'AND', 'value' => 'static')); $this->search->use_match_method = true; $this->search->match_fields = array("title", "tags"); $this->search->cat_tbl = $this->cat_tbl; $this->search->display_template = LAYOUT . '/blocks/video.html'; $this->search->template_var = 'video'; $this->search->has_user_id = true; /** * Setting up the sorting thing */ $sorting = array('date_added' => lang("date_added"), 'views' => lang("views"), 'comments' => lang("comments"), 'rating' => lang("rating"), 'favorites' => lang("favorites")); $this->search->sorting = array('date_added' => " date_added DESC", 'views' => " views DESC", 'comments' => " comments_count DESC ", 'rating' => " rating DESC", 'favorites' => " favorites DeSC"); /** * Setting Up The Search Fields */ $default = $_GET; if (is_array($default['category'])) { $cat_array = array($default['category']); } $uploaded = $default['datemargin']; $sort = $default['sort']; $this->search->search_type['videos'] = array('title' => lang('videos')); $this->search->results_per_page = config('videos_items_search_page'); $fields = array('query' => array('title' => lang('keywords'), 'type' => 'textfield', 'name' => 'query', 'id' => 'query', 'value' => cleanForm($default['query'])), 'category' => array('title' => lang('vdo_cat'), 'type' => 'checkbox', 'name' => 'category[]', 'id' => 'category', 'value' => array('category', $cat_array)), 'uploaded' => array('title' => lang('uploaded'), 'type' => 'dropdown', 'name' => 'datemargin', 'id' => 'datemargin', 'value' => $this->search->date_margins(), 'checked' => $uploaded), 'sort' => array('title' => lang('sort_by'), 'type' => 'dropdown', 'name' => 'sort', 'value' => $sorting, 'checked' => $sort)); $this->search->search_type['videos']['fields'] = $fields; }
/** * Function used to use to initialize search object for video section * op=>operator (AND OR) */ function init_search() { $this->search = new cbsearch(); $this->search->db_tbl = "groups"; $this->search->columns = array(array('field' => 'group_name', 'type' => 'LIKE', 'var' => '%{KEY}%')); $this->search->cat_tbl = $this->cat_tbl; $this->search->display_template = LAYOUT . '/blocks/group.html'; $this->search->template_var = 'group'; $this->search->multi_cat = true; $this->search->results_per_page = config('grps_items_search_page'); $this->search->has_user_id = true; /** * Setting up the sorting thing */ $sorting = array('date_added' => lang("date_added"), 'total_views' => lang("views"), 'total_comments' => lang("comments"), 'total_videos' => lang("videos"), 'total_members' => lang("total members")); $this->search->sorting = array('date_added' => " date_added DESC", 'total_views' => " total_views DESC", 'total_comments' => " total_comments DESC ", 'total_videos' => " total_videos DESC", 'total_members' => " total_members DESC"); /** * Setting Up The Search Fields */ $default = $_GET; if (is_array($default['category'])) { $cat_array = array($default['category']); } $uploaded = $default['datemargin']; $sort = $default['sort']; $this->search->search_type['groups'] = array('title' => 'Groups'); $fields = array('query' => array('title' => lang('keywords'), 'type' => 'textfield', 'name' => 'query', 'id' => 'query', 'value' => cleanForm($default['query'])), 'category' => array('title' => lang('category'), 'type' => 'checkbox', 'name' => 'category[]', 'id' => 'category', 'value' => array('category', $cat_array), 'category_type' => 'group'), 'date_margin' => array('title' => lang('created'), 'type' => 'dropdown', 'name' => 'datemargin', 'id' => 'datemargin', 'value' => $this->search->date_margins(), 'checked' => $uploaded), 'sort' => array('title' => lang('sort_by'), 'type' => 'dropdown', 'name' => 'sort', 'value' => $sorting, 'checked' => $sort)); $this->search->search_type['groups']['fields'] = $fields; }
/** * Function used to load experice fields */ function load_education_interests($default) { $max_vals = array("schools_length", "occupation_length", "companies_length", "hobbies_length", "fav_movies_length", "fav_music_length", "fav_books_length"); foreach ($max_vals as $mval) { if (config($mval) > 10) { $maxval[str_replace('_length', '', $mval)] = config($mval); } elseif (is_numeric(config($mval))) { $maxval[$mval] = 10; } else { $maxval[$mval] = 100; } } extract($maxval); if (!$default) { $default = $_POST; } $more_details = array('education' => array('title' => lang("education"), 'type' => "dropdown", 'name' => "education", 'id' => "education", 'value' => array(lang('usr_arr_no_ans'), lang('usr_arr_elementary'), lang('usr_arr_hi_school'), lang('usr_arr_some_colg'), lang('usr_arr_assoc_deg'), lang('usr_arr_bach_deg'), lang('usr_arr_mast_deg'), lang('usr_arr_phd'), lang('usr_arr_post_doc')), 'checked' => $default['education'], 'db_field' => 'education', 'auto_view' => 'yes'), 'schools' => array('title' => lang("schools"), 'type' => "textarea", 'name' => "schools", 'id' => "schools", 'value' => cleanForm($default['schools']), 'db_field' => 'schools', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $schools), 'occupation' => array('title' => lang("occupation"), 'type' => "textarea", 'name' => "occupation", 'id' => "occupation", 'value' => cleanForm($default['occupation']), 'db_field' => 'occupation', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $occupation), 'companies' => array('title' => lang("companies"), 'type' => "textarea", 'name' => "companies", 'id' => "companies", 'value' => cleanForm($default['companies']), 'db_field' => 'companies', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $companies), 'hobbies' => array('title' => lang("hobbies"), 'type' => "textarea", 'name' => "hobbies", 'id' => "hobbies", 'value' => cleanForm($default['hobbies']), 'db_field' => 'hobbies', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $hobbies), 'fav_movies' => array('title' => lang("user_fav_movs_shows"), 'type' => "textarea", 'name' => "fav_movies", 'id' => "fav_movies", 'value' => cleanForm($default['fav_movies']), 'db_field' => 'fav_movies', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $fav_movies), 'fav_music' => array('title' => lang("user_fav_music"), 'type' => "textarea", 'name' => "fav_music", 'id' => "fav_music", 'value' => cleanForm($default['fav_music']), 'db_field' => 'fav_music', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $fav_music), 'fav_books' => array('title' => lang("user_fav_books"), 'type' => "textarea", 'name' => "fav_books", 'id' => "fav_books", 'value' => cleanForm($default['fav_books']), 'db_field' => 'fav_books', 'clean_func' => 'Replacer', 'auto_view' => 'yes', 'max_length' => $fav_books)); return $more_details; }
/** * Function used to load upload form fields * it will load all the values that are submited in the upload form * after validation */ function load_post_fields() { $required_fields = $this->loadRequiredFields($array); $location_fields = $this->loadLocationFields($array); $option_fields = $this->loadOptionFields($array); $upload_fields = array_merge($required_fields, $location_fields, $option_fields); if (count($this->custom_form_fields) > 0) { $upload_fields = array_merge($upload_fields, $this->custom_form_fields); } foreach ($upload_fields as $field) { $name = formObj::rmBrackets($field['name']); $val = $_POST[$name]; if (!is_array($val)) { $val = cleanForm($_POST[$name]); echo '<input type="hidden" name="' . $name . '" value="' . $val . '">'; } else { $loop = count($val); for ($i = 0; $i < $loop; $i++) { $val = $_POST[$name][$i]; $val = cleanForm($_POST[$name][$i]); echo '<input type="hidden" name="' . $name . '[]" value="' . $val . '">'; } } } }
/** * 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; }
/** * Function used to load experice fields */ function load_education_interests($default) { if (!$default) { $default = $_POST; } $more_details = array('education' => array('title' => lang("education"), 'type' => "dropdown", 'name' => "education", 'id' => "education", 'value' => array(lang('usr_arr_no_ans'), lang('usr_arr_elementary'), lang('usr_arr_hi_school'), lang('usr_arr_some_colg'), lang('usr_arr_assoc_deg'), lang('usr_arr_bach_deg'), lang('usr_arr_mast_deg'), lang('usr_arr_phd'), lang('usr_arr_post_doc')), 'checked' => $default['education'], 'db_field' => 'education', 'auto_view' => 'yes'), 'schools' => array('title' => lang("schools"), 'type' => "textarea", 'name' => "schools", 'id' => "schools", 'value' => cleanForm($default['schools']), 'db_field' => 'schools', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'occupation' => array('title' => lang("occupation"), 'type' => "textarea", 'name' => "occupation", 'id' => "occupation", 'value' => cleanForm($default['occupation']), 'db_field' => 'occupation', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'companies' => array('title' => lang("companies"), 'type' => "textarea", 'name' => "companies", 'id' => "companies", 'value' => cleanForm($default['companies']), 'db_field' => 'companies', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'hobbies' => array('title' => lang("hobbies"), 'type' => "textarea", 'name' => "hobbies", 'id' => "hobbies", 'value' => cleanForm($default['hobbies']), 'db_field' => 'hobbies', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'fav_movies' => array('title' => lang("user_fav_movs_shows"), 'type' => "textarea", 'name' => "fav_movies", 'id' => "fav_movies", 'value' => cleanForm($default['fav_movies']), 'db_field' => 'fav_movies', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'fav_music' => array('title' => lang("user_fav_music"), 'type' => "textarea", 'name' => "fav_music", 'id' => "fav_music", 'value' => cleanForm($default['fav_music']), 'db_field' => 'fav_music', 'clean_func' => 'Replacer', 'auto_view' => 'yes'), 'fav_books' => array('title' => lang("user_fav_books"), 'type' => "textarea", 'name' => "fav_books", 'id' => "fav_books", 'value' => cleanForm($default['fav_books']), 'db_field' => 'fav_books', 'clean_func' => 'Replacer', 'auto_view' => 'yes')); return $more_details; }