Exemplo n.º 1
0
 function _validate_logo($image = '', $edit = false)
 {
     if (isset($_FILES['logo']) && !empty($_FILES['logo']['name'])) {
         //check if the field is empty or not
         $image = array('location' => './uploads/admin/images/', 'temp_location' => './uploads/admin/images/temp/', 'width' => LOGO_W, 'height' => LOGO_H, 'image' => 'logo');
         $this->load->helper('image_helper');
         $response = validate_image($image);
         if ($response['status']) {
             return true;
         } else {
             $this->form_validation->set_message('_validate_logo', $response['msg']);
             return false;
         }
     } elseif (!$edit) {
         $this->form_validation->set_message('_validate_logo', 'Please select an image for logo.');
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 2
0
    $s = manage_spawn_storage($storage);
    $s->Unlink($value);
    $value = '';
    ?>
    <script language="JavaScript" tyle="text/javascript">window.parent.CDCImage_OnImageUpload ('<?php 
    echo $field;
    ?>
', '<?php 
    echo $formname;
    ?>
', '', '');</script>
<?php 
} else {
    if (isset($_FILES['uploading'])) {
        $data = $_FILES['uploading'];
        $err = validate_image($data, $size, $hlimit, $vlimit);
        if ($err == '') {
            $s = manage_spawn_storage($storage);
            $fn = $s->Put($data, $user_id);
            $value = $fn;
            $full = $s->GetFullURL($fn);
            $p = $s->GetFileParams($value);
            ?>
    <script language="JavaScript" type="text/javascript">window.parent.CDCImage_OnImageUpload ('<?php 
            echo $field;
            ?>
', '<?php 
            echo $formname;
            ?>
', '<?php 
            echo $full;
Exemplo n.º 3
0
<?php

define('puush', '');
require_once 'config.php';
require_once 'func.php';
// ?
$k = get_post_var('k');
// ?
$c = get_post_var('c');
// Check for the file
if (!isset($_FILES['f'])) {
    exit('ERR No file provided.');
}
// The file they are uploading
$file = $_FILES['f'];
// Check the size, max 250 MB
if ($file['size'] > MAX_FILE_SIZE) {
    exit('ERR File is too big.');
}
// Ensure the image is actually a file and not a friendly virus
if (validate_image($file) === FALSE) {
    exit('ERR Invalid image.');
}
// Generate a new file name
$ext = get_ext($file['name']);
$generated_name = generate_upload_name($ext);
// Move the file
move_uploaded_file($file['tmp_name'], UPLOAD_DIR . $generated_name . '.' . $ext);
// ahem
echo '0,' . sprintf(FORMATTED_URL, $generated_name) . ',-1,-1';
Exemplo n.º 4
0
function preform_avatar_action($data, $validator)
{
    foreach ($data as $uid => $status) {
        $uid = substr($uid, 5);
        if (is_numeric($status) && is_numeric($uid)) {
            if ($status == 2) {
                validate_image($uid, $validator);
            }
            if ($status == 3) {
                refuse_image($uid, $validator);
            }
            if ($status == 4) {
                block_user($uid);
            }
        }
    }
}
Exemplo n.º 5
0
 function _validate_image($received_image = '', $edit = false)
 {
     if (isset($_FILES['image']) && !empty($_FILES['image']['name'])) {
         $this->load->helper('image_helper');
         $image = array('location' => './uploads/user/images/', 'temp_location' => './uploads/user/images/temp/', 'width' => USER_W, 'height' => USER_H, 'image' => 'image');
         $response = validate_image($image);
         if ($response['status']) {
             return true;
         } else {
             $this->form_validation->set_message('_validate_image', $response['msg']);
             return false;
         }
     } elseif (!$edit) {
         $this->form_validation->set_message('_validate_image', 'You must provide an image.');
         return false;
     } else {
         return true;
     }
 }