Exemplo n.º 1
0
 public function indexAction()
 {
     // check maintenance
     $maintenance_enabled = false;
     $manager = Schedule_Manager_Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = Zend_Json::encode($maintenance_enabled);
     // configuration
     $this->view->config = Pimcore_Config::getSystemConfig();
     //mail settings
     $mailIncomplete = false;
     if ($this->view->config->email) {
         $emailSettings = $this->view->config->email->toArray();
         if ($emailSettings['method'] == "sendmail" and !empty($emailSettings['sender']['email'])) {
             $mailIncomplete = true;
         }
         if ($emailSettings['method'] == "smtp" and !empty($emailSettings['sender']['email']) and !empty($emailSettings['smtp']['host'])) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_incomplete = Zend_Json::encode($mailIncomplete);
     // report configuration
     $this->view->report_config = Pimcore_Config::getReportConfig();
     // customviews config
     $cvConfig = Pimcore_Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Object_Abstract::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $memory_limit = filesize2bytes(ini_get("memory_limit") . "B");
     $upload_mb = min($max_upload, $max_post, $memory_limit);
     $this->view->upload_max_filesize = $upload_mb;
     // live connect
     $liveconnectToken = Pimcore_Liveconnect::getToken();
     $this->view->liveconnectToken = $liveconnectToken;
     // adding css minify filter because of IE issues with CkEditor and more than 31 stylesheets
     if (!PIMCORE_DEVMODE) {
         $front = Zend_Controller_Front::getInstance();
         $front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
     }
 }
Exemplo n.º 2
0
 public function indexAction()
 {
     $checksPHP = array();
     $checksMySQL = array();
     $checksFS = array();
     $checksApps = array();
     // check for memory limit
     $memoryLimit = ini_get("memory_limit");
     $memoryLimit = filesize2bytes($memoryLimit . "B");
     $state = "ok";
     if ($memoryLimit < 67108000) {
         $state = "error";
     } elseif ($memoryLimit < 134217000) {
         $state = "warning";
     }
     $checksPHP[] = array("name" => "memory_limit (in php.ini)", "link" => "http://www.php.net/memory_limit", "state" => $state);
     // mcrypt
     $checksPHP[] = array("name" => "mcrypt", "link" => "http://www.php.net/mcrypt", "state" => function_exists("mcrypt_encrypt") ? "ok" : "error");
     // pdo_mysql
     $checksPHP[] = array("name" => "PDO_Mysql", "link" => "http://www.php.net/pdo_mysql", "state" => @constant("PDO::MYSQL_ATTR_FOUND_ROWS") ? "ok" : "error");
     // pdo_mysql
     $checksPHP[] = array("name" => "Mysqli", "link" => "http://www.php.net/mysqli", "state" => class_exists("mysqli") ? "ok" : "error");
     // iconv
     $checksPHP[] = array("name" => "iconv", "link" => "http://www.php.net/iconv", "state" => function_exists("iconv") ? "ok" : "error");
     // dom
     $checksPHP[] = array("name" => "dom", "link" => "http://www.php.net/dom", "state" => class_exists("DOMDocument") ? "ok" : "error");
     // simplexml
     $checksPHP[] = array("name" => "SimpleXML", "link" => "http://www.php.net/simplexml", "state" => class_exists("SimpleXMLElement") ? "ok" : "error");
     // gd
     $checksPHP[] = array("name" => "GD", "link" => "http://www.php.net/gd", "state" => function_exists("gd_info") ? "ok" : "error");
     // exif
     $checksPHP[] = array("name" => "EXIF", "link" => "http://www.php.net/exif", "state" => function_exists("exif_read_data") ? "ok" : "error");
     // multibyte support
     $checksPHP[] = array("name" => "Multibyte String (mbstring)", "link" => "http://www.php.net/mbstring", "state" => function_exists("mb_get_info") ? "ok" : "error");
     // file_info support
     $checksPHP[] = array("name" => "File Information (file_info)", "link" => "http://www.php.net/file_info", "state" => function_exists("finfo_open") ? "ok" : "error");
     // zip
     $checksPHP[] = array("name" => "zip", "link" => "http://www.php.net/zip", "state" => class_exists("ZipArchive") ? "ok" : "error");
     // gzip
     $checksPHP[] = array("name" => "zlib / gzip", "link" => "http://www.php.net/zlib", "state" => function_exists("gzcompress") ? "ok" : "error");
     // bzip
     $checksPHP[] = array("name" => "Bzip2", "link" => "http://www.php.net/bzip2", "state" => function_exists("bzcompress") ? "ok" : "error");
     // openssl
     $checksPHP[] = array("name" => "OpenSSL", "link" => "http://www.php.net/openssl", "state" => function_exists("openssl_open") ? "ok" : "error");
     // Imagick
     $checksPHP[] = array("name" => "Imagick", "link" => "http://www.php.net/imagick", "state" => class_exists("Imagick") ? "ok" : "warning");
     // OPcache
     $checksPHP[] = array("name" => "OPcache", "link" => "http://www.php.net/opcache", "state" => function_exists("opcache_reset") ? "ok" : "warning");
     // memcache
     $checksPHP[] = array("name" => "Memcache", "link" => "http://www.php.net/memcache", "state" => class_exists("Memcache") ? "ok" : "warning");
     // Redis
     $checksPHP[] = array("name" => "Redis", "link" => "https://pecl.php.net/package/redis", "state" => class_exists("Redis") ? "ok" : "warning");
     // curl for google api sdk
     $checksPHP[] = array("name" => "curl", "link" => "http://www.php.net/curl", "state" => function_exists("curl_init") ? "ok" : "warning");
     $db = null;
     if ($this->getParam("mysql_adapter")) {
         // this is before installing
         try {
             $dbConfig = ['username' => $this->getParam("mysql_username"), 'password' => $this->getParam("mysql_password"), 'dbname' => $this->getParam("mysql_database")];
             $hostSocketValue = $this->getParam("mysql_host_socket");
             if (file_exists($hostSocketValue)) {
                 $dbConfig["unix_socket"] = $hostSocketValue;
             } else {
                 $dbConfig["host"] = $hostSocketValue;
                 $dbConfig["port"] = $this->getParam("mysql_port");
             }
             $db = \Zend_Db::factory($this->getParam("mysql_adapter"), $dbConfig);
             $db->getConnection();
         } catch (\Exception $e) {
             $db = null;
         }
     } else {
         // this is after installing, eg. after a migration, ...
         $db = \Pimcore\Db::get();
     }
     if ($db) {
         // storage engines
         $engines = array();
         $enginesRaw = $db->fetchAll("SHOW ENGINES;");
         foreach ($enginesRaw as $engineRaw) {
             $engines[] = strtolower($engineRaw["Engine"]);
         }
         // innodb
         $checksMySQL[] = array("name" => "InnoDB Support", "state" => in_array("innodb", $engines) ? "ok" : "error");
         // myisam
         $checksMySQL[] = array("name" => "MyISAM Support", "state" => in_array("myisam", $engines) ? "ok" : "error");
         // memory
         $checksMySQL[] = array("name" => "MEMORY Support", "state" => in_array("memory", $engines) ? "ok" : "error");
         // check database charset =>  utf-8 encoding
         $result = $db->fetchRow('SHOW VARIABLES LIKE "character\\_set\\_database"');
         $checksMySQL[] = array("name" => "Database Charset UTF8", "state" => $result['Value'] == "utf8" ? "ok" : "error");
         // create table
         $queryCheck = true;
         try {
             $db->query("CREATE TABLE __pimcore_req_check (\n                  id int(11) NOT NULL AUTO_INCREMENT,\n                  field varchar(255) CHARACTER SET latin1 NULL DEFAULT NULL,\n                  PRIMARY KEY (id)\n                ) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "CREATE TABLE", "state" => $queryCheck ? "ok" : "error");
         // alter table
         $queryCheck = true;
         try {
             $db->query("ALTER TABLE __pimcore_req_check ADD COLUMN alter_field varchar(255) NULL DEFAULT NULL");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "ALTER TABLE", "state" => $queryCheck ? "ok" : "error");
         // Manage indexes
         $queryCheck = true;
         try {
             $db->query("ALTER TABLE __pimcore_req_check\n                  CHANGE COLUMN id id int(11) NOT NULL,\n                  CHANGE COLUMN field field varchar(255) NULL DEFAULT NULL,\n                  CHANGE COLUMN alter_field alter_field varchar(255) NULL DEFAULT NULL,\n                  ADD KEY field (field),\n                  DROP PRIMARY KEY ,\n                 DEFAULT CHARSET=utf8");
             $db->query("ALTER TABLE __pimcore_req_check\n                  CHANGE COLUMN id id int(11) NOT NULL AUTO_INCREMENT,\n                  CHANGE COLUMN field field varchar(255) NULL DEFAULT NULL,\n                  CHANGE COLUMN alter_field alter_field varchar(255) NULL DEFAULT NULL,\n                  ADD PRIMARY KEY (id) ,\n                 DEFAULT CHARSET=utf8");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "Manage Indexes", "state" => $queryCheck ? "ok" : "error");
         // insert data
         $queryCheck = true;
         try {
             $db->insert("__pimcore_req_check", array("field" => uniqid(), "alter_field" => uniqid()));
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "INSERT", "state" => $queryCheck ? "ok" : "error");
         // update
         $queryCheck = true;
         try {
             $db->update("__pimcore_req_check", array("field" => uniqid(), "alter_field" => uniqid()));
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "UPDATE", "state" => $queryCheck ? "ok" : "error");
         // select
         $queryCheck = true;
         try {
             $db->fetchAll("SELECT * FROM __pimcore_req_check");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SELECT", "state" => $queryCheck ? "ok" : "error");
         // create view
         $queryCheck = true;
         try {
             $db->query("CREATE OR REPLACE VIEW __pimcore_req_check_view AS SELECT * FROM __pimcore_req_check");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "CREATE VIEW", "state" => $queryCheck ? "ok" : "error");
         // select from view
         $queryCheck = true;
         try {
             $db->fetchAll("SELECT * FROM __pimcore_req_check_view");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SELECT (from view)", "state" => $queryCheck ? "ok" : "error");
         // delete
         $queryCheck = true;
         try {
             $db->delete("__pimcore_req_check");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DELETE", "state" => $queryCheck ? "ok" : "error");
         // show create view
         $queryCheck = true;
         try {
             $db->query("SHOW CREATE VIEW __pimcore_req_check_view");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SHOW CREATE VIEW", "state" => $queryCheck ? "ok" : "error");
         // show create table
         $queryCheck = true;
         try {
             $db->query("SHOW CREATE TABLE __pimcore_req_check");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SHOW CREATE TABLE", "state" => $queryCheck ? "ok" : "error");
         // drop view
         $queryCheck = true;
         try {
             $db->query("DROP VIEW __pimcore_req_check_view");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DROP VIEW", "state" => $queryCheck ? "ok" : "error");
         // drop table
         $queryCheck = true;
         try {
             $db->query("DROP TABLE __pimcore_req_check");
         } catch (\Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DROP TABLE", "state" => $queryCheck ? "ok" : "error");
     } else {
         die("Not possible... no or wrong database settings given.<br />Please fill out the MySQL Settings in the install form an click again on `Check Requirements´");
     }
     // filesystem checks
     // website/var writable
     $websiteVarWritable = true;
     try {
         $files = $this->rscandir(PIMCORE_WEBSITE_VAR);
         foreach ($files as $file) {
             if (!is_writable($file)) {
                 $websiteVarWritable = false;
             }
         }
         $checksFS[] = array("name" => "/website/var/ writeable", "state" => $websiteVarWritable ? "ok" : "error");
     } catch (\Exception $e) {
         $checksFS[] = array("name" => "/website/var/ (not checked - too many files)", "state" => "warning");
     }
     // pimcore writeable
     $checksFS[] = array("name" => "/pimcore/ writeable", "state" => \Pimcore\Update::isWriteable() ? "ok" : "warning");
     // system & application checks
     // PHP CLI BIN
     try {
         $phpCliBin = (bool) \Pimcore\Tool\Console::getPhpCli();
     } catch (\Exception $e) {
         $phpCliBin = false;
     }
     $checksApps[] = array("name" => "PHP CLI Binary", "state" => $phpCliBin ? "ok" : "error");
     // FFMPEG BIN
     try {
         $ffmpegBin = (bool) \Pimcore\Video\Adapter\Ffmpeg::getFfmpegCli();
     } catch (\Exception $e) {
         $ffmpegBin = false;
     }
     $checksApps[] = array("name" => "FFMPEG (CLI)", "state" => $ffmpegBin ? "ok" : "warning");
     // WKHTMLTOIMAGE BIN
     try {
         $wkhtmltopdfBin = (bool) \Pimcore\Image\HtmlToImage::getWkhtmltoimageBinary();
     } catch (\Exception $e) {
         $wkhtmltopdfBin = false;
     }
     $checksApps[] = array("name" => "wkhtmltoimage (CLI)", "state" => $wkhtmltopdfBin ? "ok" : "warning");
     // HTML2TEXT BIN
     try {
         $html2textBin = (bool) \Pimcore\Mail::determineHtml2TextIsInstalled();
     } catch (\Exception $e) {
         $html2textBin = false;
     }
     $checksApps[] = array("name" => "mbayer html2text (CLI)", "state" => $html2textBin ? "ok" : "warning");
     // ghostscript BIN
     try {
         $ghostscriptBin = (bool) \Pimcore\Document\Adapter\Ghostscript::getGhostscriptCli();
     } catch (\Exception $e) {
         $ghostscriptBin = false;
     }
     $checksApps[] = array("name" => "Ghostscript (CLI)", "state" => $ghostscriptBin ? "ok" : "warning");
     // LibreOffice BIN
     try {
         $libreofficeBin = (bool) \Pimcore\Document\Adapter\LibreOffice::getLibreOfficeCli();
     } catch (\Exception $e) {
         $libreofficeBin = false;
     }
     $checksApps[] = array("name" => "LibreOffice (CLI)", "state" => $libreofficeBin ? "ok" : "warning");
     // PNG optimizer
     try {
         $pngOptimizer = (bool) \Pimcore\Image\Optimizer::getPngOptimizerCli();
     } catch (\Exception $e) {
         $pngOptimizer = false;
     }
     $checksApps[] = array("name" => "PNG Optimizer (pngcrush)", "state" => $pngOptimizer ? "ok" : "warning");
     // JPEG optimizer
     try {
         $jpgOptimizer = (bool) \Pimcore\Image\Optimizer::getJpegOptimizerCli();
     } catch (\Exception $e) {
         $jpgOptimizer = false;
     }
     $checksApps[] = array("name" => "JPEG Optimizer (imgmin, jpegoptim)", "state" => $jpgOptimizer ? "ok" : "warning");
     // timeout binary
     try {
         $timeoutBin = (bool) \Pimcore\Tool\Console::getTimeoutBinary();
     } catch (\Exception $e) {
         $timeoutBin = false;
     }
     $checksApps[] = array("name" => "timeout - (GNU coreutils)", "state" => $timeoutBin ? "ok" : "warning");
     // pdftotext binary
     try {
         $pdftotextBin = (bool) \Pimcore\Document\Adapter\Ghostscript::getPdftotextCli();
     } catch (\Exception $e) {
         $pdftotextBin = false;
     }
     $checksApps[] = array("name" => "pdftotext - (part of poppler-utils)", "state" => $pdftotextBin ? "ok" : "warning");
     $this->view->checksApps = $checksApps;
     $this->view->checksPHP = $checksPHP;
     $this->view->checksMySQL = $checksMySQL;
     $this->view->checksFS = $checksFS;
 }
Exemplo n.º 3
0
 public function indexAction()
 {
     // IE compatibility
     //$this->getResponse()->setHeader("X-UA-Compatible", "IE=8; IE=9", true);
     // clear open edit locks for this session (in the case of a reload, ...)
     \Pimcore\Model\Element\Editlock::clearSession(session_id());
     // check maintenance
     $maintenance_enabled = false;
     $manager = Model\Schedule\Manager\Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = \Zend_Json::encode($maintenance_enabled);
     // configuration
     $sysConfig = Config::getSystemConfig();
     $this->view->config = $sysConfig;
     //mail settings
     $mailIncomplete = false;
     if ($sysConfig->email) {
         if (!$sysConfig->email->debug->emailaddresses) {
             $mailIncomplete = true;
         }
         if (!$sysConfig->email->sender->email) {
             $mailIncomplete = true;
         }
         if ($sysConfig->email->method == "smtp" && !$sysConfig->email->smtp->host) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_complete = \Zend_Json::encode(!$mailIncomplete);
     // report configuration
     $this->view->report_config = Config::getReportConfig();
     // customviews config
     $cvConfig = Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Model\Object::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $upload_mb = min($max_upload, $max_post);
     $this->view->upload_max_filesize = $upload_mb;
     // csrf token
     $user = $this->getUser();
     $this->view->csrfToken = Tool\Session::useSession(function ($adminSession) use($user) {
         if (!isset($adminSession->csrfToken) && !$adminSession->csrfToken) {
             $adminSession->csrfToken = sha1(microtime() . $user->getName() . uniqid());
         }
         return $adminSession->csrfToken;
     });
     if (\Pimcore\Tool\Admin::isExtJS6()) {
         $this->forward("index6");
     }
 }
Exemplo n.º 4
0
 public function indexAction()
 {
     // clear open edit locks for this session (in the case of a reload, ...)
     \Pimcore\Model\Element\Editlock::clearSession(session_id());
     // check maintenance
     $maintenance_enabled = false;
     $manager = Model\Schedule\Manager\Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = \Zend_Json::encode($maintenance_enabled);
     // configuration
     $sysConfig = Config::getSystemConfig();
     $this->view->config = $sysConfig;
     //mail settings
     $mailIncomplete = false;
     if ($sysConfig->email) {
         if (!$sysConfig->email->debug->emailaddresses) {
             $mailIncomplete = true;
         }
         if (!$sysConfig->email->sender->email) {
             $mailIncomplete = true;
         }
         if ($sysConfig->email->method == "smtp" && !$sysConfig->email->smtp->host) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_complete = \Zend_Json::encode(!$mailIncomplete);
     // report configuration
     $this->view->report_config = Config::getReportConfig();
     $cvData = [];
     // still needed when publishing objects
     $cvConfig = Tool::getCustomViewConfig();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             // backwards compatibility
             $treeType = $tmpData["treetype"] ? $tmpData["treetype"] : "object";
             $rootNode = Model\Element\Service::getElementByPath($treeType, $tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = $tmpData["classes"] ? explode(",", $tmpData["classes"]) : null;
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 // Check if a user has privileges to that node
                 if ($rootNode->isAllowed("list")) {
                     $cvData[] = $tmpData;
                 }
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $upload_mb = min($max_upload, $max_post);
     $this->view->upload_max_filesize = $upload_mb;
     // session lifetime (gc)
     $session_gc_maxlifetime = ini_get("session.gc_maxlifetime");
     if (empty($session_gc_maxlifetime)) {
         $session_gc_maxlifetime = 120;
     }
     $this->view->session_gc_maxlifetime = $session_gc_maxlifetime;
     // csrf token
     $user = $this->getUser();
     $this->view->csrfToken = Tool\Session::useSession(function ($adminSession) use($user) {
         if (!isset($adminSession->csrfToken) && !$adminSession->csrfToken) {
             $adminSession->csrfToken = sha1(microtime() . $user->getName() . uniqid());
         }
         return $adminSession->csrfToken;
     });
     if (\Pimcore\Tool\Admin::isExtJS6()) {
         $this->forward("index6");
     }
 }
?>
</h1>
<h2><?php 
echo $titleh2;
?>
</h2>
<div id="plupload_instructions"><p><?php 
echo $intro;
?>
</p></div>
<?php 
if (isset($plupload_max_file_size)) {
    if (is_numeric($plupload_max_file_size)) {
        $sizeText = formatfilesize($plupload_max_file_size);
    } else {
        $sizeText = formatfilesize(filesize2bytes($plupload_max_file_size));
    }
    echo ' ' . sprintf($lang['plupload-maxfilesize'], $sizeText);
}
hook("additionaluploadtext");
if ($allowed_extensions != "") {
    $allowed_extensions = str_replace(", ", ",", $allowed_extensions);
    $list = explode(",", trim($allowed_extensions));
    sort($list);
    $allowed_extensions = implode(",", $list);
    ?>
<p><?php 
    echo str_replace_formatted_placeholder("%extensions", str_replace(",", ", ", $allowed_extensions), $lang['allowedextensions-extensions']);
    ?>
</p><?php 
}
Exemplo n.º 6
0
 public function indexAction()
 {
     $checksPHP = array();
     $checksMySQL = array();
     $checksFS = array();
     // check for memory limit
     $memoryLimit = ini_get("memory_limit");
     $memoryLimit = filesize2bytes($memoryLimit . "B");
     $state = "ok";
     if ($memoryLimit < 134217728) {
         $state = "error";
     } else {
         if ($memoryLimit < 268435456) {
             $state = "warning";
         }
     }
     $checksPHP[] = array("name" => "memory_limit (in php.ini)", "link" => "http://www.php.net/memory_limit", "state" => $state);
     // check for safe_mode
     $safemode = strtolower(ini_get("safe_mode"));
     $checksPHP[] = array("name" => "safe_mode (in php.ini)", "link" => "http://www.php.net/safe_mode", "state" => $safemode == "on" ? "error" : "ok");
     // mcrypt
     $checksPHP[] = array("name" => "mcrypt", "link" => "http://www.php.net/mcrypt", "state" => function_exists("mcrypt_encrypt") ? "ok" : "error");
     // pdo_mysql
     $checksPHP[] = array("name" => "PDO_Mysql", "link" => "http://www.php.net/pdo_mysql", "state" => @constant("PDO::MYSQL_ATTR_FOUND_ROWS") ? "ok" : "error");
     // pdo_mysql
     $checksPHP[] = array("name" => "Mysqli", "link" => "http://www.php.net/mysqli", "state" => class_exists("mysqli") ? "ok" : "error");
     // iconv
     $checksPHP[] = array("name" => "iconv", "link" => "http://www.php.net/iconv", "state" => function_exists("iconv") ? "ok" : "error");
     // dom
     $checksPHP[] = array("name" => "dom", "link" => "http://www.php.net/dom", "state" => class_exists("DOMDocument") ? "ok" : "error");
     // simplexml
     $checksPHP[] = array("name" => "SimpleXML", "link" => "http://www.php.net/simplexml", "state" => class_exists("SimpleXMLElement") ? "ok" : "error");
     // gd
     $checksPHP[] = array("name" => "GD", "link" => "http://www.php.net/gd", "state" => function_exists("gd_info") ? "ok" : "error");
     // multibyte support
     $checksPHP[] = array("name" => "Multibyte String (mbstring)", "link" => "http://www.php.net/mbstring", "state" => function_exists("mb_get_info") ? "ok" : "error");
     // zip
     $checksPHP[] = array("name" => "zip", "link" => "http://www.php.net/zip", "state" => class_exists("ZipArchive") ? "ok" : "error");
     // gzip
     $checksPHP[] = array("name" => "zlib / gzip", "link" => "http://www.php.net/zlib", "state" => function_exists("gzcompress") ? "ok" : "error");
     // bzip
     $checksPHP[] = array("name" => "Bzip2", "link" => "http://www.php.net/bzip2", "state" => function_exists("bzcompress") ? "ok" : "error");
     // openssl
     $checksPHP[] = array("name" => "OpenSSL", "link" => "http://www.php.net/openssl", "state" => function_exists("openssl_open") ? "ok" : "error");
     // Imagick
     $checksPHP[] = array("name" => "Imagick", "link" => "http://www.php.net/imagick", "state" => class_exists("Imagick") ? "ok" : "warning");
     // APC
     $checksPHP[] = array("name" => "APC", "link" => "http://www.php.net/apc", "state" => function_exists("apc_add") ? "ok" : "warning");
     // memcache
     $checksPHP[] = array("name" => "Memcache", "link" => "http://www.php.net/memcache", "state" => class_exists("Memcache") ? "ok" : "warning");
     // PCNTL
     $checksPHP[] = array("name" => "PCNTL", "link" => "http://www.php.net/pcntl", "state" => function_exists("pcntl_exec") ? "ok" : "warning");
     // soap
     $checksPHP[] = array("name" => "Soap", "link" => "http://www.php.net/soap", "state" => class_exists("SoapClient") ? "ok" : "warning");
     // curl for google api sdk
     $checksPHP[] = array("name" => "curl", "link" => "http://www.php.net/curl", "state" => function_exists("curl_init") ? "ok" : "warning");
     $db = null;
     if ($this->_getParam("mysql_adapter")) {
         // this is before installing
         try {
             $db = Zend_Db::factory($this->_getParam("mysql_adapter"), array('host' => $this->_getParam("mysql_host"), 'username' => $this->_getParam("mysql_username"), 'password' => $this->_getParam("mysql_password"), 'dbname' => $this->_getParam("mysql_database"), "port" => $this->_getParam("mysql_port")));
             $db->getConnection();
         } catch (Exception $e) {
             $db = null;
         }
     } else {
         // this is after installing, eg. after a migration, ...
         $db = Pimcore_Resource::get();
     }
     if ($db) {
         // storage engines
         $engines = array();
         $enginesRaw = $db->fetchAll("SHOW ENGINES;");
         foreach ($enginesRaw as $engineRaw) {
             $engines[] = strtolower($engineRaw["Engine"]);
         }
         // innodb
         $checksMySQL[] = array("name" => "InnoDB Support", "state" => in_array("innodb", $engines) ? "ok" : "error");
         // myisam
         $checksMySQL[] = array("name" => "MyISAM Support", "state" => in_array("myisam", $engines) ? "ok" : "error");
         // memory
         $checksMySQL[] = array("name" => "MEMORY Support", "state" => in_array("memory", $engines) ? "ok" : "error");
         // check database charset =>  utf-8 encoding
         $result = $db->fetchRow('SHOW VARIABLES LIKE "character\\_set\\_database"');
         $checksMySQL[] = array("name" => "Database Charset UTF8", "state" => $result['Value'] == "utf8" ? "ok" : "error");
         // create table
         $queryCheck = true;
         try {
             $db->query("CREATE TABLE __pimcore_req_check (\r\n                  id int(11) NOT NULL AUTO_INCREMENT,\r\n                  field varchar(255) CHARACTER SET latin1 NULL DEFAULT NULL,\r\n                  PRIMARY KEY (id)\r\n                ) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "CREATE TABLE", "state" => $queryCheck ? "ok" : "error");
         // alter table
         $queryCheck = true;
         try {
             $db->query("ALTER TABLE __pimcore_req_check ADD COLUMN alter_field varchar(255) NULL DEFAULT NULL");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "ALTER TABLE", "state" => $queryCheck ? "ok" : "error");
         // Manage indexes
         $queryCheck = true;
         try {
             $db->query("ALTER TABLE __pimcore_req_check\r\n                  CHANGE COLUMN id id int(11) NOT NULL,\r\n                  CHANGE COLUMN field field varchar(255) NULL DEFAULT NULL,\r\n                  CHANGE COLUMN alter_field alter_field varchar(255) NULL DEFAULT NULL,\r\n                  ADD INDEX field (field(255)),\r\n                  DROP PRIMARY KEY ,\r\n                 DEFAULT CHARSET=utf8");
             $db->query("ALTER TABLE __pimcore_req_check\r\n                  CHANGE COLUMN id id int(11) NOT NULL AUTO_INCREMENT,\r\n                  CHANGE COLUMN field field varchar(255) NULL DEFAULT NULL,\r\n                  CHANGE COLUMN alter_field alter_field varchar(255) NULL DEFAULT NULL,\r\n                  ADD PRIMARY KEY (id) ,\r\n                 DEFAULT CHARSET=utf8");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "Manage Indexes", "state" => $queryCheck ? "ok" : "error");
         // insert data
         $queryCheck = true;
         try {
             $db->insert("__pimcore_req_check", array("field" => uniqid(), "alter_field" => uniqid()));
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "INSERT", "state" => $queryCheck ? "ok" : "error");
         // update
         $queryCheck = true;
         try {
             $db->update("__pimcore_req_check", array("field" => uniqid(), "alter_field" => uniqid()));
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "UPDATE", "state" => $queryCheck ? "ok" : "error");
         // select
         $queryCheck = true;
         try {
             $db->fetchAll("SELECT * FROM __pimcore_req_check");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SELECT", "state" => $queryCheck ? "ok" : "error");
         // create view
         $queryCheck = true;
         try {
             $db->query("CREATE OR REPLACE VIEW __pimcore_req_check_view AS SELECT * FROM __pimcore_req_check");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "CREATE VIEW", "state" => $queryCheck ? "ok" : "error");
         // select from view
         $queryCheck = true;
         try {
             $db->fetchAll("SELECT * FROM __pimcore_req_check_view");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SELECT (from view)", "state" => $queryCheck ? "ok" : "error");
         // delete
         $queryCheck = true;
         try {
             $db->delete("__pimcore_req_check");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DELETE", "state" => $queryCheck ? "ok" : "error");
         // show create view
         $queryCheck = true;
         try {
             $db->query("SHOW CREATE VIEW __pimcore_req_check_view");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SHOW CREATE VIEW", "state" => $queryCheck ? "ok" : "error");
         // show create table
         $queryCheck = true;
         try {
             $db->query("SHOW CREATE TABLE __pimcore_req_check");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "SHOW CREATE TABLE", "state" => $queryCheck ? "ok" : "error");
         // drop view
         $queryCheck = true;
         try {
             $db->query("DROP VIEW __pimcore_req_check_view");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DROP VIEW", "state" => $queryCheck ? "ok" : "error");
         // drop table
         $queryCheck = true;
         try {
             $db->query("DROP TABLE __pimcore_req_check");
         } catch (Exception $e) {
             $queryCheck = false;
         }
         $checksMySQL[] = array("name" => "DROP TABLE", "state" => $queryCheck ? "ok" : "error");
     } else {
         die("Not possible... no or wrong database settings given.<br />Please fill out the MySQL Settings in the install form an click again on `Check Requirements´");
     }
     // filesystem checks
     // website/var writable
     $websiteVarWritable = true;
     $files = rscandir(PIMCORE_WEBSITE_PATH . "/var");
     foreach ($files as $file) {
         if (!is_writable($file)) {
             $websiteVarWritable = false;
         }
     }
     $checksFS[] = array("name" => "/website/var/ writeable", "state" => $websiteVarWritable ? "ok" : "error");
     // pimcore writeable
     $checksFS[] = array("name" => "/pimcore/ writeable", "state" => Pimcore_Update::isWriteable() ? "ok" : "warning");
     $this->view->checksPHP = $checksPHP;
     $this->view->checksMySQL = $checksMySQL;
     $this->view->checksFS = $checksFS;
 }