Ejemplo n.º 1
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('userId', $properties)) {
         $value = Util\Converter::int('userId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUserId($value);
         }
     }
     if (!isset($properties) || in_array('signIn', $properties)) {
         $value = Util\Converter::string('signIn' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSignIn($value);
         }
     }
     if (!isset($properties) || in_array('secure', $properties)) {
         $value = Util\Converter::string('secure' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSecure($value);
         }
     }
     if (!isset($properties) || in_array('type', $properties)) {
         $value = Util\Converter::int('type' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setType($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 2
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('parentId', $properties)) {
         $value = Util\Converter::int('parentId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setParentId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('displayOrder', $properties)) {
         $value = Util\Converter::int('displayOrder' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDisplayOrder($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 3
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('moduleId', $properties)) {
         $value = Util\Converter::int('moduleId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setModuleId($value);
         }
     }
     if (!isset($properties) || in_array('field', $properties)) {
         $value = Util\Converter::string('field' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setField($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 4
0
 public function setFromPost($properties = null)
 {
     parent::setFromPost($properties);
     if (!isset($properties) || in_array('appId', $properties)) {
         $value = Util\Converter::int('appId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAppId($value);
         }
     }
     if (!isset($properties) || in_array('mediaId', $properties)) {
         $value = Util\Converter::int('mediaId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMediaId($value);
         }
     }
     if (!isset($properties) || in_array('description', $properties)) {
         $value = Util\Converter::string('description' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDescription($value);
         }
     }
     if (!isset($properties) || in_array('displayOrder', $properties)) {
         $value = Util\Converter::int('displayOrder' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDisplayOrder($value);
         }
     }
     return $this;
 }
Ejemplo n.º 5
0
 public function detail()
 {
     $this->setBaseTpl();
     // auth
     Auth::isAdminAuthorized($this->signedUser, null, true, '/profile/sign-in');
     $logId = Converter::int('id');
     if ($logId == 0) {
         return $this->generic();
     }
     if ($this->app->logLevel() == 1) {
         return $this->generic();
     }
     $log = \Rebond\Core\Log\Data::loadById($logId);
     if (!isset($log)) {
         return $this->generic();
     }
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     // main
     $this->tplMain->set('log', $log);
     $this->tplMain->set('referer', $referer);
     // layout
     $this->tplLayout->set('column1', $this->tplMain->render('detail'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     return $this->tplMaster->render('tpl-error');
 }
Ejemplo n.º 6
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('summary', $properties)) {
         $value = Util\Converter::string('summary' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSummary($value);
         }
     }
     if (!isset($properties) || in_array('workflow', $properties)) {
         $value = Util\Converter::int('workflow' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setWorkflow($value);
         }
     }
     if (!isset($properties) || in_array('hasFilter', $properties)) {
         $value = Util\Converter::bool('hasFilter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHasFilter($value);
         }
     }
     if (!isset($properties) || in_array('hasContent', $properties)) {
         $value = Util\Converter::bool('hasContent' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHasContent($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 7
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('roleId', $properties)) {
         $value = Util\Converter::int('roleId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setRoleId($value);
         }
     }
     if (!isset($properties) || in_array('permissionId', $properties)) {
         $value = Util\Converter::int('permissionId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPermissionId($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 8
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('summary', $properties)) {
         $value = Util\Converter::string('summary' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSummary($value);
         }
     }
     if (!isset($properties) || in_array('filename', $properties)) {
         $value = Util\Converter::string('filename' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFilename($value);
         }
     }
     if (!isset($properties) || in_array('columns', $properties)) {
         $value = Util\Converter::int('columns' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setColumns($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 9
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('userId', $properties)) {
         $value = Util\Converter::int('userId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUserId($value);
         }
     }
     if (!isset($properties) || in_array('mediaView', $properties)) {
         $value = Util\Converter::int('mediaView' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMediaView($value);
         }
     }
     if (!isset($properties) || in_array('mediaPaging', $properties)) {
         $value = Util\Converter::int('mediaPaging' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMediaPaging($value);
         }
     }
     if (!isset($properties) || in_array('contentPaging', $properties)) {
         $value = Util\Converter::int('contentPaging' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setContentPaging($value);
         }
     }
     if (!isset($properties) || in_array('paging', $properties)) {
         $value = Util\Converter::int('paging' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPaging($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 10
0
 public function detail()
 {
     if ($this->app->logLevel() == 1) {
         return self::generic();
     }
     $logId = Util\Converter::int('id');
     if ($logId == 0) {
         return self::generic();
     }
     $log = \Rebond\Core\Log\Data::loadById($logId);
     if (!isset($log)) {
         return self::generic();
     }
     $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
     // main
     $tpl = new Util\Template(Util\Template::MODULE, ['app', 'error']);
     $tpl->set('log', $log);
     $tpl->set('referer', $referer);
     $tpl->set('adminUrl', \Rebond\Config::getPath('adminUrl'));
     return $tpl->render('detail');
 }
Ejemplo n.º 11
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('summary', $properties)) {
         $value = Util\Converter::string('summary' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSummary($value);
         }
     }
     if (!isset($properties) || in_array('filename', $properties)) {
         $value = Util\Converter::string('filename' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFilename($value);
         }
     }
     if (!isset($properties) || in_array('menu', $properties)) {
         $value = Util\Converter::int('menu' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMenu($value);
         }
     }
     if (!isset($properties) || in_array('menuLevel', $properties)) {
         $value = Util\Converter::int('menuLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMenuLevel($value);
         }
     }
     if (!isset($properties) || in_array('inBreadcrumb', $properties)) {
         $value = Util\Converter::bool('inBreadcrumb' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInBreadcrumb($value);
         }
     }
     if (!isset($properties) || in_array('sideNav', $properties)) {
         $value = Util\Converter::int('sideNav' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSideNav($value);
         }
     }
     if (!isset($properties) || in_array('sideNavLevel', $properties)) {
         $value = Util\Converter::int('sideNavLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSideNavLevel($value);
         }
     }
     if (!isset($properties) || in_array('inFooter', $properties)) {
         $value = Util\Converter::bool('inFooter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInFooter($value);
         }
     }
     if (!isset($properties) || in_array('footerLevel', $properties)) {
         $value = Util\Converter::int('footerLevel' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFooterLevel($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 12
0
 public function media_link_edit()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.cms.media-link', true, '/cms/media-link');
     // check
     $id = Converter::int('id');
     $moduleMedia = \Rebond\Cms\ModuleMedia\Data::loadById($id, true);
     $form = new \Rebond\Cms\ModuleMedia\Form($moduleMedia);
     // action
     if (isset($_POST['save'])) {
         Auth::isAdminAuthorized($this->signedUser, 'admin.cms.media-link.edit', true, '/cms/media-link-edit?id=' . $id);
         if ($form->setFromPost()->validate()->isValid()) {
             $moduleMedia->save();
             Session::adminSuccess('saved', '/cms/media_link');
         } else {
             Session::set('adminError', $form->getValidation()->getMessage());
         }
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Template(Template::MODULE, ['cms', 'moduleMedia']);
     $tplMain->set('item', $form);
     // layout
     if (Auth::isAdminAuthorized($this->signedUser, 'admin.cms.media-link.edit', false)) {
         $this->tplLayout->set('column1', $tplMain->render('editor'));
     } else {
         $this->tplLayout->set('column1', $tplMain->render('view'));
     }
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 13
0
 public function permission_edit()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.user.permission', true, '/user');
     // check
     $id = Converter::int('id');
     $save = Converter::int('save', 'post');
     $permission = \Rebond\Core\Permission\Data::loadById($id, true);
     $form = new \Rebond\Core\Permission\Form($permission);
     // action
     if (isset($save)) {
         Auth::isAdminAuthorized($this->signedUser, 'admin.user.permission.edit', true, '/user/permission-edit?id=' . $id);
         if ($form->setFromPost()->validate()->isValid()) {
             $permission->save();
             Session::adminSuccess('saved', '/user/permission');
         } else {
             Session::set('adminError', $form->getValidation()->getMessage());
         }
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Template(Template::MODULE, ['core', 'permission']);
     $tplMain->set('item', $form);
     // layout
     if (Auth::isAdminAuthorized($this->signedUser, 'admin.user.permission.edit', false)) {
         $this->tplLayout->set('column1', $tplMain->render('editor'));
     } else {
         $this->tplLayout->set('column1', $tplMain->render('view'));
     }
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 14
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('parentId', $properties)) {
         $value = Util\Converter::int('parentId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setParentId($value);
         }
     }
     if (!isset($properties) || in_array('templateId', $properties)) {
         $value = Util\Converter::int('templateId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTemplateId($value);
         }
     }
     if (!isset($properties) || in_array('layoutId', $properties)) {
         $value = Util\Converter::int('layoutId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setLayoutId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('css', $properties)) {
         $value = Util\Converter::string('css' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCss($value);
         }
     }
     if (!isset($properties) || in_array('js', $properties)) {
         $value = Util\Converter::string('js' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setJs($value);
         }
     }
     if (!isset($properties) || in_array('inNavHeader', $properties)) {
         $value = Util\Converter::bool('inNavHeader' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavHeader($value);
         }
     }
     if (!isset($properties) || in_array('inNavSide', $properties)) {
         $value = Util\Converter::bool('inNavSide' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavSide($value);
         }
     }
     if (!isset($properties) || in_array('inSitemap', $properties)) {
         $value = Util\Converter::bool('inSitemap' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInSitemap($value);
         }
     }
     if (!isset($properties) || in_array('inBreadcrumb', $properties)) {
         $value = Util\Converter::bool('inBreadcrumb' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInBreadcrumb($value);
         }
     }
     if (!isset($properties) || in_array('inNavFooter', $properties)) {
         $value = Util\Converter::bool('inNavFooter' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setInNavFooter($value);
         }
     }
     if (!isset($properties) || in_array('friendlyUrlPath', $properties)) {
         $value = Util\Converter::string('friendlyUrlPath' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFriendlyUrlPath($value);
         }
     }
     if (!isset($properties) || in_array('friendlyUrl', $properties)) {
         $value = Util\Converter::string('friendlyUrl' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFriendlyUrl($value);
         }
     }
     if (!isset($properties) || in_array('redirect', $properties)) {
         $value = Util\Converter::string('redirect' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setRedirect($value);
         }
     }
     if (!isset($properties) || in_array('class', $properties)) {
         $value = Util\Converter::string('class' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setClass($value);
         }
     }
     if (!isset($properties) || in_array('permission', $properties)) {
         $value = Util\Converter::string('permission' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPermission($value);
         }
     }
     if (!isset($properties) || in_array('displayOrder', $properties)) {
         $value = Util\Converter::int('displayOrder' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDisplayOrder($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 15
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('code', $properties)) {
         $value = Util\Converter::int('code' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCode($value);
         }
     }
     if (!isset($properties) || in_array('userId', $properties)) {
         $value = Util\Converter::int('userId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUserId($value);
         }
     }
     if (!isset($properties) || in_array('ip', $properties)) {
         $value = Util\Converter::string('ip' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIp($value);
         }
     }
     if (!isset($properties) || in_array('requestUri', $properties)) {
         $value = Util\Converter::string('requestUri' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setRequestUri($value);
         }
     }
     if (!isset($properties) || in_array('referer', $properties)) {
         $value = Util\Converter::string('referer' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setReferer($value);
         }
     }
     if (!isset($properties) || in_array('message', $properties)) {
         $value = Util\Converter::string('message' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMessage($value);
         }
     }
     if (!isset($properties) || in_array('trace', $properties)) {
         $value = Util\Converter::string('trace' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTrace($value);
         }
     }
     if (!isset($properties) || in_array('file', $properties)) {
         $value = Util\Converter::string('file' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFile($value);
         }
     }
     if (!isset($properties) || in_array('line', $properties)) {
         $value = Util\Converter::int('line' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setLine($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 16
0
 public function quickedit()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.tools', true, '/');
     // check
     $module = Converter::string('module');
     $id = Converter::int('id');
     $id2 = Converter::int('id2');
     $save = Converter::string('save', 'post');
     if ($module == '') {
         header('Location: /tools/quickview');
         exit;
     }
     $busModel = '\\Rebond\\Bus\\' . $module . '\\Model';
     $busData = '\\Rebond\\Bus\\' . $module . '\\Data';
     $busForm = '\\Rebond\\Bus\\' . $module . '\\Form';
     if ($id == 0) {
         $entity = new $busModel();
     } else {
         if ($id2 != 0) {
             $entity = $busData::loadById($id, $id2);
         } else {
             $entity = $busData::loadById($id);
         }
         if (!isset($entity)) {
             $entity = new $busModel();
         }
     }
     $form = new $busForm($entity);
     // action
     if (isset($save)) {
         if ($form->setFromPost()->validate()->isValid()) {
             $entity->save();
             Session::adminSuccess('saved', '/tools/quickview/#!/' . $module);
         }
         Session::set('adminError', $form->getValidation()->getMessage());
     }
     // view
     $this->setTpl();
     // nav
     $entities = \Rebond\Util\File::getFolders('Rebond/Bus/');
     $tplNav = new Template(Template::SITE, ['admin', 'tools']);
     $tplNav->set('entities', $entities);
     $tplNav->set('active', $module);
     // main
     $tplMain = new Template(Template::MODULE, ['Bus', $module]);
     $tplMain->set('item', $form);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('bus-editor'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     $this->tplMaster->set('navSide', $tplNav->render('nav'));
     $this->tplMaster->set('page', 'tools');
     $this->tplMaster->addJs('/js/tinymce/tinymce.min.js');
     $this->tplMaster->set('jsLauncher', 'toolsQuickEdit');
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 17
0
 public function feedback_view()
 {
     // auth
     Util\Auth::isAdminAuthorized($this->signedUser, 'admin.dev', true, '/');
     // check
     $id = Util\Converter::int('id');
     $feedback = \Rebond\Core\Feedback\Data::loadById($id);
     if (!isset($feedback)) {
         header('Location: /dev/feedback');
         exit;
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Util\Template(Util\Template::MODULE, ['core', 'feedback']);
     $tplMain->set('item', $feedback);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('view'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     $this->tplMaster->set('jsLauncher', 'dev');
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 18
0
 public function in_use()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.media.image', true, '/media');
     $id = Converter::int('id');
     if (!isset($id)) {
         return $this->index();
     }
     // find app modules that use medium
     $items = [];
     $moduleMedium = \Rebond\Cms\ModuleMedia\Data::loadAll();
     if ($moduleMedium) {
         foreach ($moduleMedium as $moduleMedia) {
             $module = \Rebond\Cms\Module\Data::loadById($moduleMedia->getModuleId());
             if (isset($module)) {
                 $appData = '\\Rebond\\App\\' . $module->getTitle() . '\\Data';
                 $options = [];
                 $options['where'][] = [$moduleMedia->getField() . ' = ?', $id];
                 $options['where'][] = ['content.version NOT IN (?)', [VersionType::DELETED, VersionType::OLD]];
                 $items = array_merge($items, $appData::loadAll($options));
             }
         }
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Template(Template::SITE, ['admin', 'media']);
     $tplMain->set('items', $items);
     // layout
     $this->tplLayout->set('column1', $tplMain->render('in-use'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-1-col'));
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 19
0
 public function uploadify()
 {
     $json = [];
     $json['result'] = ResultType::ERROR;
     // check
     $id = Converter::int('userId', 'post', 0);
     $this->signedUser = \Rebond\Core\User\Data::loadById($id);
     if (!isset($this->signedUser)) {
         $json['message'] = Lang::lang('accessNonAuthorized');
         return json_encode($json);
     }
     if (!$this->hasPrivilege('admin.media.upload')) {
         return $this->noPrivilege('admin.media.upload');
     }
     $folderId = Converter::int('folderId', 'post');
     $isSelectable = Converter::int('isSelectable', 'post', 1);
     if (!isset($folderId)) {
         $json['message'] = Lang::lang('errorInvalidParameters');
         return json_encode($json);
     }
     $upload = \Rebond\Util\Media::upload('', $_FILES['Filedata']);
     $originalName = $_FILES['Filedata']['name'];
     if ($upload == ResultType::ERROR) {
         $json['message'] = Lang::lang('errorFileUpload', [$originalName]);
         Log::log(Error::MEDIA_NOT_SAVED, $json['message'], __FILE__, __LINE__);
         return json_encode($json);
     }
     list($w, $h) = getimagesize(\Rebond\Config::getPath('media') . $upload);
     $ext = \Rebond\Util\File::getExtension(\Rebond\Config::getPath('media') . $upload);
     $noExt = \Rebond\Util\File::getNoExtension($originalName);
     $media = new \Rebond\Core\Media\Model();
     $media->setFolderId($folderId);
     $media->setTitle($noExt);
     $media->setAlt($noExt);
     $media->setOriginalFilename($originalName);
     $media->setExtension($ext);
     $media->setWidth($w);
     $media->setHeight($h);
     $media->setFilesize(filesize(\Rebond\Config::getPath('media') . $upload));
     $mimeType = new \finfo(FILEINFO_MIME_TYPE);
     $media->setMimetype($mimeType->file(\Rebond\Config::getPath('media') . $upload));
     $media->setUpload($upload);
     $media->setIsSelectable($isSelectable);
     $media->save();
     $json['result'] = ResultType::SUCCESS;
     $json['id'] = $media->getId();
     $json['message'] = Lang::lang('mediaUploaded', [$originalName]);
     return json_encode($json);
 }
Ejemplo n.º 20
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('googleAnalytics', $properties)) {
         $value = Util\Converter::string('googleAnalytics' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setGoogleAnalytics($value);
         }
     }
     if (!isset($properties) || in_array('keywords', $properties)) {
         $value = Util\Converter::string('keywords' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setKeywords($value);
         }
     }
     if (!isset($properties) || in_array('description', $properties)) {
         $value = Util\Converter::string('description' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setDescription($value);
         }
     }
     if (!isset($properties) || in_array('css', $properties)) {
         $value = Util\Converter::string('css' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCss($value);
         }
     }
     if (!isset($properties) || in_array('js', $properties)) {
         $value = Util\Converter::string('js' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setJs($value);
         }
     }
     if (!isset($properties) || in_array('signInUrl', $properties)) {
         $value = Util\Converter::string('signInUrl' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSignInUrl($value);
         }
     }
     if (!isset($properties) || in_array('environment', $properties)) {
         $value = Util\Converter::int('environment' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setEnvironment($value);
         }
     }
     if (!isset($properties) || in_array('sqlLog', $properties)) {
         $value = Util\Converter::bool('sqlLog' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSqlLog($value);
         }
     }
     if (!isset($properties) || in_array('timezone', $properties)) {
         $value = Util\Converter::string('timezone' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTimezone($value);
         }
     }
     if (!isset($properties) || in_array('isCms', $properties)) {
         $value = Util\Converter::bool('isCms' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsCms($value);
         }
     }
     if (!isset($properties) || in_array('cacheTime', $properties)) {
         $value = Util\Converter::int('cacheTime' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setCacheTime($value);
         }
     }
     if (!isset($properties) || in_array('useDeviceTemplate', $properties)) {
         $value = Util\Converter::bool('useDeviceTemplate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUseDeviceTemplate($value);
         }
     }
     if (!isset($properties) || in_array('skin', $properties)) {
         $value = Util\Converter::string('skin' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSkin($value);
         }
     }
     if (!isset($properties) || in_array('sendMailOnError', $properties)) {
         $value = Util\Converter::bool('sendMailOnError' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setSendMailOnError($value);
         }
     }
     if (!isset($properties) || in_array('mailListOnError', $properties)) {
         $value = Util\Converter::string('mailListOnError' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMailListOnError($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 21
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('moduleId', $properties)) {
         $value = Util\Converter::int('moduleId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setModuleId($value);
         }
     }
     if (!isset($properties) || in_array('appId', $properties)) {
         $value = Util\Converter::int('appId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAppId($value);
         }
     }
     if (!isset($properties) || in_array('contentGroup', $properties)) {
         $value = Util\Converter::int('contentGroup' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setContentGroup($value);
         }
     }
     if (!isset($properties) || in_array('filterId', $properties)) {
         $value = Util\Converter::int('filterId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFilterId($value);
         }
     }
     if (!isset($properties) || in_array('authorId', $properties)) {
         $value = Util\Converter::int('authorId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAuthorId($value);
         }
     }
     if (!isset($properties) || in_array('publisherId', $properties)) {
         $value = Util\Converter::int('publisherId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPublisherId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('urlFriendlyTitle', $properties)) {
         $value = Util\Converter::string('urlFriendlyTitle' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUrlFriendlyTitle($value);
         }
     }
     if (!isset($properties) || in_array('useExpiration', $properties)) {
         $value = Util\Converter::bool('useExpiration' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUseExpiration($value);
         }
     }
     if (!isset($properties) || in_array('goLiveDate', $properties)) {
         $value = Util\Converter::datetime('goLiveDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setGoLiveDate($value);
         }
     }
     if (!isset($properties) || in_array('expiryDate', $properties)) {
         $value = Util\Converter::datetime('expiryDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setExpiryDate($value);
         }
     }
     if (!isset($properties) || in_array('publishedDate', $properties)) {
         $value = Util\Converter::datetime('publishedDate' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPublishedDate($value);
         }
     }
     if (!isset($properties) || in_array('version', $properties)) {
         $value = Util\Converter::int('version' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setVersion($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 22
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('folderId', $properties)) {
         $value = Util\Converter::int('folderId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFolderId($value);
         }
     }
     if (!isset($properties) || in_array('title', $properties)) {
         $value = Util\Converter::string('title' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTitle($value);
         }
     }
     if (!isset($properties) || in_array('tags', $properties)) {
         $value = Util\Converter::string('tags' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setTags($value);
         }
     }
     if (!isset($properties) || in_array('upload', $properties)) {
         $value = Util\Converter::string('upload' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUpload($value);
         }
     }
     if (!isset($properties) || in_array('originalFilename', $properties)) {
         $value = Util\Converter::string('originalFilename' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setOriginalFilename($value);
         }
     }
     if (!isset($properties) || in_array('path', $properties)) {
         $value = Util\Converter::string('path' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPath($value);
         }
     }
     if (!isset($properties) || in_array('extension', $properties)) {
         $value = Util\Converter::string('extension' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setExtension($value);
         }
     }
     if (!isset($properties) || in_array('mimeType', $properties)) {
         $value = Util\Converter::string('mimeType' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setMimeType($value);
         }
     }
     if (!isset($properties) || in_array('fileSize', $properties)) {
         $value = Util\Converter::int('fileSize' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFileSize($value);
         }
     }
     if (!isset($properties) || in_array('width', $properties)) {
         $value = Util\Converter::int('width' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setWidth($value);
         }
     }
     if (!isset($properties) || in_array('height', $properties)) {
         $value = Util\Converter::int('height' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setHeight($value);
         }
     }
     if (!isset($properties) || in_array('alt', $properties)) {
         $value = Util\Converter::string('alt' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAlt($value);
         }
     }
     if (!isset($properties) || in_array('isSelectable', $properties)) {
         $value = Util\Converter::bool('isSelectable' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsSelectable($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }
Ejemplo n.º 23
0
 public function delete()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.content.edit', true, '/content/');
     // check
     $moduleName = Converter::string('module');
     $id = Converter::int('id');
     $module = $this->findModule($moduleName);
     $appData = '\\Rebond\\App\\' . $module->getTitle() . '\\Data';
     $model = $appData::loadById($id);
     if (!isset($model)) {
         Session::adminError('itemNotFound', [$moduleName . ' (' . $id . ')'], '/content/');
     }
     $appData::updateVersion($model, \Rebond\Cms\VersionType::DELETED);
     Session::adminSuccess('deleted', '/content/#!/' . $moduleName . '/published/');
 }
Ejemplo n.º 24
0
 public function gadget()
 {
     // auth
     Auth::isAdminAuthorized($this->signedUser, 'admin.page.gadget', true, '/page');
     // check
     $id = Converter::int('id');
     $save = Converter::int('save', 'post');
     $page = \Rebond\Cms\Page\Data::loadById($id);
     if (!isset($page)) {
         header('Location: /page');
         exit;
     }
     $gadget = new \Rebond\Cms\Gadget\Model();
     $gadget->setPageId($page->getId());
     $form = new \Rebond\Cms\Gadget\Form($gadget);
     // action
     if (isset($save)) {
         Auth::isAdminAuthorized($this->signedUser, 'admin.page.gadget.edit', true, '/page/gadget?id=' . $id);
         if ($form->setFromPost()->validate()->isValid()) {
             $gadget->save();
             Session::adminSuccess('saved', '/page/gadget?id=' . $id);
         } else {
             Session::set('adminError', $form->getValidation()->getMessage());
         }
     }
     // view
     $this->setTpl();
     // form
     $layout = \Rebond\Cms\Layout\Data::loadById($page->getLayoutId());
     $columns = $layout->getColumns();
     $columnOptions = [];
     for ($i = 1; $i <= $columns; $i++) {
         $columnOptions[$i] = Lang::lang('column') . ' ' . $i;
     }
     $tplForm = new Template(Template::MODULE, ['cms', 'gadget']);
     $tplForm->set('item', $form);
     $tplForm->set('title', Lang::lang('manageGadgetOf', [$page->getTitle()]));
     $tplForm->set('columnOptions', $columnOptions);
     $tplForm->set('selectedColumn', $gadget->getCol());
     // active listing
     $options = [];
     $options['join'][] = 'cms_page page ON page.id = gadget.page_id';
     $options['join'][] = 'cms_component component ON component.id = gadget.component_id';
     $options['join'][] = 'cms_module module ON module.id = component.module_id';
     $options['where'][] = ['page.id = ?', $page->getId()];
     $options['where'][] = 'module.status = 1';
     $options['where'][] = 'component.status = 1';
     $options['order'][] = 'gadget.col';
     $options['order'][] = 'gadget.display_order';
     $gadgets = \Rebond\Cms\Gadget\Data::loadAll($options);
     if ($gadgets) {
         foreach ($gadgets as $g) {
             $g->prepareFilter();
         }
     }
     // inactive listing
     $options = [];
     $options['join'][] = 'cms_page page ON page.id = gadget.page_id';
     $options['join'][] = 'cms_component component ON component.id = gadget.component_id';
     $options['join'][] = 'cms_module module ON module.id = component.module_id';
     $options['where'][] = ['page.id = ?', $page->getId()];
     $options['where'][] = 'module.status = 0 OR component.status = 0';
     $options['order'][] = 'gadget.col';
     $options['order'][] = 'gadget.display_order';
     $inactiveGadgets = \Rebond\Cms\Gadget\Data::loadAll($options);
     if ($inactiveGadgets) {
         foreach ($inactiveGadgets as $g) {
             $g->prepareFilter();
         }
     }
     $tplListing = new Template(Template::MODULE, ['cms', 'gadget']);
     $tplListing->set('items', $gadgets);
     $tplListing->set('inactiveItems', $inactiveGadgets);
     $tplListing->set('columnOptions', $columnOptions);
     // layout
     $this->tplLayout->add('column1', $tplForm->render('editor-selector'));
     $this->tplLayout->add('column2', $tplListing->render('listing'));
     // master
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-2-row'));
     $this->tplMaster->set('jsLauncher', 'pageGadget');
     return $this->tplMaster->render('tpl-default');
 }
Ejemplo n.º 25
0
 public function setFromPost($properties = null)
 {
     if (!isset($properties) || in_array('id', $properties)) {
         $value = Util\Converter::int('id' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setId($value);
         }
     }
     if (!isset($properties) || in_array('username', $properties)) {
         $value = Util\Converter::string('username' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setUsername($value);
         }
     }
     if (!isset($properties) || in_array('email', $properties)) {
         $value = Util\Converter::string('email' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setEmail($value);
         }
     }
     if (!isset($properties) || in_array('password', $properties)) {
         $value = Util\Converter::string('password' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setPassword($value);
         }
     }
     if (!isset($properties) || in_array('firstname', $properties)) {
         $value = Util\Converter::string('firstname' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setFirstname($value);
         }
     }
     if (!isset($properties) || in_array('lastname', $properties)) {
         $value = Util\Converter::string('lastname' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setLastname($value);
         }
     }
     if (!isset($properties) || in_array('avatarId', $properties)) {
         $value = Util\Converter::int('avatarId' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setAvatarId($value);
         }
     }
     if (!isset($properties) || in_array('isAdmin', $properties)) {
         $value = Util\Converter::bool('isAdmin' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsAdmin($value);
         }
     }
     if (!isset($properties) || in_array('isDev', $properties)) {
         $value = Util\Converter::bool('isDev' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setIsDev($value);
         }
     }
     if (!isset($properties) || in_array('status', $properties)) {
         $value = Util\Converter::int('status' . $this->unique, 'post');
         if (isset($value)) {
             $this->getModel()->setStatus($value);
         }
     }
     $this->token = Util\Converter::string('token' . $this->unique, 'post', $this->token);
     return $this;
 }