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


PHP Form::wrongImgFileTypeMsg方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     // Thumbnail
     $oImg = new Image($_FILES['thumb']['tmp_name']);
     if (!$oImg->validate()) {
         \PFBC\Form::setError('form_game', Form::wrongImgFileTypeMsg());
         return;
         // Stop execution of the method.
     }
     $sThumbFile = Various::genRnd($oImg->getFileName(), 30) . $oImg->getExt();
     $sThumbDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'game/img/thumb/';
     $oImg->square(60);
     $oImg->save($sThumbDir . $sThumbFile);
     unset($oImg);
     // Game
     $sGameFile = Various::genRnd($_FILES['file']['name'], 30) . PH7_DOT . $this->file->getFileExt($_FILES['file']['name']);
     $sGameDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'game/file/';
     // If the folders is not created (games not installed), yet we will create.
     $this->file->createDir(array($sThumbDir, $sGameDir));
     if (!@move_uploaded_file($_FILES['file']['tmp_name'], $sGameDir . $sGameFile)) {
         \PFBC\Form::setError('form_game', t('Impossible to upload the game. If you are the administrator, please check if the folder of games data has the write permission (CHMOD 755).'));
     } else {
         $aData = ['category_id' => $this->httpRequest->post('category_id', 'int'), 'name' => $this->httpRequest->post('name'), 'title' => $this->httpRequest->post('title'), 'description' => $this->httpRequest->post('description'), 'keywords' => $this->httpRequest->post('keywords'), 'thumb' => $sThumbFile, 'file' => $sGameFile];
         (new GameModel())->add($aData);
         /* Clean GameModel Cache */
         (new Framework\Cache\Cache())->start(GameModel::CACHE_GROUP, null, null)->clear();
         HeaderUrl::redirect(Uri::get('game', 'main', 'game', $aData['title'] . ',' . Db::getInstance()->lastInsertId()), t('The game was added successfully!'));
     }
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:30,代码来源:AdminFormProcess.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     /**
      * This can cause minor errors (eg if a user sent a file that is not a video).
      * So we hide the errors if we are not in development mode.
      */
     if (!isDebug()) {
         error_reporting(0);
     }
     // Resizing and saving the video album thumbnail
     $oPicture = new Image($_FILES['album']['tmp_name']);
     if (!$oPicture->validate()) {
         \PFBC\Form::setError('form_video_album', Form::wrongImgFileTypeMsg());
     } else {
         $iApproved = DbConfig::getSetting('videoManualApproval') == 0 ? '1' : '0';
         $sFileName = Various::genRnd($oPicture->getFileName(), 1) . '-thumb.' . $oPicture->getExt();
         (new VideoModel())->addAlbum($this->session->get('member_id'), $this->httpRequest->post('name'), $this->httpRequest->post('description'), $sFileName, $this->dateTime->get()->dateTime('Y-m-d H:i:s'), $iApproved);
         $iLastAlbumId = (int) Db::getInstance()->lastInsertId();
         $oPicture->square(200);
         /* Set watermark text on thumbnail */
         $sWatermarkText = DbConfig::getSetting('watermarkTextImage');
         $iSizeWatermarkText = DbConfig::getSetting('sizeWatermarkTextImage');
         $oPicture->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $sPath = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'video/file/' . $this->session->get('member_username') . PH7_DS . $iLastAlbumId . PH7_DS;
         $this->file->createDir($sPath);
         $oPicture->save($sPath . $sFileName);
         /* Clean VideoModel Cache */
         (new Framework\Cache\Cache())->start(VideoModel::CACHE_GROUP, null, null)->clear();
         HeaderUrl::redirect(Uri::get('video', 'main', 'addvideo', $iLastAlbumId));
     }
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:32,代码来源:AlbumFormProcess.php

示例3: setThumb

 /**
  * Sets the Blog Thumbnail.
  *
  * @param object $oPost
  * @param \PH7\Framework\File\File $oFile
  * @return void
  */
 public function setThumb($oPost, Framework\File\File $oFile)
 {
     if (!empty($_FILES['thumb']['tmp_name'])) {
         $oImage = new Framework\Image\Image($_FILES['thumb']['tmp_name']);
         if (!$oImage->validate()) {
             \PFBC\Form::setError('form_blog', Form::wrongImgFileTypeMsg());
         } else {
             /**
              * The method deleteFile first test if the file exists, if so it delete the file.
              */
             $sPathName = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'blog/' . PH7_IMG . $oPost->blogId;
             $oFile->deleteFile($sPathName);
             // It erases the old thumbnail
             $oFile->createDir($sPathName);
             $oImage->square(100);
             $oImage->save($sPathName . '/thumb.png');
         }
         unset($oImage);
     }
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:27,代码来源:Blog.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     $iApproved = AdminCore::auth() || DbConfig::getSetting('avatarManualApproval') == 0 ? '1' : '0';
     if (AdminCore::auth() && !User::auth() && $this->httpRequest->getExists(array('profile_id', 'username'))) {
         $iProfileId = $this->httpRequest->get('profile_id');
         $sUsername = $this->httpRequest->get('username');
     } else {
         $iProfileId = $this->session->get('member_id');
         $sUsername = $this->session->get('member_username');
     }
     $bAvatar = (new UserCore())->setAvatar($iProfileId, $sUsername, $_FILES['avatar']['tmp_name'], $iApproved);
     if (!$bAvatar) {
         \PFBC\Form::setError('form_avatar', Form::wrongImgFileTypeMsg());
     } else {
         $sModerationText = t('Your avatar has been received! But it will be visible once approved by our moderators. Please do not send a new avatar because this is useless!');
         $sText = t('Your avatar has been updated successfully!');
         $sMsg = $iApproved == '0' ? $sModerationText : $sText;
         \PFBC\Form::setSuccess('form_avatar', $sMsg);
     }
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:21,代码来源:AvatarFormProcess.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $iApproved = AdminCore::auth() || DbConfig::getSetting('profileBackgroundManualApproval') == 0 ? '1' : '0';
     if (AdminCore::auth() && !User::auth() && $this->httpRequest->getExists(array('profile_id', 'username'))) {
         $iProfileId = $this->httpRequest->get('profile_id');
         $sUsername = $this->httpRequest->get('username');
     } else {
         $iProfileId = $this->session->get('member_id');
         $sUsername = $this->session->get('member_username');
     }
     $bWallpaper = (new UserCore())->setBackground($iProfileId, $sUsername, $_FILES['wallpaper']['tmp_name'], $iApproved);
     if (!$bWallpaper) {
         \PFBC\Form::setError('form_design', Form::wrongImgFileTypeMsg());
     } else {
         $sModerationText = t('Your Wallpaper has been received! But it will not be visible until it is approved by our moderators. Please do not send a new not.');
         $sText = t('Your Wallpaper has been updated successfully!');
         $sMsg = DbConfig::getSetting('profileBackgroundManualApproval') ? $sModerationText : $sText;
         \PFBC\Form::setSuccess('form_design', $sMsg);
     }
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:21,代码来源:DesignFormProcess.php

示例6: setThumb

 /**
  * Sets the Note Thumbnail.
  *
  * @param object $oPost
  * @param \PH7\NoteModel $oNoteModel
  * @param \PH7\Framework\File\File $oFile
  * @return void
  */
 public function setThumb($oPost, NoteModel $oNoteModel, Framework\File\File $oFile)
 {
     if (!empty($_FILES['thumb']['tmp_name'])) {
         $oImage = new Framework\Image\Image($_FILES['thumb']['tmp_name']);
         if (!$oImage->validate()) {
             \PFBC\Form::setError('form_note', Form::wrongImgFileTypeMsg());
         } else {
             /**
              * The method deleteFile first test if the file exists, if so it delete the file.
              */
             $sPathName = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'note/' . PH7_IMG . $oPost->username . PH7_SH;
             $oFile->deleteFile($sPathName);
             // It erases the old thumbnail
             $oFile->createDir($sPathName);
             $sFileName = Various::genRnd($oImage->getFileName(), 20) . PH7_DOT . $oImage->getExt();
             $oImage->square(100);
             $oImage->save($sPathName . $sFileName);
             $oNoteModel->updatePost('thumb', $sFileName, $oPost->noteId, $oPost->profileId);
         }
         unset($oImage);
     }
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:30,代码来源:Note.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     /**
      * @desc This can cause minor errors (eg if a user sent a file that is not a photo).
      * So we hide the errors if we are not in development mode.
      */
     if (!isDebug()) {
         error_reporting(0);
     }
     /**
      * @desc
      * Check if the photo album ID is valid. The value must be numeric.
      * This test is necessary because when the selection exists but that no option is available (this can when a user wants to add photos but he has no album)
      * the return value is of type "string" and the value is "1".
      */
     if (!is_numeric($this->httpRequest->post('album_id'))) {
         \PFBC\Form::setError('form_picture', t('Please add a category before you add some photos.'));
         return;
         // Stop execution of the method.
     }
     /**
      * @desc Resizing and saving some photos
      */
     $aPhotos = $_FILES['photos']['tmp_name'];
     for ($i = 0, $iNumPhotos = count($aPhotos); $i < $iNumPhotos; $i++) {
         $oPicture1 = new Image($aPhotos[$i], 2500, 2500);
         if (!$oPicture1->validate()) {
             \PFBC\Form::setError('form_picture', Form::wrongImgFileTypeMsg());
             return;
             // Stop execution of the method.
         }
         $sAlbumTitle = $this->httpRequest->post('album_title');
         $iAlbumId = (int) $this->httpRequest->post('album_id');
         $oPicture2 = clone $oPicture1;
         $oPicture3 = clone $oPicture1;
         $oPicture4 = clone $oPicture1;
         $oPicture5 = clone $oPicture1;
         $oPicture6 = clone $oPicture1;
         $oPicture2->square(400);
         $oPicture3->square(600);
         $oPicture4->square(800);
         $oPicture5->square(1000);
         $oPicture6->square(1200);
         /* Set watermark text on images */
         $sWatermarkText = DbConfig::getSetting('watermarkTextImage');
         $iSizeWatermarkText = DbConfig::getSetting('sizeWatermarkTextImage');
         $oPicture1->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $oPicture2->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $oPicture3->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $oPicture4->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $oPicture5->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $oPicture6->watermarkText($sWatermarkText, $iSizeWatermarkText);
         $sPath = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'picture/img/' . $this->session->get('member_username') . PH7_DS . $iAlbumId . PH7_DS;
         $sFileName = Various::genRnd($oPicture1->getFileName(), 20);
         $sFile1 = $sFileName . '-original.' . $oPicture1->getExt();
         // Original
         $sFile2 = $sFileName . '-400.' . $oPicture2->getExt();
         $sFile3 = $sFileName . '-600.' . $oPicture3->getExt();
         $sFile4 = $sFileName . '-800.' . $oPicture4->getExt();
         $sFile5 = $sFileName . '-1000.' . $oPicture5->getExt();
         $sFile6 = $sFileName . '-1200.' . $oPicture6->getExt();
         $oPicture1->save($sPath . $sFile1);
         $oPicture2->save($sPath . $sFile2);
         $oPicture3->save($sPath . $sFile3);
         $oPicture4->save($sPath . $sFile4);
         $oPicture5->save($sPath . $sFile5);
         $oPicture6->save($sPath . $sFile6);
         $iApproved = DbConfig::getSetting('pictureManualApproval') == 0 ? '1' : '0';
         // It creates a nice title if no title is specified.
         $sTitle = $this->httpRequest->postExists('title') && $this->str->length($this->str->trim($this->httpRequest->post('title'))) > 2 ? $this->httpRequest->post('title') : $this->str->upperFirst(str_replace(array('-', '_'), ' ', str_ireplace(PH7_DOT . $oPicture1->getExt(), '', escape($_FILES['photos']['name'][$i], true))));
         (new PictureModel())->addPhoto($this->session->get('member_id'), $iAlbumId, $sTitle, $this->httpRequest->post('description'), $sFile1, $this->dateTime->get()->dateTime('Y-m-d H:i:s'), $iApproved);
     }
     /* Clean PictureModel Cache */
     (new Framework\Cache\Cache())->start(PictureModel::CACHE_GROUP, null, null)->clear();
     $sModerationText = t('Your photo(s) has been received! But it will be visible once approved by our moderators. Please do not send a new photo(s) because this is useless!');
     $sText = t('Your photo(s) has been added successfully!');
     $sMsg = $iApproved == '0' ? $sModerationText : $sText;
     Header::redirect(Uri::get('picture', 'main', 'album', $this->session->get('member_username') . ',' . $sAlbumTitle . ',' . $iAlbumId), $sMsg);
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:80,代码来源:PictureFormProcess.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     /********** General Settings **********/
     if (!$this->str->equals($this->httpRequest->post('site_name'), DbConfig::getSetting('siteName'))) {
         DbConfig::setSetting($this->httpRequest->post('site_name'), 'siteName');
     }
     if (!$this->str->equals($this->httpRequest->post('default_template'), DbConfig::getSetting('defaultTemplate'))) {
         DbConfig::setSetting($this->httpRequest->post('default_template'), 'defaultTemplate');
     }
     if (!$this->str->equals($this->httpRequest->post('default_language'), DbConfig::getSetting('defaultLanguage'))) {
         DbConfig::setSetting($this->httpRequest->post('default_language'), 'defaultLanguage');
     }
     if (!$this->str->equals($this->httpRequest->post('map_type'), DbConfig::getSetting('mapType'))) {
         DbConfig::setSetting($this->httpRequest->post('map_type'), 'mapType');
     }
     if (!$this->str->equals($this->httpRequest->post('splash_page'), DbConfig::getSetting('splashPage'))) {
         DbConfig::setSetting($this->httpRequest->post('splash_page'), 'splashPage');
     }
     if (!$this->str->equals($this->httpRequest->post('bg_splash_vid'), DbConfig::getSetting('bgSplashVideo'))) {
         DbConfig::setSetting($this->httpRequest->post('bg_splash_vid'), 'bgSplashVideo');
     }
     if (!$this->str->equals($this->httpRequest->post('full_ajax_site'), DbConfig::getSetting('fullAjaxSite'))) {
         DbConfig::setSetting($this->httpRequest->post('full_ajax_site'), 'fullAjaxSite');
     }
     if (!$this->str->equals($this->httpRequest->post('site_status'), DbConfig::getSetting('siteStatus'))) {
         DbConfig::setSiteMode($this->httpRequest->post('site_status'));
     }
     if (!$this->str->equals($this->httpRequest->post('disclaimer'), DbConfig::getSetting('disclaimer'))) {
         DbConfig::setSetting($this->httpRequest->post('disclaimer'), 'disclaimer');
     }
     if (!$this->str->equals($this->httpRequest->post('cookie_consent_bar'), DbConfig::getSetting('cookieConsentBar'))) {
         DbConfig::setSetting($this->httpRequest->post('cookie_consent_bar'), 'cookieConsentBar');
     }
     if (!$this->str->equals($this->httpRequest->post('is_software_news_feed'), DbConfig::getSetting('isSoftwareNewsFeed'))) {
         DbConfig::setSetting($this->httpRequest->post('is_software_news_feed'), 'isSoftwareNewsFeed');
     }
     /********** Logo Settings **********/
     if (!empty($_FILES['logo']['tmp_name'])) {
         $oLogo = new Framework\Image\Image($_FILES['logo']['tmp_name']);
         if (!$oLogo->validate()) {
             \PFBC\Form::setError('form_setting', Form::wrongImgFileTypeMsg());
             $this->bIsErr = true;
         } else {
             /*
              * The method deleteFile first test if the file exists, if so it delete the file.
              */
             $sPathName = PH7_PATH_TPL . PH7_TPL_NAME . PH7_DS . PH7_IMG . 'logo.png';
             $this->file->deleteFile($sPathName);
             // It erases the old logo.
             $oLogo->dynamicResize(250, 60);
             $oLogo->save($sPathName);
             // Clear CSS cache, because the logo is storaged with data URI in the CSS cache file
             $this->file->deleteDir(PH7_PATH_CACHE . Framework\Layout\Gzip::CACHE_DIR);
             // Clear the Web browser cache
             (new Framework\Navigation\Browser())->noCache();
         }
     }
     /********** Email **********/
     if (!$this->str->equals($this->httpRequest->post('email_name'), DbConfig::getSetting('emailName'))) {
         DbConfig::setSetting($this->httpRequest->post('email_name'), 'emailName');
     }
     if (!$this->str->equals($this->httpRequest->post('admin_email'), DbConfig::getSetting('adminEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('admin_email'), 'adminEmail');
     }
     if (!$this->str->equals($this->httpRequest->post('feedback_email'), DbConfig::getSetting('feedbackEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('feedback_email'), 'feedbackEmail');
     }
     if (!$this->str->equals($this->httpRequest->post('return_email'), DbConfig::getSetting('returnEmail'))) {
         DbConfig::setSetting($this->httpRequest->post('return_email'), 'returnEmail');
     }
     /********** Registration **********/
     if (!$this->str->equals($this->httpRequest->post('user_activation_type'), DbConfig::getSetting('userActivationType'))) {
         DbConfig::setSetting($this->httpRequest->post('user_activation_type'), 'userActivationType');
     }
     if (!$this->str->equals($this->httpRequest->post('aff_activation_type'), DbConfig::getSetting('affActivationType'))) {
         DbConfig::setSetting($this->httpRequest->post('aff_activation_type'), 'affActivationType');
     }
     if (!$this->str->equals($this->httpRequest->post('min_username_length'), DbConfig::getSetting('minUsernameLength'))) {
         $iMaxUsernameLength = DbConfig::getSetting('maxUsernameLength') - 1;
         if ($this->httpRequest->post('min_username_length') > $iMaxUsernameLength) {
             \PFBC\Form::setError('form_setting', t('The minimum length of the username cannot exceed %0% characters.', $iMaxUsernameLength));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($this->httpRequest->post('min_username_length'), 'minUsernameLength');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('max_username_length'), DbConfig::getSetting('maxUsernameLength'))) {
         if ($this->httpRequest->post('max_username_length') > PH7_MAX_USERNAME_LENGTH) {
             \PFBC\Form::setError('form_setting', t('The maximum length of the username cannot exceed %0% characters.', PH7_MAX_USERNAME_LENGTH));
             $this->bIsErr = true;
         } else {
             DbConfig::setSetting($this->httpRequest->post('max_username_length'), 'maxUsernameLength');
         }
     }
     if (!$this->str->equals($this->httpRequest->post('min_age_registration'), DbConfig::getSetting('minAgeRegistration'))) {
         if ($this->httpRequest->post('min_age_registration') >= DbConfig::getSetting('maxAgeRegistration')) {
             \PFBC\Form::setError('form_setting', t('You cannot specify a minimum age higher than the maximum age.'));
             $this->bIsErr = true;
         } else {
//.........这里部分代码省略.........
开发者ID:revcozmo,项目名称:pH7-Social-Dating-CMS,代码行数:101,代码来源:SettingFormProcess.php


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