public function getUpdateInformationAction() { $id = $this->_getParam("id"); $type = $this->_getParam("type"); if ($type == "plugin") { $extensionPath = PIMCORE_PLUGINS_PATH . "/" . $id; } else { if ($type = "brick") { $extensionPath = PIMCORE_WEBSITE_PATH . "/var/areas/" . $id; } } $remoteConfig = array("token" => Pimcore_Liveconnect::getToken(), "id" => $id, "type" => $type, "revision" => trim(file_get_contents($extensionPath . "/.pimcore_extension_revision"))); $rawData = Pimcore_Tool::getHttpData("http://extensions.pimcore.org/update/getUpdateInformation.php", null, array("data" => base64_encode(serialize($remoteConfig)))); if (!$rawData) { header('HTTP/1.1 403 Forbidden'); exit; } $steps = array(); $numberOfFiles = 0; $data = Zend_Json::decode($rawData); foreach ($data["revisions"] as $revision) { foreach ($revision["files"] as $file) { $steps[] = array("action" => $file["action"], "controller" => "download", "params" => array("id" => $id, "type" => $type, "path" => $file["path"], "revision" => $file["revision"])); $numberOfFiles++; } $steps[] = array("action" => "check-update-script", "controller" => "update", "params" => array("id" => $id, "type" => $type, "revision" => $revision["revision"])); } $this->_helper->json(array("steps" => $steps, "fileAmount" => $numberOfFiles)); }
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); } }
public function downloadFileAction() { $id = $this->_getParam("id"); $type = $this->_getParam("type"); $path = $this->_getParam("path"); $revision = $this->_getParam("revision"); $remoteConfig = $this->_getAllParams(); $remoteConfig["token"] = Pimcore_Liveconnect::getToken(); $rawData = Pimcore_Tool::getHttpData("http://extensions.pimcore.org/download/downloadFile.php?data=" . base64_encode(serialize($remoteConfig))); if (!$rawData) { header('HTTP/1.1 403 Forbidden'); exit; } $file = Zend_Json::decode($rawData); if ($type == "plugin") { $parentPath = PIMCORE_PLUGINS_PATH; } else { if ($type == "brick") { $parentPath = PIMCORE_WEBSITE_PATH . "/var/areas"; } } if (!is_dir($parentPath)) { mkdir($parentPath, 0755, true); } $fileDestPath = $parentPath . $path; if (!is_dir(dirname($fileDestPath))) { mkdir(dirname($fileDestPath), 0755, true); } file_put_contents($fileDestPath, base64_decode($file["content"])); chmod($fileDestPath, 0766); // write revision information $revisionFile = $parentPath . "/" . $id . "/.pimcore_extension_revision"; file_put_contents($revisionFile, $revision); chmod($revisionFile, 0766); $this->_helper->json(array("success" => true)); }
public function verifyUploadAction() { $client = Pimcore_Tool::getHttpClient(); $client->setParameterPost("data", base64_encode(Pimcore_Tool_Serialize::serialize(array("id" => $this->_getParam("id"), "type" => $this->_getParam("type"), "token" => Pimcore_Liveconnect::getToken())))); $client->setUri("http://extensions.pimcore.org/share/verifyUpload.php"); $response = $client->request(Zend_Http_Client::POST); $this->_helper->json(array("success" => true)); }
public function liveconnectAction() { $token = $this->_getParam("token"); Pimcore_Liveconnect::setToken($token); $this->view->token = $token; }