示例#1
0
 /**
  * check admin
  */
 private function checkAdmin()
 {
     if (!$this->isAdmin) {
         Util::back('권한이 없습니다.');
         Goose::end();
     }
 }
示例#2
0
 /**
  * index method
  */
 public function index()
 {
     if ($this->param['method'] == 'POST') {
         $result = null;
         switch ($this->param['action']) {
             case 'create':
                 $result = $this->transaction('create', $_POST);
                 break;
             case 'modify':
                 $result = $this->transaction('modify', $_POST);
                 break;
             case 'remove':
                 $result = $this->transaction('remove', $_POST);
                 break;
             case 'sort':
                 $result = $this->transaction('sort', $_POST);
                 break;
         }
         if ($result) {
             Module::afterAction($result);
         }
         Goose::end();
     } else {
         require_once __GOOSE_PWD__ . $this->path . 'view.class.php';
         $view = new View($this);
         $view->render();
     }
 }
示例#3
0
 /**
  * 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();
 }
示例#4
0
 /**
  * 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';
 }
示例#5
0
/**
 * Check $_POST
 *
 * @return Boolean : 이상이 없으면 true, 문제가 있으면 false값을 리턴한다.
 */
function checkPost()
{
    $errorValue = Util::checkExistValue($_POST, array('goose_root', 'goose_url', 'dbId', 'dbName', 'email', 'name'));
    if ($errorValue) {
        Util::back("[{$errorValue}]값이 없습니다.");
        Goose::end();
    }
    if (!$_POST['dbPassword'] || $_POST['dbPassword'] != $_POST['dbPassword2']) {
        Util::back("DB 비밀번호와 확인값이 다릅니다.");
        return false;
    }
    if (!$_POST['password'] || $_POST['password'] != $_POST['password2']) {
        Util::back("관리자 비밀번호와 확인값이 다릅니다.");
        return false;
    }
    return true;
}
示例#6
0
 /**
  * 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();
     }
 }
示例#7
0
 /**
  * index method
  */
 public function index()
 {
     if ($this->param['method'] == 'POST') {
         $post = Util::getMethod();
         switch ($this->param['action']) {
             case 'upload':
                 $result = $this->actUploadFiles($_FILES['file'], $post['upload_loc'], $post['table'] ? $post['table'] : $this->name);
                 echo Util::arrayToJson($result);
                 break;
             case 'remove':
                 $data = Util::jsonToArray($post['data'], true);
                 $fileSrls = $fileTmpSrls = array();
                 foreach ($data as $k => $v) {
                     if ($v['table'] == 'file_tmp') {
                         $fileTmpSrls[] = $v['srl'];
                     } else {
                         if ($v['table'] == 'file') {
                             $fileSrls[] = $v['srl'];
                         }
                     }
                 }
                 if (count($fileSrls)) {
                     $this->actRemoveFile($fileSrls, 'file');
                 }
                 if (count($fileTmpSrls)) {
                     $this->actRemoveFile($fileTmpSrls, 'file_tmp');
                 }
                 echo json_encode(array('state' => 'success'));
                 break;
         }
         Goose::end(false);
     } else {
         require_once __GOOSE_PWD__ . $this->path . 'view.class.php';
         $view = new View($this);
         $view->render();
     }
 }
示例#8
0
 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);
     }
 }
示例#9
0
 /**
  * view - remove
  */
 private function view_remove()
 {
     // check admin
     $this->checkAdmin();
     // set user srl
     $user_srl = $this->param['params'][0] ? (int) $this->param['params'][0] : null;
     // set repo
     $repo = array();
     // get user data
     $data = $this->parent->getItem(array('where' => 'srl=' . $user_srl));
     if ($data['state'] == 'error') {
         Util::back($data['message']);
         Goose::end();
     } else {
         if ($data['state'] == 'success') {
             $repo['user'] = $data['data'];
         }
     }
     // set container pwd
     $this->pwd_container = __GOOSE_PWD__ . $this->skinPath . 'view_remove.html';
     require_once $this->layout->getUrl();
 }
示例#10
0
            $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();
}
示例#11
0
 /**
  * view - remove
  */
 private function view_remove()
 {
     // check admin
     $this->checkAdmin();
     // set nest srl
     $nest_srl = $this->param['params'][0] ? (int) $this->param['params'][0] : null;
     // get nest data
     $data = $this->parent->getItem(array('where' => 'srl=' . $nest_srl));
     if ($data['state'] == 'error') {
         Util::back($data['message']);
         Goose::end();
     }
     $repo['nest'] = $data['state'] == 'success' ? $data['data'] : array();
     // set pwd_container
     $this->pwd_container = Util::isFile(array(__GOOSE_PWD__ . $this->path . 'skin/' . $repo['nest']['json']['nestSkin'] . '/view_remove.html', __GOOSE_PWD__ . $this->path . 'skin/' . $this->set['skin'] . '/view_remove.html'));
     require_once $this->layout->getUrl();
 }
示例#12
0
文件: lib.php 项目: qeist/goose
}
// set goose pwd
define('__GOOSE_PWD__', str_replace('core/lib.php', '', str_replace('\\', '/', __FILE__)));
// set session
if (defined('__USE_GOOSE_SESSION__')) {
    session_cache_expire(30);
    session_start();
    session_save_path(__GOOSE_PWD__);
}
// load classes
require_once __GOOSE_PWD__ . 'core/classes/Util.class.php';
require_once __GOOSE_PWD__ . 'core/classes/Goose.class.php';
require_once __GOOSE_PWD__ . 'core/classes/Spawn.class.php';
require_once __GOOSE_PWD__ . 'core/classes/Module.class.php';
// create Goose Instance
$goose = Goose::getInstance();
$goose->init();
// check install
if ($goose->isInstalled()) {
    // set user config variables
    $dbConfig = null;
    // array
    $table_prefix = null;
    // string
    $accessLevel = null;
    // int
    $basic_module = null;
    // string
    // load user config file
    require_once __GOOSE_PWD__ . 'data/config.php';
    // create and connect database
 public function quack()
 {
     $this->goose->honk();
     $this->notifyObservers();
 }
示例#14
0
文件: api.class.php 项目: qeist/goose
 /**
  * render
  * 결과물을 출력한다.
  *
  * @param array $getResult
  * @param string $type output type
  */
 private function render($getResult, $type)
 {
     $result = '';
     switch ($type) {
         case "xml":
             $xml = new SimpleXMLElement("<?xml version=\"1.0\"?><root></root>");
             $this->arrayToXml($getResult, $xml);
             $result = $xml->asXML();
             $header = "Content-Type: text/xml; charset=utf-8";
             break;
         case "json":
             $result = json_encode($getResult, true);
             $header = "Content-Type: text/plain; charset=utf-8";
             break;
         case "text":
             $result = $getResult;
             $header = "Content-Type: text/plain; charset=utf-8";
             break;
         default:
             // to html
             $result = $getResult;
             $header = "content-type:text/html; charset=utf-8";
             break;
     }
     header($header);
     print_r($result);
     Goose::end(false);
 }
 public function quack()
 {
     $this->goose->honk();
 }
示例#16
0
 /**
  * view - remove
  */
 private function view_remove()
 {
     // check admin
     $this->checkAdmin();
     // set srl
     if ($this->param['params'][1]) {
         $category_srl = (int) $this->param['params'][0];
         $article_srl = (int) $this->param['params'][1];
     } else {
         if ($this->param['params'][0]) {
             $article_srl = (int) $this->param['params'][0];
         }
     }
     // check article_srl
     if (!$article_srl) {
         Util::back('article_srl값이 없습니다.');
         Goose::end();
     }
     // set repo
     $repo = array();
     // get article data
     $data = $this->parent->getItem(array('where' => 'srl=' . $article_srl));
     $repo['article'] = $data['state'] == 'success' ? $data['data'] : null;
     // get nest data
     $nest = Module::load('nest');
     if ($nest->name) {
         $data = $nest->getItem(array('where' => 'srl=' . $repo['article']['nest_srl']));
         $repo['nest'] = $data['state'] == 'success' ? $data['data'] : null;
     }
     // set pwd_container
     $this->pwd_container = Util::isFile(array(__GOOSE_PWD__ . $this->path . 'skin/' . $repo['nest']['json']['articleSkin'] . '/view_remove.html', __GOOSE_PWD__ . $this->skinPath . 'view_remove.html'));
     // set skin path
     $this->skinPath = Util::isDir($this->path . 'skin/{dir}/', $repo['nest']['json']['articleSkin'], $this->set['skin'], __GOOSE_PWD__);
     require_once $this->layout->getUrl();
 }
示例#17
0
 /**
  * logout
  *
  * @param string $url 로그아웃을 끝내고 이동하는 페이지 url
  */
 public function logout($url = null)
 {
     unset($_SESSION['goose_name']);
     unset($_SESSION['goose_email']);
     unset($_SESSION['goose_level']);
     Util::redirect($url ? $url : __GOOSE_ROOT__);
     Goose::end();
 }
示例#18
0
 /**
  * view - remove
  */
 private function view_remove()
 {
     // check admin
     $this->checkAdmin();
     // set srl
     $nest_srl = $this->param['params'][0] ? (int) $this->param['params'][0] : null;
     $category_srl = $this->param['params'][1] ? (int) $this->param['params'][1] : null;
     // set repo
     $repo = array();
     // load modules
     $nest = Module::load('nest');
     // get nest data
     $data = $nest->getItem(array('field' => 'name', 'where' => 'srl=' . $nest_srl));
     $repo['nest'] = $data['state'] == 'success' ? $data['data'] : array();
     // get category data
     $data = $this->parent->getItem(array('where' => 'srl=' . $category_srl));
     if ($data['state'] == 'error') {
         Util::back($data['message']);
         Goose::end();
     } else {
         if ($data['state'] == 'success') {
             $repo['category'] = $data['data'];
         }
     }
     // set container pwd
     $this->pwd_container = __GOOSE_PWD__ . $this->skinPath . 'view_remove.html';
     require_once $this->layout->getUrl();
 }
示例#19
0
文件: run.php 项目: qeist/goose
<?php

if (!defined('__GOOSE__')) {
    exit;
}
$post = Util::getMethod();
require_once __GOOSE_PWD__ . '/ext/Parsedown/Parsedown.class.php';
require_once __GOOSE_PWD__ . '/ext/parsedown-extra/ParsedownExtra.php';
$parsedown = new ParsedownExtra();
if ($post['content']) {
    echo '<div class="markdown-body">' . $parsedown->text($post['content']) . '</div>';
} else {
    echo '<div class="markdown-error">[ERROR] 내용이 없습니다.</div>';
}
Goose::end(false);