Esempio n. 1
0
 public function infoAction()
 {
     $quota = new \Cms\Quota();
     $serverData = array('mode' => CmsVersion::getMode(), 'maxUploadSize' => $this->getMaxUploadSize(), 'urls' => $this->getPublicUrlEndpoints(), 'quota' => $quota->toArray(), 'supportedPublishTypes' => $this->getSupportedPublishTypes(), 'language' => Registry::getConfig()->translation->default);
     $this->responseData->setData(new ServerInfoResponse($serverData));
     // XHR request
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
         // return as json
         $this->setResponseType(self::RESPONSE_TYPE_JSON);
         return;
     }
     // return as javascript
     $this->setResponseType(self::RESPONSE_TYPE_JS_VAR, array('name' => 'CMSSERVER'));
     return;
 }
Esempio n. 2
0
 /**
  * copy an existing website under a new name
  *
  * @param int    $id
  * @param string $newname
  *
  * @return mixed
  */
 public function copy($id, $newname)
 {
     $this->checkWebsiteMaxCountQuota();
     $attributes = array('name' => $newname);
     /** @var $website \Cms\Data\Website */
     $website = $this->execute('copy', array($id, $attributes, \Cms\Version::getMode()));
     $this->createWebsiteDirectories($website->getId());
     return $website;
 }
Esempio n. 3
0
 /**
  * @param array   $attributes
  * @param boolean $useAttributesId
  *
  * @return \Orm\Entity\Website
  */
 public function create($attributes, $useAttributesId = false)
 {
     $website = new Website();
     try {
         if ($useAttributesId && isset($attributes['id'])) {
             $website->setId($attributes['id']);
         } else {
             $website->setNewGeneratedId();
         }
         $website->setShortId($this->createShortId());
         $this->setAttributesToWebsite($attributes, $website);
         $website->setCreationMode(\Cms\Version::getMode());
         $website->setMarkedForDeletion(false);
         $this->getEntityManager()->persist($website);
         $this->getEntityManager()->flush();
         $this->getEntityManager()->refresh($website);
     } catch (Exception $e) {
         throw new CmsException(606, __METHOD__, __LINE__, null, $e);
     }
     return $website;
 }