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


PHP UTIL_File::checkUploadedFile方法代码示例

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


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

示例1: chooseTheme

 public function chooseTheme()
 {
     $language = OW::getLanguage();
     $router = OW::getRouter();
     $this->themeService->updateThemeList();
     $this->themeService->updateThemesInfo();
     $themes = $this->themeService->findAllThemes();
     $themesInfo = array();
     $activeTheme = OW::getThemeManager()->getSelectedTheme()->getDto()->getKey();
     /* @var $theme BOL_Theme */
     foreach ($themes as $theme) {
         $themesInfo[$theme->getKey()] = array("key" => $theme->getKey(), "title" => $theme->getTitle(), "iconUrl" => $this->themeService->getStaticUrl($theme->getKey()) . BOL_ThemeService::ICON_FILE, "previewUrl" => $this->themeService->getStaticUrl($theme->getKey()) . BOL_ThemeService::PREVIEW_FILE, "active" => $theme->getKey() == $activeTheme, "changeUrl" => $router->urlFor(__CLASS__, "changeTheme", array(BOL_StorageService::URI_VAR_KEY => $theme->getKey())), "update_url" => (int) $theme->getUpdate() == 1 ? $router->urlFor("ADMIN_CTRL_Themes", "updateRequest", array(BOL_StorageService::URI_VAR_KEY => $theme->getKey())) : false);
         if (!in_array($theme->getKey(), array(BOL_ThemeService::DEFAULT_THEME, $activeTheme))) {
             $themesInfo[$theme->getKey()]["delete_url"] = $router->urlFor(__CLASS__, "deleteTheme", array("key" => $theme->getKey()));
         }
         if ($theme->getLicenseCheckTimestamp() > 0) {
             $params = array(BOL_StorageService::URI_VAR_BACK_URI => urlencode($router->uriForRoute("admin_themes_choose")), BOL_StorageService::URI_VAR_KEY => $theme->getKey(), BOL_StorageService::URI_VAR_ITEM_TYPE => BOL_StorageService::URI_VAR_ITEM_TYPE_VAL_THEME, BOL_StorageService::URI_VAR_DEV_KEY => $theme->getDeveloperKey(), BOL_StorageService::URI_VAR_RETURN_RESULT => 0);
             $themesInfo[$theme->getKey()]["license_url"] = OW::getRequest()->buildUrlQueryString($router->urlFor("ADMIN_CTRL_Storage", "checkItemLicense"), $params);
         }
         $xmlInfo = $this->themeService->getThemeXmlInfoForKey($theme->getKey());
         $themesInfo[$theme->getKey()] = array_merge($themesInfo[$theme->getKey()], $xmlInfo);
     }
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl() . "theme_select.js");
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin("base")->getStaticJsUrl() . "jquery.sticky.js");
     $addData = array("deleteConfirmMsg" => $language->text("admin", "themes_choose_delete_confirm_msg"), "deleteActiveThemeMsg" => $language->text("admin", "themes_cant_delete_active_theme"));
     OW::getDocument()->addOnloadScript("window.owThemes = new ThemesSelect(" . json_encode($themesInfo) . ", " . json_encode($addData) . ");\n        \t\$('.selected_theme_info input.theme_select_submit').click(function(){\n    \t\t\twindow.location.href = '{$themesInfo[$activeTheme]['changeUrl']}';\n    \t\t});\n            \$('.selected_theme_info_stick').sticky({topSpacing:60});\n            \$('.admin_themes_select a.theme_icon').click( function(){ \$('.theme_info .theme_control_button').hide(); });");
     $this->assign("adminThemes", array(BOL_ThemeService::DEFAULT_THEME => $themesInfo[BOL_ThemeService::DEFAULT_THEME]));
     $this->assign("themeInfo", $themesInfo[$activeTheme]);
     $event = new OW_Event("admin.filter_themes_to_choose", array(), $themesInfo);
     OW::getEventManager()->trigger($event);
     $this->assign("themes", $event->getData());
     // add theme
     $form = new Form("theme-add");
     $form->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $file = new FileField("file");
     $form->addElement($file);
     $submit = new Submit("submit");
     $submit->setValue($language->text("admin", "plugins_manage_add_submit_label"));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $result = UTIL_File::checkUploadedFile($_FILES["file"]);
             if (!$result["result"]) {
                 $this->feedback->error($result["message"]);
                 $this->redirect($router->urlForRoute("admin_themes_choose"));
             }
             $pluginfilesDir = OW::getPluginManager()->getPlugin("base")->getPluginFilesDir();
             $tempFile = $this->getTemDirPath() . UTIL_String::getRandomStringWithPrefix("theme_add") . ".zip";
             $tempDirName = UTIL_String::getRandomStringWithPrefix("theme_add");
             if (!move_uploaded_file($_FILES["file"]["tmp_name"], $tempFile)) {
                 $this->feedback->error($language->text("admin", "manage_theme_add_move_file_error"));
                 $this->redirect($router->urlForRoute("admin_themes_choose"));
             }
             $zip = new ZipArchive();
             if ($zip->open($tempFile) === true) {
                 $zip->extractTo($this->getTemDirPath() . $tempDirName);
                 $zip->close();
             } else {
                 $this->feedback->error($language->text("admin", "manage_theme_add_extract_error"));
                 $this->redirect($router->urlForRoute("admin_themes_choose"));
             }
             unlink($tempFile);
             $this->redirect(OW::getRequest()->buildUrlQueryString($router->urlFor(__CLASS__, "processAdd"), array("dir" => $tempDirName)));
         }
     }
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:68,代码来源:themes.php

示例2: addImage

 /**
  * 
  * @param string $fileArr
  * @return \BOL_ThemeImage
  */
 public function addImage($fileArr)
 {
     $result = UTIL_File::checkUploadedFile($fileArr, self::CONTROL_IMAGE_MAX_FILE_SIZE_IN_MB * 1024 * 1024);
     if (!$result["result"]) {
         return null;
     }
     if (!UTIL_File::validateImage($fileArr["name"])) {
         return null;
     }
     $image = new BOL_ThemeImage();
     $image->addDatetime = time();
     $this->themeImageDao->save($image);
     $ext = UTIL_File::getExtension($fileArr["name"]);
     $imageName = "theme_image_" . $image->getId() . "." . $ext;
     //cloudfiles header fix for amazon : need right extension to upload file with right header
     $newTempName = $fileArr["tmp_name"] . "." . $ext;
     rename($fileArr['tmp_name'], $newTempName);
     OW::getStorage()->copyFile($newTempName, $this->getUserfileImagesDir() . $imageName);
     if (file_exists($newTempName)) {
         unlink($newTempName);
     }
     $image->setFilename($imageName);
     $this->themeImageDao->save($image);
     return $image;
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:30,代码来源:theme_service.php

示例3: add

 /**
  * Uploads new plugin and extracts archive contecnts.
  */
 public function add()
 {
     OW::getNavigation()->activateMenuItem(OW_Navigation::ADMIN_PLUGINS, "admin", "sidebar_menu_plugins_add");
     $language = OW::getLanguage();
     $feedback = OW::getFeedback();
     $form = new Form("plugin-add");
     $form->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $file = new FileField("file");
     $form->addElement($file);
     $submit = new Submit("submit");
     $submit->setValue($language->text("admin", "plugins_manage_add_submit_label"));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $result = UTIL_File::checkUploadedFile($_FILES["file"]);
             if (!$result["result"]) {
                 $feedback->error($result["message"]);
                 $this->redirect();
             }
             $pluginfilesDir = OW::getPluginManager()->getPlugin("base")->getPluginFilesDir();
             $tempFile = $pluginfilesDir . UTIL_String::getRandomStringWithPrefix("plugin_add") . ".zip";
             $tempDirName = UTIL_String::getRandomStringWithPrefix("plugin_add");
             if (!move_uploaded_file($_FILES["file"]["tmp_name"], $tempFile)) {
                 $feedback->error($language->text("admin", "manage_plugin_add_move_file_error"));
                 $this->redirectToAction("index");
             }
             $zip = new ZipArchive();
             if ($zip->open($tempFile) === true) {
                 $zip->extractTo($this->getTemDirPath() . $tempDirName);
                 $zip->close();
             } else {
                 $feedback->error($language->text("admin", "manage_plugin_add_extract_error"));
                 $this->redirectToAction("index");
             }
             unlink($tempFile);
             $this->redirect(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor(__CLASS__, "processAdd"), array("dir" => $tempDirName)));
         }
     }
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:44,代码来源:plugins.php


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