本文整理汇总了PHP中files类的典型用法代码示例。如果您正苦于以下问题:PHP files类的具体用法?PHP files怎么用?PHP files使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了files类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
if ($id > 0) {
$lead = $this->getLead($id);
// Comments
$comments = new comments();
if (isset($_POST['comment']) === true) {
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comments->addComment($values, 'lead');
}
// files
$file = new files();
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$file->upload($_FILES, 'lead', $id);
$tpl->setNotification('FILE_UPLOADED', 'success');
} else {
$tpl->setNotification('NO_FILE', 'error');
}
}
$files = new files();
$tpl->assign('files', $files->getFilesByModule('lead', $id));
$tpl->assign('comments', $comments->getComments('lead', $id));
$tpl->assign('contactInfo', $this->getLeadContact($id));
$tpl->assign('lead', $lead);
} else {
$tpl->display('general.error');
}
$tpl->display('leads.showLead');
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:32,代码来源:class.showLead.php
示例2: clear_cache
function clear_cache()
{
$tmp_path = WEB_CACHE;
//$tmp_my_path=dir($tmp_path);
if (!class_exists('files')) {
include_once WEB_INC . 'file.class.php';
}
$FS = new files();
$FS->file_Delete($tmp_path);
}
开发者ID:zrwlc2008,项目名称:abhx,代码行数:10,代码来源:index.php
示例3: upload
public static function upload()
{
$dir = 'files/';
$file = $_FILES['files'];
$parts = explode('.', $file['name'][0]);
$ext = strtolower(strtolower(end($parts)));
$name = mb_strtolower(implode('.', array_slice($parts, 0, count($parts) - 1)));
$name = files::fixname($name);
$name = self::get_available_filename($dir, $name, $ext);
$filename = $name . '.' . $ext;
if (move_uploaded_file($file['tmp_name'][0], $dir . $filename)) {
$finfo = new finfo(FILEINFO_MIME);
$type = $finfo->file($dir . $filename);
$mime = substr($type, 0, strpos($type, ';'));
$file = ORM::factory('File');
$file->filename = $name;
$file->type = $mime;
$file->ext = $ext;
$file->created = time();
try {
$file->save();
return $file;
} catch (exception $e) {
unlink($dir . $name);
return false;
}
} else {
return false;
}
}
开发者ID:artbypravesh,项目名称:morningpages,代码行数:30,代码来源:files.php
示例4: save
function save()
{
$content = ob_get_contents();
ob_clean();
files::write(self::$file, $content);
echo $content;
}
开发者ID:rigidus,项目名称:ea,代码行数:7,代码来源:cache.php
示例5: siteMap
function siteMap()
{
db::table('pages');
db::where('site_id', ADMIN_SITE_ID);
db::where('page_map', '1');
db::where('page_dynamic', '0');
$res = db::select();
$content = '';
while ($row = mysql_fetch_assoc($res)) {
$content .= '
<url>
<loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc>
<lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod>
</url>';
}
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . '
</urlset>';
if (files::write(ROOT . '/sitemap.xml', $xml)) {
buffer::set('sitemap.xml успешно создан.');
} else {
buffer::set('Не удалось записать sitemap.xml.');
}
}
开发者ID:rigidus,项目名称:ea,代码行数:27,代码来源:map.module.php
示例6: package_jeu
function package_jeu($titre)
{
global $phpbb_root_path, $phpEx, $areabb;
// On est développeur et on veut le package de son mod
load_function('lib.files');
$package = new files();
$name = 'AreaBB-jeux_' . $titre . '.pkg.gz';
// on crée le package serialize
$res = $package->makePackage($name, CHEMIN_JEU . $titre, CHEMIN_JEU, 1);
// on l'enregistre dans un fichier
if (($fp = fopen($phpbb_root_path . $areabb['chemin_pkg_jeux'] . $name, 'w')) !== false) {
fwrite($fp, $res, strlen($res));
fclose($fp);
}
return true;
}
开发者ID:Nekrofage,项目名称:FJR,代码行数:16,代码来源:dl.php
示例7: action_edit
public function action_edit()
{
$file = ORM::factory('file', $this->request->param('id'));
if (!$file->loaded()) {
notes::add('error', 'Filen blev ikke fundet!');
cms::redirect('files');
}
if ($_POST) {
$filename = arr::get($_POST, 'filename', '');
if (empty($filename)) {
$filename = $file->filename;
}
if ($filename != $file->filename) {
$filename = files::fixname($filename);
$filename = files::get_available_filename('files/', $filename, $file->ext);
rename('files/' . $file->filename(), 'files/' . $filename . '.' . $file->ext);
$versions = $file->versions->find_all();
if ((bool) $versions->count()) {
foreach ($versions as $version) {
$version->delete();
}
}
}
$file->filename = $filename;
$file->alt = arr::get($_POST, 'alt', '');
$file->description = arr::get($_POST, 'description', '');
try {
$file->save();
cms::redirect('files/edit/' . $file->id);
} catch (exception $e) {
notes::add('error', 'Filen kunne ikke gemmes! Siden sagde: ' . $e->getMessage());
}
}
$this->bind('file', $file);
}
开发者ID:artbypravesh,项目名称:morningpages,代码行数:35,代码来源:Files.php
示例8: run
public function run()
{
$tpl = new template();
$id = (int) $_GET['id'];
if ($id > 0) {
$lead = $this->getLead($id);
$values = array('name' => $lead['name'], 'potentialMoney' => $lead['potentialMoney'], 'actualMoney' => $lead['actualMoney'], 'refSource' => $lead['refSource'], 'refValue' => $lead['refValue'], 'status' => $lead['status'], 'proposal' => $lead['proposal']);
$clients = new clients();
$dbClient = $clients->getClient($lead['clientId']);
$client = array('name' => $dbClient['name'], 'street' => $dbClient['street'], 'zip' => $dbClient['zip'], 'city' => $dbClient['city'], 'state' => $dbClient['state'], 'country' => $dbClient['country'], 'phone' => $dbClient['phone'], 'email' => $dbClient['email'], 'internet' => $dbClient['internet']);
if (isset($_POST['save'])) {
if (isset($_FILES['file'])) {
if (htmlspecialchars($_FILES['file']['name']) !== '') {
$file = new files();
$file->upload($_FILES, 'lead', $id);
}
}
if (isset($_POST['name']) && isset($_POST['referralSource']) && isset($_POST['money']) && isset($_POST['status'])) {
$refValue = '';
if ($_POST['referralSource'] && $_POST['referralValueOther'] != '') {
$refValue = $_POST['referralValueOther'];
} else {
if ($_POST['referralSource'] == 5 && $_POST['referralValueClient'] > 0) {
$refValue = $_POST['referralValueClient'];
}
}
$values = array('name' => $_POST['name'], 'potentialMoney' => $_POST['money'], 'actualMoney' => $_POST['actualMoney'], 'refSource' => $_POST['referralSource'], 'refValue' => $refValue, 'status' => $_POST['status']);
$client = array('name' => $_POST['clientName'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'email' => $_POST['email'], 'internet' => $_POST['internet']);
$this->editLead($values, $id);
$clients->editClient($client, $lead['clientId']);
$tpl->setNotification('EDIT_SUCCESS', 'success');
} else {
$tpl->setNotification('MISSING_FIELDS', 'error');
}
}
$tpl->assign('client', $client);
$tpl->assign('lead', $values);
} else {
$tpl->display('general.error');
}
$client = new clients();
$tpl->assign('status', $this->getStatus());
$tpl->assign('referralSources', $this->getReferralSources());
$tpl->assign('clients', $client->getAll());
$tpl->display('leads.editLead');
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:46,代码来源:class.editLead.php
示例9: isDeletable
function isDeletable($f)
{
if (is_file($f)) {
return is_writable(dirname($f));
} elseif (is_dir($f)) {
return is_writable(dirname($f)) && count(files::scandir($f)) <= 2;
}
}
开发者ID:Nekrofage,项目名称:FJR,代码行数:8,代码来源:lib.files.php
示例10: base
public function base()
{
$submit = isset($_GET['submit']) ? true : false;
$link = isset($_GET['link']) ? $_GET['link'] : false;
$message = 'Add the link below';
if ($submit && $link) {
$link_explode = explode('/', $link);
$file = new files($this->getDb());
$added = $file->select('*', 'WHERE link="' . $link . '"');
if (!isset($added[0]['id'])) {
$file->insert(array('name' => urldecode($link_explode[count($link_explode) - 1]), 'approved' => 0, 'downloaded' => 0, 'created' => time(), 'link' => $link));
$message = 'Successfully Added! You can add another link below';
} else {
$message = 'This link is already in the index. You can add another link below';
}
}
$this->set('message', $message);
}
开发者ID:sudhanshuraheja,项目名称:PDF-Search,代码行数:18,代码来源:addController.php
示例11: writeFileFromPost
/**
* Ecrit un fichier avec les données envoyées en POST.
*
* @param string $sFilename
* @return void
*/
public function writeFileFromPost($sFilename)
{
if (!is_dir(dirname($sFilename))) {
files::makeDir(dirname($sFilename), true);
}
$aValues = array_merge($this->getDefaultValues(), $this->getPostValues());
$sFileContent = $this->getFileContent($aValues);
file_put_contents($sFilename, $sFileContent);
}
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:class.oktDefinitionsLessEditor.php
示例12: getFile
function getFile()
{
$file_id = params::get('file');
$dir = FILES_ROOT . 'pages/';
db::table('pages_files');
db::where('file_id', $file_id);
$file = db::assoc();
$link = $dir . $file_id . '.' . $file['file_type'];
files::downloadFile($link, $file['file_name'] . '.' . $file['file_type']);
}
开发者ID:rigidus,项目名称:ea,代码行数:10,代码来源:main.handler.php
示例13: __construct
/**
* Constructor.
*
* @param string $sLogDir
*/
public function __construct($sLogDir = null)
{
if (is_null($sLogDir)) {
$sLogDir = OKT_LOG_PATH;
}
$this->sLogDir = $sLogDir;
if (!is_dir($this->sLogDir)) {
files::makeDir($this->sLogDir, true);
}
}
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:class.oktSimpleLog.php
示例14: index
public function index()
{
import('@.ORG.files');
$files = files::files_tree('./doc', '.php');
if (count($files)) {
foreach ($files as $key => $value) {
$this->sign_by_file($value);
dump($value);
}
}
echo 'done!';
}
开发者ID:nuke2015,项目名称:signature,代码行数:12,代码来源:IndexAction.class.php
示例15: run
/**
* run - display template and edit data
*
* @access public
*/
public function run()
{
$tpl = new template();
$id = '';
if (isset($_GET['id']) === true) {
$id = (int) $_GET['id'];
}
$client = $this->getClient($id);
if (empty($client) === false) {
$file = new files();
$project = new projects();
$msgKey = '';
if ($_SESSION['userdata']['role'] == 'admin') {
$tpl->assign('admin', true);
}
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$msgKey = $file->upload($_FILES, 'client', $id);
}
}
$comment = new comments();
//Add comment
if (isset($_POST['comment']) === true) {
$mail = new mailer();
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comment->addComment($values, 'client');
}
$tpl->assign('userClients', $this->getClientsUsers($id));
$tpl->assign('comments', $comment->getComments('client', $id));
$tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv'));
$tpl->assign('info', $msgKey);
$tpl->assign('client', $client);
$tpl->assign('clientProjects', $project->getClientProjects($id));
$tpl->assign('files', $file->getFilesByModule('client'));
//var_dump($file->getFilesByModule('client')); die();
$tpl->display('clients.showClient');
} else {
$tpl->display('general.error');
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:45,代码来源:class.showClient.php
示例16: show
function show()
{
$event = web::getEvent();
if ($event === false) {
$year = date('Y');
} else {
$year = $event;
}
s::set('info_date_select', htmlspecialchars($year));
$sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0' GROUP BY `date` ORDER BY `date` DESC";
$res = db::query($sql);
$rows = mysql_num_rows($res);
if ($rows > 1) {
s::add('info_date_selector', '<ul class="years">');
while ($row = mysql_fetch_assoc($res)) {
if ($row['date'] == $year) {
$row['date'] = '<li><span>' . $row['date'] . '</span></li>';
} else {
$row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>';
}
s::add('info_date_selector', $row['date']);
}
s::add('info_date_selector', '</ul>');
}
$files = array();
db::table('info_files');
$r = db::select();
while ($a = mysql_fetch_assoc($r)) {
$files[$a['section_id']][] = $a;
}
db::table('info_sections');
db::order('section_order', 'DESC');
db::where('section_year', $year);
$r = db::select();
if (db::rows() == 0) {
web::error404();
}
while ($a = mysql_fetch_assoc($r)) {
if ($a['section_view'] == '0') {
s::roll('sections', $a);
} else {
s::roll('sections_view', $a);
}
if (isset($files[$a['section_id']])) {
foreach ($files[$a['section_id']] as $v) {
$v['file_icon'] = files::getFileIco($v['file_type']);
$v['file_size'] = files::parseSizeSmart($v['file_size']);
s::roll('items' . $a['section_id'], $v);
}
}
}
}
开发者ID:rigidus,项目名称:ea,代码行数:52,代码来源:main.handler.php
示例17: getCleanContentType
function getCleanContentType($contenttype, $filename = '')
{
global $FILE_LIB;
if (isset($FILE_LIB['alias'][$contenttype])) {
$contenttype = $FILE_LIB['alias'][$contenttype];
}
if ($contenttype == 'application/octet-stream' && $filename != '') {
if (preg_match('/^(.*)\\.([^\\.]*)$/', $filename, $matches)) {
$contenttype = files::getContentTypeFromExtension(strtolower($matches[2]));
}
}
return $contenttype;
}
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:13,代码来源:files.library.php
示例18: makeDirs
/**
* Make basis directories
*
*/
protected function makeDirs()
{
if (file_exists($this->dir)) {
throw new Exception(sprintf(__('m_development_bootstrap_module_allready_exists'), $this->id));
}
files::makeDir($this->dir);
files::makeDir($this->dir . '/_install', true);
files::makeDir($this->dir . '/_install/tpl', true);
files::makeDir($this->dir . '/inc', true);
files::makeDir($this->dir . '/inc/admin', true);
files::makeDir($this->dir . '/locales', true);
files::makeDir($this->dir . '/locales/fr', true);
files::makeDir($this->dir . '/locales/en', true);
}
开发者ID:jewelhuq,项目名称:okatea,代码行数:18,代码来源:class.module.bootstrap.simple.php
示例19: execute
function execute()
{
// Make views
$files = new files($this->files->getClass());
$files->setFeature("photo");
$files->makeFile("crud/view.images", $this->directory . "/views/images.blade.php");
// Change mainFoto input on read
$analyzeFile = new analyzeFile($this->directory . "/views/create.blade.php");
$analyzeFile->waitForFunctions();
$search = 'name = \'{{$mainFoto}}\'';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$analyzeFile->changeLine($line, "");
// Remove line
$analyzeFile->changeLine($line + 1, "");
$analyzeFile->changeLine($line - 1, "");
$analyzeFile->changeLine($line - 2, "");
$res = $analyzeFile->finishWait();
$analyzeFile = new analyzeFile($this->directory . "/controllers/" . ucfirst($this->files->getClass()->id) . "Controller.php");
$analyzeFile->waitForFunctions();
$search = 'Input::get(\'{{$mainFoto}}\')';
$search = $files->replace($search);
$analyzeFile->replaceLineWhere($search, "");
$res = $analyzeFile->finishWait();
$analyzeFile = new analyzeFile($this->directory . "/views/edit.blade.php");
$analyzeFile->waitForFunctions();
$search = '{{$data->{{$mainFoto}}}}';
$search = $files->replace($search);
$line = $analyzeFile->getLineWhere($search);
$analyzeFile->changeLine($line, "");
// Remove line
$analyzeFile->changeLine($line + 1, "");
$analyzeFile->changeLine($line - 1, "");
$analyzeFile->changeLine($line - 2, "");
$res = $analyzeFile->finishWait();
// add in Menu
$analyzeFile = new analyzeFile("result/theme/views/layouts/master.blade.php");
$analyzeFile->waitForFunctions();
$search = '@if(Request::is(\'{{$id}}/*\') && isset($id))';
$search = $files->replace($search);
$add = ' <a href="{{url(\'{{$id}}/images\'.\'/\'.$id)}}">Images</a>';
$add = $files->replace($add);
$analyzeFile->addAfterLine($search, $add);
$res = $analyzeFile->finishWait();
}
开发者ID:weblabormx,项目名称:crudMaker,代码行数:45,代码来源:photo.php
示例20: upload
function upload()
{
$dir = FILES_ROOT . 'all/';
if (!empty($_FILES['file']['name'])) {
$file_name = urldecode($_GET['file_name']);
$file_type = files::info($_FILES['file']['name'], 'type');
$file_size = files::info($_FILES['file']['tmp_name'], 'size');
db::table('files');
db::insert('', 'NOW()', $file_name, $file_type, $file_size);
$file_id = mysql_insert_id();
$file = $dir . $file_id . '.' . $file_type;
copy($_FILES['file']['tmp_name'], $file);
$file_icon = files::getFileIco($file_type);
buffer::set('<p class="load"><img src="/i/fileicons/' . $file_icon . '.png" width="18" height="18" alt="" /> <a href="/download/files/download/?file=' . $file_id . '">' . $file_name . '</a> <span>(' . $file_type . ', ' . round($file_size / 1000) . ' Кб)</span></p>');
}
}
开发者ID:rigidus,项目名称:ea,代码行数:16,代码来源:main.handler.php
注:本文中的files类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论