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


PHP files类代码示例

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


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


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