本文整理汇总了PHP中get_file_name函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_name函数的具体用法?PHP get_file_name怎么用?PHP get_file_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getClassInstance
/**
* Метод получает экземпляр класса и, если нужно, кеширует его.
*/
public static function getClassInstance($__DIR__, $subDir, $className, $parent, $caching = true)
{
if (!is_valid_file_name($className)) {
return null;
//---
}
$className = get_file_name($className);
if ($className == $parent) {
//Абстрактный класс/интерфейс лежит рядом с классами реализации - пропустим его
return null;
}
//Абсолютный путь к классу
$classPath = file_path(array($__DIR__, $subDir), $className, PsConst::EXT_PHP);
//Ключ кеширования
$cacheKey = md5($classPath);
$CACHE = $caching ? SimpleDataCache::inst(__CLASS__, __FUNCTION__) : null;
if ($CACHE && $CACHE->has($cacheKey)) {
return $CACHE->get($cacheKey);
}
$INST = null;
if (is_file($classPath)) {
//Подключим данный класс
require_once $classPath;
//Проверим, существует ли класс
$rc = PsUtil::newReflectionClass($className, false);
$INST = $rc && $rc->isSubclassOf($parent) ? $rc->newInstance() : null;
}
if ($CACHE && $INST) {
$CACHE->set($cacheKey, $INST);
}
return $INST;
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:35,代码来源:Classes.php
示例2: print_files
/**
* Prints out a list of files and their comments
*
* @param unknown_type $rootDirs
* @param unknown_type $relPath
* @param unknown_type $title
*/
function print_files($rootDirs, $relPath, $title, $comments)
{
if ($comments) {
echo "<div><h2>{$title}</h2>";
} else {
echo "<div class='api-list' style='float: left;'><h2>{$title}</h2>";
}
foreach ($rootDirs as $dir) {
if (!file_exists($dir . $relPath)) {
continue;
}
$files = scandir($dir . $relPath);
echo '<ul>';
foreach ($files as $file) {
if (!is_dir($file)) {
echo '<li><STRONG>' . get_file_name($file) . '</STRONG></li>';
if ($comments) {
echo '<li><STRONG>File Path:</STRONG> ' . $dir . DIRECTORY_SEPARATOR . $relPath . DIRECTORY_SEPARATOR . $file . '</li>';
echo '<li>' . getComments($dir . DIRECTORY_SEPARATOR . $relPath . DIRECTORY_SEPARATOR . $file) . '</li>';
}
}
}
echo '</ul>';
}
echo '</div>';
}
开发者ID:jkinner,项目名称:ringside,代码行数:33,代码来源:index.php
示例3: dimpConsoleLog
function dimpConsoleLog()
{
global $CALLED_FILE;
if ($CALLED_FILE) {
$log = file_path(dirname($CALLED_FILE), get_file_name($CALLED_FILE), 'log');
$FULL_LOG = PsLogger::controller()->getFullLog();
$FULL_LOG = mb_convert_encoding($FULL_LOG, 'UTF-8', 'cp866');
file_put_contents($log, $FULL_LOG);
}
}
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:MainImportProcess.php
示例4: testIdNumbering
public function testIdNumbering()
{
/* try to see if the dirs are being created */
$this->assertEquals(get_file_name("data/uploads/0/020"), Submission::getPathToCodeFromId(20));
$this->assertEquals(get_file_name("data/uploads/1/000"), Submission::getPathToCodeFromId(1000));
$this->assertEquals(get_file_name("data/uploads/1/999"), Submission::getPathToCodeFromId(1999));
$this->assertEquals(get_file_name("data/uploads/178/456"), Submission::getPathToCodeFromId(178456));
assert(is_dir(get_file_name("data/uploads/1")));
assert(is_dir(get_file_name("data/uploads/178")));
}
开发者ID:rajatkhanduja,项目名称:opc,代码行数:10,代码来源:SubmissionsTest.php
示例5: createJson
function createJson()
{
global $wpdb;
$table2album = $wpdb->prefix . "xy_album";
$table2photo = $wpdb->prefix . "xy_photo";
$albums = $wpdb->get_results("SELECT * FROM {$table2album}");
$i = 0;
$j = 0;
foreach ($albums as $album) {
$album_name[$i] = $album->album_name;
$album_intro[$i] = $album->album_intro;
$album_cover[$i] = $album->album_cover;
$album_id = $album->album_ID;
$photos = $wpdb->get_results("SELECT * FROM {$table2photo} where photo_album = {$album_id}");
foreach ($photos as $photo) {
$photo_name[$i][$j] = get_file_name($photo->photo_url);
$photo_intro[$i][$j] = $photo->photo_intro;
$photo_tag[$i][$j] = $photo->photo_tag;
$photo_thumb_url[$i][$j] = $photo->photo_thumb_url;
$photo_url[$i][$j] = $photo->photo_url;
$j++;
}
$i++;
}
$albumJson = '[';
for ($k = 0; $k < $i; $k++) {
$albumJson = $albumJson . '{ "album_name":"' . $album_name[$k] . '","album_intro":"' . $album_intro[$k] . '","album_cover":"' . $album_cover[$k] . '","photo":[';
for ($m = 0; $m < $j; $m++) {
if ($photo_name[$k][$m] == "") {
$var = trim($albumJson);
$len = strlen($var) - 1;
$str = $var[$len];
//最后一个字符是逗号才去删除
if ($str == ",") {
$albumJson = substr($albumJson, 0, strlen($albumJson) - 1);
$flag = 1;
}
continue;
}
$albumJson = $albumJson . '{ "photo_name":"' . $photo_name[$k][$m] . '", "photo_intro":"' . $photo_intro[$k][$m] . '", "photo_tag":"' . $photo_tag[$k][$m] . '","photo_thumb_url":"' . $photo_thumb_url[$k][$m] . '","photo_url":"' . $photo_url[$k][$m] . '" }';
if ($m != $j - 1) {
$albumJson = $albumJson . ',';
}
//echo $photo_name[$k][$m];
}
$albumJson = $albumJson . ']}';
if ($k != $i - 1) {
$albumJson = $albumJson . ',';
}
//echo "<br />";
}
$albumJson = $albumJson . ']';
return $albumJson;
}
开发者ID:laiello,项目名称:xiyoulinux,代码行数:54,代码来源:xy_update_json.php
示例6: upload_download_delete_blob
function upload_download_delete_blob()
{
echo '<table><form method=post enctype=\'multipart/form-data\'>';
foreach ($_POST as $key => $value) {
if ($key != 'action') {
echo '<tr><td>' . $key . '</td><td><input type=text readonly name=\'' . $key . '\' value=\'' . $value . '\'></td></tr>';
}
}
$fname = get_file_name($_POST['_attachment_id']);
echo '<tr><td>File to upload</td>';
echo '<td><input type=file name=attachment></td><td><input type=reset value=clear></td></tr>';
echo '<tr><td>Filename</td><td><input readonly type=text name=attachment_name value=\'' . $fname . '\'></td></tr>';
echo '<tr><td colspan=5 ><input type=submit name=action value=upload_file>';
echo '<input type=submit name=action value=download_file>';
echo '<input type=submit name=action value=delete_file></td></tr></table></form>';
}
开发者ID:nishishailesh,项目名称:myLIS,代码行数:16,代码来源:manage_blob.php
示例7: tearDown
public function tearDown ()
{
contestDB::get_zend_db ()->closeConnection();
$datadir = get_file_name ("data/");
/* let's move our log file somewhere */
/* close the logger. */
Logger::flush ();
$logfile = "$datadir/logs/" . posix_getuid () . ".log";
if (is_file ($logfile)) {
$contents = file_get_contents ($logfile);
file_put_contents ("logs/" . posix_getuid () . ".log", $contents, FILE_APPEND);
}
safeSystem ("fusermount -zu $datadir");
}
开发者ID:rajatkhanduja,项目名称:opc,代码行数:16,代码来源:OpcDataTest.php
示例8: makeDir
//$subdir = win_dir_format($subdir);
$indexSavePath = "./data/index/{$key}/" . $subdir;
makeDir($indexSavePath);
$mapFile = $indexSavePath . "/paper_url_mapping.log";
delFile($mapFile);
$icount = 1;
while ($line = readLine($fp)) {
$arr = explode("\t", $line);
$u = $arr[6];
$paperName = $arr[0];
$paperName = win_dir_format($paperName);
//echo $paperName . "\n";
$htmlFileName = $indexSavePath . "/" . $paperName . ".html";
$tmpFile = iconv("utf-8", "gb2312//IGNORE", $htmlFileName);
$dbCode = get_db_code($u);
$fileName = get_file_name($u);
$tableName = get_table_name($u);
$realUrl = get_real_url($dbCode, $fileName, $tableName);
if (file_exists($tmpFile)) {
if (filesize($tmpFile) < 100) {
delFile($htmlFileName);
} else {
echo "Cache hit! continue -> {$htmlFileName}\n";
$mapContent = "{$paperName}\t{$realUrl}\n";
save($mapFile, $mapContent, "a+");
continue;
}
}
$indexContent = @file_get_contents($realUrl);
if (strlen($indexContent) == 0) {
die("{$realUrl}");
开发者ID:highestgoodlikewater,项目名称:cnkispider,代码行数:31,代码来源:getindex.php
示例9: fopen
}
}
$pageToBeDeployedHandle = fopen(DOC_ROOT_PATH . $datarow[CSV_URL_INDEX], 'w') or die("can't open file");
fwrite($pageToBeDeployedHandle, $pageToBeDeployed);
chmod(DOC_ROOT_PATH . $datarow[CSV_URL_INDEX], 0777);
// Close reference to file
fclose($pageToBeDeployedHandle);
if (FTP_ENABLED) {
$pageToBeDeployedHandle = fopen(DOC_ROOT_PATH . $datarow[CSV_URL_INDEX], 'r') or die("can't open file");
// change to proper dir
if (!@ftp_chdir($conn_id, REMOTE_DOC_ROOT_PATH . get_file_dir($filePath))) {
build_directory_structure_ftp($conn_id, get_file_dir($filePath));
ftp_chdir($conn_id, REMOTE_DOC_ROOT_PATH . get_file_dir($filePath));
}
// try to upload $file
if (ftp_fput($conn_id, get_file_name($filePath), $pageToBeDeployedHandle, FTP_ASCII)) {
$successArray[] = "http://www.iwanttolol.com/" . $datarow[CSV_URL_INDEX];
} else {
$errorArray[] = "FTP error: {$thePage}";
}
// Close reference to file
fclose($pageToBeDeployedHandle);
}
} else {
$errorArray[] = "No content (" . strlen($theContent) . "): {$thePage}";
error_log("No content: {$thePage}. Content: \n" . $theContent, 0);
}
$counter++;
if (DEBUG_MODE && $counter > 8) {
break;
}
开发者ID:tchalvak,项目名称:airl,代码行数:31,代码来源:generate-detail-pages.php
示例10: dumpError
/**
* Метод сохраняет ошибку выполнения в файл
*
* @param Exception $exception
*/
public static function dumpError(Exception $exception, $additionalInfo = '')
{
if (ConfigIni::exceptionsMaxDumpCount() <= 0) {
return;
//---
}
$additionalInfo = trim("{$additionalInfo}");
//Поставим защиту от двойного дампинга ошибки
$SafePropName = 'ps_ex_dumped';
if (property_exists($exception, $SafePropName)) {
return;
//---
}
$exception->{$SafePropName} = true;
try {
$INFO[] = 'SERVER: ' . (isset($_SERVER) ? print_r($_SERVER, true) : '');
$INFO[] = 'REQUEST: ' . (isset($_REQUEST) ? print_r($_REQUEST, true) : '');
$INFO[] = 'SESSION: ' . (isset($_SESSION) ? print_r($_SESSION, true) : '');
$INFO[] = 'FILES: ' . (isset($_FILES) ? print_r($_FILES, true) : '');
if ($additionalInfo) {
$INFO[] = "ADDITIONAL:\n{$additionalInfo}\n";
}
$INFO[] = 'STACK:';
$INFO[] = ExceptionHelper::formatStackFile($exception);
$original = ExceptionHelper::extractOriginal($exception);
$fname = get_file_name($original->getFile());
$fline = $original->getLine();
$DM = DirManager::autogen('exceptions');
if ($DM->getDirContentCnt() >= ConfigIni::exceptionsMaxDumpCount()) {
$DM->clearDir();
}
$DM->getDirItem(null, PsUtil::fileUniqueTime() . " [{$fname} {$fline}]", 'err')->putToFile(implode("\n", $INFO));
} catch (Exception $ex) {
//Если в методе дампа эксепшена ошибка - прекращаем выполнение.
die("Exception [{$exception->getMessage()}] dump error: [{$ex->getMessage()}]");
}
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:42,代码来源:ExceptionHandler.php
示例11: getDialog
/** @return BaseDialog */
public function getDialog($ident)
{
return $this->getEntityClassInst(get_file_name($ident));
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:5,代码来源:DialogManager.php
示例12: _rename
function _rename($dir, $file_src, $file_dest, $force = false)
{
$oldwd = getcwd();
chdir(realpath($dir));
if (!file_exists($file_src)) {
return false;
}
$copy = "";
$file_name = get_file_name($file_dest);
$file_ext = get_file_extension($file_dest);
if (!$force && strtolower($file_src) == $file_dest && substr(PHP_OS, 0, 3) != "WIN") {
$n = 2;
while (file_exists($file_name . $copy . "." . $file_ext)) {
$copy = "_" . $n;
$n++;
}
}
$file = $file_name . $copy . "." . $file_ext;
$ok = rename($file_src, $file);
chdir($oldwd);
return $ok ? $file : false;
}
开发者ID:4images,项目名称:4images,代码行数:22,代码来源:checkimages.php
示例13: buildListPage
function buildListPage($listPageObject)
{
global $errorArray;
global $successArray;
global $templateHtml;
global $statusFile;
global $pageBeforeContent;
global $pageAfterContent;
global $conn_id;
global $listCounter;
global $numListPages;
$errorSize = count($errorArray);
fwrite($statusFile, "<strong>(" . ($listCounter + 1) . "/{$numListPages}) Memory Used:" . memory_get_usage() . "</strong> " . $listPageObject->url . ":<br>");
fwrite($statusFile, " " . $listPageObject->toString() . "<br>");
//Open handle to page
if (!file_exists(DOC_ROOT_PATH . "{$listPageObject->url}")) {
build_directory_structure($listPageObject->url);
}
$pageToBeDeployedHandle = fopen(DOC_ROOT_PATH . $listPageObject->url, 'w') or die("can't open file");
//Insert title into head section
$updatedPageBeforeContent = str_replace("#head-additional-styles-and-scripts#", "<title>{$listPageObject->listingName} Vacation and Resort Listing</title>", $pageBeforeContent);
// Add the remote path where the installation is located
$updatedPageBeforeContent = str_replace("#remote-install-path#", REMOTE_INSTALL_PATH, $updatedPageBeforeContent);
// Replace the agency code
$updatedPageBeforeContent = str_replace("#agency-code#", AGENCY_CODE, $updatedPageBeforeContent);
//Insert country code and empty hotel code for search
$updatedPageBeforeContent = str_replace("#country-code-upper##hotel-code-upper#", "", $updatedPageBeforeContent);
if (property_exists($listPageObject, "countryCode")) {
$updatedPageBeforeContent = str_replace("#country-code-upper#", $listPageObject->countryCode, $updatedPageBeforeContent);
$updatedPageBeforeContent = str_replace("#dest-region#", "", $updatedPageBeforeContent);
} else {
// Chain pages we aren't sure of country or hotel, so just filter by destination region
$updatedPageBeforeContent = str_replace("#country-code-upper#", "", $updatedPageBeforeContent);
$updatedPageBeforeContent = str_replace("#hotel-code-upper#", "", $updatedPageBeforeContent);
$updatedPageBeforeContent = str_replace("#dest-region#", DEST_REGION_FILTER, $updatedPageBeforeContent);
}
$updatedPageBeforeContent = str_replace("#meta-keywords#", $listPageObject->listingName . ", " . $listPageObject->listingName . " hotel, " . $listPageObject->listingName . " resort, " . $listPageObject->listingName . " all inclusive", $updatedPageBeforeContent);
$updatedPageBeforeContent = str_replace("#meta-description#", PRETTY_SITE_NAME . " provides All-inclusive vacations to " . $listPageObject->listingName . ". Great prices, personal service, and can price match (then beat) any other offer.", $updatedPageBeforeContent);
//Write html before the content
fwrite($pageToBeDeployedHandle, $updatedPageBeforeContent);
//Check to see if we should treat as a hotel chain object or standard hotel object
if (strcmp(get_class($listPageObject), "ChainListPageObject") != 0) {
foreach ($listPageObject->hotelCodes as $childHotel) {
$hotelListObject = get_hotel_info($listPageObject->countryCode, $childHotel);
if (!empty($hotelListObject->hotelName)) {
$listOutput = $hotelListObject->formattedOutput();
fwrite($statusFile, " " . $hotelListObject->hotelName . "<br>");
//Write html for current hotel
fwrite($pageToBeDeployedHandle, $listOutput);
} else {
$errorArray[$hotelListObject->countryCode . $hotelListObject->hotelCode] = "countryCode:{$hotelListObject->countryCode}, hotelCode:{$hotelListObject->hotelCode}";
}
if (kill_build()) {
fwrite($statusFile, "<br>BUILD KILLED!!!<br>");
$errorArray[] = "Build Killed!";
break;
}
}
} else {
foreach ($listPageObject->hotels as $hotelListObject) {
if (!empty($hotelListObject->hotelName)) {
$listOutput = $hotelListObject->formattedOutput();
fwrite($statusFile, " " . $hotelListObject->hotelName . "<br>");
//Write html for current hotel
fwrite($pageToBeDeployedHandle, $listOutput);
} else {
$errorArray[$hotelListObject->countryCode . $hotelListObject->hotelCode] = "countryCode:{$hotelListObject->countryCode}, hotelCode:{$hotelListObject->hotelCode}";
}
if (kill_build()) {
fwrite($statusFile, "<br>BUILD KILLED!!!<br>");
$errorArray[] = "Build Killed!";
break;
}
}
}
fwrite($statusFile, "<br>");
$pageAfterContent = str_replace("#pretty-site-name#", PRETTY_SITE_NAME, $pageAfterContent);
//Write html after the content
fwrite($pageToBeDeployedHandle, $pageAfterContent);
chmod(DOC_ROOT_PATH . "{$listPageObject->url}", 0777);
// Close reference to file
fclose($pageToBeDeployedHandle);
if (FTP_ENABLED) {
$pageToBeDeployedHandle = fopen(DOC_ROOT_PATH . $listPageObject->url, 'r') or die("can't open file");
// change to proper dir
build_directory_structure_ftp($conn_id, get_file_dir($listPageObject->url));
ftp_chdir($conn_id, REMOTE_DOC_ROOT_PATH . get_file_dir($listPageObject->url));
// try to upload $file and check if all the hotels in list were successfully added (errors start == errors end)
if (ftp_fput($conn_id, get_file_name($listPageObject->url), $pageToBeDeployedHandle, FTP_ASCII) && $errorSize == count($errorArray)) {
$successArray[] = "http://" . SITE_DOMAIN . $listPageObject->url;
} else {
if ($errorSize == count($errorArray)) {
// If the error count is equal then it is FTP error, else has been logged above
$errorArray[] = "FTP error: {$listPageObject->url}";
}
}
// Close reference to file
fclose($pageToBeDeployedHandle);
}
}
开发者ID:tchalvak,项目名称:airl,代码行数:100,代码来源:generate-list-pages.php
示例14: upload
function upload()
{
$dir = post('dir');
$file = post('file');
$suffix = strtolower(get_file_name($file, '.'));
if (strpos('jpg,gif,png,bmp,jpeg,rar,zip,pdf', $suffix) !== false) {
move_uploaded_file($_FILES['file_path']['tmp_name'], $dir . $file);
set_cookie('file', $dir . $file);
}
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:10,代码来源:deal.php
示例15: exit
} else {
echo "You have to specify an end time or duration.\n";
exit(1);
}
}
$endTime = $dom->createElement("contestEndTime", date($xsdformat, $unix));
$root->appendChild($endTime);
}
if (empty($name)) {
$name = "Unnamed contest";
}
$e = $dom->createElement("name", $name);
$root->appendChild($e);
if (!empty($enable_queue_privacy)) {
$e = $dom->createElement("enable-queue-privacy", "true");
$root->appendChild($e);
}
$frontend = $dom->createElement("frontend");
$root->appendChild($frontend);
$home = $dom->createElement("page", "Home");
$frontend->appendChild($home);
$home->setAttribute("id", "home");
$home->setAttribute("href", "general/home.html");
file_put_contents(get_file_name("data/contests/{$id}.xml"), $dom->saveXML());
chmod(get_file_name("data/contests/{$id}.xml"), 0755);
if (empty($quiet)) {
echo "-----LOG-----\n";
echo $dom->saveXML();
echo "\nJust verify that the timestamps have been correctly parsed.\n";
Logger::get_logger()->info("contest added with: " . $argv);
}
开发者ID:rajatkhanduja,项目名称:opc,代码行数:31,代码来源:addcontest.php
示例16: file_put_contents
$res->appendChild($element);
if (!empty($checker)) {
$element = $dom->createElement("checker", $checker);
$root->appendChild($element);
}
if (empty($grading_style)) {
$grading_style = config::$default_grading_style;
}
$element = $dom->createElement("grading-style", $grading_style);
$root->appendChild($element);
if (empty($rlim)) {
$rlim = "";
}
$element = $dom->createElement("resourcelimits_string", $rlim);
$root->appendChild($element);
file_put_contents(get_file_name("data/problems/" . $id . ".xml"), $dom->saveXML());
chmod(get_file_name("data/problems/{$id}.xml"), 0755);
chmod(get_file_name("data/problems/{$id}"), 0755);
echo "-----LOG-----\n";
echo $dom->saveXML();
$db = contestDB::get_zend_db();
$id = pg_escape_string($id);
$nick = pg_escape_string($nick);
$rlim = pg_escape_string($rlim);
if (empty($onlyupdate)) {
$sql = "insert into problemdata (id,numcases,nickname,state,submissionlimit,owner) values \n('{$id}',{$numcases},'{$nick}','ok',{$sublim},'{$contest}')";
} else {
$sql = "update problemdata set numcases={$numcases},nickname='{$nick}',\nstate='ok',submissionlimit={$sublim},owner='{$contest}' where id='{$id}'";
}
$db->query($sql);
echo "Done, copy your problem statement to " . config::$problems_directory . "/{$id}/index.{html|pdf|ps}. Note that html file should contain only the body " . "part!\n";
开发者ID:rajatkhanduja,项目名称:opc,代码行数:31,代码来源:addproblem.php
示例17: copy_file
function copy_file($image_src, $image_dest, $image_media_file, $dest_file_name, $type, $filter = 1, $move = 1)
{
$image_src_file = $image_src . "/" . $image_media_file;
$dest_file_name = $filter ? filterFileName($dest_file_name) : $dest_file_name;
$ok = 0;
if (!file_exists($image_dest) || !is_dir($image_dest)) {
$oldumask = umask(0);
$result = _mkdir($image_dest);
@chmod($image_dest, CHMOD_DIRS);
umask($oldumask);
}
switch ($type) {
case 1:
// overwrite mode
if (file_exists($image_src . "/" . $image_media_file)) {
if (file_exists($image_dest . "/" . $dest_file_name)) {
unlink($image_dest . "/" . $dest_file_name);
}
$ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $dest_file_name);
}
break;
case 2:
// create new with incremental extention
if (file_exists($image_src . "/" . $image_media_file)) {
$file_extension = get_file_extension($dest_file_name);
$file_name = get_file_name($dest_file_name);
$n = 2;
$copy = "";
while (file_exists($image_dest . "/" . $file_name . $copy . "." . $file_extension)) {
$copy = "_" . $n;
$n++;
}
$new_file = $file_name . $copy . "." . $file_extension;
$ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $new_file);
$dest_file_name = $new_file;
}
break;
case 3:
// do nothing if exists, highest protection
// do nothing if exists, highest protection
default:
if (file_exists($image_src . "/" . $image_media_file)) {
if (file_exists($image_dest . "/" . $dest_file_name)) {
$ok = 0;
} else {
$ok = copy($image_src . "/" . $image_media_file, $image_dest . "/" . $dest_file_name);
}
}
break;
}
if ($ok) {
if ($move) {
@unlink($image_src_file);
}
@chmod($image_dest . "/" . $dest_file_name, CHMOD_FILES);
return $dest_file_name;
} else {
return false;
}
}
开发者ID:4images,项目名称:4images,代码行数:60,代码来源:admin_functions.php
示例18: display_success
global $LSP_URL;
if (!SESSION_EMPTY() && (get_user_id(SESSION()) == get_file_owner(GET('file')) || is_admin(get_user_id(SESSION())))) {
if (GET('confirmation') == "true") {
if (delete_file(GET('file'))) {
display_success('File deleted successfully', array('Delete'));
} else {
display_error('Sorry, file ' . GET('file') . ' could not be deleted', array('Delete'));
}
get_latest();
} else {
display_warning('This will delete all comments and ratings.', array('Delete', get_file_url()));
echo '<div class="col-md-9">';
$form = new form(null, 'Confirm Delete', 'fa-trash');
?>
<p class="lead">Confirm deletion of <strong><?php
echo get_file_name(GET('file'));
?>
</strong>?</p>
<div class="form-group">
<a class="btn btn-danger" href="<?php
echo "{$LSP_URL}?content=delete&confirmation=true&file=" . GET('file');
?>
">
<span class="fa fa-check"></span> Delete</a>
<a class="btn btn-warning" href="<?php
echo "{$LSP_URL}?action=show&file=" . GET('file');
?>
">
<span class="fa fa-close"></span> Cancel</a>
</form>
<?php
开发者ID:kmklr72,项目名称:lmms.io,代码行数:31,代码来源:delete_file.php
示例19: viewAction
function viewAction()
{
if (!$this->validateProblemAccess()) {
return;
}
$prob = $this->view->prob;
$this->view->content_html = file_get_contents(get_file_name("data/problems/" . $this->_request->get("probid") . "/index.html"));
if (function_exists("tidy_parse_string") && $this->_request->get("tidy") != "false") {
/* tidy to XHTML strict */
$opt = array("output-xhtml" => true, "add-xml-decl" => true, "bare" => true, "clean" => true, "quote-ampersand" => true, "doctype" => "strict");
$tidy = tidy_parse_string($this->view->content_html, $opt);
tidy_clean_repair($tidy);
$this->view->content_html = tidy_get_output($tidy);
$this->fixImages();
/* redo the tidy, I agree it's slow, but easy way out. :) */
$opt = array("output-xhtml" => true, "doctype" => "strict", "show-body-only" => true);
$tidy = tidy_parse_string($this->view->content_html, $opt);
tidy_clean_repair($tidy);
$this->view->content_html = tidy_get_output($tidy);
}
if ($this->_request->get("plain") == "true") {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setBody($this->view->content_html);
}
}
开发者ID:rajatkhanduja,项目名称:opc,代码行数:26,代码来源:ProblemsController.php
示例20: getPathBase
public function getPathBase()
{
return get_file_name($this->path);
}
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:4,代码来源:WebPage.php
注:本文中的get_file_name函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论