Esempio n. 1
0
    /**
     * FUNCTION USED TO LOAD FORM OPTION FIELDS
     * broadacast [Radio Button]
     * embedding [Radio Button]
     * rating [Radio Button]
     * comments [Radio Button]
     * comments rating [Radio Button]
     */
    function loadOptionFields($default = NULL)
    {
        global $LANG, $uploadFormOptionFieldsArray;
        if ($default == NULL) {
            $default = $_POST;
        }
        $broadcast = $default['broadcast'] ? $default['broadcast'] : 'public';
        $comments = $default['allow_comments'] ? $default['allow_comments'] : 'yes';
        $comment_voting = $default['comment_voting'] ? $default['comment_voting'] : 'yes';
        $rating = $default['allow_rating'] ? $default['allow_rating'] : 'yes';
        $embedding = $default['allow_embedding'] ? $default['allow_embedding'] : 'yes';
        //Checking weather to enabled or disable password field
        $video_pass_disable = 'disabled="disabled"  ';
        $video_user_disable = 'disabled="disabled"  ';
        if ($broadcast == 'unlisted') {
            $video_pass_disable = "";
        } elseif ($broadcast == 'private') {
            $video_user_disable = '';
        }
        $uploadFormOptionFieldsArray = array('broadcast' => array('title' => lang('vdo_br_opt'), 'type' => 'radiobutton', 'name' => 'broadcast', 'id' => 'broadcast', 'value' => get_broadcast_options("upload_fields"), 'checked' => $broadcast, 'db_field' => 'broadcast', 'required' => 'no', 'validate_function' => 'yes_or_no', 'display_function' => 'display_sharing_opt', 'default_value' => 'public', 'extra_tags' => ' onClick="
									$(\'#video_password\').attr(\'disabled\',\'disabled\');
									$(\'#video_users\').attr(\'disabled\',\'disabled\');
									if($(this).val()==\'unlisted\') 
										$(\'#video_password\').attr(\'disabled\',\'\')
									else if($(this).val()==\'private\') 
										$(\'#video_users\').attr(\'disabled\',\'\')

									" '), 'video_password' => array('title' => lang('video_password'), 'type' => 'password', 'name' => 'video_password', 'id' => 'video_password', 'value' => $default['video_password'], 'db_field' => 'video_password', 'required' => 'no', 'extra_tags' => " {$video_pass_disable} ", 'hint_2' => lang('set_video_password')), 'video_users' => array('title' => lang('video_users'), 'type' => 'textarea', 'name' => 'video_users', 'id' => 'video_users', 'value' => $default['video_users'], 'db_field' => 'video_users', 'required' => 'no', 'extra_tags' => " {$video_user_disable} ", 'hint_2' => lang('specify_video_users'), 'validate_function' => 'video_users', 'use_func_val' => true), 'comments' => array('title' => lang('comments'), 'type' => 'radiobutton', 'name' => 'allow_comments', 'id' => 'comments', 'value' => array('yes' => lang('vdo_allow_comm'), 'no' => lang('vdo_dallow_comm')), 'checked' => $comments, 'db_field' => 'allow_comments', 'required' => 'no', 'validate_function' => 'yes_or_no', 'display_function' => 'display_sharing_opt', 'default_value' => 'yes'), 'commentsvote' => array('title' => lang('vdo_comm_vote'), 'type' => 'radiobutton', 'name' => 'comment_voting', 'id' => 'comment_voting', 'value' => array('yes' => lang('vdo_allow_comm') . ' Voting', 'no' => lang('vdo_dallow_comm') . ' Voting'), 'checked' => $comment_voting, 'db_field' => 'comment_voting', 'required' => 'no', 'validate_function' => 'yes_or_no', 'display_function' => 'display_sharing_opt', 'default_value' => 'yes'), 'rating' => array('title' => lang('ratings'), 'type' => 'radiobutton', 'name' => 'allow_rating', 'id' => 'rating', 'value' => array('yes' => lang('vdo_allow_rating'), 'no' => lang('vdo_dallow_ratig')), 'checked' => $rating, 'db_field' => 'allow_rating', 'required' => 'no', 'validate_function' => 'yes_or_no', 'display_function' => 'display_sharing_opt', 'default_value' => 'yes'), 'embedding' => array('title' => lang('vdo_embedding'), 'type' => 'radiobutton', 'name' => 'allow_embedding', 'id' => 'embedding', 'value' => array('yes' => lang('vdo_embed_opt1'), 'no' => lang('vdo_embed_opt2')), 'checked' => $embedding, 'db_field' => 'allow_embedding', 'required' => 'no', 'validate_function' => 'yes_or_no', 'display_function' => 'display_sharing_opt', 'default_value' => 'yes'));
        return $uploadFormOptionFieldsArray;
    }
/**
 * Is valid broadcast option
 * 
 * @param STRING $opt
 * @return BOOLEAN $is_broadcast
 */
function is_valid_broadcast($opt)
{
    $options = get_broadcast_options();
    if (in_array($opt, $options)) {
        return true;
    } else {
        return false;
    }
}