Exemple #1
0
 /**
  * System-Check ausführen
  * @return array
  */
 protected function getCheckOptionsSystem()
 {
     $checkOptions = array();
     $loadedExtensions = array_map('strtolower', get_loaded_extensions());
     $phpVer = '5.4.0';
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPVERSION')] = array('current' => phpversion(), 'recommend' => $phpVer, 'result' => version_compare(phpversion(), $phpVer, '>='), 'helplink' => 'http://php.net/', 'optional' => 0);
     $recomVal = 64;
     $curVal = \fpcm\classes\baseconfig::memoryLimit();
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPMEMLIMIT')] = array('current' => $curVal . ' MiB', 'recommend' => $recomVal . ' MiB', 'result' => $curVal >= $recomVal ? true : false, 'helplink' => 'http://php.net/manual/de/info.configuration.php', 'optional' => 1);
     $recomVal = 10;
     $curVal = ini_get('max_execution_time');
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPMAXEXECTIME')] = array('current' => $curVal . ' sec', 'recommend' => $recomVal . ' sec', 'result' => $curVal >= $recomVal ? true : false, 'helplink' => 'http://php.net/manual/de/info.configuration.php', 'optional' => 1);
     $dbDrivers = \PDO::getAvailableDrivers();
     $resultMySql = in_array('mysql', $dbDrivers);
     $resultPgSql = in_array('pgsql', $dbDrivers);
     $sqlhelp = 'http://php.net/manual/de/pdo.getavailabledrivers.php';
     $current = $resultMySql || $resultPgSql ? true : false;
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_MYSQL')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => $resultMySql, 'helplink' => $sqlhelp, 'optional' => !$resultMySql && $resultPgSql ? 1 : 0);
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_PGSQL')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => $resultPgSql, 'helplink' => $sqlhelp, 'optional' => $resultMySql ? 1 : 0);
     if (is_object(\fpcm\classes\baseconfig::$fpcmDatabase)) {
         $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_ACTIVE')] = array('current' => \fpcm\classes\baseconfig::$fpcmDatabase->getDbtype(), 'recommend' => implode(', ', array_intersect($dbDrivers, array_keys(\fpcm\classes\database::$supportedDBMS))), 'result' => true, 'helplink' => 'http://php.net/manual/de/pdo.getavailabledrivers.php', 'optional' => 0);
         $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBVERSION')] = array('current' => \fpcm\classes\baseconfig::$fpcmDatabase->getDbVersion(), 'recommend' => \fpcm\classes\baseconfig::$fpcmDatabase->getRecommendVersion(), 'result' => \fpcm\classes\baseconfig::$fpcmDatabase->checkDbVersion(), 'helplink' => 'http://php.net/manual/de/pdo.getattribute.php', 'optional' => 0);
     }
     $current = in_array('pdo', $loadedExtensions) && in_array('pdo_mysql', $loadedExtensions);
     $checkOptions['PHP Data Objects (PDO)'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.pdo.php', 'optional' => 0);
     $current = CRYPT_SHA256 == 1 ? true : false;
     $current = $current && in_array(\fpcm\classes\security::defaultHashAlgo, hash_algos());
     $checkOptions['SHA256 Hash Algorithm'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/function.hash-algos.php', 'optional' => 0);
     $current = in_array('gd', $loadedExtensions);
     $checkOptions['GD Lib'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/book.image.php', 'optional' => 0);
     $current = in_array('json', $loadedExtensions);
     $checkOptions['JSON'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/book.json.php', 'optional' => 0);
     $current = in_array('xml', $loadedExtensions) && in_array('simplexml', $loadedExtensions) && class_exists('DOMDocument');
     $checkOptions['XML, SimpleXML, DOMDocument'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.simplexmlelement.php', 'optional' => 0);
     $current = in_array('zip', $loadedExtensions);
     $checkOptions['ZipArchive'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.ziparchive.php', 'optional' => 0);
     $externalCon = \fpcm\classes\baseconfig::canConnect();
     $checkOptions['allow_url_fopen = 1 (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $externalCon ? 'true' : false, 'recommend' => 'true', 'result' => true && $externalCon, 'helplink' => 'http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen', 'optional' => 1);
     $current = in_array('curl', $loadedExtensions);
     $checkOptions['cURL (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => false || $current, 'helplink' => 'http://php.net/manual/en/book.curl.php', 'optional' => 1);
     $current = in_array('phar', $loadedExtensions);
     $checkOptions['Phar (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => false || $current, 'helplink' => 'http://php.net/manual/en/class.phar.php', 'optional' => 1);
     $checkFolders = $this->getCheckFolders();
     foreach ($checkFolders as $description => $folderPath) {
         $current = is_writable($folderPath);
         $pathOutput = \fpcm\model\files\ops::removeBaseDir($folderPath, true);
         $checkOptions['<i>' . $description . ' ' . $pathOutput . '</i> ' . $this->lang->translate('GLOBAL_WRITABLE')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'optional' => 0);
     }
     return $checkOptions;
 }
Exemple #2
0
 /**
  * Erzeugt Thumbanils für Dateimanager
  * @param arraye $folderFiles
  */
 public function createFilemanagerThumbs($folderFiles = null)
 {
     $folderFiles = is_null($folderFiles) ? $this->getFolderList() : $folderFiles;
     include_once \fpcm\classes\loader::libGetFilePath('PHPImageWorkshop', 'ImageWorkshop.php');
     $filesizeLimit = \fpcm\classes\baseconfig::memoryLimit(true) * 0.025;
     $memoryWorkLimit = \fpcm\classes\baseconfig::memoryLimit(true) * 0.5;
     foreach ($folderFiles as $folderFile) {
         if (filesize($folderFile) >= $filesizeLimit) {
             $msgPath = ops::removeBaseDir($folderFile);
             \fpcm\classes\logs::syslogWrite("Skip filemanager thumbnail generation for {$msgPath} because of image dimension. You may reduce file size?");
             continue;
         }
         $phpImgWsp = \PHPImageWorkshop\ImageWorkshop::initFromPath($folderFile);
         $image = new \fpcm\model\files\image(basename($folderFile), '', '');
         if (file_exists($image->getFileManagerThumbnail())) {
             $image = null;
             $phpImgWsp = null;
             continue;
         }
         if (memory_get_usage(true) < $memoryWorkLimit) {
             $phpImgWsp->cropMaximumInPixel(0, 0, "MM");
         }
         $phpImgWsp->resizeInPixel(100, 100);
         $phpImgWsp->save(dirname($image->getFileManagerThumbnail()), basename($image->getFileManagerThumbnail()));
         if (!file_exists($image->getFileManagerThumbnail())) {
             trigger_error('Unable to create filemanager thumbnail: ' . $image->getFileManagerThumbnail());
         }
         $image = null;
         $phpImgWsp = null;
     }
 }
Exemple #3
0
 /**
  * Erzeugt ein Thumbnail für das aktuelle Bild
  * @return boolean
  */
 public function createThumbnail()
 {
     include_once \fpcm\classes\loader::libGetFilePath('PHPImageWorkshop', 'ImageWorkshop.php');
     $phpImgWsp = \PHPImageWorkshop\ImageWorkshop::initFromPath($this->getFullpath());
     if (memory_get_usage(true) < \fpcm\classes\baseconfig::memoryLimit(true) * 0.5) {
         $phpImgWsp->cropMaximumInPixel(0, 0, 'MM');
     }
     $phpImgWsp->resizeInPixel($this->config->file_img_thumb_width, $this->config->file_img_thumb_height);
     $phpImgWsp->save($this->getFilepath() . dirname($this->getThumbnail()), basename($this->getThumbnail()), true, null, 85);
     $this->events->runEvent('thumbnailCreate', $this);
     if (!file_exists($this->getFilepath() . $this->getThumbnail())) {
         trigger_error('Unable to create filemanager thumbnail: ' . $this->getThumbnail());
         return false;
     }
     return true;
 }