本文整理汇总了PHP中fileExists函数的典型用法代码示例。如果您正苦于以下问题:PHP fileExists函数的具体用法?PHP fileExists怎么用?PHP fileExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fileExists函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __invoke
function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
{
/** @var ResponseInterface $response */
$response = $next();
$lang = $this->locale->locale();
// The check for app->translation is made here instead of conditionally adding this middleware
// because loaded modules can change this setting.
if (!$this->settings->translation || !$lang) {
return $response;
}
if (!isset(self::$translation[$lang])) {
// Load and merge all translation files now.
self::$translation[$lang] = [];
$trans =& self::$translation[$lang];
$folders = $this->settings->languageFolders;
foreach ($folders as $folder) {
$path = "{$folder}/{$lang}.ini";
$newTrans = fileExists($path) ? parse_ini_file($path) : null;
if ($newTrans) {
$trans = array_merge($trans, $newTrans);
}
}
if (!$trans) {
$paths = array_map(function ($path) {
return "<li>" . ErrorConsole::shortFileName($path);
}, $folders);
throw new ConfigException("A translation file for language <b>{$lang}</b> was not found.\n<p>Search paths:\n<ul>" . implode('', $paths) . "</ul>", FlashType::ERROR);
}
}
$out = preg_replace_callback(self::FIND_TRANS_KEY, function ($args) use($lang) {
$a = $args[1];
return empty(self::$translation[$lang][$a]) ? '$' . $a : preg_replace('#\\r?\\n#', '<br>', self::$translation[$lang][$a]);
}, $response->getBody());
return $response->withBody($this->responseFactory->makeBody($out));
}
开发者ID:electro-framework,项目名称:framework,代码行数:35,代码来源:TranslationMiddleware.php
示例2: theSkeletonDirectory
function theSkeletonDirectory()
{
$directory = getBowerDirectory() . 'skeleton-css/';
if (!fileExists($directory)) {
consoleLog("You seem to be missing the 'skeleton-css' folder", 'error');
}
print $directory;
}
开发者ID:jackkemmish,项目名称:WEB14203-Jack-Kemmish,代码行数:8,代码来源:functions.php
示例3: showPhoto
function showPhoto($picture = NULL, $param = NULL)
{
// usable parameters for photo display
$height = isset($param['height']) ? $param['height'] : 100;
$width = isset($param['width']) ? $param['width'] : 100;
$id = isset($param['id']) ? $param['id'] : FALSE;
$align = isset($param['align']) ? $param['align'] : "absmiddle";
$check = isset($param['check']) ? $param['check'] : FALSE;
$nocache = isset($param['nocache']) ? $param['nocache'] : FALSE;
// TRUE = disable caching, add time string to image url
$title = isset($param['title']) ? $param['title'] : "User's Photo";
$class = isset($param['class']) ? $param['class'] : "user-photo";
if (isset($picture) && strlen(trim($picture)) > 0) {
$remote = stristr($picture, 'http');
// do a check here to see if image is from twitter / facebook / remote URL
if (!$remote) {
if ($nocache) {
$picture = $picture . '?t=' . md5(time());
}
// only if $nocache is TRUE
$path = site_url(RES_DIR . '/user/profile/' . $picture);
//. -- disabled time attachment, no need to break cache
} else {
$path = $picture;
// request proper cropped size from facebook for this photo
if (stripos($path, 'graph.facebook.com')) {
$path .= '?width=' . $width . '&height=' . $height;
// this appends size requirements to facebook image
}
// request bigger photo from twitter
if (stripos($path, 'twimg.com')) {
if ($height > 75) {
$path = str_replace('_normal', '_bigger', $path);
// this forces _bigger 73x73 sized image (over default 48x48), no custom crop offered
}
if ($height < 25) {
$path = str_replace('_normal', '_mini', $path);
// this forces _mini 24x24 sized image (over default 48x48), no custom crop offered
}
}
}
if ($check && !$remote) {
if (!fileExists($path)) {
$title = "Photo not found! ";
$path = site_url(RES_DIR . '/img/default-person.png');
}
}
} else {
$path = site_url(RES_DIR . '/img/default-person.png');
}
return '<img ' . ($id ? 'id="' . $id . '"' : '') . ' src="' . $path . '" height="' . $height . '" width="' . $width . '" title="' . $title . '" alt="' . $title . '" class="' . $class . '">';
}
开发者ID:bet0x,项目名称:A3,代码行数:52,代码来源:photo_helper.php
示例4: fileValid
function fileValid($bucket, $file, $interval)
{
syslog(LOG_DEBUG, "fileValid: file " . $file);
try {
if (fileExists($bucket, $file)) {
$mTime = lastModifiedTime($bucket, $file);
$date = new DateTime();
$curTime = $date->getTimestamp();
if ($curTime - $mTime < $interval) {
return true;
}
}
return false;
} catch (Exception $e) {
syslog(LOG_ERR, $e->getMessage());
return false;
}
}
开发者ID:girishji,项目名称:zouk-event-calendar,代码行数:18,代码来源:retrieve.php
示例5: fileUpload
function fileUpload($imgFile)
{
$file_path = $_SESSION['rootDir'] . '/images/gallery/' . basename($imgFile["name"]);
if (fileExists($file_path)) {
if (move_uploaded_file($imgFile["tmp_name"], $file_path)) {
resizeImage($file_path);
return 'images/gallery/' . basename($imgFile["name"]);
} else {
$_SESSION['status'] = 'error';
$_SESSION['flashData'] = 'File can not be uploaded';
header('location:' . baseUrl . 'admin/gallery/');
exit;
}
} else {
$_SESSION['status'] = 'error';
$_SESSION['flashData'] = 'Same file cannot be uploaded twice';
header('location:' . baseUrl . 'admin/gallery/');
}
}
开发者ID:vinayadahal,项目名称:new_design,代码行数:19,代码来源:galleryController.php
示例6: refreshJSCache
function refreshJSCache()
{
$dest = listFilesFromType("html", "php");
$avFuncs = array();
$needFuncs = array();
$destFiles = array();
foreach ($dest as $file) {
$destPath = "html/" . getScriptJS($file);
if (!in_array($destPath, $destFiles)) {
$destFiles[] .= $destPath;
$avFuncs = listAvailableFunctions("scripts/source/script.js");
$needFuncs = listNeededFunctions($file, $avFuncs);
$needFuncs = listDependences($needFuncs, $avFuncs);
$source = getFunctionsSrc($needFuncs, $avFuncs);
if (count($needFuncs) != 0) {
if (fileExists($destPath)) {
if (@unlink($destPath)) {
echo start_comment . "File " . $destPath . " unlinked !" . end_comment . "\n";
}
}
$handleW = @fopen($destPath, "w");
if ($handleW) {
fwrite($handleW, $source);
echo start_comment . "File " . $destPath . " done !" . end_comment . "\n";
foreach ($needFuncs as $function) {
echo start_comment . $function . end_comment . "\n";
}
} else {
echo "error khudsf87098df<br>";
}
@fclose($handleW);
}
}
}
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:35,代码来源:genScriptJS.php
示例7: foreach
foreach ($amenu as $m => $k) {
natcasesort($k);
foreach ($k as $l) {
${$m} .= $l;
}
}
if (empty($rootmenu)) {
$radmin1 = '/*';
$radmin2 = '*/';
}
if (empty($settingsmenu)) {
$adminc1 = '/*';
$adminc2 = '*/';
}
if (function_exists('fsockopen')) {
$dzcp_v = fileExists("http://www.dzcp.de/version.txt");
if ($dzcp_v <= _version) {
$version = '<b>' . _akt_version . ': <span class="fontGreen">' . _version . '</span></b>';
$old = "";
} else {
$version = "<a href=\"http://www.dzcp.de\" target=\"_blank\" title=\"external Link: www.dzcp.de\"><b>" . _akt_version . ":</b> <span class=\"fontRed\">" . _version . "</span></a>";
$old = "_old";
}
$dzcp_news = @file_get_contents('http://www.dzcp.de/dzcp_news.php');
}
if (@file_exists(basePath . "/_installer") && $chkMe == 4) {
$index = _installdir;
} else {
$index = show($dir . "/admin", array("head" => _config_head, "forumkats" => $fkats, "newskats" => $nkats, "version" => $version, "old" => $old, "dbase" => _stats_mysql, "einst" => _config_einst, "content" => _content, "newsticker" => '<div style="padding:3px">' . (empty($dzcp_news) ? '' : '<b>DZCP News:</b><br />') . '<marquee direction="right" scrollamount="5" scrolldelay="10" onmouseover="this.stop()" onmouseout="this.start()">' . $dzcp_news . '</marquee></div>', "rootadmin" => _rootadmin, "rootmenu" => $rootmenu, "settingsmenu" => $settingsmenu, "contentmenu" => $contentmenu, "radmin1" => $radmin1, "radmin2" => $radmin2, "adminc1" => $adminc1, "adminc2" => $adminc2, "show" => $show));
}
}
开发者ID:nopuls,项目名称:dzcp,代码行数:31,代码来源:index.php
示例8: upload
case "upload":
if (isset($_POST['dir'])) {
upload($_POST['dir']);
}
break;
case "uploadSmart":
uploadSmart();
break;
case "uploadAuth":
if (isset($_POST['path'])) {
uploadAuth($_POST['path']);
}
break;
case "fileExists":
if (isset($_POST['path'])) {
fileExists($_POST['path']);
}
break;
case "thumbnail":
if (isset($_POST['fileid'])) {
thumbnail($_POST['fileid']);
}
break;
case "newPassword":
if (isset($_POST['currentPassword'], $_POST['newPassword'])) {
newPassword($_POST['currentPassword'], $_POST['newPassword']);
}
break;
case "getThumb":
if (isset($_GET['path'], $_GET['filename'])) {
getThumb($_GET['path'], $_GET['filename']);
开发者ID:kkappel,项目名称:relay,代码行数:31,代码来源:relay.php
示例9: getHQPreviewNow
}
//echo "Breite: ".$breite_neu.", Höhe: ".$hoehe_neu;
if ($breite_neu < $hoehe_neu) {
//falls die Ausrichtung falsch in den EXIF-Daten gespeichert wurde, kann das Vorschau-Bild nachtraeglich gedreht werden:
echo "\n\t\t\t\t<TD align='center' colspan='1' width = '130px' style= 'padding-top:2px; padding-bottom:2px;'>\n\t\t\t\t<img src='{$inst_path}/pic2base/bin/share/images/no_pic.gif' width='124' height='0' />\n\t\t\t\t<div id='pic{$pic_id}'>\n\t\t\t\t<SPAN style='cursor:pointer;' onClick='rotPrevPic(\"8\", \"{$FileNameV}\", \"{$pic_id}\", \"{$fs_hoehe}\")'><img src=\"{$inst_path}/pic2base/bin/share/images/90-ccw.gif\" width=\"8\" height=\"8\" style='margin-right:10px;' title='Vorschaubild 90° links drehen' /></span>";
getHQPreviewNow($pic_id, $hoehe_neu, $breite_neu, $base_file, isset($kat_id), $mod, $form_name);
echo "\n\t\t\t\t<SPAN style='cursor:pointer;' onClick='rotPrevPic(\"6\", \"{$FileNameV}\", \"{$pic_id}\", \"{$fs_hoehe}\")'><img src=\"{$inst_path}/pic2base/bin/share/images/90-cw.gif\" width=\"8\" height=\"8\" style='margin-left:10px;' title='Vorschaubild 90° rechts drehen' /></span>\n\t\t\t\t</div>\n\t\t\t\t</TD>";
} else {
echo "<TD align='center' colspan='1' width = '130px' style= 'padding-top:2px; padding-bottom:2px;'>\n\t\t\t\t<div id='pic{$pic_id}'>";
getHQPreviewNow($pic_id, $hoehe_neu, $breite_neu, $base_file, isset($kat_id), $mod, $form_name);
echo "\n\t\t\t\t</div>\n\t\t\t\t</TD>";
}
//Erzeugung der Download-Icons:
$Owner = mysql_result($result6, $i6, 'Owner');
//Pruefung, ob diese Datei bereits im Download-Ordner des angemeldeten Users liegt. Wenn nicht: Download-Icon mit link zur Kopier-Routine; wenn ja: selected-Icon mit Link zur L�sch-Routine:
$check = fileExists($FileName, $c_username);
if ($check > '0') {
//Die Datei befindet sich im Download-Ordner des Users und wird mit Klick auf das Icon geloescht:
$icon[$i6] = "\n\t\t\t\t<TD align='center' width='43'>\n\t\t\t\t<div id='box{$pic_id}'>\n\t\t\t\t<SPAN style='cursor:pointer;' onClick='delPicture(\"{$FileName}\",\"{$c_username}\",\"{$pic_id}\")'>\n\t\t\t\t<img src='{$inst_path}/pic2base/bin/share/images/selected.gif' width='12' height='12' hspace='0' vspace='0'/>\n\t\t\t\t</SPAN>\t\n\t\t\t\t</div>\n\t\t\t\t</TD>";
} else {
//echo $Owner.", ".$user_id;
//Die Datei befindet sich nicht im Download-Ordner des Users und wird mit Klick auf das Icon dort hin kopiert:
if (hasPermission($c_username, 'adminlogin') or hasPermission($c_username, 'downloadpic')) {
$icon[$i6] = "\n\t\t\t\t\t<TD align='center'width='43'>\n\t\t\t\t\t<div id='box{$pic_id}'>\n\t\t\t\t\t<SPAN style='cursor:pointer;' onClick='copyPicture(\"{$FileName}\",\"{$c_username}\",\"{$pic_id}\")'><img src='{$inst_path}/pic2base/bin/share/images/download.gif' width='12' height='12' hspace='0' vspace='0' title='Bild in den Download-Ordner kopieren'/></SPAN>\n\t\t\t\t\t</div>\t\n\t\t\t\t\t</TD>";
} else {
$icon[$i6] = "<TD align='center' width='43'><BR></TD>";
}
}
}
//Leer-Raum mit Leer-Zellen auffuellen (Zelle mit Dummy-Bild zur Streckung gefuellt), wenn Bilder gefunden wurden:
if ($num6_1 > '0') {
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:31,代码来源:get_preview.php
示例10: fileExists
<!DOCTYPE >
<html>
<head>
<meta charset="utf-8" />
<title>数据录入</title>
</head>
<body>
<?php
$select = $_GET['data_select'];
$key = $_GET['data_key'];
$value = $_GET['data_value'];
$fileName = '../data/dataInfo.json';
require_once '../tool/file.tool.php';
fileExists($fileName, "[[],[],[],[],[]]");
$file = file_get_contents($fileName);
$json = json_decode($file);
$jsonS = $json[$select];
$length = count($jsonS);
$json[$select][$length] = array('key' => $key, 'value' => $value);
$json2 = json_encode($json);
file_put_contents($fileName, $json2);
?>
<h1 id='show'>数据录入中,5秒后回到首页 </h1>
<script>
var oShow = document.getElementById('show');
var count = 0;
开发者ID:huoxuhuoxu,项目名称:alsi,代码行数:30,代码来源:dataEntry.php
示例11: registerMacros
/**
* Registers a module's macros directory, along with any immediate sub-directories.
*
* @param ModuleInfo $moduleInfo
* @return $this
*/
function registerMacros(ModuleInfo $moduleInfo)
{
$path = "{$this->kernelSettings->baseDirectory}/{$moduleInfo->path}/{$this->moduleMacrosPath}";
if (fileExists($path)) {
$all = FilesystemFlow::from($path)->onlyDirectories()->keys()->all();
array_unshift($all, $path);
$this->macrosDirectories = array_merge($all, $this->macrosDirectories);
}
return $this;
}
开发者ID:electro-modules,项目名称:matisse,代码行数:16,代码来源:MatisseSettings.php
示例12: deleteImage
function deleteImage($fileName = "")
{
if ($fileName != "") {
if (fileExists($fileName . ".gif")) {
@unlink($fileName . ".gif");
return True;
}
} elseif (isset($_SESSION['userCheck'])) {
if (fileExists($_SESSION['userCheck'] . ".gif")) {
@unlink($_SESSION['userCheck'] . ".gif");
}
unset($_SESSION['userCheck']);
return True;
} else {
return False;
}
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:17,代码来源:function.php
示例13: importTableHeaderFromCSV
public function importTableHeaderFromCSV($file)
{
$filename = $file . ".csv";
if (!fileExists($filename) and $this->entityexist($file)) {
echo "import can only in a new table";
die;
}
$CSVHandler = new CSVHandler($filename);
$CSVHandler->countColumns();
$data = $CSVHandler->getHeaders();
$HelperFunctions = new HelperFunctions();
$data = $HelperFunctions->array_trim($data);
$Evaluator = new Evaluator();
$date = array_filter($data, $Evaluator->returnOnlyLettersNumbersUnderscore($data));
$sql = "CREATE TABLE IF NOT EXISTS ` " . $file . " ` (";
for ($i = 0; $i <= $CSVHandler->countColumns(); $i++) {
if ($i == 0) {
$sql .= "`" . $data[$i] . "` int(11) NOT NULL auto_increment";
}
$sql .= "`" . $data[$i] . "` varchar(255) NOT NULL default ''";
if ($i == 0) {
$sql .= "PRIMARY KEY (`" . $data[$i] . "`)";
}
}
$sql .= ")";
$result = $this->executeGenericStatement($sql);
if (empty($result)) {
return NULL;
}
}
开发者ID:jenspapenhagen,项目名称:miniORM,代码行数:30,代码来源:GenericEntityManager.php
示例14: requirePackage
function requirePackage($package, $file)
{
if (fileExists('/app/packages/' . $package . '/' . $file)) {
require_once path('/app/packages/' . $package . '/' . $file);
} else {
display_error('The file ' . path('/app/packages/' . $package . '/' . $file) . ' does not exist');
}
}
开发者ID:rasikajoshi,项目名称:Generatrix,代码行数:8,代码来源:utils.php
示例15: showPhoto
/**
* Shows users photo
* @param string $picture Description
* @param Array $param Array with parameters to be included in the generated img tag (height, width, id, check, nocache, title, class)
* @return string
*/
function showPhoto($picture = NULL, $param = NULL, $path = null, $defaultPath = null)
{
if (!is_array($param)) {
$param = array();
}
if (!$path) {
$path = base_url() . RES_DIR . '/user/profile/';
}
if (!$defaultPath) {
$defaultPath = base_url() . RES_DIR . '/img/user.png';
}
// usable parameters for photo display
$check = isset($param['check']) ? $param['check'] : FALSE;
$nocache = isset($param['nocache']) ? $param['nocache'] : FALSE;
// TRUE = disable caching, add time string to image url
unset($param['check'], $param['nocache']);
$height = isset($param['height']) ? (int) $param['height'] : 100;
$width = isset($param['width']) ? (int) $param['width'] : 100;
$param['alt'] = isset($param['alt']) ? trim($param['alt']) : '';
if (isset($picture) && strlen(trim($picture)) > 0) {
$remote = stristr($picture, 'http');
// do a check here to see if image is from twitter / facebook / remote URL
if (!$remote) {
if ($nocache) {
$picture = $picture . (strpos($path, '?') === false ? '?' : '&') . 't=' . md5(time());
}
// only if $nocache is TRUE
$path .= $picture;
//. -- disabled time attachment, no need to break cache
} else {
$path = $picture;
// request proper cropped size from facebook for this photo
if (stripos($path, 'graph.facebook.com')) {
$path .= (strpos($path, '?') === false ? '?' : '&') . 'width=' . $width . '&height=' . $height;
// this appends size requirements to facebook image
}
// request bigger photo from twitter
if (stripos($path, 'twimg.com')) {
if ($height > 75) {
$path = str_replace('_normal', '_bigger', $path);
// this forces _bigger 73x73 sized image (over default 48x48), no custom crop offered
}
if ($height < 25) {
$path = str_replace('_normal', '_mini', $path);
// this forces _mini 24x24 sized image (over default 48x48), no custom crop offered
}
}
}
if ($check && !$remote) {
if (!fileExists($path)) {
$title = "Imagen no encontrada! ";
$path = $defaultPath;
}
}
} else {
$path = $defaultPath;
}
$param['src'] = $path;
$output = "<img ";
foreach ($param as $key => $value) {
$output .= $key . '="' . $value . '" ';
}
$output .= "/>";
return $output;
}
开发者ID:nelsondaza,项目名称:Carus,代码行数:71,代码来源:photo_helper.php
示例16: generateGeoImageArray
function generateGeoImageArray($pic_id_arr, $userName, $uID, $softwareRoot)
{
//$start1 = microtime(); //Startzeit-Variable zur Laufzeitermittlung
//flush();
include $softwareRoot . '/bin/share/db_connect1.php';
$res = "";
$num_pic = count($pic_id_arr);
//Gesamtzahl der gefundenen Bilder
for ($imageArrayIndex = 0; $imageArrayIndex < $num_pic; $imageArrayIndex++) {
$res1 = mysql_query("SELECT * FROM {$table2} WHERE pic_id = '{$pic_id_arr[$imageArrayIndex]}'");
$fileName = mysql_result($res1, 0, 'FileName');
$fileNamePrefix = str_replace('.jpg', '', $fileName);
$ratio = mysql_result($res1, 0, 'ExifImageWidth') / mysql_result($res1, 0, 'ExifImageHeight');
if (mysql_result($res1, 0, 'Orientation') >= '5') {
$ratio = 1.0 / $ratio;
}
$downloadStatus = 0;
//Erzeugung der Download-Icons:
$Owner = mysql_result($res1, 0, 'Owner');
$check = fileExists($fileNamePrefix, $uID);
if ($check > 0) {
//Die Datei befindet sich im Download-Ordner des Users und wird mit Klick auf das Icon geloescht:
$downloadStatus = 100;
} else {
//Die Datei befindet sich nicht im Download-Ordner des Users und wird mit Klick auf das Icon dort hin kopiert:
if ($uID == $Owner and hasPermission($uID, 'downloadmypics', $softwareRoot) or hasPermission($uID, 'downloadallpics', $softwareRoot)) {
if (directDownload($uID, $softwareRoot)) {
$downloadStatus = 1;
} else {
$downloadStatus = 2;
}
} else {
$downloadStatus = 0;
}
}
$res .= 'imageArray.push({fileName: "' . $fileNamePrefix . '", ratio: ' . $ratio . ', id: "' . $fileNamePrefix . '", downloadStatus: ' . $downloadStatus . ', Owner: ' . $Owner . '});
';
}
return $res;
}
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:40,代码来源:get_preview.php
示例17: date_default_timezone_set
<?php
date_default_timezone_set('Asia/ShangHai');
$time = time();
$filename = "../data/record.json";
require_once '../tool/file.tool.php';
fileExists($filename, '[{"datetime":0}]');
$json_string = file_get_contents($filename);
$json2 = json_decode($json_string, true);
$a = $json2[0]['datetime'];
$b = $a - $time;
$c = 'false';
if ($b < -86400) {
$json2[0]['datetime'] = $time;
$json = json_encode($json2);
file_put_contents($filename, $json);
$c = 'true';
} else {
$d = date('Ymd', $time);
$f = date('Ymd', $a);
$e = $f - $d;
if ($e < 0) {
$json2[0]['datetime'] = $time;
$json = json_encode($json2);
file_put_contents($filename, $json);
$c = 'true';
}
}
echo $c;
?>
开发者ID:huoxuhuoxu,项目名称:alsi,代码行数:30,代码来源:recordData.php
示例18: checkIfFileExists
function checkIfFileExists($file)
{
return fileExists($file);
}
开发者ID:paubereng,项目名称:sesio,代码行数:4,代码来源:151122_pau.berengueras.02363.php
示例19: getDataFromSQL
break;
}
$sql = "SELECT T_topography.Is_public, T_file.Path, T_topography.Enabled ";
$sql .= "FROM `" . $_SESSION['Application_host'] . "`.`T_topography` ";
$sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`J_topo_file` ON J_topo_file.Id_topography = T_topography.Id ";
$sql .= "INNER JOIN `" . $_SESSION['Application_host'] . "`.`T_file` ON T_file.Id = J_topo_file.Id_file ";
$sql .= "WHERE T_file.Id_author = " . $topo_usr_id . " AND T_topography.Id = " . $topo_id . " AND T_file.Path LIKE '%u" . $topo_usr_id . "_t" . $topo_id . "_r" . $random_id . "%' ";
$data = getDataFromSQL($sql, __FILE__, $frame, __FUNCTION__);
if ($data['Count'] < 1) {
$code_err = 2;
break;
}
// MANQUE LE CAS OU LA PERSONNE CONNECTEE NE DEVRAIS PAS POUVOIR VOIR LA TOPO !!!
if (USER_IS_CONNECTED || $data[0]['Is_public'] == 'YES' && $data[0]['Enabled'] == 'YES') {
$filename = basename($data[0]['Path']);
if (!fileExists($filename)) {
$code_err = 3;
break;
}
/*$kind = (exif_imagetype($filename)) ? 'image' : 'application';
header('Content-Type: '.$kind.'/'.strtolower(getFileExtension($filename)));*/
header('Content-Type: image/' . strtolower(getFileExtension($filename)));
readfile($filename);
} else {
$code_err = 4;
break;
}
break;
default:
$code_err = 100;
break;
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:31,代码来源:image_secure.php
示例20: generateImageArray
function generateImageArray($sqlResult, $userName, $uID, $softwareRoot)
{
$res = "";
$sqlResultNumRows = mysql_num_rows($sqlResult);
for ($imageArrayIndex = 0; $imageArrayIndex < $sqlResultNumRows; $imageArrayIndex++) {
$fileName = mysql_result($sqlResult, $imageArrayIndex, 'FileName');
$fileNamePrefix = str_replace('.jpg', '', $fileName);
/*
$ratio = (mysql_result($sqlResult, $imageArrayIndex, 'ExifImageWidth') / mysql_result($sqlResult, $imageArrayIndex, 'ExifImageHeight'));
if (mysql_result($sqlResult, $imageArrayIndex, 'Orientation') >= '5')
{
$ratio = 1.0 / $ratio;
}
*/
if (mysql_result($sqlResult, $imageArrayIndex, 'ExifImageHeight') !== '0') {
$ratio = mysql_result($sqlResult, $imageArrayIndex, 'ExifImageWidth') / mysql_result($sqlResult, $imageArrayIndex, 'ExifImageHeight');
if (mysql_result($sqlResult, $imageArrayIndex, 'Orientation') >= '5') {
$ratio = 1.0 / $ratio;
}
} else {
$ratio = 1;
// hier ggf. Mail an Admin versenden
}
$downloadStatus = 0;
//Erzeugung der Download-Icons:
$Owner = mysql_result($sqlResult, $imageArrayIndex, 'Owner');
$check = fileExists($fileName, $uID);
if ($check > 0) {
//Die Datei befindet sich im Download-Ordner des Users und wird mit Klick auf das Icon geloescht:
$downloadStatus = 100;
} else {
//Die Datei befindet sich nicht im Download-Ordner des Users und wird mit Klick auf das Icon dort hin kopiert:
if ($uID == $Owner and hasPermission($uID, 'downloadmypics', $softwareRoot) or hasPermission($uID, 'downloadallpics', $softwareRoot)) {
if (directDownload($uID, $softwareRoot)) {
$downloadStatus = 1;
} else {
$downloadStatus = 2;
}
} else {
$downloadStatus = 0;
}
}
$res .= 'imageArray.push({fileName: "' . $fileNamePrefix . '", ratio: ' . $ratio . ', id: "' . mysql_result($sqlResult, $imageArrayIndex, 'pic_id') . '", downloadStatus: ' . $downloadStatus . ', Owner: ' . $Owner . '});
';
}
return $res;
}
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:47,代码来源:main_functions.php
注:本文中的fileExists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论