/** * login transaction */ private function loginTransaction() { $user = Spawn::item(array('table' => Spawn::getTableName('user'), 'where' => "email='{$_POST['email']}'")); if ($user && $user['pw'] === md5($_POST['password'])) { $_SESSION['goose_name'] = $user['name']; $_SESSION['goose_email'] = $user['email']; $_SESSION['goose_level'] = $user['level']; $url = strpos($_POST['redir'], 'auth/login') ? __GOOSE_ROOT__ : $_POST['redir']; Util::redirect($url); Goose::end(); } else { Util::back('로그인정보가 맞지 않습니다.'); } Goose::end(); }
/** * upload file db update * tempFiles 테이블에 있는 임시파일들 목록을 files 테이블에 옮기고, 썸네일으로 사용하는 첨부파일 번호를 리턴한다. * * @param array $post $_POST * @param int $art_srl 글을 등록하고 바로 가져온 srl번호 * @param int $thum_srl 썸네일 srl번호 * @return int 바뀐 썸네일 srl번호 */ function fileUpload($post, $art_srl, $thum_srl) { $thumnail_srl = null; if ($post['addQueue']) { $queue = explode(',', $post['addQueue']); foreach ($queue as $k => $v) { if (!$v) { continue; } $tmpFile = Spawn::item(array('table' => Spawn::getTableName('file_tmp'), 'where' => 'srl=' . (int) $v)); if (count($tmpFile)) { // insert file $result = Spawn::insert(array('table' => Spawn::getTableName('file'), 'data' => array('srl' => null, 'article_srl' => $art_srl, 'name' => $tmpFile['name'], 'loc' => $tmpFile['loc'], 'type' => $tmpFile['type'], 'size' => $tmpFile['size'], 'regdate' => date("YmdHis")))); // set thumnail srl if ($tmpFile['srl'] == $thum_srl) { $thumnail_srl = Spawn::getLastIdx(); } // remove tmp file $result = Spawn::delete(array('table' => Spawn::getTableName('file_tmp'), 'where' => 'srl=' . (int) $v)); } } } return $thumnail_srl ? $thumnail_srl : $thum_srl; }
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('article_srl')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // remove data $result = Spawn::delete(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . $post['article_srl'])); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // load module $file = Module::load('file'); // get srls $data = $file->getItems(array('field' => 'srl', 'where' => 'article_srl=' . $post['article_srl'])); $files = $data['state'] == 'success' ? $data['data'] : null; if ($files) { $srls = array(); foreach ($files as $k => $v) { $srls[] = (int) $v['srl']; } $result = $file->actRemoveFile($srls, 'file'); }
if ($post['delete_article']) { $file = Module::load('file'); // remove attach files $articles = Spawn::items(array('table' => Spawn::getTableName('article'), 'field' => 'srl', 'where' => 'nest_srl=' . (int) $post['nest_srl'])); $file_srls = array(); foreach ($articles as $k => $v) { $data = $file->getItems(array('field' => 'srl', 'where' => 'article_srl=' . (int) $v['srl'])); if ($data['state'] == 'success') { foreach ($data['data'] as $k2 => $v2) { if ($v2['srl']) { $file_srls[] = (int) $v2['srl']; } } } } $file->actRemoveFile($file_srls, 'file'); $result = Spawn::delete(array('table' => Spawn::getTableName('article'), 'where' => 'nest_srl=' . (int) $post['nest_srl'], 'debug' => false)); } // remove category data if ($post['delete_category']) { $result = Spawn::delete(array('table' => Spawn::getTableName('category'), 'where' => 'nest_srl=' . (int) $post['nest_srl'], 'debug' => false)); } // remove nest data $result = Spawn::delete(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $post['nest_srl'], 'debug' => false)); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url $params = $_SESSION['app_srl'] ? $_SESSION['app_srl'] . '/' : ''; $redirectUrl = __GOOSE_ROOT__ . 'nest/index/' . $params; return array('state' => 'success', 'action' => 'redirect', 'url' => $redirectUrl);
@define(__StartTime__, array_sum(explode(' ', microtime()))); } // is localhost define('__IS_LOCAL__', preg_match("/(192.168)/", $_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] == "::1" ? true : false); // load program files require_once __GOOSE_LIB__; require_once 'lib/func.php'; // get preferences try { $tmp = Spawn::item(['table' => Spawn::getTableName('json'), 'field' => 'json', 'where' => 'srl=' . (int) $srl_json_pref])['json']; if (!$tmp) { throw new Exception('not found preference data'); } $pref = new Object(['string' => $tmp, 'json' => Util::jsonToArray($tmp, true, true)]); // get gnb $tmp = Spawn::item(['table' => Spawn::getTableName('json'), 'field' => 'json', 'where' => 'srl=' . (int) $pref->json['srl']['json_gnb']])['json']; if (!$tmp) { throw new Exception('not found global navigation data'); } $gnb = new Object(['string' => $tmp, 'json' => Util::jsonToArray($tmp, true, true)]); } catch (Exception $e) { echo $e->getMessage(); Goose::end(); } // init router $router = Module::load('router'); $router->route->setBasePath(__ROOT__); require_once 'lib/map.php'; $router->match = $router->route->match(); // route action if ($router->match) {
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('name', 'email', 'pw', 'level')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // 중복 이메일주소 감사 $cnt = Spawn::count(array('table' => Spawn::getTableName($this->name), 'where' => "email='{$post['email']}'")); if ($cnt > 0) { return array('state' => 'error', 'action' => 'back', 'message' => '이메일주소가 이미 존재합니다.'); } // check password if ($post['pw'] != $post['pw2']) { return array('state' => 'error', 'action' => 'back', 'message' => '비밀번호와 비밀번호 확인값이 틀립니다.'); } // insert data $result = Spawn::insert(array('table' => Spawn::getTableName($this->name), 'data' => array('srl' => null, 'email' => $post['email'], 'name' => $post['name'], 'pw' => md5($post['pw']), 'level' => $post['level'], 'regdate' => date('YmdHis')))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . $this->name . '/index/');
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('nest_srl', 'name')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // get max $max = "select max(turn) as maximum from " . Spawn::getTableName($this->name); $max = $this->goose->spawn->db->prepare($max); $max->execute(); $max = (int) $max->fetchColumn(); $max += 1; // insert data $result = Spawn::insert(array('table' => Spawn::getTableName($this->name), 'data' => array('srl' => null, 'nest_srl' => $post['nest_srl'], 'turn' => $max, 'name' => $post['name'], 'regdate' => date('YmdHis')))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url $params = $post['nest_srl'] ? $post['nest_srl'] . '/' : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . $this->name . '/index/' . $params);
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'); foreach ($arr as $k => $v) { $result = $this->installModule($v); echo "<p>Create table - " . $result['message'] . "</p>"; } // add admin user $result = Spawn::insert(array('table' => Spawn::getTableName('user'), 'data' => array('srl' => null, 'email' => $_POST['email'], 'name' => $_POST['name'], 'pw' => md5($_POST['password']), 'level' => $_POST['adminLevel'], 'regdate' => date("YmdHis")))); echo "<p>Add admin user - " . ($result == 'success' ? 'Complete' : "ERROR : {$result}") . "</p>"; // add basic navigation on json table $cnt = Spawn::count(array('table' => Spawn::getTableName('json'), 'where' => "name='Goose Navigation'")); if (!$cnt) { $data = Util::checkUserFile(__GOOSE_PWD__ . 'core/misc/navigationTree.json'); $data = Util::openFile($data); $data = Util::jsonToArray($data, true, true); $data = Util::arrayToJson($data, true); $result = Spawn::insert(array('table' => __dbPrefix__ . 'json', 'data' => array('srl' => null, 'name' => 'Goose Navigation', 'json' => $data, 'regdate' => date("YmdHis")))); } else { $result = '"Goose Navigation" Data already exists.'; } echo "<p>Add json data - " . ($result == 'success' ? 'Complete' : "ERROR : {$result}") . "</p>"; echo "<hr/>"; echo "<h1>END INSTALL</h1>"; echo "<nav><a href=\"" . __GOOSE_ROOT__ . "\">Go to intro page</a></nav>";
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin && $post['email'] != $_SESSION['goose_email']) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('name', 'level')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // check password if ($post['pw'] && $post['pw'] != $post['pw2']) { return array('state' => 'error', 'action' => 'back', 'message' => '비밀번호와 비밀번호 확인값이 틀립니다.'); } // update data $result = Spawn::update(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $post['user_srl'], 'data' => array("name='" . $post['name'] . "'", "level=" . (int) $post['level'], $post['pw'] ? "pw='" . md5($post['pw']) . "'" : null))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . $this->name . '/index/');
/** * install * * @param array $installData install.json 데이터 * @return string 문제없으면 "success" 출력한다. */ public function install($installData) { $query = Spawn::arrayToCreateTableQuery(array('tableName' => Spawn::getTableName($this->name), 'fields' => $installData)); return Spawn::action($query); }
/** * Up like * * @param array $options : [ * article_srl * header_key * ] * @return array */ public function upLike($options) { if (!$this->checkAuthHeader($options['header_key'])) { return ['state' => 'error', 'message' => 'Path not allowed']; } if (!$options['article_srl']) { return ['state' => 'error', 'message' => 'not found article_srl']; } $article = Spawn::item(['table' => Spawn::getTableName('article'), 'where' => 'srl=' . $options['article_srl'], 'field' => 'srl,json']); if (!isset($article['json'])) { return ['state' => 'error', 'message' => 'not found article data']; } $article['json'] = Util::jsonToArray($article['json'], null, true); $like = isset($article['json']['like']) ? (int) $article['json']['like'] : 0; $article['json']['like'] = $like + 1; $json = Util::arrayToJson($article['json'], true); $result = Spawn::update(['table' => Spawn::getTableName('article'), 'data' => ['json=\'' . $json . '\''], 'where' => 'srl=' . (int) $options['article_srl']]); return $result == 'success' ? ['state' => 'success', 'message' => 'update complete'] : ['state' => 'error', 'message' => 'fail update complete']; }
// check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('title', 'content')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // adjust value if (!$isExternalTransaction) { $post['title'] = htmlspecialchars(addslashes($post['title'])); $post['content'] = addslashes($post['content']); } // update data $result = Spawn::update(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $post['article_srl'], 'data' => array("app_srl=" . (int) $post['app_srl'], "nest_srl=" . (int) $post['nest_srl'], "category_srl=" . (int) $post['category_srl'], "title='" . $post['title'] . "'", "content='{$post['content']}'", "json='{$post['json']}'", "modate='" . date("YmdHis") . "'"))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // load module $file = Module::load('file'); // remove files if (count($post['removeFiles'])) { $result = $file->actRemoveFile($post['removeFiles'], 'file'); } // file upload if (count($files['upload'])) { $result = $file->actUploadFiles($files['upload'], 'data/upload/original/', 'file', $post['article_srl']); } // redirect url $param = $post['category_srl'] ? $post['category_srl'] . '/' : '';
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('name', 'id', 'json')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // 아이디값 중복 확인 $cnt = Spawn::count(array('table' => Spawn::getTableName('nest'), 'where' => "id='{$post['id']}'")); if ($cnt > 0) { return array('state' => 'error', 'action' => 'back', 'message' => 'id가 이미 존재합니다.'); } // insert data $result = Spawn::insert(array('table' => Spawn::getTableName('nest'), 'data' => array('srl' => null, 'app_srl' => (int) $post['app_srl'], 'id' => $post['id'], 'name' => $post['name'], 'json' => $post['json'], 'regdate' => date('YmdHis')))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url $params = $_SESSION['app_srl'] ? $_SESSION['app_srl'] : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . 'nest/index/' . $params);
/** * install * * @param array $installData install.json 데이터 * @return string 문제없으면 "success" 출력한다. */ public function install($installData) { Util::createDirectory(__GOOSE_PWD__ . $this->set['upPath_upload'], 0777); Util::createDirectory(__GOOSE_PWD__ . $this->set['upPath_original'], 0777); Util::createDirectory(__GOOSE_PWD__ . $this->set['upPath_make'], 0777); $query = Spawn::arrayToCreateTableQuery(array('tableName' => __dbPrefix__ . $this->name . '_tmp', 'fields' => $installData['field_tmp'])); $queryResult = Spawn::action($query); $query2 = Spawn::arrayToCreateTableQuery(array('tableName' => __dbPrefix__ . $this->name, 'fields' => $installData['field'])); $query2Result = Spawn::action($query2); if ($queryResult == 'success' && $query2Result == 'success') { return 'success'; } else { return $queryResult . ', ' . $query2Result; } }
<?php if (!defined('__GOOSE__')) { exit; } $files = null; switch ($this->param['action']) { case 'create': $files = Spawn::items(array('table' => Spawn::getTableName('file_tmp'), 'order' => 'srl', 'sort' => 'asc')); $state = 'complete'; $type = 'session'; break; case 'modify': $files = Spawn::items(array('table' => Spawn::getTableName('file'), 'where' => 'article_srl=' . (int) $article_srl, 'order' => 'srl', 'sort' => 'asc')); $state = 'uploaded'; $type = 'edit'; break; } // adjust data $pushData = array(); if (count($files)) { foreach ($files as $k => $v) { $item = array('srl' => $v['srl'], 'location' => $v['loc'], 'filename' => $v['name'], 'filetype' => $v['type'], 'filesize' => $v['size'], 'state' => $state, 'type' => $type); $pushData[] = $item; } } return json_encode($pushData);
/** * api - get data * 데이터를 얻어오는 역할을 하는 메서드 * * @param string $method * @param array $get parameter * @return array */ private function api_get($method, $get) { if (!$this->auth($get['api_key'])) { return array('state' => 'error', 'message' => '올바른 api_key값이 아닙니다.'); } // check mod value if (!$get['mod']) { return array('state' => 'error', 'message' => 'mod값이 없습니다.'); } // set table $get['table'] = $get['table'] ? $get['table'] : $get['mod']; // get module $activeMod = Module::load($get['mod']); // get allow field if (!count($activeMod->set['allowApi']['read'])) { return array('state' => 'error', 'message' => '해당모듈에 허용하는 필드에 접근할 수 없습니다.'); } // set parameters $params = $this->parameterToArray($get, $activeMod->set['allowApi']['read'][$get['table']]); switch ($method) { // get count case 'count': $result = Spawn::count(array('table' => Spawn::getTableName($params['table']), 'where' => $params['where'] ? $params['where'] : null)); return array('state' => 'success', 'data' => $result); break; // get single item // get single item case 'single': $result = Spawn::item(array('table' => Spawn::getTableName($params['table']), 'field' => $params['field'], 'where' => $params['where'], 'debug' => false)); if (!$result) { $result = array(); } return array('state' => 'success', 'data' => $result); break; // get multiple items // get multiple items case 'multi': $total = Spawn::count(array('table' => Spawn::getTableName($params['table']), 'where' => $params['where'])); if ($total > 0) { require_once __GOOSE_PWD__ . 'core/classes/Paginate.class.php'; $params['page'] = $params['page'] > 1 ? $params['page'] : 1; $params['limit'] = $params['limit'] ? $params['limit'] : $this->set['defaultPagePerCount']; $params['sort'] = $params['sort'] ? $params['sort'] : $params['order'] ? "desc" : ""; $paginate = new Paginate($total, $params['page'], array(), $params['limit'], 1); $result = Spawn::items(array('table' => Spawn::getTableName($params['table']), 'field' => $params['field'], 'where' => $params['where'], 'order' => $params['order'], 'sort' => $params['sort'], 'limit' => array($paginate->offset, $paginate->size), 'debug' => false)); } else { $result = array(); } return array('state' => 'success', 'data' => $result); break; // no method // no method default: return array('state' => 'error', 'message' => 'method값이 없습니다.'); break; } }
/** * install * * @param array $installData install.json 데이터 * @return string 문제없으면 "success" 출력한다. */ public function install($installData) { $query = Spawn::arrayToCreateTableQuery(array('tableName' => __dbPrefix__ . $this->name, 'fields' => $installData)); return Spawn::action($query); }
// load file module if (file_exists(__GOOSE_PWD__ . $article_json['thumnail']['url'])) { unlink(__GOOSE_PWD__ . $article_json['thumnail']['url']); } // upload $thumnailUrl = uploadThumnail($_POST['thumnail_image']); // set json $new_article_json['thumnail']['srl'] = $thumnail_srl; $new_article_json['thumnail']['url'] = $thumnailUrl; $thumnailUploaded = true; } // 썸네일 이미지는 있고, 썸네일 이미지가 새로 만들어지지 않을때 if ($article_json['thumnail']['srl'] && !$thumnailUploaded) { // get article item data $filesCount = Spawn::count(array('table' => Spawn::getTableName('file'), 'where' => 'article_srl=' . (int) $post['article_srl'] . ' and srl=' . (int) $article_json['thumnail']['srl'])); if (!$filesCount) { // delete thumnail file if (file_exists(__GOOSE_PWD__ . $article_json['thumnail']['url'])) { unlink(__GOOSE_PWD__ . $article_json['thumnail']['url']); } // set json $new_article_json['thumnail'] = array('srl' => '0', 'url' => '', 'coords' => ''); } } // convert array to json $json_result = Util::arrayToJson($new_article_json, true); // update article $result = Spawn::update(array('table' => Spawn::getTableName('article'), 'where' => 'srl=' . (int) $article_srl, 'data' => array("json='{$json_result}'"))); } // return return $dbUpdateResult;
if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('title', 'content')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // adjust value if (!$isExternalTransaction) { $post['title'] = htmlspecialchars(addslashes($post['title'])); $post['content'] = addslashes($post['content']); } // insert data $result = Spawn::insert(array('table' => Spawn::getTableName($this->name), 'data' => array('srl' => null, 'app_srl' => (int) $post['app_srl'], 'nest_srl' => (int) $post['nest_srl'], 'category_srl' => (int) $post['category_srl'], 'title' => $post['title'], 'content' => $post['content'], 'hit' => 0, 'json' => $post['json'], 'ip' => $_SERVER['REMOTE_ADDR'], 'regdate' => date("YmdHis"), 'modate' => date("YmdHis")), 'debug' => false)); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // get last insert srl $last_srl = Spawn::getLastIdx(); // file upload if (count($files['upload'])) { // load module $file = Module::load('file'); // upload file $uploadFiles = $file->actUploadFiles($files['upload'], 'data/upload/original/', 'file', $last_srl); } // redirect url $param = $post['nest_srl'] ? $post['nest_srl'] . '/' : ''; $param .= $post['nest_srl'] && $post['category_srl'] ? $post['category_srl'] . '/' : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . 'article/index/' . $param);
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('nest_srl', 'srls')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // set srls $srls = explode(',', $post['srls']); // update db for ($i = 0; $i < count($srls); $i++) { $result = Spawn::update(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $srls[$i], 'data' => array('turn=' . $i))); } // redirect url $params = $post['nest_srl'] ? $post['nest_srl'] . '/' : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . $this->name . '/index/' . $params);
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('nest_srl', 'name', 'json')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // update article $result = Spawn::update(array('table' => Spawn::getTableName('article'), 'where' => "nest_srl=" . (int) $post['nest_srl'], 'data' => array("group_srl=" . (int) $post['group_srl']))); // update nest $result = Spawn::update(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $post['nest_srl'], 'data' => array("app_srl=" . (int) $post['app_srl'], "name='{$post['name']}'", "json='{$post['json']}'"))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url $params = $_SESSION['app_srl'] ? $_SESSION['app_srl'] . '/' : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . 'nest/index/' . $params);
/** * drop table * * @param string $tableName * @return string */ public static function dropTable($tableName = null) { return Spawn::action('drop table ' . $tableName); }
<?php if (!defined('__GOOSE__')) { exit; } // check user if (!$this->isAdmin) { return array('state' => 'error', 'action' => 'back', 'message' => '권한이 없습니다.'); } // check post $errorValue = Util::checkExistValue($post, array('nest_srl', 'category_srl', 'name')); if ($errorValue) { return array('state' => 'error', 'action' => 'back', 'message' => "[{$errorValue}]값이 없습니다."); } // update data $result = Spawn::update(array('table' => Spawn::getTableName($this->name), 'where' => 'srl=' . (int) $post['category_srl'], 'data' => array("name='{$post['name']}'"))); if ($result != 'success') { return array('state' => 'error', 'action' => 'back', 'message' => 'Fail execution database'); } // redirect url $params = $post['nest_srl'] ? $post['nest_srl'] . '/' : ''; return array('state' => 'success', 'action' => 'redirect', 'url' => __GOOSE_ROOT__ . $this->name . '/index/' . $params);
private function assertCommandCount($command, $count) { $spawn = new Spawn(); $spawn->addProcessesFromCommand(explode(' ', $command)); static::assertEquals($count, $spawn->getProcessesCount()); }