Esempio n. 1
0
 public function UploadImage($imgdata, $folder = 'Temp')
 {
     $base_dir = WWW_ROOT . DS . 'files/' . $folder;
     if (!is_dir($base_dir)) {
         mkdir($base_dir, 0755, true);
     }
     $arr_img = explode(".", $imgdata["name"]);
     $ext = strtolower($arr_img[count($arr_img) - 1]);
     if ($imgdata['error'] == 0 && in_array($ext, array('jpg', 'gif', 'png'))) {
         $fname = removeSpecialChar($imgdata['name']);
         $file = time() . "_" . $fname;
         if (upload_my_file($imgdata['tmp_name'], $base_dir . '/' . $file)) {
             $save_path = "thumb_" . $file;
             create_thumb($base_dir . '/' . $file, 150, $base_dir . '/' . $save_path);
             $array = array('image' => $file, 'thumb' => $save_path);
             return $array;
         } else {
             return '0';
         }
     } else {
         return '0';
     }
 }
 public function upload_img_file($arr, $id)
 {
     $fileUpload = WWW_ROOT . 'files' . DS . $id;
     if (!is_dir($fileUpload)) {
         mkdir($fileUpload, 0777);
     }
     if (!is_dir($fileUpload . '/thumb')) {
         mkdir($fileUpload . '/thumb', 0777);
     }
     if (!is_dir($fileUpload . '/minithumb')) {
         mkdir($fileUpload . '/minithumb', 0777);
     }
     $fname = removeSpecialChar($arr['name']);
     $file = time() . "_" . $fname;
     if (upload_my_file($arr['tmp_name'], $fileUpload . '/' . $file)) {
         $save_path = "thumb_" . $file;
         $min_save_path = "mini_thumb_" . $file;
         create_thumb($fileUpload . '/' . $file, 150, $fileUpload . '/thumb/' . $save_path);
         create_thumb($fileUpload . '/' . $file, 42, $fileUpload . '/minithumb/' . $min_save_path);
         return $file;
     } else {
         return 0;
     }
 }
Esempio n. 3
0
 public function upload_doc_file($arr, $id)
 {
     $fileUpload = WWW_ROOT . 'files' . DS . 'Agents' . DS . $id;
     if (!is_dir($fileUpload)) {
         mkdir($fileUpload, 0777);
     }
     $fname = removeSpecialChar($arr['name']);
     $file = time() . "_" . $fname;
     if (upload_my_file($arr['tmp_name'], $fileUpload . '/' . $file)) {
         return $file;
     } else {
         return 0;
     }
 }
Esempio n. 4
0
$pr = new MyLogin();
$glob_user = $pr->checkLogin();
$user_id = $pr->get_user_id();
$user_name = $pr->get_username();
/*******************************************************************/
//reaguje na odeslani formularu
if (isset($_POST["logging_out"])) {
    $glob_user = null;
    $pr->logoutUser();
}
if ($glob_user && $user_id != -1 && $user_name) {
    include_once "classes/posting.class.php";
    $posting = new Posting();
    if (isset($_POST["post_textarea"])) {
        $post_id = $posting->send_new_post($user_id, $_POST["post_textarea"]);
        $ret = upload_my_file($post_id, "images/post/");
    }
    if (isset($_POST["comment_textarea"])) {
        $posting->send_new_comment($user_id, $user_name, $_POST["comment_textarea"], $_POST["post_id"]);
    }
    call_edit_post($posting);
    call_delete_post($posting);
    call_like_post($posting, $user_id);
}
/********************************************************************/
// seznam dostupnych stran k zobrazeni
$dostupne = array("index", "login", "register", "home", "profile");
// defaultne se zobrazuje prvni strana
$zobrazim = $dostupne[0];
if (isset($_GET["web"]) && in_array($_GET["web"], $dostupne)) {
    $zobrazim = $_GET["web"];