本文整理汇总了PHP中get_file_extension函数的典型用法代码示例。如果您正苦于以下问题:PHP get_file_extension函数的具体用法?PHP get_file_extension怎么用?PHP get_file_extension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_file_extension函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_field_value
/**
* Convert a field value to something renderable.
*
* @param array The field details
* @param mixed The raw value
* @return mixed Rendered field (tempcode or string)
*/
function render_field_value($field, $ev)
{
if (is_object($ev)) {
return $ev;
}
if ($ev == '') {
return '';
}
$original_filename = basename($ev);
$download_url = (url_is_local($ev) ? get_custom_base_url() . '/' : '') . $ev;
if (strpos($ev, '::') !== false) {
list($ev, $original_filename) = explode('::', $ev);
$keep = symbol_tempcode('KEEP');
$download_url = find_script('catalogue_file') . '?original_filename=' . urlencode($original_filename) . '&file=' . urlencode(basename($ev)) . $keep->evaluate();
}
$extension = get_file_extension($ev);
require_code('mime_types');
$mime_type = get_mime_type($extension);
if ((strpos($mime_type, 'video') !== false || strpos($mime_type, 'audio') !== false) && addon_installed('galleries')) {
// Video/Audio HTML
switch ($mime_type) {
case 'video/quicktime':
$tpl = 'GALLERY_VIDEO_QT';
break;
case 'audio/x-pn-realaudio':
$tpl = 'GALLERY_VIDEO_RM';
break;
default:
$tpl = 'GALLERY_VIDEO_GENERAL';
}
return do_template($tpl, array('URL' => url_is_local($ev) ? get_custom_base_url() . '/' . $ev : $ev, 'WIDTH' => get_option('default_video_width'), 'HEIGHT' => get_option('default_video_height'), 'MIME_TYPE' => $mime_type));
}
return hyperlink($download_url, $original_filename, true, true);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:41,代码来源:upload.php
示例2: __construct
public function __construct($uploads, $uploadDir = 'uploads/')
{
foreach ($uploads as $current) {
$this->uploadFile = $uploadDir . $current->name . "." . get_file_extension($current->name);
if ($this->upload($current, $this->uploadFile)) {
echo "Successfully uploaded " . $current->name . "\n";
}
}
}
开发者ID:iamzcr,项目名称:iamzcr-code,代码行数:9,代码来源:upload.php
示例3: get_file_type_icon
function get_file_type_icon($file_name)
{
static $mime;
$ext = get_file_extension($file_name);
if (!isset($mime)) {
require TR_INCLUDE_PATH . 'lib/mime.inc.php';
}
if (isset($mime[$ext]) && $mime[$ext][1]) {
return $mime[$ext][1];
}
return 'generic';
}
开发者ID:harriswong,项目名称:AContent,代码行数:12,代码来源:filemanager_display.inc.php
示例4: get_mime
function get_mime($file)
{
function get_file_extension($file_name)
{
return mb_convert_case(substr(strrchr($file_name, '.'), 1), MB_CASE_LOWER, "UTF-8");
}
$arr = ["323" => "text/h323", "*" => "application/octet-stream", "acx" => "application/internet-property-stream", "ai" => "application/postscript", "aif" => "audio/x-aiff", "aifc" => "audio/x-aiff", "aiff" => "audio/x-aiff", "asf" => "video/x-ms-asf", "asr" => "video/x-ms-asf", "asx" => "video/x-ms-asf", "au" => "audio/basic", "avi" => "video/x-msvideo", "axs" => "application/olescript", "bas" => "text/plain", "bcpio" => "application/x-bcpio", "bin" => "application/octet-stream", "bmp" => "image/bmp", "c" => "text/plain", "cat" => "application/vnd.ms-pkiseccat", "cdf" => "application/x-cdf", "cdf" => "application/x-netcdf", "cer" => "application/x-x509-ca-cert", "class" => "application/octet-stream", "clp" => "application/x-msclip", "cmx" => "image/x-cmx", "cod" => "image/cis-cod", "cpio" => "application/x-cpio", "crd" => "application/x-mscardfile", "crl" => "application/pkix-crl", "crt" => "application/x-x509-ca-cert", "csh" => "application/x-csh", "css" => "text/css", "dcr" => "application/x-director", "der" => "application/x-x509-ca-cert", "dir" => "application/x-director", "dll" => "application/x-msdownload", "dms" => "application/octet-stream", "doc" => "application/msword", "dot" => "application/msword", "dvi" => "application/x-dvi", "dxr" => "application/x-director", "eps" => "application/postscript", "etx" => "text/x-setext", "evy" => "application/envoy", "exe" => "application/octet-stream", "fif" => "application/fractals", "flr" => "x-world/x-vrml", "gif" => "image/gif", "gtar" => "application/x-gtar", "gz" => "application/x-gzip", "h" => "text/plain", "hdf" => "application/x-hdf", "hlp" => "application/winhlp", "hqx" => "application/mac-binhex40", "hta" => "application/hta", "htc" => "text/x-component", "htm" => "text/html", "html" => "text/html", "htt" => "text/webviewhtml", "ico" => "image/x-icon", "ief" => "image/ief", "iii" => "application/x-iphone", "ins" => "application/x-internet-signup", "isp" => "application/x-internet-signup", "jfif" => "image/pipeg", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "js" => "application/x-javascript", "latex" => "application/x-latex", "lha" => "application/octet-stream", "lsf" => "video/x-la-asf", "lsx" => "video/x-la-asf", "lzh" => "application/octet-stream", "m13" => "application/x-msmediaview", "m14" => "application/x-msmediaview", "m3u" => "audio/x-mpegurl", "man" => "application/x-troff-man", "mdb" => "application/x-msaccess", "me" => "application/x-troff-me", "mht" => "message/rfc822", "mhtml" => "message/rfc822", "mid" => "audio/mid", "mny" => "application/x-msmoney", "mov" => "video/quicktime", "movie" => "video/x-sgi-movie", "mp2" => "video/mpeg", "mp3" => "audio/mpeg", "mpa" => "video/mpeg", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mpp" => "application/vnd.ms-project", "mpv2" => "video/mpeg", "ms" => "application/x-troff-ms", "msg" => "application/vnd.ms-outlook", "mvb" => "application/x-msmediaview", "nc" => "application/x-netcdf", "nws" => "message/rfc822", "oda" => "application/oda", "p10" => "application/pkcs10", "p12" => "application/x-pkcs12", "p7b" => "application/x-pkcs7-certificates", "p7c" => "application/x-pkcs7-mime", "p7m" => "application/x-pkcs7-mime", "p7r" => "application/x-pkcs7-certreqresp", "p7s" => "application/x-pkcs7-signature", "pbm" => "image/x-portable-bitmap", "pdf" => "application/pdf", "pfx" => "application/x-pkcs12", "pgm" => "image/x-portable-graymap", "pko" => "application/ynd.ms-pkipko", "pma" => "application/x-perfmon", "pmc" => "application/x-perfmon", "pml" => "application/x-perfmon", "pmr" => "application/x-perfmon", "pmw" => "application/x-perfmon", "pnm" => "image/x-portable-anymap", "pot" => "application/vnd.ms-powerpoint", "ppm" => "image/x-portable-pixmap", "pps" => "application/vnd.ms-powerpoint", "ppt" => "application/vnd.ms-powerpoint", "prf" => "application/pics-rules", "ps" => "application/postscript", "pub" => "application/x-mspublisher", "qt" => "video/quicktime", "ra" => "audio/x-pn-realaudio", "ram" => "audio/x-pn-realaudio", "ras" => "image/x-cmu-raster", "rgb" => "image/x-rgb", "rmi" => "audio/mid", "roff" => "application/x-troff", "rtf" => "application/rtf", "rtx" => "text/richtext", "scd" => "application/x-msschedule", "sct" => "text/scriptlet", "setpay" => "application/set-payment-initiation", "setreg" => "application/set-registration-initiation", "sh" => "application/x-sh", "shar" => "application/x-shar", "sit" => "application/x-stuffit", "snd" => "audio/basic", "spc" => "application/x-pkcs7-certificates", "spl" => "application/futuresplash", "src" => "application/x-wais-source", "sst" => "application/vnd.ms-pkicertstore", "stl" => "application/vnd.ms-pkistl", "stm" => "text/html", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "svg" => "image/svg+xml", "swf" => "application/x-shockwave-flash", "t" => "application/x-troff", "tar" => "application/x-tar", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texi" => "application/x-texinfo", "texinfo" => "application/x-texinfo", "tgz" => "application/x-compressed", "tif" => "image/tiff", "tiff" => "image/tiff", "tr" => "application/x-troff", "trm" => "application/x-msterminal", "tsv" => "text/tab-separated-values", "txt" => "text/plain", "uls" => "text/iuls", "ustar" => "application/x-ustar", "vcf" => "text/x-vcard", "vrml" => "x-world/x-vrml", "wav" => "audio/x-wav", "wcm" => "application/vnd.ms-works", "wdb" => "application/vnd.ms-works", "wks" => "application/vnd.ms-works", "wmf" => "application/x-msmetafile", "wps" => "application/vnd.ms-works", "wri" => "application/x-mswrite", "wrl" => "x-world/x-vrml", "wrz" => "x-world/x-vrml", "xaf" => "x-world/x-vrml", "xbm" => "image/x-xbitmap", "xla" => "application/vnd.ms-excel", "xlc" => "application/vnd.ms-excel", "xlm" => "application/vnd.ms-excel", "xls" => "application/vnd.ms-excel", "xlt" => "application/vnd.ms-excel", "xlw" => "application/vnd.ms-excel", "xof" => "x-world/x-vrml", "xpm" => "image/x-xpixmap", "xwd" => "image/x-xwindowdump", "z" => "application/x-compress", "zip" => "application/zip"];
try {
return $arr[get_file_extension($file)];
} catch (Exception $ex) {
return $arr["*"];
}
}
开发者ID:platonicvizard,项目名称:printcode,代码行数:13,代码来源:GetMime.php
示例5: check_extensions
function check_extensions($Type, $Name)
{
global $MusicExtensions, $ComicsExtensions;
if ($Type == 'Music' || $Type == 'Audiobooks' || $Type == 'Comedy' || $Type == 'E-Books') {
if (!isset($MusicExtensions[get_file_extension($Name)])) {
invalid_error($Name);
}
} elseif ($Type == 'Comics') {
if (!isset($ComicsExtensions[get_file_extension($Name)])) {
invalid_error($Name);
}
}
}
开发者ID:karamanolev,项目名称:Gazelle,代码行数:13,代码来源:file_checker.class.php
示例6: get_files
function get_files($images_dir, $exts = array('jpg'))
{
$files = array();
if ($handle = opendir($images_dir)) {
while (false !== ($file = readdir($handle))) {
$extension = strtolower(get_file_extension($file));
if ($extension && in_array($extension, $exts)) {
$files[] = $file;
}
}
closedir($handle);
}
return $files;
}
开发者ID:skyhawk5657,项目名称:photo_gallery,代码行数:14,代码来源:functions.php
示例7: view_dir_full
function view_dir_full($root)
{
$a = 0;
if (is_dir($root)) {
if ($dh = opendir($root)) {
echo "<table >";
while (($file = readdir($dh)) !== false) {
if (!($file == "." || $file == "..")) {
if (is_dir($root . "/" . $file)) {
global $temp;
$temp = $file;
echo '<tr><td><a href="http://localhost/minor/fms/fms_test.php?col=' . $root . "/" . str_replace(" ", "%20", $file) . '"><img src="../img/folder.png" width="25" height="25" border="0" alt="directory:">' . $file . '</a>';
if ($_SESSION['CurrentUserType'] == "admin" || $_SESSION['CurrentUserType'] == "faculty") {
echo ' </td><td><a href="delete_dir.php?col1=' . $root . '&col2=' . $file . '"><img src="../img/delete.png" width="10" height="10" border="0" alt=""></a> </td><td>';
}
$a++;
} else {
$str = $file;
if (strlen($str) > 13) {
$str = substr($str, 0, 15);
$str = $str . "...";
}
$info = get_file_extension($file);
if ($info == "pdf") {
echo '<tr><td><img src="../img/filetype_pdf.png" width="25" height="25" border="0" alt=""><a href="' . $root . '/' . $file . '" target="_blank">' . $str . '</a>';
if ($_SESSION['CurrentUserType'] == "admin" || $_SESSION['CurrentUserType'] == "faculty") {
echo ' </td><td><a href="delete_dir.php?col1=' . $root . '&col2=' . $file . '"><img src="../img/delete.png" width="10" height="10" border="0" alt=""></a></td></tr><br>';
}
$a++;
} else {
if ($info == "docx") {
echo '<tr><td><img src="../img/docx.png" width="25" height="25" border="0" alt=""><a href="' . $root . '/' . $file . '"target="_blank">' . $str . '</a>';
if ($_SESSION['CurrentUserType'] == "admin" || $_SESSION['CurrentUserType'] == "faculty") {
echo '</a> </td><td><a href="delete_dir.php?col1=' . $root . '&col2=' . $file . '"><img src="../img/delete.png" width="10" height="10" border="0" alt=""></a></td></tr><br>';
}
$a++;
}
}
}
}
}
closedir($dh);
}
}
echo '</table>';
}
开发者ID:vikram0602,项目名称:jiit-connect,代码行数:46,代码来源:fms_test.php
示例8: set_filename
function set_filename($path, $filename)
{
if (!file_exists($path . $filename)) {
return $filename;
}
$ext = get_file_extension($filename);
$filename = str_replace($ext, '', $filename);
$new_filename = '';
for ($i = 1; $i < 100; $i++) {
if (!file_exists($path . $filename . $i . $ext)) {
$new_filename = $filename . $i . $ext;
break;
}
}
if ($new_filename == '') {
return FALSE;
} else {
return $new_filename;
}
}
开发者ID:tjankovic,项目名称:FAB-UI,代码行数:20,代码来源:ft_file_helper.php
示例9: read_path
function read_path($dir, $ext = null)
{
$file = null;
$files = array();
if ($root = @opendir($dir)) {
while ($file = readdir($root)) {
if ($file == "." || $file == "..") {
continue;
}
if (!is_null($ext)) {
$extension = get_file_extension($file);
if ($ext == $extension) {
$files[] = $file;
}
} else {
$files[] = $file;
}
}
array_multisort($files, SORT_ASC);
return $files;
}
}
开发者ID:platform-project,项目名称:platform-project,代码行数:22,代码来源:filesystem.php
示例10: post_create
public function post_create()
{
$file = null;
$image_name = Opensim\UUID::random();
$action = Input::get('action');
if (isset($action) and $action == 'logo') {
$file = Input::file('logo_image');
$logo_path = path('public') . 'bundles/splashscreen/img/logo/';
foreach (glob($logo_path . "logo.*") as $filename) {
@File::delete($filename);
}
$path = $logo_path . $file['name'];
$logo_parts = explode('.', $file['name']);
$path = $logo_path;
$image_name = 'logo.' . $logo_parts['1'];
$image_path = '/bundles/splashscreen/img/logo/' . $image_name;
Input::upload('logo_image', $path, $image_name);
return View::make('splashscreen::backend.imagesbackgrounds.partials.logo', array('image_name' => $image_name, 'path' => $image_path))->render();
Log::error($path);
}
if (isset($action) and $action == 'background') {
$file = Input::file('background');
$path = path('public') . 'bundles/splashscreen/img/backgrounds/';
$ext = get_file_extension($file['name']);
$image_name = $image_name . '.' . $ext;
$image_path = '/bundles/splashscreen/img/backgrounds/' . $image_name;
Input::upload('background', $path, $image_name);
return View::make('splashscreen::backend.imagesbackgrounds.partials.image', array('image_name' => $image_name, 'path' => $image_path, 'action' => 'background'))->render();
}
if (isset($action) and $action == 'daytimebkg') {
$file = Input::file('daytimebkg');
$path = path('public') . 'bundles/splashscreen/img/day_time_bkgs/';
$image_name = $file['name'];
$image_path = '/bundles/splashscreen/img/day_time_bkgs/' . $image_name;
Input::upload('daytimebkg', $path, $image_name);
return View::make('splashscreen::backend.imagesbackgrounds.partials.day_time_bkgs', array('image_name' => $image_name, 'path' => $image_path, 'action' => 'daytimebkg'))->render();
}
}
开发者ID:juaniiie,项目名称:mwi,代码行数:38,代码来源:imagesbackgrounds.php
示例11: finalize_mesh
/** FINALIZE UPDATE FIRMWARE TASK
*
* @param $tid - TASK ID
* @param $status - TASK STATUS (STOPPED - PERFORMED)
*
**/
function finalize_mesh($tid, $status)
{
//global $log;
//$log->info('Task #'.$tid.' mesh '.$status);
//$log->info('Task #'.$tid.' start finalizing');
//LOAD DB
$db = new Database();
//GET TASK
$task = $db->query('select * from sys_tasks where id=' . $tid);
//GET TASK ATTRIBUTES
$attributes = json_decode($task['attributes'], TRUE);
//MOVE OUTPUT FILE TO OBJECT FOLDER
$_id_object = $attributes['id_object'];
$id_file = $attributes['id_new_file'];
$_output = $attributes['output'];
$_output_file_name = get_name($_output);
$_output_extension = get_file_extension($_output);
$_output_folder_destination = '/var/www/upload/' . str_replace('.', '', $_output_extension) . '/';
$_output_file_name = set_filename($_output_folder_destination, $_output_file_name);
// MOVE TO FINALLY FOLDER
shell_exec('sudo cp ' . $_output . ' ' . $_output_folder_destination . $_output_file_name);
// ADD PERMISSIONS
shell_exec('sudo chmod 746 ' . $_output_folder_destination . $_output_file_name);
// INSERT RECORD TO DB
$data_file['file_name'] = $_output_file_name;
$data_file['file_path'] = $_output_folder_destination;
$data_file['full_path'] = $_output_folder_destination . $_output_file_name;
$data_file['raw_name'] = str_replace($_output_extension, '', $_output_file_name);
$data_file['client_name'] = str_replace($_output_extension, '', $_output_file_name);
$data_file['orig_name'] = $_output_file_name;
$data_file['file_ext'] = $_output_extension;
$data_file['file_size'] = filesize($_output_folder_destination . $_output_file_name);
$data_file['print_type'] = print_type($_output_folder_destination . $_output_file_name);
$data_file['note'] = 'Reconstructed on ' . date("F j, Y, g:i a");
$data_file['insert_date'] = 'now()';
$data_file['file_type'] = 'application/octet-stream';
// ADD TASK RECORD TO DB
$db->update('sys_files', array('column' => 'id', 'value' => $id_file, 'sign' => '='), $data_file);
// ADD ASSOCIATION OBJ FILE
$data['id_obj'] = $_id_object;
$data['id_file'] = $id_file;
$id_ass = $db->insert('sys_obj_files', $data);
$db->close();
//UPDATE TASK
update_task($tid, $status);
sleep(10);
//REMOVE ALL TEMPORARY FILES
shell_exec('sudo rm -rf ' . $attributes['folder']);
//$log->info('Task #'.$tid.' end finalizing');
}
开发者ID:pardoc,项目名称:FAB-UI,代码行数:56,代码来源:finalize.php
示例12: nice_format
$date_with_time = nice_format($entry['date'], true);
if ($is_dir) {
$tool_content .= "<td> </td><td class='center'>{$date}</td>";
} else {
if ($entry['format'] == ".meta") {
$size = format_file_size($entry['size']);
$tool_content .= "<td class='center'>{$size}</td><td class='center'>{$date}</td>";
} else {
$size = format_file_size($entry['size']);
$tool_content .= "<td class='center'>{$size}</td><td class='center' title='{$date_with_time}'>{$date}</td>";
}
}
if (!$is_in_tinymce) {
if ($can_upload) {
$tool_content .= "<td class='option-btn-cell'>";
$xmlCmdDirName = $entry['format'] == ".meta" && get_file_extension($cmdDirName) == "xml" ? substr($cmdDirName, 0, -4) : $cmdDirName;
$tool_content .= action_button(array(array('title' => $langGroupSubmit, 'url' => "{$urlAppend}modules/work/group_work.php?course={$course_code}&group_id={$group_id}&submit={$cmdDirName}", 'icon' => 'fa-book', 'show' => $subsystem == GROUP and isset($is_member) and $is_member), array('title' => $dload_msg, 'url' => $download_url, 'icon' => 'fa-save'), array('title' => $langVisible, 'url' => "{$base_url}" . ($entry['visible'] ? "mkInvisibl={$cmdDirName}" : "mkVisibl={$cmdDirName}"), 'icon' => $entry['visible'] ? 'fa-eye' : 'fa-eye-slash'), array('title' => $langResourceAccess, 'url' => "{$base_url}limited={$cmdDirName}", 'icon' => 'fa-unlock', 'show' => $course_id > 0 and course_status($course_id) == COURSE_OPEN and $entry['public']), array('title' => $langMove, 'url' => "{$base_url}move={$cmdDirName}", 'icon' => 'fa-arrows', 'show' => $entry['format'] != '.meta'), array('title' => $langRename, 'url' => "{$base_url}rename={$cmdDirName}", 'icon' => 'fa-repeat', 'show' => $entry['format'] != '.meta'), array('title' => $langComments, 'url' => "{$base_url}comment={$cmdDirName}", 'icon' => 'fa-comment-o', 'show' => $entry['format'] != '.meta'), array('title' => $langReplace, 'url' => "{$base_url}replace={$cmdDirName}", 'icon' => 'fa-reply', 'show' => !$is_dir && $entry['format'] != '.meta'), array('title' => $langMetadata, 'url' => "{$base_url}metadata={$xmlCmdDirName}", 'icon' => 'fa-tags', 'show' => get_config("insert_xml_metadata")), array('title' => $langResourceAccess, 'url' => "{$base_url}public={$cmdDirName}", 'icon' => 'fa-lock', 'show' => $course_id > 0 and course_status($course_id) == COURSE_OPEN and !$entry['public']), array('title' => $langDelete, 'url' => "{$base_url}filePath={$cmdDirName}&delete=1", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => "{$langConfirmDelete} {$entry['filename']}")));
$tool_content .= "</td>";
} else {
// student view
$tool_content .= "<td class='text-center'>" . icon('fa-save', $dload_msg, $download_url) . "</td>";
}
}
$tool_content .= "</tr>";
}
}
$tool_content .= "</table>\n </div>\n </div>\n </div>";
if ($can_upload && !$is_in_tinymce) {
$tool_content .= "<br><div class='text-right'>{$langMaxFileSize} " . ini_get('upload_max_filesize') . "</div>";
}
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:31,代码来源:index.php
示例13: _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
示例14: lang
$description .= '<tr><td>' . lang('mail BCC') . ':</td><td>' . MailUtilities::displayMultipleAddresses(clean($email->getBcc())) . '</td></tr>';
}
$description .= '<tr><td>' . lang('date') . ':</td><td>' . format_datetime($email->getSentDate(), 'l, j F Y - '.$time_format, logged_user()->getTimezone()) . '</td></tr>';
if ($email->getHasAttachments() && is_array($attachments) && count($attachments) > 0) {
$description .= '<tr><td colspan=2> <fieldset>
<legend class="toggle_collapsed" onclick="og.toggle(\'mv_attachments\',this)">' . lang('attachments') . '</legend>
<div id="mv_attachments" style="display:none">
<table>';
foreach($attachments as $att) {
if (!array_var($att, 'hide')) {
$size = $att['size'];//format_filesize(strlen($att["Data"]));
$fName = str_starts_with($att["FileName"], "=?") ? iconv_mime_decode($att["FileName"], 0, "UTF-8") : utf8_safe($att["FileName"]);
if (trim($fName) == "" && strlen($att["FileName"]) > 0) $fName = utf8_encode($att["FileName"]);
$description .= '<tr><td style="padding-right: 10px">';
$ext = get_file_extension($fName);
$fileType = FileTypes::getByExtension($ext);
if (isset($fileType))
$icon = $fileType->getIcon();
else
$icon = "unknown.png";
$download_url = get_url('mail', 'download_attachment', array('email_id' => $email->getId(), 'attachment_id' => $c));
include_once ROOT . "/library/browser/Browser.php";
if (Browser::instance()->getBrowser() == Browser::BROWSER_IE) {
$download_url = "javascript:location.href = '$download_url';";
}
$description .= '<img src="' . get_image_url("filetypes/" . $icon) .'"></td>
<td><a target="_self" href="' . $download_url . '">' . clean($fName) . " ($size)" . '</a></td></tr>';
}
$c++;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:view.php
示例15: frontend
//.........这里部分代码省略.........
$page['url'] = $this->app->url_manager->string();
$page['active_site_template'] = $the_active_site_template;
template_var('no_edit', 1);
$mod_params = '';
if ($preview_module_template != false) {
$mod_params = $mod_params . " template='{$preview_module_template}' ";
}
if ($preview_module_id != false) {
$mod_params = $mod_params . " id='{$preview_module_id}' ";
}
$found_mod = $page_url;
$page['content'] = '<microweber module="' . $page_url . '" ' . $mod_params . ' />';
// $page['simply_a_file'] = 'clean.php';
$page['layout_file'] = 'clean.php';
template_var('content', $page['content']);
template_var('new_page', $page);
}
if ($found_mod == false) {
if (empty($page)) {
$the_new_page_file = false;
$page_url_segment_1 = $this->app->url_manager->segment(0, $page_url);
$td = templates_path() . $page_url_segment_1;
$td_base = $td;
$page_url_segment_2 = $this->app->url_manager->segment(1, $page_url);
$directly_to_file = false;
$page_url_segment_3 = $this->app->url_manager->segment(-1, $page_url);
$page_url_segment_1 = $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
$td_base = templates_path() . $the_active_site_template . DS;
$page_url_segment_3_str = implode(DS, $page_url_segment_3);
if ($page_url_segment_3_str != '') {
$page_url_segment_3_str = rtrim($page_url_segment_3_str, DS);
$page_url_segment_3_str = rtrim($page_url_segment_3_str, '\\');
$page_url_segment_3_str_copy = $page_url_segment_3_str;
$is_ext = get_file_extension($page_url_segment_3_str);
if ($is_ext == false or $is_ext != 'php') {
$page_url_segment_3_str = $page_url_segment_3_str . '.php';
}
$td_f = $td_base . DS . $page_url_segment_3_str;
$td_fd = $td_base . DS . $page_url_segment_3_str_copy;
$td_fd2 = $td_base . DS . $page_url_segment_3[0];
if (is_file($td_f)) {
$the_new_page_file = $page_url_segment_3_str;
$simply_a_file = $directly_to_file = $td_f;
} else {
if (is_dir($td_fd)) {
$td_fd_index = $td_fd . DS . 'index.php';
if (is_file($td_fd_index)) {
$the_new_page_file = $td_fd_index;
$simply_a_file = $directly_to_file = $td_fd_index;
}
} else {
$is_ext = get_file_extension($td_fd);
if ($is_ext == false or $is_ext != 'php') {
$td_fd = $td_fd . '.php';
}
$is_ext = get_file_extension($td_fd2);
if ($is_ext == false or $is_ext != 'php') {
$td_fd2 = $td_fd2 . '.php';
}
if (is_file($td_fd)) {
$the_new_page_file = $td_fd;
$simply_a_file = $directly_to_file = $td_fd;
} elseif (is_file($td_fd2)) {
$the_new_page_file = $td_fd2;
$simply_a_file = $directly_to_file = $td_fd2;
} else {
开发者ID:microweber,项目名称:microweber,代码行数:67,代码来源:DefaultController.php
示例16: handleUploadedFile
/**
* This function will process uploaded file
*
* @param array $uploaded_file
* @param boolean $create_revision Create new revision or update last one
* @param string $revision_comment Revision comment, if any
* @return ProjectFileRevision
*/
function handleUploadedFile($uploaded_file, $create_revision = true, $revision_comment = '')
{
$revision = null;
if (!$create_revision) {
$revision = $this->getLastRevision();
}
// if
if (!$revision instanceof ProjectFileRevision) {
$revision = new ProjectFileRevision();
$revision->setFileId($this->getId());
$revision->setRevisionNumber($this->getNextRevisionNumber());
if (trim($revision_comment) == '' && $this->countRevisions() < 1) {
$revision_comment = lang('initial versions');
}
// if
}
// if
$revision->deleteThumb(false);
// remove thumb
// We have a file to handle!
//executes only while uploading files
if (!is_array($uploaded_file) || !isset($uploaded_file['name']) || !isset($uploaded_file['size']) || !isset($uploaded_file['type']) || (!isset($uploaded_file['tmp_name']) || !is_readable($uploaded_file['tmp_name']))) {
throw new InvalidUploadError($uploaded_file);
}
// if
if (isset($uploaded_file['error']) && $uploaded_file['error'] > UPLOAD_ERR_OK) {
throw new InvalidUploadError($uploaded_file);
}
// if
//eyedoc MOD
$extension = get_file_extension(basename($uploaded_file['name']));
if ($uploaded_file['type'] == 'application/octet-stream' && $extension == 'eyedoc') {
$uploaded_file['type'] = 'text/html';
}
//eyedoc MOD
// calculate hash
if ($revision->columnExists('hash')) {
$hash = hash_file("sha256", $uploaded_file['tmp_name']);
$revision->setColumnValue('hash', $hash);
}
$repository_id = FileRepository::addFile($uploaded_file['tmp_name'], array('name' => $uploaded_file['name'], 'type' => $uploaded_file['type'], 'size' => $uploaded_file['size']));
$revision->setRepositoryId($repository_id);
$revision->deleteThumb(false);
$revision->setFilesize($uploaded_file['size']);
if (config_option('detect_mime_type_from_extension')) {
$type = Mime_Types::instance()->get_type($extension);
if ($type) {
$revision->setTypeString($type);
} else {
$revision->setTypeString($uploaded_file['type']);
}
} else {
$revision->setTypeString($uploaded_file['type']);
}
if (trim($extension)) {
$file_type = FileTypes::getByExtension($extension);
if ($file_type instanceof Filetype) {
$revision->setFileTypeId($file_type->getId());
}
// if
}
// if
$revision->setComment($revision_comment);
$revision->save();
$this->last_revision = $revision;
// update last revision
return $revision;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:76,代码来源:ProjectFile.class.php
示例17: submit_work
function submit_work($uid, $group_id, $id, $file) {
global $groupPath, $langUploadError, $langUploadSuccess,
$langBack, $m, $tool_content, $workPath,
$group_sql, $webDir, $course_code, $is_editor;
$ext = get_file_extension($file);
$local_name = greek_to_latin('Group ' . $group_id . (empty($ext) ? '' : '.' . $ext));
$original_filename = Database::get()->querySingle("SELECT filename FROM document WHERE $group_sql AND path = ?s", $file)->filename;
$source = $groupPath . $file;
$destination = work_secret($id) . "/$local_name";
delete_submissions_by_uid($uid, $group_id, $id, $destination);
if (is_dir($source)) {
$original_filename = $original_filename . '.zip';
$zip_filename = $webDir . 'courses/temp/' . safe_filename('zip');
zip_documents_directory($zip_filename, $file, $is_editor);
$source = $zip_filename;
}
if (copy($source, "$workPath/$destination")) {
Database::get()->query("INSERT INTO assignment_submit (uid, assignment_id, submission_date,
submission_ip, file_path, file_name, comments, group_id, grade_comments)
VALUES (?d, ?d, NOW(), '$_SERVER[REMOTE_ADDR]', ?s, ?s, ?s, ?d, ''", $uid, $id, $destination, $original_filename, $_POST['comments'], $group_id);
$tool_content .="<div class='alert alert-success'>$langUploadSuccess
<br>$m[the_file] \"$original_filename\" $m[was_submitted]<br>
<a href='index.php?course=$course_code'>$langBack</a></div><br>";
} else {
$tool_content .="<div class='alert alert-danger'>$langUploadError<br>
<a href='index.php?course=$course_code'>$langBack</a></div><br>";
}
}
开发者ID:nikosv,项目名称:openeclass,代码行数:33,代码来源:group_work.php
-
TOTOLINK T6 V4.1.9cu.5179_B20201015 was discovered to contain a stack overflow v
阅读:705|2022-07-08
-
xorrior/macOSTools: macOS Offensive Tools
阅读:891|2022-08-18
-
caseypugh/minecraft: Some scripts to make your server more fun
阅读:528|2022-08-16
-
Testinium/MobileDeviceInfo
阅读:1856|2022-09-04
-
xsfelvis/MaterialDesignStudy: A practice demo based on MaterialDesign
阅读:828|2022-08-17
-
unit U_func;
interface uses forms,SysUtils,ComCtrls,DBGrids,DB,Dialogs,Messages
阅读:523|2022-07-18
-
tradingview/charting-library-tutorial: This tutorial explains step by step how t
阅读:949|2022-08-15
-
kmycode/mastoom: Mastodon cross-platform client
阅读:999|2022-08-17
-
重的笔顺怎么写?重的笔顺笔画顺序是什么?介绍重字的笔画顺序怎么写了解到好多的写字朋
阅读:672|2022-11-06
-
Dynamical Systems with Applications using MATLAB® | SpringerLink
阅读:620|2022-08-17
|
请发表评论