本文整理汇总了PHP中FLEXIUtilities::funcIsDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP FLEXIUtilities::funcIsDisabled方法的具体用法?PHP FLEXIUtilities::funcIsDisabled怎么用?PHP FLEXIUtilities::funcIsDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLEXIUtilities
的用法示例。
在下文中一共展示了FLEXIUtilities::funcIsDisabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
//.........这里部分代码省略.........
if (!$packager->create($archivepath, $files)) {
$msg = JText::_('FLEXI_OPERATION_FAILED'). ": compressed archive could not be created";
$app->enqueueMessage($msg, 'notice');
$this->setRedirect('index.php', '');
return;
}*/
$za = new flexicontent_zip();
$res = $za->open($archivepath, ZipArchive::CREATE);
if ($res !== true) {
$msg = JText::_('FLEXI_OPERATION_FAILED') . ": compressed archive could not be created";
$app->enqueueMessage($msg, 'notice');
$this->setRedirect('index.php', '');
return;
}
$za->addDir($targetpath, "");
$za->close();
// *********************************
// Remove temporary folder structure
// *********************************
if (!JFolder::delete($targetpath)) {
$msg = "Temporary folder " . $targetpath . " could not be deleted";
$app->enqueueMessage($msg, 'notice');
}
// Delete old files (they can not be deleted during download time ...)
$tmp_path = JPath::clean($app->getCfg('tmp_path'));
$matched_files = JFolder::files($tmp_path, 'fcmd_uid_.*', $recurse = false, $fullpath = true);
foreach ($matched_files as $archive_file) {
//echo "Seconds passed:". (time() - filemtime($tmp_folder)) ."<br>". "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($tmp_folder)) . "<br>";
if (time() - filemtime($archive_file) > 3600) {
JFile::delete($archive_file);
}
}
// Delete old tmp folder (in case that the some archiving procedures were interrupted thus their tmp folder were not deleted)
$matched_folders = JFolder::folders($tmp_path, 'fcmd_uid_.*', $recurse = false, $fullpath = true);
foreach ($matched_folders as $tmp_folder) {
//echo "Seconds passed:". (time() - filemtime($tmp_folder)) ."<br>". "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($tmp_folder)) . "<br>";
JFolder::delete($tmp_folder);
}
$dlfile = new stdClass();
$dlfile->filename = 'cart_files_' . date('m-d-Y_H-i-s') . '.zip';
// a friendly name instead of $archivename
$dlfile->abspath = $archivepath;
} else {
$dlfile = reset($valid_files);
}
// Get file filesize and extension
$dlfile->size = filesize($dlfile->abspath);
$dlfile->ext = strtolower(JFile::getExt($dlfile->filename));
// Set content type of file (that is an archive for multi-download)
$ctypes = array("pdf" => "application/pdf", "exe" => "application/octet-stream", "rar" => "application/zip", "zip" => "application/zip", "txt" => "text/plain", "doc" => "application/msword", "xls" => "application/vnd.ms-excel", "ppt" => "application/vnd.ms-powerpoint", "gif" => "image/gif", "png" => "image/png", "jpeg" => "image/jpg", "jpg" => "image/jpg", "mp3" => "audio/mpeg");
$dlfile->ctype = isset($ctypes[$dlfile->ext]) ? $ctypes[$dlfile->ext] : "application/force-download";
// *****************************************
// Output an appropriate Content-Type header
// *****************************************
header("Pragma: public");
// required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
// required for certain browsers
header("Content-Type: " . $dlfile->ctype);
//quotes to allow spaces in filenames
$download_filename = strlen($dlfile->filename_original) ? $dlfile->filename_original : $dlfile->filename;
if ($method == 'view') {
header("Content-Disposition: inline; filename=\"" . $download_filename . "\";");
} else {
header("Content-Disposition: attachment; filename=\"" . $download_filename . "\";");
}
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $dlfile->size);
// *******************************
// Finally read file and output it
// *******************************
if (!FLEXIUtilities::funcIsDisabled('set_time_limit')) {
@set_time_limit(0);
}
$chunksize = 1 * (1024 * 1024);
// 1MB, highest possible for fread should be 8MB
if (1 || $dlfile->size > $chunksize) {
$handle = @fopen($dlfile->abspath, "rb");
while (!feof($handle)) {
print @fread($handle, $chunksize);
ob_flush();
flush();
}
fclose($handle);
} else {
// This is good for small files, it will read an output the file into
// memory and output it, it will cause a memory exhausted error on large files
ob_clean();
flush();
readfile($dlfile->abspath);
}
// ****************************************************
// In case of multi-download clear the session variable
// ****************************************************
//if ($task=='download_tree') $session->set($tree_var, false,'flexicontent');
// Done ... terminate execution
$app->close();
}