コード例 #1
0
ファイル: __form.php プロジェクト: aim-web-projects/mansion
function init_input_check($gc) {

	if(is_zip($gc)) {

		if(strlen($_POST["q2"]) > 0) {
			$gc->buken_sbt = $_POST["q2"];
		}else{
			$gc->msg->add("物件種別を選択してください。");
		}

	}else{

		if(strlen($_POST["zip1"].$_POST["zip2"]) > 0) {
			$gc->msg->add("郵便番号に該当する市区町村がみつかりませんでした。");
		}else{

			$gc->shikucyouson_no = $_POST["shikucyouson"];

			if(!is_numeric($gc->shikucyouson_no)){
				$gc->shikucyouson_no = 0;
			}

			if($gc->shikucyouson_no > 0) {
				if(strlen($_POST["q1"]) > 0) {
					$gc->buken_sbt = $_POST["q1"];
				}else{
					$gc->msg->add("物件種別を選択してください。");
				}
			}else{
				$gc->msg->add("入力内容に不備があります。");
			}

			$gc->buken = $_POST["buken"];
			$gc->banchi = $_POST["banchi"];
			$gc->buken_tatemono = $_POST["buken_tatemono"];

		}

	}

	if($gc->msg->count > 0){
		return false;
	}

	get_shikucyouson($gc);

	return true;

}
コード例 #2
0
ファイル: uploader.php プロジェクト: hatone/zenphoto-1.4.1.4
                    }
                    // soe stripped out all the name.
                    $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
                    if (file_exists($targetFile)) {
                        $append = '_' . time();
                        $seoname = stripSuffix($seoname) . $append . '.' . getSuffix($seoname);
                        $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
                    }
                    if (move_uploaded_file($tempFile, $targetFile)) {
                        @chmod($targetFile, 0666 & CHMOD_VALUE);
                        $album = new Album($gallery, $folder);
                        $image = newImage($album, $seoname);
                        $image->setOwner($_zp_current_admin_obj->getUser());
                        if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
                            $image->setTitle(substr($name, 0, strrpos($name, '.')));
                        }
                        $image->save();
                    } else {
                        $error = UPLOAD_ERR_NO_FILE;
                    }
                } else {
                    if (is_zip($name)) {
                        unzip($tempFile, $targetPath);
                    }
                }
            }
        }
    }
}
$file = $_FILES['file'];
echo '{"name":"' . $file['name'] . '","type":"' . $file['type'] . '","size":"' . $file['size'] . '","error":' . $error . '}';
コード例 #3
0
ファイル: uploader.php プロジェクト: rb26/zenphoto
 private function handle_file_upload($uploaded_file, $name, $size, $type, $error)
 {
     global $folder, $targetPath, $_zp_current_admin_obj;
     $file = new stdClass();
     $name = $this->trim_file_name($name, $type);
     $seoname = seoFriendly($name);
     if (strrpos($seoname, '.') === 0) {
         $seoname = sha1($name) . $seoname;
     }
     // soe stripped out all the name.
     $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
     if (file_exists($targetFile)) {
         $append = '_' . time();
         $seoname = stripSuffix($seoname) . $append . '.' . getSuffix($seoname);
         $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
     }
     $file->name = $seoname;
     $file->size = intval($size);
     $file->type = $type;
     $error = $this->has_error($uploaded_file, $file, $error);
     if (!$error && $file->name) {
         $file_path = $this->options['upload_dir'] . $file->name;
         $append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
         clearstatcache();
         if ($uploaded_file && is_uploaded_file($uploaded_file)) {
             // multipart/formdata uploads (POST method uploads)
             if ($append_file) {
                 file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
             } else {
                 move_uploaded_file($uploaded_file, $file_path);
                 if (Gallery::validImage($name) || Gallery::validImageAlt($name)) {
                     @chmod($targetFile, FILE_MOD);
                     $album = newAlbum($folder);
                     $image = newImage($album, $seoname);
                     $image->setOwner($_zp_current_admin_obj->getUser());
                     if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
                         $image->setTitle(stripSuffix($name, '.'));
                     }
                     $image->save();
                 } else {
                     if (is_zip($targetFile)) {
                         unzip($targetFile, $targetPath);
                         unlink($targetFile);
                     } else {
                         $file->error = $error = UPLOAD_ERR_EXTENSION;
                         // invalid file uploaded
                     }
                 }
             }
         } else {
             // Non-multipart uploads (PUT method support)
             file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         }
         $file_size = filesize($file_path);
         if ($file_size === $file->size) {
             $file->url = $this->options['upload_url'] . rawurlencode($file->name);
             foreach ($this->options['image_versions'] as $version => $options) {
                 if ($this->create_scaled_image($file->name, $options)) {
                     $file->{$version . '_url'} = $options['upload_url'] . rawurlencode($file->name);
                 }
             }
         } else {
             if ($this->options['discard_aborted_uploads']) {
                 @chmod($file_path, 0777);
                 unlink($file_path);
                 $file->error = 'abort';
             }
         }
         $file->size = $file_size;
         $file->delete_url = $this->options['script_url'] . '?file=' . rawurlencode($file->name);
         $file->delete_type = 'DELETE';
     } else {
         $file->error = $error;
     }
     return $file;
 }
コード例 #4
0
}
$warning = "";
set_time_limit(0);
if (isset($_GET["grouped"])) {
    if (isset($_POST['selection'])) {
        $paths = array();
        foreach ($_POST['selection'] as $md5) {
            $paths[] = getPathForMD5Chain(DOWNLOADS_DIR, $md5);
        }
        doZipGrouped($paths);
    } else {
        throw new Exception("No selection provided.");
    }
} else {
    $path = getPathFromURL();
    if (is_zip($path)) {
        doUnzip($path);
    } else {
        if (is_rar($path)) {
            doUnrar($path);
        } else {
            if (is_dir($path)) {
                doZip($path);
            } else {
                $warning = "Impossible de traiter le fichier <b>" . basename($path) . "</b>, ce n'est ni une archive ZIP/RAR ni un dossier.";
            }
        }
    }
}
?>
コード例 #5
0
ファイル: datso.upload.php プロジェクト: j0rg3m414/centerar
        } else {
            die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
        }
    } else {
        die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
    }
} else {
    $out = @fopen($targetDir . DS . $fileName, $chunk == 0 ? "wb" : "ab");
    if ($out) {
        $in = fopen("php://input", "rb");
        if ($in) {
            while ($buff = fread($in, 4096)) {
                fwrite($out, $buff);
            }
        } else {
            die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
        }
        fclose($out);
    } else {
        die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    }
}
if ($chunk == $chunks - 1) {
    if (is_zip($targetDir . DS . $fileName)) {
        $exr = JArchive::extract($targetDir . DS . $fileName, $targetDir);
        if ($exr === true) {
            JFile::delete($targetDir . DS . $fileName);
        }
    }
}
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
コード例 #6
0
ファイル: common.php プロジェクト: KasaiDot/Download-Manager
function isCompressedArchive($filePath)
{
    return is_zip($filePath) || is_rar($filePath);
}