当前位置: 首页>>代码示例>>PHP>>正文


PHP GetFileExtension函数代码示例

本文整理汇总了PHP中GetFileExtension函数的典型用法代码示例。如果您正苦于以下问题:PHP GetFileExtension函数的具体用法?PHP GetFileExtension怎么用?PHP GetFileExtension使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetFileExtension函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CheckRights

 function CheckRights($method, $strong, &$path)
 {
     $result = true;
     if (!parent::CheckRights($method)) {
         $result = false;
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage('WD_ACCESS_DENIED'), 'ACCESS_DENIED');
     } elseif ($path != '') {
         $io = CBXVirtualIo::GetInstance();
         $path = $io->CombinePath($this->_udecode($path));
         $strFileName = GetFileName($path);
         $extention = "." . strtolower(GetFileExtension($strFileName));
         if (in_array($method, array("COPY", "MOVE", "PUT"))) {
             if (!$GLOBALS["USER"]->IsAdmin() && HasScriptExtension($strFileName)) {
                 $result = false;
                 $GLOBALS['APPLICATION']->ThrowException(GetMessage("WD_FILE_ERROR13"), "FORBIDDEN_EXTENTION");
             } elseif (IsFileUnsafe($strFileName) || $strFileName == "index.php") {
                 $result = false;
                 $GLOBALS['APPLICATION']->ThrowException(GetMessage("WD_FILE_ERROR14"), "FORBIDDEN_NAME");
             } elseif (!$io->ValidatePathString($io->CombinePath("/", $path)) || !$io->ValidateFilenameString($strFileName)) {
                 $result = false;
                 $GLOBALS['APPLICATION']->ThrowException(GetMessage("WD_FILE_ERROR14"), "FORBIDDEN_NAME");
             } elseif (in_array($extention, $this->arFileForbiddenExtentions["WRITE"])) {
                 $result = false;
                 $GLOBALS['APPLICATION']->ThrowException(GetMessage("WD_FILE_ERROR13"), "FORBIDDEN_EXTENTION");
             }
         } elseif (in_array($extention, $this->arFileForbiddenExtentions["READ"])) {
             $result = false;
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage('WD_ACCESS_DENIED'), 'ACCESS_DENIED');
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:32,代码来源:file.php

示例2: getSkinsFromDir

 function getSkinsFromDir($path)
 {
     $arSkins = array();
     $basePath = $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $path);
     $arSkinExt = array('swf', 'zip');
     $arPreviewExt = array('png', 'gif', 'jpg', 'jpeg');
     $prExtCnt = count($arPreviewExt);
     $handle = @opendir($basePath);
     while (false !== ($f = @readdir($handle))) {
         if ($f == "." || $f == ".." || $f == ".htaccess" || !is_file($basePath . '/' . $f)) {
             continue;
         }
         $ext = strtolower(GetFileExtension($f));
         if (in_array($ext, $arSkinExt)) {
             $name = substr($f, 0, -strlen($ext) - 1);
             // name of the skin
             if (strlen($name) <= 0) {
                 continue;
             }
             $Skin = array('filename' => $f);
             $Skin['name'] = strtoupper(substr($name, 0, 1)) . strtolower(substr($name, 1));
             $Skin['the_path'] = $path;
             // Try to find preview
             for ($i = 0; $i < $prExtCnt; $i++) {
                 if (file_exists($basePath . '/' . $name . '.' . $arPreviewExt[$i])) {
                     $Skin['preview'] = $name . '.' . $arPreviewExt[$i];
                     break;
                 }
             }
             $arSkins[] = $Skin;
         }
     }
     return $arSkins;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:34,代码来源:.parameters.php

示例3: IsCanEditPage

 function IsCanEditPage($currentFilePath, $documentRoot, $filemanExists)
 {
     $io = CBXVirtualIo::GetInstance();
     if (!$io->FileExists($documentRoot . $currentFilePath) || !$GLOBALS["USER"]->CanDoFileOperation("fm_edit_existent_file", array(SITE_ID, $currentFilePath))) {
         return false;
     }
     //need fm_lpa for every .php file, even with no php code inside
     if (in_array(GetFileExtension($currentFilePath), GetScriptFileExt()) && !$GLOBALS["USER"]->CanDoFileOperation('fm_lpa', array(SITE_ID, $currentFilePath)) && !$GLOBALS["USER"]->CanDoOperation('edit_php')) {
         return false;
     }
     if ($filemanExists) {
         return $GLOBALS["USER"]->CanDoOperation("fileman_admin_files") && $GLOBALS["USER"]->CanDoOperation("fileman_edit_existent_files");
     }
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:15,代码来源:top_panel.php

示例4: __struct_get_file_info

function __struct_get_file_info($abs_path, $file)
{
	static $arTextExt = array("php", "htm", "html");

	$io = CBXVirtualIo::GetInstance();

	$arFile = array("file"=>$file, "name"=>"");
	if($io->DirectoryExists($abs_path."/".$file))
	{
		$arFile["type"] = "D";
		if($io->FileExists($abs_path."/".$file."/.section.php"))
		{
			$sSectionName = "";
			$arDirProperties = array();
			include($io->GetPhysicalName($abs_path."/".$file."/.section.php"));
			$arFile["name"] = $sSectionName;
			$arFile["properties"] = $arDirProperties;
		}
	}
	else
	{
		$arFile["type"] = "F";
		if(in_array(GetFileExtension($file), $arTextExt))
		{
			$f = $io->GetFile($abs_path."/".$file);
			$sContent = $f->GetContents();
			$arContent = ParseFileContent($sContent);
			$arFile["name"] = CUtil::ConvertToLangCharset($arContent["TITLE"]);
			$arFile["properties"] = $arContent["PROPERTIES"];
		}
	}
	if($GLOBALS['arOptions']['show_file_info'] == true)
	{
		if ($io->DirectoryExists($abs_path."/".$file))
		{
			$f = $io->GetDirectory($abs_path."/".$file);
			$arFile["time"] = $f->GetModificationTime();
		}
		else
		{
			$f = $io->GetFile($abs_path."/".$file);
			$arFile["time"] = $f->GetModificationTime();
			$arFile["size"] = $f->GetFileSize();
		}
	}
	return $arFile;
}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:47,代码来源:structure.php

示例5: CheckDir

function CheckDir($sourceDir)
{
    $counter = 0;
    $sourceDir = FixDirSlash($sourceDir);
    // Copy files and directories.
    $sourceDirHandler = opendir($sourceDir);
    while ($file = readdir($sourceDirHandler)) {
        // Skip ".", ".." and hidden fields (Unix).
        if (substr($file, 0, 1) == '.') {
            continue;
        }
        $sourcefilePath = $sourceDir . $file;
        if (is_dir($sourcefilePath)) {
            $counter += CheckDir($sourcefilePath);
        }
        if (!is_file($sourcefilePath) || @GetFileExtension($sourcefilePath) != 'php' || !CheckUtf8Bom($sourcefilePath)) {
            continue;
        }
        echo $sourcefilePath, '<br />';
        $counter++;
    }
    return $counter;
}
开发者ID:nardin,项目名称:FCKeditor,代码行数:23,代码来源:php_bom_finder.php

示例6: GetFilrIcon

function GetFilrIcon($compPath, $pathQ, $arParams, $arF)
{
    $arMime = array('pdf' => 'pdf.png', 'doc' => 'doc.png', 'docx' => 'doc.png', 'ppt' => 'ppt.png', 'pptx' => 'ppt.png', 'rar' => 'rar.png', 'xls' => 'xls.png', 'xlsx' => 'xls.png', 'zip' => 'zip.png');
    $fIcon = $compPath . "/images/" . "blank.png";
    $fExtQ = strtolower(GetFileExtension($pathQ));
    if ($arParams["RESOURCE_TYPE"] == "IBLOCK") {
        if (CFile::isImage($arF['NAME'])) {
            return $compPath . "/images/img.png";
        }
        $icon = isset($arMime[$fExtQ]) ? $arMime[$fExtQ] : 'blank.png';
        return $compPath . "/images/{$icon}";
    }
    $fileID = $pathQ;
    $arFile = CFile::MakeFileArray($fileID);
    $isPictureExt = false;
    $arPExt = explode(",", CFile::GetImageExtensions());
    foreach ($arPExt as $v) {
        if (strtolower(trim($v)) == $fExtQ) {
            $isPictureExt = true;
            break;
        }
    }
    $isPicture = false;
    if ($isPictureExt && isset($arFile["tmp_name"])) {
        $imgArray = CFile::GetImageSize($arFile["tmp_name"], true);
        if (is_array($imgArray)) {
            if ($arFIcon = CFile::ResizeImageGet($fileID, array("width" => "58", "height" => "58"), BX_RESIZE_IMAGE_EXACT, true)) {
                $fIcon = $arFIcon["src"];
                $isPicture = true;
            }
        }
    }
    if (!$isPicture && array_key_exists($fExtQ, $arMime)) {
        $fIcon = $compPath . "/images/" . $arMime[$fExtQ];
    }
    return $fIcon;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:37,代码来源:component.php

示例7: BaseCheckFields

 function BaseCheckFields($val)
 {
     $arErrors = array();
     if (!is_array($val)) {
         $val = array();
     }
     // Check uploaded file
     if ($val["B_NEW_FILE"] != "N" && isset($val["FILE"])) {
         if ($val["FILE"]["error"] == 1 || $val["FILE"]["error"] == 2) {
             $arErrors[] = GetMessage("IBLOCK_PROP_VIDEO_SIZE_ERROR", array('#FILE_NAME#' => $pathto)) . "\n";
         }
         if (strlen($val["FILE"]["tmp_name"]) > 0) {
             $name = $val["FILE"]["name"];
             $name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "_", $name);
             $ext = GetFileExtension($name);
             if (strlen($ext) == 0 || HasScriptExtension($name) || substr($name, 0, 1) == ".") {
                 $arErrors[] = GetMessage("IBLOCK_PROP_VIDEO_INCORRECT_EXT", array("#EXT#" => strtoupper($ext)));
             } elseif (!is_uploaded_file($val["FILE"]["tmp_name"])) {
                 $arErrors[] = GetMessage("IBLOCK_PROP_VIDEO_UPLOAD_ERROR");
             } else {
                 $quota = new CDiskQuota();
                 if (!$quota->checkDiskQuota(array("FILE_SIZE" => $val["FILE"]["size"]))) {
                     $arErrors[] = GetMessage("IBLOCK_PROP_VIDEO_QUOTE_ERROR") . "\n";
                 }
             }
         }
     }
     return $arErrors;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:29,代码来源:properties.php

示例8: IncludeModuleLangFile

*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/prolog.php";
if (!$USER->CanDoOperation('edit_php')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/translate/include.php";
IncludeModuleLangFile(__FILE__);
define("HELP_FILE", "translate_list.php");
/***************************************************************************
                           GET | POST
***************************************************************************/
$strError = "";
$file = Rel2Abs("/", $file);
$abs_path = CSite::GetSiteDocRoot(false) . htmlspecialcharsbx($file);
if (strpos($file, "/bitrix/") !== 0 || strpos($file, "/lang/") === false || GetFileExtension($file) != "php") {
    $strError = GetMessage("trans_edit_err") . "<br>";
}
$APPLICATION->SetTitle(GetMessage("TRANS_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if ($strError == "") {
    $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("TRANS_TITLE"), "ICON" => "translate_edit", "TITLE" => GetMessage("TRANS_TITLE_TITLE")));
    $tabControl = new CAdminTabControl("tabControl", $aTabs);
    $chain = "";
    $arPath = array();
    $path_back = dirname($file);
    $arSlash = explode("/", $path_back);
    if (is_array($arSlash)) {
        $arSlash_tmp = $arSlash;
        $lang_key = array_search("lang", $arSlash) + 1;
        unset($arSlash_tmp[$lang_key]);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:translate_show_php.php

示例9: GetFileType

function GetFileType($path)
{
	$extension = GetFileExtension(strtolower($path));
	switch ($extension)
	{
		case "jpg": case "jpeg": case "gif": case "bmp": case "png":
			$type = "IMAGE";
			break;
		case "swf":
			$type = "FLASH";
			break;
		case "html": case "htm": case "asp": case "aspx":
		case "phtml": case "php": case "php3": case "php4": case "php5": case "php6":
		case "shtml": case "sql": case "txt": case "inc": case "js": case "vbs":
		case "tpl": case "css": case "shtm":
			$type = "SOURCE";
			break;
		default:
			$type = "UNKNOWN";
	}
	return $type;
}
开发者ID:nProfessor,项目名称:Mytb,代码行数:22,代码来源:tools.php

示例10: actionUpmusic

 public function actionUpmusic()
 {
     $songModel = new Song();
     if (isset($_POST['Song'])) {
         $songModel->attributes = $_POST['Song'];
         $songModel->userid = Yii::app()->session['uid'];
         if ($songModel->validate()) {
             if (!empty($_FILES['songname']['tmp_name'])) {
                 $file = $_FILES['songname'];
                 if (!MusicTypeCheck($file['name'], $file['size'])) {
                     Yii::app()->user->setFlash('upstatus', 'Sorry, 音乐文件大小或格式错误 :(');
                     $this->redirect(array("Upmusic"));
                     die;
                 }
                 $type = "." . GetFileExtension($file['name']);
                 Yii::import('application.vendors.*');
                 require_once 'Qiniu/rs.php';
                 require_once 'Qiniu/io.php';
                 $bucket = Yii::app()->params['bucket'];
                 $accessKey = Yii::app()->params['accessKey'];
                 $secretKey = Yii::app()->params['secretKey'];
                 $newname = time() . rand(10000, 99999) . $type;
                 //先保存记录
                 $songModel->song = $newname;
                 if ($songModel->save()) {
                     /**
                      * 
                      */
                 } else {
                     Yii::app()->user->setFlash('upstatus', 'Sorry,系统错误,上传音乐失败 :(');
                 }
                 Qiniu_SetKeys($accessKey, $secretKey);
                 $putPolicy = new Qiniu_RS_PutPolicy($bucket);
                 $upToken = $putPolicy->Token(null);
                 list($ret, $err) = Qiniu_Put($upToken, $newname, file_get_contents($file['tmp_name']), null);
                 if ($err === null) {
                     //成功
                     /***
                      * 
                      */
                     $this->redirect(array('admin/Imusic'));
                 } else {
                     //失败
                     Yii::app()->user->setFlash('upstatus', 'Sorry,系统错误,上传音乐失败 :(');
                 }
             }
         }
     }
     $data = array('songModel' => $songModel);
     $this->render("upmusic", $data);
 }
开发者ID:returncn,项目名称:chen-xia-cms,代码行数:51,代码来源:AdminController.php

示例11: array

if ($APPLICATION->GetShowIncludeAreas()) {
    require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php";
    $aUserOpt = CUserOptions::GetOption("global", "settings", array());
    if ($aUserOpt["page_edit_control_enable"] != "N") {
        $documentRoot = CSite::GetSiteDocRoot(SITE_ID);
        if (isset($_SERVER["REAL_FILE_PATH"]) && $_SERVER["REAL_FILE_PATH"] != "") {
            $currentFilePath = $_SERVER["REAL_FILE_PATH"];
        } else {
            $currentFilePath = $APPLICATION->GetCurPage(true);
        }
        $bCanEdit = true;
        if (!is_file($documentRoot . $currentFilePath) || !$USER->CanDoFileOperation("fm_edit_existent_file", array(SITE_ID, $currentFilePath))) {
            $bCanEdit = false;
        }
        //need fm_lpa for every .php file, even with no php code inside
        if ($bCanEdit && !$USER->CanDoOperation('edit_php') && in_array(GetFileExtension($currentFilePath), GetScriptFileExt()) && !$USER->CanDoFileOperation('fm_lpa', array(SITE_ID, $currentFilePath))) {
            $bCanEdit = false;
        }
        if ($bCanEdit && IsModuleInstalled("fileman") && !($USER->CanDoOperation("fileman_admin_files") && $USER->CanDoOperation("fileman_edit_existent_files"))) {
            $bCanEdit = false;
        }
        if ($bCanEdit) {
            echo $APPLICATION->IncludeStringBefore();
            $BX_GLOBAL_AREA_EDIT_ICON = true;
        }
    }
}
define("START_EXEC_PROLOG_AFTER_2", microtime());
$GLOBALS["BX_STATE"] = "WA";
$APPLICATION->RestartWorkarea(true);
//magically replacing the current file with another one
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:prolog_after.php

示例12: GetExtension

 public function GetExtension()
 {
     return GetFileExtension($this->path);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:4,代码来源:virtual_file.php

示例13: array

$arResult["RETURN_DATA"] = "";
$arResult["RETURN_DATA_ARRAY"] = array();
// *************************/Default params*************************************************************
if (is_array($arResult["FILE"]) && !empty($arResult["FILE"]["SRC"])) {
    $arResult["FILE"]["FULL_SRC"] = CHTTP::URN2URI($arResult["FILE"]["SRC"], $arParams["SERVER_NAME"]);
    $ct = strToLower($arResult["FILE"]["CONTENT_TYPE"]);
    if ($arParams["SHOW_MODE"] == "LINK") {
        // do nothing
    } elseif ($arParams["MAX_FILE_SIZE"] >= $arResult["FILE"]["FILE_SIZE"] && substr($ct, 0, 6) == "image/") {
        $arResult["RETURN_DATA"] = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:forum.interface", "popup_image", array("URL" => $arParams["SHOW_MODE"] == "RSS" ? $arResult["FILE"]["FULL_SRC"] : $arResult["FILE"]["SRC"], "SIZE" => $arParams["SIZE"], "MAX_SIZE" => $arParams["MAX_SIZE"], "HTML_SIZE" => $arParams["HTML_SIZE"], "MODE" => $arParams["SHOW_MODE"] == "RSS" ? "RSS" : "SHOW2IMAGES", "IMG_WIDTH" => $arResult["FILE"]["WIDTH"], "IMG_HEIGHT" => $arResult["FILE"]["HEIGHT"], "IMG_NAME" => $arResult["FILE"]["ORIGINAL_NAME"], "IMG_SIZE" => $arResult["FILE"]["FILE_SIZE"], "CONVERT" => $arParams["CONVERT"], "FAMILY" => $arParams["FAMILY"], "RETURN" => "Y"), $this->__component->__parent !== null ? $this->__component->__parent : $this->__component, array("HIDE_ICONS" => "Y"));
    }
    $arResult["RETURN_DATA_ARRAY"]["DATA"] = $arResult["RETURN_DATA"];
    $arData = array();
    $size = intVal($arResult["FILE"]["FILE_SIZE"]) > 0 ? CFile::FormatSize(intval($arResult['FILE']['FILE_SIZE'])) : '';
    $sTitle = !empty($arResult["FILE"]["ORIGINAL_NAME"]) ? $arResult["FILE"]["ORIGINAL_NAME"] : GetMessage("FRM_DOWNLOAD");
    $file_ext = GetFileExtension($arResult["FILE"]["ORIGINAL_NAME"]);
    $arData["TITLE"] = "<a href=\"" . $arResult["FILE"]["SRC"] . "&action=download" . "\" class=\"forum-file forum-file-" . $file_ext . "\" " . (!empty($arResult["RETURN_DATA"]) ?: (substr($ct, 0, 6) == "image/" ? " data-bx-viewer=\"image\" data-bx-src=\"" . $arResult["FILE"]["SRC"] . "\" " . " data-bx-title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . "\" " . " data-bx-owner=\"" . htmlspecialcharsbx($arResult["FILE"]["OWNER"]) . "\" " . " data-bx-dateModify=\"" . htmlspecialcharsbx($arResult["FILE"]["TIMESTAMP_X"]) . "\" " . " data-bx-size=\"" . htmlspecialcharsbx($arResult["FILE"]["FILE_SIZE"]) . "\" " . " data-bx-download=\"" . $arResult["FILE"]["SRC"] . "&action=download\" " . " data-bx-width=\"" . htmlspecialcharsbx($arResult["FILE"]["WIDTH"]) . "\" " . " data-bx-height=\"" . htmlspecialcharsbx($arResult["FILE"]["HEIGHT"]) . "\" " : " data-bx-viewer=\"unknown\" data-bx-src=\"" . $arResult["FILE"]["SRC"] . "\" " . " data-bx-title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . "\" " . " data-bx-owner=\"" . htmlspecialcharsbx($arResult["FILE"]["OWNER"]) . "\" " . " data-bx-dateModify=\"" . htmlspecialcharsbx($arResult["FILE"]["TIMESTAMP_X"]) . "\" data-bx-tooBigSizeMsg=\"\" " . " data-bx-size=\"" . $size . "\" " . " data-bx-download=\"" . $arResult["FILE"]["SRC"] . "&action=download\" ")) . "title=\"" . str_replace("#FILE_NAME#", $arResult["FILE"]["ORIGINAL_NAME"], GetMessage("FRM_DOWNLOAD_TITLE")) . '" target="_blank">' . '<span>' . $arResult["FILE"]["ORIGINAL_NAME"] . '</span></a>';
    if ($size != '') {
        $arData["SIZE"] = "<span class=\"forum-file-size\">(" . $size . ")</span>";
    }
    $arResult["RETURN_DATA_ARRAY"] += $arData;
    if ($arParams["SHOW_MODE"] == "RSS") {
        $arResult["RETURN_DATA"] = !empty($arResult["RETURN_DATA"]) ? $arResult["RETURN_DATA"] : '<a href="' . $arResult["FILE"]["FULL_SRC"] . '">' . $arResult["FILE"]["ORIGINAL_NAME"] . '</a>';
    } elseif ($arParams["SHOW_MODE"] == "THUMB" && !empty($arResult["RETURN_DATA"])) {
        $arResult["RETURN_DATA"] = "<span class=\"forum-attach\" title=\"" . htmlspecialcharsbx($arResult["FILE"]["ORIGINAL_NAME"]) . " (" . $size . ")\">" . $arResult["RETURN_DATA"] . "</span>";
    } elseif ($arParams["SHOW_MODE"] != "FULL" || empty($arResult["RETURN_DATA"])) {
        $arResult["RETURN_DATA"] = "<span class=\"forum-attach\">" . implode(" ", $arData) . "</span>";
    } else {
        $arResult["RETURN_DATA"] = "<div class=\"forum-attach\">" . $arResult["RETURN_DATA"] . "<div>" . implode(" ", $arData) . "</div></div>";
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:template.php

示例14: install_playtomic

function install_playtomic($gameid)
{
    $table = '';
    $pre = 'ptomic';
    global $mysqli;
    $categories = array('Action' => 2, 'Adventure' => 3, 'Strategy' => 10, 'Multiplayer' => 2, 'Puzzle' => 1, 'Rhythm' => 7, 'Shooter' => 5, 'Sports' => 4, 'Other' => 7, 'RPG' => 3, 'Arcade' => 9, 'Driving' => 4, 'Defense' => 10, 'Rhythm' => 7, 'Education' => 7, 'Gadgets' => 1, 'Fighting' => 2, 'Dress Up' => 8, 'Board Game' => 7, 'Pimp & Customize' => 8, 'Pimp &amp; Customize' => 8);
    $query = yasDB_select("SELECT * FROM `playtomicfeed` WHERE `id` = '{$gameid}'", false);
    $result = $query->fetch_array(MYSQLI_ASSOC);
    $gamename = $result['name'];
    $thumburl = $result['thumburl'];
    $thumburl_200 = $result['thumbnail_200x200'];
    $screen1_thumb = '';
    $screen2_thumb = '';
    $screen3_thumb = '';
    $screen4_thumb = '';
    $gameurl = $result['gameurl'];
    $c = explode(",", $result['categories']);
    // Remove comma delimiter and seperate categories into array in order to insert single category.
    $category = $categories[$c[0]];
    $slug = str_replace(array('-', '_'), '', $result['slug']);
    // Download and save game file
    $game_file = $pre . "_" . $slug . "." . GetFileExtension($result['gameurl']);
    $game_url = '../swf/' . $game_file;
    download_file($gameurl, $game_url);
    $gamefile = 'swf/' . $game_file;
    // Download and save 100x100 thumbnail pic
    $smallthumb = $pre . "_" . $slug . "." . GetFileExtension($result['thumburl']);
    $sm_thumb = '../img/' . $smallthumb;
    download_file($thumburl, $sm_thumb);
    $gamethumb = 'img/' . $smallthumb;
    // Download and save 200x200 thumbnail pic
    $gamethumb200 = '';
    /*if(!empty($result['thumbnail_200x200']) || $type == 0) {
    		$t_url = str_replace("..", "", $result['thumbnail_200x200']);
    		$mediumthumb = $pre."_200_" . $slug . "." . GetFileExtension($result['thumbnail_200x200']);
    		$med_thumb = '../img/' . $mediumthumb;			
    		download_file($t_url, $med_thumb);
    		$gamethumb200 = 'img/' . $mediumthumb; 
    	} else {
    		$gamethumb200 = '';
    	}*/
    /////////////////////////////////////////////////////////////////////////////////////////////////
    // Remove code comment to download the game screen images - depends on availabilty in the feed //
    /////////////////////////////////////////////////////////////////////////////////////////////////
    /*
    // Download and save screen 1 pic
    if($result['screenthumburl1']) {
    	$t_url = str_replace("..", "", $result['screenthumburl1']);
    	$largethumb = $pre."_screen1_" . $slug . "." . GetFileExtension($result['screenthumburl1']);
    	$screen1_thumb = '../img/' . $largethumb;			
    	download_file($t_url, $screen1_thumb);
    }	
    // Download and save screen 2 pic
    if($result['screenthumburl2']) {
    	$t_url = str_replace("..", "", $result['screenthumburl2']);
    	$largethumb = $pre."_screen2_" . $slug . "." . GetFileExtension($result['screenthumburl2']);
    	$screen2_thumb = '../img/' . $largethumb;			
    	download_file($t_url, $screen2_thumb);
    }	
    // Download and save screen 3 pic
    if($result['screenthumburl3']) {
    	$t_url = str_replace("..", "", $result['screenthumburl3']);
    	$largethumb = $pre."_screen3_" . $slug . "." . GetFileExtension($result['screenthumburl3']);
    	$screen3_thumb = '../img/' . $largethumb;			
    	download_file($t_url, $screen3_thumb);
    }	
    // Download and save screen 4 pic
    if($result['screenthumburl2']) {
    	$t_url = str_replace("..", "", $result['screenthumburl4']);
    	$largethumb = $pre."_screen4_" . $slug . "." . GetFileExtension($result['screenthumburl4']);
    	$screen4_thumb = '../img/' . $largethumb;			
    	download_file($t_url, $screen4_thumb);
    }	
    */
    $desc = yasDB_clean($result['description']);
    // Prep for DB insert
    $instructions = yasDB_clean($result['instructions']);
    $keywords = $result['keywords'];
    $keywords = yasDB_clean($keywords);
    $gamename = yasDB_clean($gamename);
    $gamefile = yasDB_clean($gamefile);
    $gamethumb = yasDB_clean($gamethumb);
    $height = $result['height'];
    $width = $result['width'];
    $query->close();
    $query = yasDB_insert("INSERT INTO `games` (`id`, `title`, `description`, `instructions`, `keywords`, `file`, `height`, `width`, `category`, `plays`, `code`, `type`, `source`, `sourceid`, `thumbnail`, `thumbnail_200`, `screen1`, `screen2`, `screen3`, `screen4`) VALUES (NULL, '{$gamename}', '{$desc}', '{$instructions}', '{$keywords}', '{$gamefile}', '{$height}', '{$width}', {$category}, 0, '', 'SWF', 'PLAYTOMIC', {$gameid}, '{$gamethumb}', '{$gamethumb200}', '{$screen1_thumb}', '{$screen2_thumb}','{$screen3_thumb}','{$screen4_thumb}')", false);
    if (!$query) {
        echo 'Error updating Games database';
        return false;
    }
    $query = yasDB_update("UPDATE `playtomicfeed` SET isinstalled = 1 WHERE id = '{$result['id']}'", false);
    if (!query) {
        echo 'Error updating $table database';
        return false;
    }
    return true;
}
开发者ID:royalswe,项目名称:yas26,代码行数:97,代码来源:playtomic_functions.php

示例15: GetItems


//.........这里部分代码省略.........
            echo $perm_del;
            ?>
, ren : <?php 
            echo $perm_ren;
            ?>
},
	date : '<?php 
            echo $Dir["DATE"];
            ?>
',
	timestamp : '<?php 
            echo $Dir["TIMESTAMP"];
            ?>
',
	size : 0
};
<?php 
        }
        if ($Params['getFiles']) {
            $ind = -1;
            foreach ($arFiles as $File) {
                $name = addslashes(htmlspecialcharsex($File["NAME"]));
                $path_i = addslashes(htmlspecialcharsex($File["ABS_PATH"]));
                $path_i = str_replace("//", "/", $path_i);
                $arPath_i = array($site, $path_i);
                if (!$USER->CanDoFileOperation('fm_view_file', $arPath_i)) {
                    continue;
                }
                $ind++;
                $perm_del = $USER->CanDoFileOperation('fm_delete_file', $arPath_i) ? 'true' : 'false';
                $perm_ren = $USER->CanDoFileOperation('fm_rename_file', $arPath_i) ? 'true' : 'false';
                $imageAddProps = '';
                if ($genTmb) {
                    $ext = strtolower(GetFileExtension($name));
                    if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'jpe', 'bmp'))) {
                        $tmbPath = BX_PERSONAL_ROOT . "/tmp/fd_tmb" . $path_i;
                        $destinationFile = $rootPath . $tmbPath;
                        if (!file_exists($destinationFile)) {
                            $sourceFile = $File['PATH'];
                            if (CFile::ResizeImageFile($sourceFile, $destinationFile, array('width' => 140, 'height' => 110))) {
                                $imageAddProps = ",\n" . 'tmb_src : \'' . CUtil::JSEscape($tmbPath) . '\'';
                            }
                        } else {
                            $imageAddProps = ",\n" . 'tmb_src : \'' . CUtil::JSEscape($tmbPath) . '\'';
                        }
                    }
                }
                ?>
arFDFiles['<?php 
                echo $path_js;
                ?>
'][<?php 
                echo $ind;
                ?>
] =
{
	name : '<?php 
                echo $name;
                ?>
',
	path : '<?php 
                echo $path_i;
                ?>
',
	permission : {del : <?php 
                echo $perm_del;
开发者ID:spas-viktor,项目名称:books,代码行数:67,代码来源:file_dialog.php


注:本文中的GetFileExtension函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。