/**
  * @return mixed
  */
 public function getContent()
 {
     if ($this->user->isAdmin() === false) {
         return false;
     }
     if ($this->request->isPost()) {
         $cmd = $this->request->post('cmd', null);
         if (method_exists($this, $cmd)) {
             return $this->{$cmd}();
         }
         $this->response->finish();
     }
     $extensions = $this->db->getRepository('\\Fraym\\Registry\\Entity\\Registry')->findBy(array(), array('name' => 'asc'));
     $unregisteredExtensions = $this->registryManager->getUnregisteredExtensions();
     $extensionUpdates = new \Doctrine\Common\Collections\ArrayCollection();
     $updates = $this->registryManager->getUpdates($extensions);
     if (is_object($updates)) {
         foreach ($updates as $k => $update) {
             $extensionUpdates->set($k, $update);
         }
     }
     $this->view->assign('unregisteredExtensions', $unregisteredExtensions);
     $this->view->assign('extensions', $extensions);
     $this->view->assign('extensionUpdates', $extensionUpdates);
     return $this->siteManagerController->getIframeContent($this->template->fetch('Extension'));
 }
 /**
  * @return bool|mixed
  */
 public function getContent()
 {
     if ($this->user->isAdmin() === false) {
         return false;
     }
     $this->view->assign('sites', $this->blockChangeSetManager->getSites());
     $this->view->assign('changeSets', $this->blockChangeSetManager->getChangeSets(), false);
     return $this->siteManagerController->getIframeContent($this->view->fetch('BlockChangeSetManager'));
 }
 /**
  * @return bool|mixed
  */
 public function getContent()
 {
     if ($this->user->isAdmin() === false) {
         return false;
     }
     $currentEntity = false;
     $errors = false;
     $data = array();
     $formFields = array();
     $entities = array();
     $modelClass = false;
     $model = false;
     $modelName = $this->request->gp('model', false);
     $groupedModels = $this->db->getRepository('\\Fraym\\EntityManager\\Entity\\Group')->findAll();
     if ($modelName) {
         $model = $this->entityManager->getEntityByStringOrId($modelName);
         if ($model) {
             $modelClass = $model->className;
         }
     }
     if ($this->request->isXmlHttpRequest()) {
         return $this->createEntityFromSingleField($modelClass);
     }
     if ($modelClass && $this->request->isPost()) {
         $data = $this->request->getGPAsArray();
         $validation = $this->validation->setData($data)->getFormFieldValidation($modelClass);
         if ($id = $this->request->post('id')) {
             $currentEntity = $this->db->getRepository($modelClass)->findOneById($id);
             if (isset($data['cmd']) && $data['cmd'] == 'update' && $currentEntity && ($errors = $validation->check()) === true) {
                 $currentEntity->updateEntity($data);
             } elseif (isset($data['cmd']) && $data['cmd'] == 'remove' && $currentEntity) {
                 $this->db->remove($currentEntity);
                 $this->db->flush();
                 $data = array();
                 $currentEntity = false;
             } elseif (isset($data['cmd']) && $data['cmd'] == 'update') {
                 $currentEntity->updateEntity($data, false);
             }
         } else {
             if (isset($data['cmd']) && $data['cmd'] == 'new' && ($errors = $validation->check()) === true) {
                 $currentEntity = new $modelClass();
                 $currentEntity->updateEntity($data);
             }
         }
     }
     if ($modelClass && $model) {
         $entities = $this->db->getRepository($modelClass)->findAll();
         $formFields = $this->formField->setClassName($modelClass)->getFields();
     }
     $this->view->assign('locales', $this->locale->getLocales());
     $this->view->assign('data', $data);
     $this->view->assign('errors', $errors);
     $this->view->assign('currentEntity', $currentEntity);
     $this->view->assign('entities', $entities);
     $this->view->assign('groupedModels', $groupedModels);
     $this->view->assign('model', $model);
     $this->view->assign('formFields', $formFields);
     return $this->siteManagerController->getIframeContent($this->template->fetch('EntityView'));
 }
Example #4
0
 /**
  * LogOut function for Users. It unsets the session.
  *
  * @return mixed
  */
 public function viewlogOut()
 {
     if ($this->request->isPost() && $this->request->post('logout', false) == '1') {
         $this->user->logout();
         $this->checkLoginRedirectConfig();
     }
     $this->view->assign('user', $this->user);
     if ($this->xml === false) {
         return $this->siteManagerController->getIframeContent($this->view->fetch('AdminArea'), ['cssClass' => 'admin-login']);
     } else {
         $this->view->setTemplate('LogOut');
     }
 }
Example #5
0
 /**
  * @return mixed
  */
 public function getContent()
 {
     if ($this->user->isAdmin() === false) {
         return false;
     }
     if ($this->request->isPost()) {
         $cmd = $this->request->post('cmd', null);
         if (method_exists($this, $cmd)) {
             return $this->{$cmd}();
         }
         $this->response->finish();
     }
     $extensions = $this->db->getRepository('\\Fraym\\Registry\\Entity\\Registry')->findBy([], ['name' => 'asc']);
     $updates = $this->registryManager->getUpdates($extensions);
     $extensionPackages = $this->registryManager->getExtensionPackages($extensions);
     $unregisteredExtensions = $this->registryManager->getUnregisteredExtensions();
     $this->registryManager->updateUnregisteredExtensions($unregisteredExtensions);
     $this->view->assign('unregisteredExtensions', $unregisteredExtensions);
     $this->view->assign('extensions', $extensions);
     $this->view->assign('extensionPackages', $extensionPackages, false);
     $this->view->assign('extensionUpdates', $updates, false);
     return $this->siteManagerController->getIframeContent($this->view->fetch('Extension'));
 }
Example #6
0
 /**
  * Block config
  *
  * @Fraym\Annotation\Route("/fraym/admin/block", name="block", permission={"\Fraym\User\User"="isAdmin"})
  * @return mixed
  */
 public function renderBlock()
 {
     $contentId = $this->request->gp('contentId');
     $blockTemplates = $this->db->getRepository('\\Fraym\\Block\\Entity\\Template')->findBy([], ['name' => 'asc']);
     $extensions = $this->db->getRepository('\\Fraym\\Block\\Entity\\Extension')->findBy([], ['name' => 'asc']);
     $users = $this->db->getRepository('\\Fraym\\User\\Entity\\User')->findBy([], ['username' => 'asc']);
     $userGroups = $this->db->getRepository('\\Fraym\\User\\Entity\\Group')->findBy([], ['name' => 'asc']);
     $this->view->assign('blockTemplates', $blockTemplates);
     $this->view->assign('users', $users);
     $this->view->assign('userGroups', $userGroups);
     $this->view->assign('extensions', $extensions);
     $this->view->assign('contentId', $contentId);
     return $this->siteManagerController->getIframeContent($this->view->fetch('BlockIframeContent'));
 }
Example #7
0
 /**
  * @Fraym\Annotation\Route("/fraym/admin/menu/selection", name="menuSelection", permission={"\Fraym\User\User"="isAdmin"})
  * @return bool|mixed
  */
 public function getContent()
 {
     if ($this->request->isXmlHttpRequest()) {
         return $this->ajaxHandler();
     } else {
         $this->view->assign('sites', $this->db->getRepository('\\Fraym\\Site\\Entity\\Site')->findAll());
         $params = $this->request->getGPAsArray();
         if (isset($params['function'])) {
             return $this->addAndEditMenuItem($params);
         }
         $mode = $this->request->gp('mode', false);
         $this->view->assign('mode', $mode);
         return $this->siteManager->getIframeContent($this->view->fetch('SiteMenuOverview'));
     }
 }
Example #8
0
 /**
  * Block config
  *
  * @return mixed
  */
 public function renderBlock()
 {
     if ($this->user->isAdmin() === false) {
         return;
     }
     $contentId = $this->request->gp('contentId');
     $blockTemplates = $this->db->getRepository('\\Fraym\\Block\\Entity\\BlockTemplate')->findBy(array(), array('name' => 'asc'));
     $extensions = $this->db->getRepository('\\Fraym\\Block\\Entity\\BlockExtension')->findBy(array(), array('name' => 'asc'));
     $users = $this->db->getRepository('\\Fraym\\User\\Entity\\User')->findBy(array(), array('username' => 'asc'));
     $userGroups = $this->db->getRepository('\\Fraym\\User\\Entity\\Group')->findBy(array(), array('name' => 'asc'));
     $this->view->assign('blockTemplates', $blockTemplates);
     $this->view->assign('users', $users);
     $this->view->assign('userGroups', $userGroups);
     $this->view->assign('extensions', $extensions);
     $this->view->assign('contentId', $contentId);
     return $this->siteManagerController->getIframeContent($this->template->fetch('BlockIframeContent.tpl'));
 }
Example #9
0
 /**
  * @return mixed
  */
 public function fileViewer()
 {
     if ($this->user->isAdmin() === false) {
         return;
     }
     $fileContent = $this->request->post('fileContent', false);
     $storage = $this->request->gp('storage');
     $path = $this->request->gp('path');
     $cmd = $this->request->gp('cmd');
     $cropOpt = $this->request->gp('cropOpt');
     $fullPath = $this->fileManager->pathExists($storage, $path);
     if ($fullPath) {
         $content = '';
         $inlineImage = null;
         if (is_file($fullPath)) {
             if ($fileContent) {
                 file_put_contents($fullPath, $fileContent);
             }
             $content = file_get_contents($fullPath);
         }
         $pathinfo = pathinfo($fullPath);
         if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], array('png', 'gif', 'jpg', 'jpeg', 'bmp', 'tiff'))) {
             if ($cmd === 'crop') {
                 $cropFilename = dirname($fullPath) . DIRECTORY_SEPARATOR . 'crop_' . implode('_', $cropOpt) . basename($fullPath);
                 /**
                  * var \Imagine\Gd\Imagine $imagine
                  */
                 $imagine = $this->serviceLocator->get('Imagine');
                 $image = $imagine->open($fullPath);
                 $image->crop(new \Imagine\Image\Point($cropOpt['x'], $cropOpt['y']), new \Imagine\Image\Box($cropOpt['w'], $cropOpt['h']))->save($cropFilename);
                 $fullPath = $cropFilename;
             }
             $size = getimagesize($fullPath);
             $inlineImage = 'data:' . $size['mime'] . ';base64,' . base64_encode(file_get_contents($fullPath));
         }
         $this->view->assign('inlineImage', $inlineImage);
         $this->view->assign('storage', $storage);
         $this->view->assign('file', basename($fullPath));
         $this->view->assign('path', $path);
         $this->view->assign('content', $content);
     }
     return $this->siteManagerController->getIframeContent($this->view->fetch('FileViewer'));
 }
Example #10
0
 /**
  *
  */
 public function getContent()
 {
     $values = array();
     $errors = array();
     $result = array();
     if ($this->request->isPost()) {
         $fields = $this->request->post('field');
         $this->validation->setData($fields);
         $this->validation->addRule('email', 'email')->addRule('subject', 'notEmpty')->addRule('name', 'notEmpty')->addRule('description', 'notEmpty')->addRule('reproduce', 'notEmpty');
         $check = $this->validation->check();
         if ($check === true) {
             $params = array('fields' => $fields, 'client_info' => array('version' => \Fraym\Core::VERSION, 'php_version' => phpversion(), 'os' => php_uname('s'), 'apc_enabled' => APC_ENABLED, 'image_processor' => IMAGE_PROCESSOR, 'server' => $_SERVER, 'env' => ENV));
             $result = $this->request->send(self::BUGREPORT_URL, $params);
         } else {
             $errors = $check;
         }
     }
     $this->view->assign('result', $result);
     $this->view->assign('values', $values);
     $this->view->assign('errors', $errors);
     return $this->siteManagerController->getIframeContent($this->view->fetch('BugReport'));
 }