/** * 输出:地区信息-ip,地区信息默认被url encode * 可选&callback=xxxx参数指定回调函数 * 可选&type=json参数指定使用json(IP=》地区信息)格式输出 * 可选&f=raw参数指定不对地区信息进行urlencode,当type=json时,此参数值无效 * @param string $ip IP地址,可选,为null时优先选择$_GET['ip']、服务器抓取的客户端IP * @return void */ public function geoinfo($ip = null) { if (is_null($ip)) { if (!empty($_GET['ip'])) { $ip = $_GET['ip']; } else { $ip = g::ip(); } } if (empty($ip)) { return; } $key = GeoTool::getAreaLogByIp($ip); // debugLog ( __CLASS__ . ':geo', $key.'-'.$ip ); if (!empty($key)) { // // $value = (isset($_GET['f']) && 'raw'==$_GET['f'] ?$key:rawurlencode($key)).'-'.$ip; $value = $key . '-' . $ip; // $this->apiReturn(isset($_GET['type']) && 'json' == $_GET['type'] ? array($ip => $key) : $value, 0); // echo $value; if (!isset($_GET['ck']) || 'none' != $_GET['ck']) { setcookie('geoinfo', rawurlencode($key) . '-' . $ip, TIMESTAMP + 30 * 60, '/', '.56.com'); } } }
function check($c, $p) { $c->log($p); $mdpass = md5($p['loginPassword']); $data = g::db()->getRows("SELECT count(*) as 'result' ,`u_id`,permission_id, limit_mac,u_room FROM `user` where u_username = '******'loginName']}' and u_password = '******' "); $c->log($data[0]); $isAdmin = false; if ($data[0][permission_id] == 0) { $isAdmin = true; } if ($data[0][result] == 1) { $u = new gzUser(); $u->id = $data[0]['u_id']; $u->isAuthcate = true; $u->isAdmin = $isAdmin; $u->limit_mac = $data[0]["limit_mac"]; $u->name = $data[0]["u_room"]; g::$session->setUser($u); g::$session->writeClose(); unset($u->loginPassword); $c->data(array("user" => $u))->send(true); } else { $c->send(false); } $c->send(false); }
function send($success = false) { $this->success = $success; g::obStart(); header('Content-Type: application/json'); echo json_encode($this); exit; }
function _init($m, $get, $post) { if (g::$session->user->isAdmin == false) { //echo '{"_GMSG_":"ERROR","MESSAGE":"Access Denied!","You Is not Admin":"req"}'; g::client()->fn('redirect', '#/')->send(); //g::client()->fn('js','alert("-*-")')->send(); exit; } }
public function removeUser($c, $p) { g::db()->exec("DELETE FROM `authenuser` WHERE `a_id` = ?", array($p['a_id'])); $data = Router::comm('/ip/hotspot/user/remove', array(".id" => "*" . $p['id'])); if (empty($data)) { $c->send(true); } $c->send(false); }
/** * GetCityNameByIp * * @static * @access public * @return void */ public static function getAreaNameByIp($ip = false) { $array = array(); $ip = $ip ? $ip : g::ip(); $city = GeoTool::convertIp($ip); if (preg_match('/局域网/', $city)) { return $array; } if (is_array($city) && $city['err'] === true) { return $array; } $city = explode('市', $city); if ($city[0]) { $array = explode('省', $city[0]); } return $array; }
function db_goDelete($c, $p) { g::db()->exec('delete from table1 where id=?', array($p['id'])); $c->send(true); }
function load() { // initiate the site and make pages and page // globally available $site = $this; $panel = $this; $pages = $this->pages; $page = $this->pages->active(); if ($page->isErrorPage() && $this->uri()->path() != c::get('404')) { go(url(c::get('404'))); } g::set('site', $this); g::set('panel', $this); g::set('pages', $pages); g::set('page', $page); // set the global template vars tpl::set('site', $this); tpl::set('panel', $this); tpl::set('pages', $pages); tpl::set('page', $page); // initiate the user settings $settings = new settings(); g::set('settings', $settings); tpl::set('settings', $settings); // add a user $panel->user = new user(); // load the language paneload::language(); // check for a valid array of user accounts and other correct setups if (!check::installed() || !check::hasAccounts() || check::stillHasDefaultAccount() || check::wrongKirbyVersion()) { require c::get('root.panel') . '/modals/installation.php'; return; } // add all panel info $panel->isHome = !$panel->uri->path(1) ? true : false; $panel->show = $panel->uri->param('show'); $panel->action = $panel->uri->param('do'); $panel->nocontent = (string) $page->contents() == '' ? true : false; if ($panel->isHome && $panel->show != 'info' && $panel->show != 'logout') { $panel->show = 'home'; } switch ($panel->action) { case 'edit-pages': $panel->sortable = true; break; } if ($panel->isHome) { $settings->pages = true; $settings->flip = false; } switch ($panel->show) { case 'logout': $panel->user->logout(); exit; break; case 'files': $thumbDir = c::get('root') . '/thumbs'; $panel->fancybox = true; $panel->thumbs = is_dir($thumbDir) && is_writable($thumbDir) ? true : false; break; // more available views // more available views case 'info': case 'home': case 'pages': case 'options': if (($panel->show == 'home' || $panel->show == 'info') && !$panel->isHome) { go(url() . '/show:' . $panel->show); } break; default: $valid = array('options', 'content'); if (!in_array($panel->show, $valid)) { $panel->show = 'content'; } break; } // init the form if ($panel->show == 'info' || $panel->show == 'content') { $panel->form = new form($settings); } // set the template file; $panel->templateFile = $panel->show . '.php'; $panel->templateRoot = c::get('root.panel') . '/templates'; content::start(); if ($panel->user->isLoggedIn()) { require $panel->templateRoot . '/' . $panel->templateFile; } else { require $panel->templateRoot . '/login.php'; } content::end(); }
$oDataset->next(); $row = $oDataset->getRow(); $response = isset($row['CATEGORY_NAME']) ? 'false' : 'true'; echo $response; break; case 'updateCategory': try { require_once 'classes/model/ProcessCategory.php'; $catUID = $_REQUEST['cat_uid']; $catName = trim($_REQUEST['category']); $pcat = new ProcessCategory(); $pcat->setNew(false); $pcat->setCategoryUid($catUID); $pcat->setCategoryName($catName); $pcat->save(); g::auditLog("UpdateCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") "); echo '{success: true}'; } catch (Exception $ex) { echo '{success: false, error: ' . $ex->getMessage() . '}'; } break; case 'canDeleteCategory': require_once 'classes/model/Process.php'; $proc = new Process(); $aProcess = $proc->getAllProcessesByCategory(); $catUID = $_REQUEST['CAT_UID']; $response = isset($aProcess[$catUID]) ? 'false' : 'true'; echo $response; break; case 'deleteCategory': try {
function getExternalStepAction() { $oPluginRegistry =& PMPluginRegistry::getSingleton(); g::pr($oPluginRegistry->getSteps()); return $oPluginRegistry->getSteps(); }
*/ // Use default autoload implementation // set_include_path(__DIR__); spl_autoload_register(); $john_doe = new John\Doe(); $john_doe->write_message_to('Samuel Smitters'); /** * Below several equal ways to register real classnames * under facade, emty facade names, chaining several facades init * initialize and call same class method with help of Gubnota/Gubnota loder **/ \Gubnota\Gubnota::instance()->empty_facade()->facade('John', 'John\\Doe')->facade('Smith', 'John\\Doe')->delete_facade('Smith'); // From there we'll be using g:: symlink instead of \Gubnota\Gubnota:: g::John('write_message_to', 'Laura Smith', 'Are you still there?'); // Same like: // $john = new John(); // $john->write_message_to('Laura Smith', 'Are you still there?'); g::instance()->John->write_message_to('Dude', 'Got message?'); g::instance()->John->write_message_to('Dude', 'Got message?'); g::instance()->John->write_message_to('Dude II', 'Got message?'); g::instance()->rand; $instance = g::instance(); print "g::instance()->rand = " . g::instance()->rand . "\n"; print "g::instance()->rand = " . $instance->rand . " equals\n"; print "Creation of new independent pocket of classes:\n"; $instance2 = new g(); print "\$instance2->rand = {$instance2->rand} not equals\n"; print "g::instance()->rand = " . $instance->rand . " still equals\n"; print "g::instance()->facade('John') = " . g::instance()->facade('John') . "\n"; print "g::instance()->classes = " . str_replace(["Array\n", "(", ")\n"], ['', '[', ']'], print_r(g::instance()->classes, 1)) . "\n";
function update($p) { $permSet = array(); if (!empty($p['pm'])) { foreach ($p['pm'] as $k => $v) { $permSet[$k] = $v == 'on' ? true : cInt($v); } } $this->id = isPostor('id'); $this->acr = cInt(isPostor('acr', 0)); $this->acw = cInt(isPostor('acw', 0)); if (!isset($permSet['esv.def']) && !isset($permSet['ews.def'])) { $permSet['esv.def'] = true; } if ($this->id == 1) { $this->acr = 99; $this->acw = 99; $adm = array('esv.def' => issetor($permSet['esv.def'], false), 'ews.def' => issetor($permSet['ews.def'], false)); $permSet = $adm; } $this->name = trim(isPostor('name')); $this->desc = isPostor('desc'); $this->props["pm"] = $permSet; if (empty($this->name)) { gzClient::begin()->eAlert("Error:!Name is not empty...")->send(); } $data = array('userg_name' => $this->name, 'userg_description' => $this->desc, 'userg_acr' => $this->acr, 'userg_acw' => $this->acw, 'rec_update' => NOW, 'userg_props' => json_encode($this->props)); if (empty($this->id)) { $data['rec_update'] = NOW; $data['rec_create'] = NOW; g::DB()->aInsert($data, 'sg_user_group'); } else { g::DB()->aUpdate($data, 'sg_user_group', 'userg_id', $this->id); g::cacheSet('UGROUP' . $this->id, $this); } //gzData::uGroupInfo(true); gzClient::begin()->redirect("cpanel.usergroup")->endSend(); }
<?php /////////////////////////////////////////////////////// // ---------------------------------------------------------- // SNIPPET // ---------------------------------------------------------- ///////////////////////////////////////////////////////////// // Create instances $instances = g::get('kmap.instances'); g::set('kmap.instances', $instances + 1); // Set variables if (!isset($id)) { $id = 'map-' . uniqid(); } if (!isset($width)) { $width = 300; } if (!isset($height)) { $height = 300; } if (!isset($type)) { $type = 'roadmap'; } // roadmap, sattelite, hybrid, terrain if (!isset($class)) { $class = 'map'; } if (!isset($zoom)) { $zoom = 15; } if (!isset($address)) {
function calculateExecutionDateSingle() { try { $rowsCreated = 0; $rowsRejected = 0; G::LoadClass('dates'); $oDates = new dates(); //SELECT // EVENT.PRO_UID, // EVENT.TAS_UID , // EVENT.EVN_TAS_ESTIMATED_DURATION , // EVENT.EVN_WHEN, // APP_DELEGATION.APP_UID , // APP_DELEGATION.DEL_INDEX , // APP_DELEGATION.TAS_UID , // APP_DELEGATION.DEL_DELEGATE_DATE , // APP_DELEGATION.DEL_INIT_DATE , // APP_DELEGATION.DEL_TASK_DUE_DATE , // APP_DELEGATION.DEL_FINISH_DATE //from APP_DELEGATION // JOIN EVENT ON ( APP_DELEGATION.TAS_UID = EVENT.TAS_UID AND APP_DELEGATION.DEL_FINISH_DATE IS NULL ) // LEFT JOIN APP_EVENT ON ( APP_EVENT.APP_UID = APP_DELEGATION.APP_UID AND APP_EVENT.DEL_INDEX = APP_DELEGATION.DEL_INDEX ) // WHERE // APP_EVENT.APP_UID IS NULL // and EVN_STATUS = 'ACTIVE' // AND EVN_RELATED_TO = 'SINGLE' // and DEL_FINISH_DATE IS NULL //-- and APP_DELEGATION.DEL_DELEGATE_DATE > "2009-01-01 12:00:00" //ORDER BY APP_DELEGATION.DEL_DELEGATE_DATE //get info about the Event and the APP_DELEGATION to process $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(EventPeer::EVN_UID); $oCriteria->addSelectColumn(EventPeer::PRO_UID); $oCriteria->addSelectColumn(EventPeer::TAS_UID); $oCriteria->addSelectColumn(EventPeer::EVN_TAS_ESTIMATED_DURATION); $oCriteria->addSelectColumn(EventPeer::EVN_WHEN); $oCriteria->addSelectColumn(EventPeer::EVN_WHEN_OCCURS); $oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO); $oCriteria->addSelectColumn(EventPeer::EVN_MAX_ATTEMPTS); $oCriteria->addSelectColumn(AppDelegationPeer::APP_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); $aConditions = array(); $aConditions[] = array(AppDelegationPeer::TAS_UID, EventPeer::TAS_UID); //$aConditions[] = array(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::IS_NULL ); //is null is supported by addJoinMC by the way. $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); $aConditions = array(); $aConditions[] = array(AppDelegationPeer::APP_UID, AppEventPeer::APP_UID); $aConditions[] = array(AppDelegationPeer::DEL_INDEX, AppEventPeer::DEL_INDEX); $aConditions[] = array(EventPeer::EVN_UID, AppEventPeer::EVN_UID); $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); $oCriteria->add(AppEventPeer::APP_UID, null, Criteria::ISNULL); $oCriteria->add(EventPeer::EVN_STATUS, 'ACTIVE'); $oCriteria->add(EventPeer::EVN_RELATED_TO, 'SINGLE'); $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); // $oCriteria->add(AppDelegationPeer::DEL_DELEGATE_DATE, date('Y-m-d') , Criteria::GREATER_THAN ); $oDataset = EventPeer::doSelectRs($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $aRows = array(); while ($oDataset->next()) { $aRows[] = $oDataset->getRow(); } g::pr($aRows); die; $oDataset->next(); while ($aData = $oDataset->getRow()) { $estimatedDuration = (double) $aData['EVN_TAS_ESTIMATED_DURATION']; $when = (double) $aData['EVN_WHEN']; $whenOccurs = $aData['EVN_WHEN_OCCURS']; if ($whenOccurs == 'AFTER_TIME') { //for multiple $sDueDate = date('Y-m-d H:i:s', $oDates->calculateDate($aData['DEL_DELEGATE_DATE'], $estimatedDuration, 'days', 1)); $sDueDate = $aData['DEL_TASK_DUE_DATE']; $calculatedDueDateA = $oDates->calculateDate($sDueDate, $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); $validStartDate = $sActionDate >= $aData['DEL_DELEGATE_DATE']; } else { $sDueDate = $aData['DEL_DELEGATE_DATE']; $calculatedDueDateA = $oDates->calculateDate($sDueDate, $when, 'days', 1); $sActionDate = date('Y-m-d H:i:s', $calculatedDueDateA['DUE_DATE_SECONDS']); $validStartDate = $sActionDate >= $aData['DEL_DELEGATE_DATE']; } $aData['APP_EVN_ACTION_DATE'] = $sActionDate; $aData['APP_EVN_ATTEMPTS'] = $aData['EVN_MAX_ATTEMPTS']; if ($validStartDate) { $rowsCreated++; $oAppEvent = new AppEvent(); $oAppEvent->create($aData); } else { $rowsRejected++; $aData['APP_EVN_STATUS'] = 'INVALID'; $oAppEvent = new AppEvent(); $oAppEvent->create($aData); } $oDataset->next(); } return "Created {$rowsCreated} SINGLE rows in APP_EVENT and rejected {$rowsRejected} rows "; } catch (Exception $oError) { throw new Exception($oError->getMessage()); } }
public static function obClearn() { if (!self::$isOBHeader) { return; } self::$isOBHeader = true; ob_clean(); }
*/ try { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $_POST = $filter->xssFilterHard($_POST); G::LoadInclude('ajax'); if (isset($_POST['form'])) { $_POST = $_POST['form']; } $_POST['function'] = get_ajax_value('function'); $_POST['function'] = $filter->xssFilterHard($_POST['function']); switch ($_POST['function']) { case 'savePredetermined': require_once "classes/model/Translation.php"; $tranlationsList = Translation::getTranslationEnvironments(); g::pr($tranlationsList); die; if (isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang']) { echo 'The Setting was saved successfully!'; } else { echo 'Some error occured while the setting was being save, try later please.'; } break; case 'languagesList': require_once 'classes/model/Language.php'; require_once 'classes/model/IsoCountry.php'; require_once 'classes/model/Translation.php'; G::loadClass('configuration'); $isoCountry = new isoCountry(); $translationRow = new Translation(); $response = new stdClass();
<?php require "setting.php"; require LOC_DIR . 'core/gz.php'; g::init(); g::sideExec();
<?php $instances = g::get('kflattr.instances'); g::set('kflattr.instances', $instances + 1); // set the defaults if (!isset($user_id)) { die('Please pass the flattr userid'); } if (!isset($url)) { $url = $page->url(); } if (!isset($title)) { $title = $page->title(); } if (!isset($description)) { $description = null; } if (!isset($category)) { $category = null; } if (!isset($language)) { $language = null; } if (!isset($tags)) { $tags = null; } if (!isset($button)) { $button = null; } if (!isset($popout)) { $popout = null;
/** * parse a smarty template and return teh result as string * * @author Erik Amaru Ortiz <*****@*****.**> * @param $template string * containing the template filename on /gulliver/templates/ * directory * @param $data associative * array containig the template data * @return $content string containing the parsed template content */ public function parseTemplate($template, $data = array()) { $content = ''; ob_start(); g::renderTemplate($template, $data); $content = ob_get_contents(); ob_get_clean(); return $content; }
function removeRow($c, $p) { g::db()->exec("DELETE FROM `{$this->table}` WHERE `{$this->table}`.`hierarchy_id` = ?", array($p['hierarchy_id'])); $c->send(true); }
/** * get task list * * @param string $userId * @return $result will return an object */ public function taskList ($userId) { try { g::loadClass( 'groups' ); $oGroup = new Groups(); $aGroups = $oGroup->getActiveGroupsForAnUser( $userId ); $result = array (); $oCriteria = new Criteria( 'workflow' ); $del = DBAdapter::getStringDelimiter(); $oCriteria->addSelectColumn( TaskPeer::PRO_UID ); $oCriteria->addSelectColumn( TaskPeer::TAS_UID ); $oCriteria->addSelectColumn( TaskPeer::TAS_START ); $oCriteria->setDistinct(); $oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' ); $oCriteria->addAlias( "C1", 'CONTENT' ); $tasTitleConds = array (); $tasTitleConds[] = array (TaskPeer::TAS_UID,'C1.CON_ID' ); $tasTitleConds[] = array ('C1.CON_CATEGORY',$del . 'TAS_TITLE' . $del ); $tasTitleConds[] = array ('C1.CON_LANG',$del . SYS_LANG . $del ); $oCriteria->addJoinMC( $tasTitleConds, Criteria::LEFT_JOIN ); $oCriteria->addJoin( TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN ); $oCriteria->addOr( TaskUserPeer::USR_UID, $userId ); $oCriteria->addOr( TaskUserPeer::USR_UID, $aGroups, Criteria::IN ); $oDataset = TaskPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $result[] = array ('guid' => $aRow['TAS_UID'], 'name' => $aRow['TAS_TITLE'], 'processId' => $aRow['PRO_UID'], 'initialTask' => $aRow['TAS_START'] == 'TRUE' ? '1' : '0'); $oDataset->next(); } return $result; } catch (Exception $e) { $result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage() ); return $result; } }
public function removeUserlogin($c, $p) { $c->log($p['u_id']); g::db()->exec("DELETE FROM `user` WHERE `u_id` = ?", array($p['u_id'])); $c->send(true); }
function getAllUsersArray($action) { global $oAppCache; $status = array(); $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER")); $users[] = array("", G::LoadTranslation("ID_ALL_USERS")); if ($action == 'to_reassign') { //now get users, just for the Search action $cUsers = $oAppCache->getToReassignListCriteria(null); $cUsers->addSelectColumn(AppCacheViewPeer::USR_UID); if (g::MySQLSintaxis()) { $cUsers->addGroupByColumn(AppCacheViewPeer::USR_UID); } $cUsers->addAscendingOrderByColumn(AppCacheViewPeer::APP_CURRENT_USER); $oDataset = AppCacheViewPeer::doSelectRS($cUsers); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $users[] = array($aRow['USR_UID'], $aRow['APP_CURRENT_USER']); $oDataset->next(); } } return $users; }
<?php require "setting.php"; require LOC_DIR . 'core/gz.php'; g::init(); g::frontExec();