Ejemplo n.º 1
0
 /**
  * แสดงผล
  */
 public function render(Request $request)
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // โมดูลที่ต้องการติดตั้ง
         $module = $request->get('m')->filter('a-z');
         $widget = $request->get('w')->filter('a-z');
         $this->module = $module !== '' ? $module : $widget;
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         if ($module !== '') {
             $ul->appendChild('<li><span class="icon-modules">{LNG_Module}</span></li>');
             $type = 'module';
         } elseif ($widget !== '') {
             $ul->appendChild('<li><span class="icon-widgets">{LNG_Widgets}</span></li>');
             $type = 'widget';
         } else {
             // 404.html
             return \Index\Error\Controller::page404();
         }
         $ul->appendChild('<li><span>{LNG_Install}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-inbox">' . $this->title() . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Install\\View')->render($type, $this->module));
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 2
0
 /**
  * แสดงผล
  */
 public function render(Request $request)
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // รายการที่ต้องการ
         $index = \Index\Menuwrite\Model::getMenu(self::$request->get('id')->toInt());
         if ($index) {
             // สร้างหรือแก้ไข
             // แสดงผล
             $section = Html::create('section');
             // breadcrumbs
             $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
             $ul = $breadcrumbs->add('ul');
             $ul->appendChild('<li><span class="icon-modules">{LNG_Menus} &amp; {LNG_Web pages}</span></li>');
             $ul->appendChild('<li><a href="{BACKURL?module=pages&id=0}">{LNG_Menus}</a></li>');
             $ul->appendChild('<li><span>{LNG_' . (empty($index->id) ? 'Create' : 'Edit') . '}</span></li>');
             $section->add('header', array('innerHTML' => '<h1 class="icon-write">' . $this->title() . '</h1>'));
             if ($index) {
                 // แสดงฟอร์ม
                 $section->appendChild(createClass('Index\\Menuwrite\\View')->render($index));
                 return $section->render();
             }
         }
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 3
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // ภาษาที่ต้องการ
         $language = self::$request->get('language', Language::name())->toString();
         if (preg_match('/^[a-z]{2,2}$/', $language)) {
             // intro detail
             $template = ROOT_PATH . DATA_FOLDER . 'intro.' . $language . '.php';
             if (is_file($template)) {
                 $template = trim(preg_replace('/<\\?php exit([\\(\\);])?\\?>/', '', file_get_contents($template)));
             } else {
                 $template = '<p style="padding: 20px; text-align: center; font-weight: bold;"><a href="index.php">Welcome<br>ยินดีต้อนรับ</a></p>';
             }
             // แสดงผล
             $section = Html::create('section');
             // breadcrumbs
             $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
             $ul = $breadcrumbs->add('ul');
             $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
             $ul->appendChild('<li><span>{LNG_Intro Page}</span></li>');
             $section->add('header', array('innerHTML' => '<h1 class="icon-write">' . $this->title() . '</h1>'));
             // แสดงฟอร์ม
             $section->appendChild(createClass('Index\\Intro\\View')->render($language, $template));
             return $section->render();
         }
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 4
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // รายการที่ต้องการ
         $index = \Index\Mailwrite\Model::getIndex(self::$request->get('id')->toInt());
         // สร้างหรือแก้ไข
         $title = Language::get(empty($index->id) ? 'Create' : 'Edit');
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
         $ul->appendChild('<li><a href="{BACKURL?module=mailtemplate&id=0}">{LNG_Email template}</a></li>');
         $ul->appendChild('<li><span>' . $title . '</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-write">' . $title . ' ' . $index->name . '</h1>'));
         if ($index) {
             // แสดงฟอร์ม
             $section->appendChild(createClass('Index\\Mailwrite\\View')->render($index));
             return $section->render();
         }
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 5
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-modules">{LNG_Menus} &amp; {LNG_Web pages}</span></li>');
         $ul->appendChild('<li><a href="{BACKURL?module=mods&id=0}">{LNG_installed module}</a></li>');
         $ul->appendChild('<li><span>{LNG_Create}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-new">' . $this->title() . '</h1>'));
         // owner
         $modules = array();
         foreach (Gcms::$install_owners as $owner => $item) {
             if (file_exists(ROOT_PATH . 'modules/' . $owner . '/controllers/admin/init.php')) {
                 $class = ucfirst($owner) . '\\Admin\\Init\\Controller';
                 if (method_exists($class, 'description')) {
                     // get module description
                     $description = $class::description();
                     if (!empty($description)) {
                         $modules[$owner] = $description . ' [' . $owner . ']';
                     }
                 }
             }
         }
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Addmodule\\View')->render($modules));
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // ภาษาที่ต้องการ
         $language = self::$request->get('language', Language::name())->toString();
         if (preg_match('/^[a-z]{2,2}$/', $language)) {
             // maintenance detail
             $template = ROOT_PATH . DATA_FOLDER . 'maintenance.' . $language . '.php';
             if (is_file($template)) {
                 $template = trim(preg_replace('/<\\?php exit([\\(\\);])?\\?>/', '', file_get_contents($template)));
             } else {
                 $template = '<p style="padding: 20px; text-align: center; font-weight: bold;">Website Temporarily Closed for Maintenance, Please try again in a few minutes.<br>ปิดปรับปรุงเว็บไซต์ชั่วคราวเพื่อบำรุงรักษา กรุณาลองใหม่ในอีกสักครู่</p>';
             }
             // แสดงผล
             $section = Html::create('section');
             // breadcrumbs
             $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
             $ul = $breadcrumbs->add('ul');
             $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
             $ul->appendChild('<li><span>{LNG_Maintenance Mode}</span></li>');
             $section->add('header', array('innerHTML' => '<h1 class="icon-write">' . $this->title() . '</h1>'));
             // แสดงฟอร์ม
             $section->appendChild(createClass('Index\\Maintenance\\View')->render($language, $template));
             return $section->render();
         }
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
 /**
  * แสดงผล
  */
 public function render()
 {
     // สมาชิก
     if ($login = Login::isMember()) {
         // id ที่ต้องการ ถ้าไม่มีใช้คนที่ login
         $id = self::$request->get('id', $login['id'])->toInt();
         // อ่านข้อมูลสมาชิก
         $user = \Index\Editprofile\Model::getUser($id);
         if ($user && ($login['status'] == 1 || $login['id'] == $user->id)) {
             $template = Template::create('', '', 'editprofile');
             $contents = array();
             foreach ($user as $key => $value) {
                 if ($key === 'provinceID' || $key === 'country' || $key === 'sex' || $key === 'status') {
                     // select
                     if ($key == 'provinceID') {
                         $source = Province::all();
                     } elseif ($key == 'country') {
                         $source = Country::all();
                     } elseif ($key == 'sex') {
                         $source = Language::get('SEXES');
                     } elseif ($key == 'status') {
                         $source = self::$cfg->member_status;
                     }
                     $datas = array();
                     foreach ($source as $k => $v) {
                         $sel = $k == $value ? ' selected' : '';
                         $datas[] = '<option value="' . $k . '"' . $sel . '>' . $v . '</option>';
                     }
                     $contents['/{' . strtoupper($key) . '}/'] = implode('', $datas);
                 } elseif ($key === 'admin_access' || $key === 'subscrib') {
                     $contents['/{' . strtoupper($key) . '}/'] = $value == 1 ? 'checked' : '';
                 } elseif ($key === 'icon') {
                     if (is_file(ROOT_PATH . self::$cfg->usericon_folder . $value)) {
                         $icon = WEB_URL . self::$cfg->usericon_folder . $value;
                     } else {
                         $icon = WEB_URL . 'skin/img/noicon.jpg';
                     }
                     $contents['/{ICON}/'] = $icon;
                 } else {
                     $contents['/{' . strtoupper($key) . '}/'] = $value;
                 }
             }
             $contents['/{ADMIN}/'] = Login::isAdmin() && $user->fb == 0 ? '' : 'readonly';
             $contents['/{HIDDEN}/'] = implode("\n", Form::get2Input());
             $contents['/{ACCEPT}/'] = Mime::getEccept(self::$cfg->user_icon_typies);
             $template->add($contents);
             Gcms::$view->setContents(array('/:type/' => implode(', ', self::$cfg->user_icon_typies)), false);
             return $template->render();
         } else {
             // 404.html
             return \Index\Error\Controller::page404();
         }
     } else {
         // 404.html
         return \Index\Error\Controller::page404();
     }
 }
Ejemplo n.º 8
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if ($login = Login::isAdmin()) {
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-email">{LNG_Mailbox}</span></li>');
         $ul->appendChild('<li><span>{LNG_Email send}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-email-sent">' . $this->title() . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Sendmail\\View')->render($login));
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 9
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-home">{LNG_Home}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-dashboard">' . $this->title() . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Dashboard\\View')->render());
         return $section->render();
     } else {
         // 404.html
         return \Index\Error\Controller::page404();
     }
 }
Ejemplo n.º 10
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><a class="icon-user" href="index.php?module=member">{LNG_Users}</a></li>');
         $ul->appendChild('<li><span>{LNG_Register}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-register">' . $this->title() . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Register\\View')->render());
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 11
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-tools">{LNG_Tools}</span></li>');
         $ul->appendChild('<li><span>{LNG_Language}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-language">' . $this->title() . '</h1>'));
         // แสดงตาราง
         $section->appendChild(createClass('Index\\Language\\View')->render());
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 12
0
 /**
  * แสดงผล
  */
 public function render(Request $request)
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-modules">{LNG_Menus} &amp; {LNG_Web pages}</span></li>');
         $ul->appendChild('<li><span>{LNG_installed module}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-modules">' . $this->title() . '</h1>'));
         // แสดงตาราง
         $section->appendChild(createClass('Index\\Mods\\View')->render());
         return $section->render();
     } else {
         // 404.html
         return \Index\Error\Controller::page404();
     }
 }
Ejemplo n.º 13
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
         $ul->appendChild('<li><span>{LNG_Other}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-config">' . $this->title() . '</h1>'));
         // โหลด config
         $config = Config::load(ROOT_PATH . 'settings/config.php');
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Other\\View')->render($config));
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 14
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-tools">{LNG_Tools}</span></li>');
         $ul->appendChild('<li><span>' . $this->title() . '</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-world">' . $this->title() . '</h1>'));
         $div = $section->add('div', array('class' => 'setup_frm'));
         $div = $div->add('div', array('class' => 'item'));
         $div->appendChild('<div id="debug_layer"></div>');
         $div->appendChild('<div class="submit right"><a id="debug_clear" class="button large red">{LNG_Clear}</a></div>');
         $section->script('showDebug();');
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 15
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-tools">{LNG_Tools}</span></li>');
         $ul->appendChild('<li><span>{LNG_Database}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-database">' . $this->title() . '</h1>'));
         $div = $section->add('div', array('class' => 'setup_frm'));
         // แสดงฟอร์ม
         $view = new \Index\Database\View();
         $div->appendChild($view->export());
         $div->appendChild($view->import());
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }
Ejemplo n.º 16
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // รายการที่ต้องการ
         $id = self::$request->get('id')->toString();
         $title = Language::get(empty($id) ? 'Create' : 'Edit');
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
         $ul->appendChild('<li><a href="{BACKURL?module=languages&id=0}">{LNG_Language}</a></li>');
         $ul->appendChild('<li><span>' . $title . '</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-language">' . $title . ' {LNG_Language} ' . $id . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Languageadd\\View')->render($id));
         return $section->render();
     } else {
         // 404.html
         return \Index\Error\Controller::page404();
     }
 }
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if (Login::isAdmin()) {
         // ชนิดของภาษาที่เลือก php,js
         $this->type = self::$request->get('type')->toString();
         $this->type = $this->type == 'js' ? 'js' : 'php';
         // รายการที่แก้ไข (id)
         $this->id = self::$request->get('id', -1)->toInt();
         // โหลดไฟล์ภาษา ที่ติดตั้ง
         $languages = Language::installed($this->type);
         $installed_languages = Language::installedLanguage();
         $this->languages = array();
         if ($this->id > -1) {
             $this->language = $languages[$this->id];
             foreach ($installed_languages as $item) {
                 if (isset($this->language['array'])) {
                     if (isset($this->language[$item])) {
                         foreach ($this->language[$item] as $k => $v) {
                             if (!isset($this->languages[$k]['key'])) {
                                 $this->languages[$k]['key'] = $k;
                                 foreach ($installed_languages as $a) {
                                     $this->languages[$k][$a] = '';
                                 }
                             }
                             $this->languages[$k][$item] = $v;
                         }
                     }
                 } else {
                     if (!isset($this->languages[0]['key'])) {
                         $this->languages[0]['key'] = '';
                         foreach ($installed_languages as $a) {
                             $this->languages[0][$a] = '';
                         }
                     }
                     if (isset($this->language[$item])) {
                         $this->languages[0][$item] = $this->language[$item];
                     }
                 }
             }
         } else {
             // ใหม่
             $this->language = array('key' => '');
             $this->languages[0]['key'] = '';
             foreach ($installed_languages as $item) {
                 $this->languages[0][$item] = '';
             }
         }
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-tools">{LNG_Tools}</span></li>');
         $ul->appendChild('<li><a href="{BACKURL?module=language}">{LNG_Language}</a></li>');
         $ul->appendChild('<li><span>{LNG_' . ($this->id > -1 ? 'Edit' : 'Create') . '}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-language">' . $this->title() . '</h1>'));
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Languageedit\\View')->render($this));
         return $section->render();
     } else {
         // 404.html
         return \Index\Error\Controller::page404();
     }
 }
Ejemplo n.º 18
0
 /**
  * แสดงผล
  */
 public function render()
 {
     // แอดมิน
     if ($login = Login::isAdmin()) {
         // โหลด config
         $config = Config::load(ROOT_PATH . 'settings/config.php');
         // path ของ skin
         $dir = ROOT_PATH . 'skin';
         // action
         $action = self::$request->get('action')->toString();
         if (!empty($action)) {
             if ($login['email'] == 'demo' || !empty($login['fb'])) {
                 $message = '<aside class=error>{LNG_Unable to complete the transaction}</aside>';
             } else {
                 $theme = preg_replace('/[\\/\\\\]/ui', '', self::$request->get('theme')->text());
                 if (is_dir($dir . "/{$theme}")) {
                     if ($action == 'use') {
                         // skin ที่กำหนด
                         $config->skin = $theme;
                         unset($_SESSION['skin']);
                         // บันทึก config.php
                         if (Config::save($config, ROOT_PATH . 'settings/config.php')) {
                             self::$request->setSession('my_skin', $config->skin);
                             $message = '<aside class=message>{LNG_Select a new template successfully}</aside>';
                         } else {
                             $message = '<aside class=error>' . sprintf(Language::get('File %s cannot be created or is read-only.'), 'settings/config.php') . '</aside>';
                         }
                     } elseif ($action == 'delete') {
                         // ลบ skin
                         File::removeDirectory($dir . '/' . $theme . '/');
                         $message = '<aside class=message>{LNG_Successfully remove template files}</aside>';
                     }
                 }
             }
         }
         // แสดงผล
         $section = Html::create('section');
         // breadcrumbs
         $breadcrumbs = $section->add('div', array('class' => 'breadcrumbs'));
         $ul = $breadcrumbs->add('ul');
         $ul->appendChild('<li><span class="icon-settings">{LNG_Site settings}</span></li>');
         $ul->appendChild('<li><span>{LNG_Template}</span></li>');
         $section->add('header', array('innerHTML' => '<h1 class="icon-template">' . $this->title() . '</h1>'));
         if (!empty($message)) {
             $section->appendChild($message);
         }
         // อ่าน theme ทั้งหมด
         $themes = array();
         $f = opendir($dir);
         while (false !== ($text = readdir($f))) {
             if ($text !== $config->skin && $text !== "." && $text !== "..") {
                 if (is_dir($dir . "/{$text}") && is_file($dir . "/{$text}/style.css")) {
                     $themes[] = $text;
                 }
             }
         }
         closedir($f);
         // แสดงฟอร์ม
         $section->appendChild(createClass('Index\\Template\\View')->render($dir, $config, $themes));
         return $section->render();
     }
     // 404.html
     return \Index\Error\Controller::page404();
 }