本文整理汇总了PHP中gcms::testDir方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::testDir方法的具体用法?PHP gcms::testDir怎么用?PHP gcms::testDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::testDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$input = 'gallery_detail';
} elseif ($file['tmp_name'] == '' && $id == 0) {
// อัลบัมใหม่ ต้องมีรูปภาพเสมอ
$ret['ret_gallery_pic'] = 'REQUIRE_PICTURE';
$error = 'REQUIRE_PICTURE';
$input = 'gallery_pic';
} else {
// อัปโหลดรูปภาw
if ($file['tmp_name'] != '') {
// ตรวจสอบไฟล์อัปโหลด
$info = gcms::isValidImage($config['gallery_image_type'], $file);
if (!$info) {
$ret['ret_gallery_pic'] = 'INVALID_FILE_TYPE';
$input = 'gallery_pic';
$error = 'INVALID_FILE_TYPE';
} elseif (!gcms::testDir(DATA_PATH . "gallery/{$index['id']}/")) {
$ret['ret_gallery_pic'] = 'DO_NOT_UPLOAD';
$input = 'gallery_pic';
$error = 'DO_NOT_UPLOAD';
} else {
// อัปโหลดรูปภาพจริง
$res = gcms::resizeImage($file['tmp_name'], DATA_PATH . "gallery/{$index['id']}/", "0.{$info['ext']}", $info, $config['gallery_image_w']);
if (!$res) {
$ret['ret_gallery_pic'] = 'DO_NOT_UPLOAD';
$input = 'gallery_pic';
$error = 'DO_NOT_UPLOAD';
} else {
$save2['image'] = $res['name'];
}
// อัปโหลด thumbnail
if (!gcms::cropImage($file['tmp_name'], DATA_PATH . "gallery/{$index['id']}/thumb_{$save2['image']}", $info, $config['gallery_thumb_w'], $config['gallery_thumb_h'])) {
示例2: while
}
$f = @opendir($counter_dir);
if ($f) {
while (false !== ($text = readdir($f))) {
if ($text != '.' && $text != '..') {
if ($text != $y) {
gcms::rm_dir($counter_dir . "/{$text}");
}
}
}
closedir($f);
}
}
// ตรวจสอบ + สร้าง โฟลเดอร์
gcms::testDir("{$counter_dir}/{$y}", 0755);
gcms::testDir("{$counter_dir}/{$y}/{$m}", 0755);
// ip ปัจจุบัน
$counter_ip = gcms::getip();
// session ปัจจุบัน
$counter_ssid = session_id();
// วันนี้
$counter_day = date('Y-m-d', $mmktime);
// อ่านข้อมูล counter ล่าสุด
$sql = "SELECT * FROM `" . DB_COUNTER . "` ORDER BY `id` DESC LIMIT 1";
$my_counter = $db->customQuery($sql);
$my_counter = sizeof($my_counter) == 1 ? $my_counter[0] : array('date' => '', 'counter' => 0);
if ($my_counter['date'] != $counter_day) {
// วันใหม่
$my_counter['visited'] = 0;
$my_counter['pages_view'] = 0;
$my_counter['date'] = $counter_day;
示例3: elseif
if (preg_match('/^(.*)\\.(.*)$/', $file['name'], $match)) {
$file_name = $match[1];
$save['ext'] = $match[2];
}
// ตรวจสอบไฟล์อัปโหลด
if ($file_name == '' || !in_array($save['ext'], $config['edocument_file_typies'])) {
$ret['ret_edocument_file'] = 'INVALID_FILE_TYPE';
$input = !$input ? 'edocument_file' : $input;
$error = !$error ? 'INVALID_FILE_TYPE' : $error;
} elseif ($file['size'] > $config['edocument_upload_size']) {
$ret['ret_edocument_file'] = 'FILE_TOO_BIG';
$input = !$input ? 'edocument_file' : $input;
$error = !$error ? 'FILE_TOO_BIG' : $error;
} else {
// ตรวจสอบโฟลเดอร์
gcms::testDir(DATA_PATH . 'edocument/');
// อัปโหลด
$save['file'] = "{$mmktime}.{$save['ext']}";
while (file_exists(DATA_PATH . "edocument/{$save['file']}")) {
$mmktime++;
$save['file'] = "{$mmktime}.{$save['ext']}";
}
if (!@copy($file['tmp_name'], DATA_PATH . "edocument/{$save['file']}")) {
$ret['ret_edocument_file'] = 'DO_NOT_UPLOAD';
$input = !$input ? 'edocument_file' : $input;
$error = !$error ? 'DO_NOT_UPLOAD' : $error;
} else {
if ($save['topic'] == '') {
$save['topic'] = $file_name;
}
$save['size'] = $file['size'];
示例4: curl_setopt
// video thumbnail
if (isset($item->{'thumbnails'}->{'standard'})) {
$url = $item->{'thumbnails'}->{'standard'}->{'url'};
} else {
$url = $item->{'thumbnails'}->{'high'}->{'url'};
}
if (function_exists('curl_init') && ($ch = @curl_init())) {
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$thumbnail = curl_exec($ch);
curl_close($ch);
} else {
$thumbnail = file_get_contents($url);
}
// ตรวจสอบโฟลเดอร์
gcms::testDir(DATA_PATH . 'video/');
$f = @fopen(DATA_PATH . "video/{$youtube}.jpg", 'w');
if (!$f) {
$ret['error'] = 'DO_NOT_UPLOAD';
} else {
fwrite($f, $thumbnail);
fclose($f);
$ret['imgIcon'] = rawurlencode(DATA_URL . "video/{$youtube}.jpg?{$mmktime}");
$save['youtube'] = $youtube;
$save['last_update'] = $mmktime;
if ($id == 0) {
$save['module_id'] = $index['module_id'];
$id = $db->add(DB_VIDEO, $save);
} else {
$db->edit(DB_VIDEO, $index['id'], $save);
}