/** * render * * @param string $action */ public function render($action) { $this->pwd_container = __GOOSE_PWD__ . $this->path . 'pages/' . $action . '.html'; if (!file_exists($this->pwd_container)) { Goose::error(404); } require_once $this->layout->getUrl(); }
/** * transaction * 인스톨 처리 * */ public function transaction() { if (version_compare(PHP_VERSION, __GOOSE_MIN_PHP_VERSION__, '<')) { Goose::error(999, 'low php version'); Goose::end(); } $this->skinPath = $this->path . 'skin/' . $this->set['skin'] . '/'; require_once __GOOSE_PWD__ . $this->skinPath . 'transaction_install.php'; }
/** * view - read */ private function view_read($module) { $this->moduleName = $module; $this->page = $this->param['params'][0] ? $this->param['params'][0] : 'index'; // check doc file $pwd_page = __GOOSE_PWD__ . 'module/' . $this->moduleName . '/help/' . $this->page; $this->pwd_page = Util::isFile(array($pwd_page . '.md', $pwd_page . '.html')); if (file_exists($this->pwd_page)) { // get module setting $this->page_modSet = Util::jsonToArray(Util::openFile(__GOOSE_PWD__ . 'module/' . $this->moduleName . '/setting.json')); // set pwd_container $this->pwd_container = __GOOSE_PWD__ . $this->skinPath . 'view_page.html'; require_once $this->layout->getUrl(); } else { Goose::error(404); Goose::end(); } }
public function init($pwd_map, $accessLevel) { $this->route->setBasePath(preg_replace('/\\/$/', '', __GOOSE_ROOT__)); require_once Util::checkUserFile($pwd_map); $this->match = $this->route->match(); if ($this->match) { $_module = isset($this->match['params']['module']) ? $this->match['params']['module'] : null; $_action = isset($this->match['params']['action']) ? $this->match['params']['action'] : null; $_method = $_SERVER['REQUEST_METHOD']; // check access level $auth = Module::load('auth', array('action' => $_action, 'method' => $_method)); $auth->auth($accessLevel['login']); // load module $modName = $_module ? $_module : $this->set['basicModule']; $baseModule = Module::load($modName, array('action' => $_action, 'method' => $_method, 'params' => array($this->match['params']['param0'], $this->match['params']['param1'], $this->match['params']['param2'], $this->match['params']['param3']))); // check module if ($baseModule->state == 'error') { Goose::error(403, $baseModule->message); } if (!$baseModule) { Goose::error(101, 'module error'); } if (is_array($baseModule) && $baseModule['state'] == 'error') { Goose::error(101, $baseModule['message']); } // check index method if (!method_exists($baseModule, 'index')) { Goose::error(101, $modName . '모듈의 index()메서드가 없습니다.'); } // index module if (method_exists($baseModule, 'index')) { $baseModule->index(); } } else { Goose::error(404); } }
} return true; } // check post data if (checkPost() == true) { // create directories Util::createDirectory(__GOOSE_PWD__ . "data", 0755); // create config.php $tpl_config = $this->tpl_config(array('define' => array('url' => $_POST['goose_url'], 'root' => $_POST['goose_root']), 'db' => array('dbname' => $_POST['dbName'], 'name' => $_POST['dbId'], 'password' => $_POST['dbPassword'], 'host' => $_POST['dbHost'], 'prefix' => $_POST['dbPrefix']), 'level' => array('login' => $_POST['loginLevel'], 'admin' => $_POST['adminLevel']), 'apiKey' => $_POST['apiPrefix'], 'timezone' => $_POST['timezone'], 'basic_module' => 'intro')); if ($tpl_config != 'success') { Goose::error(999, 'Failed to create the file data/config.php'); Goose::end(); } // create modules.json if ($this->tpl_modules() != 'success') { Goose::error(999, 'Failed to create the file data/modules.json'); Goose::end(); } } else { Goose::end(); } // load config file require_once __GOOSE_PWD__ . 'data/config.php'; // create and connect database $this->goose->createSpawn(); $this->goose->spawn->connect($dbConfig); $this->goose->spawn->prefix = $table_prefix; // set admin $this->goose->isAdmin = true; // install modules $arr = array('user', 'nest', 'app', 'json', 'file', 'article', 'category');
$article_srl = isset($_params['article']) ? (int) $_params['article'] : null; // set update hit $updateHit = $pref->json['article']['updateHit'] ? isCookieKey($pref->json['article']['cookiePrefix'] . 'hit-' . $article_srl, 7) : false; // get article $data = $api->view(['app_srl' => $pref->json['srl']['app'], 'article_srl' => $article_srl, 'contentType' => $pref->json['article']['type'], 'updateHit' => $updateHit, 'print_data' => $_GET['get'] ? $_GET['get'] : 'all']); if ($data['state'] == 'error') { Goose::error(101, $data['message'], __ROOT_URL__); Goose::end(); } $loc_container = 'pages/article.php'; if ($_GET['popup']) { require_once $loc_container; Goose::end(); } break; case 'page': $loc_container = 'pages/page.php'; break; } // render ajax if ($_targetArray[0] == 'ajax') { $_name = $_targetArray[1] ? $_targetArray[1] : null; require_once 'pages/ajax.php'; Goose::end(); } require_once 'pages/layout.php'; } else { // 404 error Goose::error(404, null, __ROOT_URL__); Goose::end(); }
$goose->spawn->connect($dbConfig); // set api_key define('__apiKey__', md5($apiKey)); // set table prefix define('__dbPrefix__', $table_prefix); // set admin $goose->isAdmin = $accessLevel['admin'] == $_SESSION['goose_level'] ? true : false; // act router module $router = Module::load('router'); $router->init(__GOOSE_PWD__ . $router->path . 'map.php', $accessLevel); } else { define('__GOOSE_ROOT__', preg_replace('/index.php$/', '', $_SERVER['SCRIPT_NAME'])); define('__dbPrefix__', $_POST['dbPrefix'] ? $_POST['dbPrefix'] : null); // load install module $install = Module::load('install'); if ($install->name == 'install') { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $install->transaction(); } else { $install->form(); } } else { if ($install['state'] == 'error') { Goose::error(101, $install['message']); } else { Goose::error(101, 'module error'); } } } // end goose Goose::end();