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


PHP files::getFilemask方法代码示例

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


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

示例1: event_ExecuteEditor

 function event_ExecuteEditor(&$data)
 {
     global $lang, $manager;
     if (isset($manager->types[$data['type']]['content']['movie']) && $data['sheet'] == 'movie') {
         if (isset($_REQUEST['json']) && $_REQUEST['json'] == 'list') {
             $res = sql::query("\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t*\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t\t");
             $tpl = new Template($this->getTemplate('json.template'));
             if ($movie = sql::fetch_array($res)) {
                 $tpl->set("movie", $movie);
             }
             echo $tpl->fetch();
             exit;
         }
         if (isset($_REQUEST['json']) && $_REQUEST['json'] == 'delete') {
             $res = sql::query("\r\n\t\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t\t* \r\n\t\t\t\t\t\tFROM \r\n\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie\r\n\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t\t");
             if ($row = sql::fetch_array($res)) {
                 $directory = _BASE_MEDIA_ . 'movies/';
                 if (file_exists($directory . $row['filename'])) {
                     unlink($directory . $row['filename']);
                 }
                 $res = sql::query("\r\n\t\t\t\t\t\t\tDELETE FROM \r\n\t\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie\r\n\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t\t\t");
             }
             // Mark this action as a modification
             revisions::updateModificationDate($data['params']['id'], $data['params']['revision']);
             exit;
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             /* Upload */
             if (isset($_FILES['Filedata'])) {
                 if ($_FILES['Filedata']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
                     $directory = _BASE_MEDIA_ . 'movies/';
                     $original = $_FILES['Filedata']['name'];
                     $contenttype = files::getCleanContentType($_FILES['Filedata']['type'], $_FILES['Filedata']['name']);
                     $filename = files::getUniqueName($contenttype, $directory);
                     if (files::allowedContentType($contenttype, 'movie')) {
                         // Insert into database...
                         move_uploaded_file($_FILES['Filedata']['tmp_name'], $directory . $filename);
                         $res = sql::query("\r\n\t\t\t\t\t\t\t\t\tINSERT INTO\r\n\t\t\t\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie \r\n\t\t\t\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\t\t\t\tID='" . $data['params']['id'] . "', \r\n\t\t\t\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "',\r\n\t\t\t\t\t\t\t\t\t\tfilename='" . addslashes($filename) . "', \r\n\t\t\t\t\t\t\t\t\t\tname='" . addslashes($original) . "',\r\n\t\t\t\t\t\t\t\t\t\ttype='" . addslashes($contenttype) . "', \r\n\t\t\t\t\t\t\t\t\t\tsize='" . addslashes($_FILES['Filedata']['size']) . "',\r\n\t\t\t\t\t\t\t\t\t\twidth=320,\r\n\t\t\t\t\t\t\t\t\t\theight=240,\r\n\t\t\t\t\t\t\t\t\t\tautostart=0\r\n\t\t\t\t\t\t\t\t");
                         // Mark this action as a modification
                         revisions::updateModificationDate($data['params']['id'], $data['params']['revision']);
                         // Workaround for a Flash bug on OS X.. We need to send back content... any content will do
                         echo " ";
                         flush();
                         exit;
                     } else {
                         header("HTTP/1.1 415 Unsupported Media Type");
                         header("Status: 415 Unsupported Media Type");
                         exit;
                     }
                 } else {
                     switch ($_FILES['Filedata']['error']) {
                         case UPLOAD_ERR_INI_SIZE:
                         case UPLOAD_ERR_FORM_SIZE:
                             header("HTTP/1.1 413 Request Entity Too Large");
                             header("Status: 413 Request Entity Too Large");
                             exit;
                         case UPLOAD_ERR_NO_FILE:
                         case UPLOAD_ERR_PARTIAL:
                         default:
                             header("HTTP/1.1 400 Bad Request");
                             header("Status: 400 Bad Request");
                             exit;
                     }
                 }
             } else {
                 // Update size and autostart
                 $autostart = isset($_REQUEST['autostart']) ? intval($_REQUEST['autostart']) : 0;
                 $width = isset($_REQUEST['size']) ? intval($_REQUEST['size']) : 320;
                 switch ($width) {
                     case 320:
                         $height = 240;
                     case 640:
                         $height = 480;
                     default:
                         $height = round($width / 4 * 3);
                 }
                 $res = sql::query("\r\n\t\t\t\t\t\t\tUPDATE\r\n\t\t\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie\r\n\t\t\t\t\t\t\tSET\r\n\t\t\t\t\t\t\t\twidth='" . addslashes($width) . "',\r\n\t\t\t\t\t\t\t\theight='" . addslashes($height) . "',\r\n\t\t\t\t\t\t\t\tautostart='" . addslashes($autostart) . "'\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t\t\t");
             }
             // Mark this action as a modification
             revisions::updateModificationDate($data['params']['id'], $data['params']['revision']);
             header("Location: " . url::item($data['params']['id'], 'edit') . "/movie?revision=" . $data['params']['revision']);
             exit;
         }
         $res = sql::query("\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t*\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t" . _TABLE_PREFIX_ . "contents_movie\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\tID='" . $data['params']['id'] . "' AND\r\n\t\t\t\t\t\trevision='" . $data['params']['revision'] . "'\r\n\t\t\t\t");
         $tpl = new Template($this->getTemplate('editor.template'));
         if ($movie = sql::fetch_array($res)) {
             $tpl->set("movie", $movie);
         }
         $tpl->set("id", $data['params']['id']);
         $tpl->set("revision", $data['params']['revision']);
         $tpl->set("filemask", files::getFilemask('movie'));
         $tpl->set("ticket", ticket::generate($data['params']['id']));
         $data['template']->append('content', $tpl->fetch());
         // Make sure the following assets are included
         $data['page']->assets->registerJavascript('/core/assets/javascript/plugin.js');
         $data['page']->assets->registerJavascript('/core/assets/javascript/flash.js');
         $data['page']->assets->registerJavascript('/core/assets/javascript/upload.js');
         $data['page']->assets->registerJavascript('/core/assets/javascript/progress.js');
         $data['page']->assets->registerJavascript($this->localAsset('editor.js'));
         $data['page']->assets->registerJavascript($this->localAsset('player.js'));
//.........这里部分代码省略.........
开发者ID:KasaiDot,项目名称:Dashboard2,代码行数:101,代码来源:plugin.php


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