Пример #1
0
 function cb_risky($smd_v)
 {
     if ($smd_v['content_type'] == 'html') {
         $m_value = rem_risky_tags($smd_v['m_value']);
         unset($smd_v['m_value']);
         $smd_v = @format_str($smd_v);
         $smd_v['m_value'] = $m_value;
     } else {
         $smd_v = @format_str($smd_v);
     }
     return $smd_v;
 }
 $misc_id = (int) getgpcvar("misc_id", "P");
 //die('x');
 ##/ Validate Fields
 include_once '../../includes/form_validator.php';
 $form_v = new Valitron\Validator($_POST);
 $rules = ['required' => [['title'], ['m_value'], ['m_cat']], 'lengthMax' => [['title', 250], ['m_cat', 70]]];
 $form_v->labels(array('title' => 'Name / Title', 'm_value' => 'Value', 'm_cat' => 'Category'));
 $form_v->rules($rules);
 $form_v->validate();
 $fv_errors = $form_v->errors();
 //var_dump("<pre>", $_POST, $fv_errors); die();
 #-
 if (!is_array($fv_errors) || empty($fv_errors) || count($fv_errors) <= 0) {
     $content_type = @$_POST['content_type'];
     if ($content_type == 'html') {
         $m_value = rem_risky_tags($_POST_ori['m_value']);
     } else {
         if ($content_type == 'plain') {
             $m_value = $_POST['m_value'];
         }
     }
     //var_dump($content_type, $m_value); die();
     ##/ Image processing & savings
     include_once '../../includes/resize_images.php';
     $up_path = "../assets/images_2/misc/";
     //if(!is_dir($up_path)){mkdir($up_path, 0705, true);}
     $sql_prt = $new_m_image = '';
     if (is_uploaded_file(@$_FILES['m_image']['tmp_name'])) {
         $new_m_image = upload_img_rs('m_image', 0, 0, $up_path, 'Image', '', '', 'CUSA_ADMIN_MSG_GLOBAL');
         if ($new_m_image != '') {
             $sql_prt .= " m_image='{$new_m_image}', ";
         $fv_errors[] = array('The SEO TAG you entered already exists! Please try a different one.');
     }
 }
 #-
 if (!is_array($fv_errors) || empty($fv_errors) || count($fv_errors) <= 0) {
     #/ Setup variables to save
     $_POST['cat_id'] = (int) @$_POST['cat_id'];
     $_POST['popup_only'] = (int) @$_POST['popup_only'];
     $_POST['is_active'] = (int) @$_POST['is_active'];
     $_POST['show_in_footer'] = (int) @$_POST['show_in_footer'];
     $m_type = $pg_content = '';
     $sql_prt = $new_pdf_content = '';
     $up_path = "../assets/media/docs/";
     if ($content_type == 'html') {
         if ($self_managed == '0') {
             $pg_content = rem_risky_tags($_POST_ori['pg_content']);
             $sql_prt .= " pdf_content='', ";
             if ($sp_id > 0) {
                 $cur_pdf_content = @$_POST["cur_pdf_content"];
                 if (!empty($cur_pdf_content)) {
                     @unlink($up_path . $cur_pdf_content);
                 }
             }
         }
     } else {
         if ($content_type == 'pdf') {
             $pg_content = $_POST['page_heading'] = $_POST['head_msg'] = $_POST['pg_content'] = '';
             $_POST['meta_keywords'] = $_POST['meta_descr'] = '';
             ##/ Setup PDF file
             if (is_uploaded_file(@$_FILES['pdf_content']['tmp_name'])) {
                 $up_type = $_FILES['pdf_content']['type'];
Пример #4
0
/////////////////////////////////////////////////////////////////
if (isset($_POST['question_text'])) {
    $vc_id = (int) getgpcvar("vc_id", "P");
    $user_id = (int) getgpcvar("user_id", "P");
    ##/ Validate Fields
    include_once '../../includes/form_validator.php';
    $form_v = new Valitron\Validator($_POST);
    $rules = ['required' => [['question_text'], ['voice_cat_id'], ['user_id']], 'lengthMax' => [['question_text', 170]]];
    $form_v->labels(array('question_text' => 'Voice Question', 'voice_cat_id' => 'Voice Category', 'user_id' => 'User Info'));
    $form_v->rules($rules);
    $form_v->validate();
    $fv_errors = $form_v->errors();
    //var_dump("<pre>", $_POST, $fv_errors); die();
    #-
    if (!is_array($fv_errors) || empty($fv_errors) || count($fv_errors) <= 0) {
        $voice_details = rem_risky_tags($_POST_ori['voice_details']);
        $_POST['is_blocked'] = (int) @$_POST['is_blocked'];
        ##/ Set Voice Tags
        $voice_tag_ids = '';
        if (array_key_exists('voice_tags', $_POST) && is_array($_POST['voice_tags'])) {
            $voice_tag_ids_ar = array();
            foreach ($_POST['voice_tags'] as $voice_tags) {
                $sql_1 = "INSERT INTO voice_tags (tag, added_on) VALUES ('{$voice_tags}', NOW())\n                ON DUPLICATE KEY UPDATE tag='{$voice_tags}', id=LAST_INSERT_ID(id)";
                @mysql_exec($sql_1, 'save');
                $voice_tag_ids_ar[] = (string) @mysql_insert_id();
            }
            //var_dump("<pre>", $_POST, $voice_tag_ids_ar); die();
            if (!empty($voice_tag_ids_ar)) {
                $voice_tag_ids = @json_encode($voice_tag_ids_ar);
            }
        }