function &siteevent_translate(&$obj) { loader_import('saf.Database.Generic'); $g = new Generic('siteevent_event', 'id'); $g->multilingual = true; $res =& $g->translate($obj); return $res; }
/** * Retrieve oid for a given object. Reserves a new * unique oid for the object if it is not yet associated * with one. Returns the associated oid otherwise. * * @param lang.Object object * @return int */ public function oidFor(Generic $object) { static $oid = 1; if (!isset($this->map[$object->hashCode()])) { // Reserve new oid $xoid = $oid++; // Register object $this->map[$object->hashCode()] = $xoid; $this->oid[$xoid] = $object; } return $this->map[$object->hashCode()]; }
/** * Write a record * * @param lang.Generic object * @param string[] fields if omitted, all fields will be written */ public function write(Generic $object, array $fields = array()) { $values = array(); $class = $object->getClass(); if (!$fields) { foreach ($class->getFields() as $f) { $values[] = $class->getMethod('get' . ucfirst($f->getName()))->invoke($object); } } else { foreach ($fields as $name) { $values[] = $class->getMethod('get' . ucfirst($name))->invoke($object); } } return $this->writeValues($values); }
public function overwriteRead($return) { $objs = $return['objs']; // pr($objs); foreach ($objs as $obj) { if (isset($obj->status)) { if ($obj->status == "1") { $obj->status = "Free"; } else { $obj->status = "Occupied"; } } if (isset($obj->availability)) { if ($obj->availability == "1") { $obj->availability = "Active"; } else { $obj->availability = "Inactive"; } } if (isset($obj->id_restaurant)) { $resto = new MasterRestaurantModel(); $resto->getByID($obj->id_restaurant); if (Generic::IsNullOrEmptyString($resto->name)) { $obj->id_restaurant = "Error"; } else { $obj->id_restaurant = $resto->name; } } } return $return; }
public function changeStatusProgress() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_order_detail = isset($_GET['id_order_detail']) ? addslashes($_GET['id_order_detail']) : ""; if (!$id_order_detail) { Generic::errorMsg("id order detail not found!"); } $objOrderDetail = new OrderDetailModel(); $objOrderDetail->getByID($id_order_detail); if ($objOrderDetail->id_order == "") { Generic::errorMsg("id order detail not found!"); } $statusProgress = intval($objOrderDetail->status_progress); if ($statusProgress == 2) { Generic::errorMsg("Status is " . $statusProgress); } $statusProgress = $statusProgress + 1; $objOrderDetail->status_progress = strval($statusProgress); $objOrderDetail->load = 1; $objOrderDetail->save(); $json['results'] = $statusProgress; echo json_encode($json); die; }
public function getCashOutHistoryTransaction() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $idResto = Generic::mustCheck($_GET['id_restaurant'], "No ID Restaurant Found"); $rt = new MasterRestoTransactionModel(); $arrTrans = $rt->getWhere("id_restaurant='{$idResto}' AND type_transaction='2' ORDER BY datetime_transaction DESC "); $result['transactions'] = array(); foreach ($arrTrans as $trans) { unset($b); $b['id_transaction'] = $trans->id_transaction; $b['id_restaurant'] = $trans->id_restaurant; $b['gross_amount'] = (double) $trans->gross_amount; $b['net_amount'] = (double) $trans->net_amount; $b['type_transaction'] = $trans->type_transaction; $b['datetime_transaction'] = $trans->datetime_transaction; $b['approved'] = $trans->approved == "1"; $result['transactions'][] = $b; } $json['status_code'] = 1; $json['results'] = $result; echo json_encode($json); die; }
/** * regex rules for php * * @return void */ protected function _preProcess() { parent::_addStringPattern(); $this->_addPattern('/(class|namespace)\\s([^\\s|\\;]+)/', '$1 <span class="' . $this->_css_prefix . 'method">$2</span>'); $this->_addPattern('/(include(_once)?|namespace|require(_once)?)([(\\s|\\()])/', '<span class="' . $this->_css_prefix . 'keyword">$1</span>$4'); $this->_addPattern('/new\\s([^()\\$]+)/', 'new <span class="' . $this->_css_prefix . 'function">$1</span>'); $this->_addPattern('/extends\\s([^\\s]+)/', 'extends <span class="' . $this->_css_prefix . 'method"><em>$1</em></span>'); $this->_addPattern('/([\\:]{2})([A-Z_0-9]+)(;|,|:|\\))/', '::<span class="' . $this->_css_prefix . 'constant">$2</span>$3'); $this->_addPattern('/([\\\\a-zA-Z_0-9]+)([\\:]{2})/', '<span class="' . $this->_css_prefix . 'class">$1</span><span class="' . $this->_css_prefix . 'keyword">::</span>'); $this->_addPattern('/\\.(?![^\'\\"\\s]*([\'\\"]))/', '<span class="' . $this->_css_prefix . 'keyword">.</span>'); $this->_addPattern('/default/', '<span class="' . $this->_css_prefix . 'keyword">default</span>'); $this->_addPattern('/function\\s(.+)\\(/', 'function <span class="' . $this->_css_prefix . 'method">$1</span>('); $this->_addPattern('/([^_])array\\(/', '$1<span class="' . $this->_css_prefix . 'function">array</span>('); $this->_addPattern('/(\\()([a-zA-Z0-9]+)(\\s)(\\$)/', '$1<span class="' . $this->_css_prefix . 'function">$2</span> $'); // add the generic code handling stuff parent::_preProcess(); $this->_addPattern('/instanceof\\s(.+)\\)/', '<span class="' . $this->_css_prefix . 'keyword">instanceof</span> <span class="' . $this->_css_prefix . 'function">$1</span>)'); // namespace stuff $this->_addPattern('/use\\s(.*);/', '<span class="' . $this->_css_prefix . 'keyword">use</span> <span class="' . $this->_css_prefix . 'function">$1</span>;'); $this->_addPattern('/\\\\/', '<span class="' . $this->_css_prefix . 'default">\\</span>'); $this->_addPattern('/,/', '<span class="' . $this->_css_prefix . 'default">,</span>'); // keep this in?? $this->_addPattern('/echo/', '<span class="' . $this->_css_prefix . 'function">echo</span>'); $this->_addPattern('/(?i)\\b(s(huffle|ort)|is_null|header|var_dump|date|setcookie|n(ext|at(sort|casesort))|c(o(unt|mpact)|urrent)|in_array|(strto|micro)time|u(sort|ksort|asort)|prev|e(nd|xtract)|k(sort|ey|rsort)|a(sort|r(sort|ray_(s(hift|um|plice|earch|lice)|c(h(unk|ange_key_case)|o(unt_values|mbine))|intersect(_(u(key|assoc)|key|assoc))?|diff(_(u(key|assoc)|key|assoc))?|u(n(shift|ique)|intersect(_(uassoc|assoc))?|diff(_(uassoc|assoc))?)|p(op|ush|ad|roduct)|values|key(s|_exists)|f(il(ter|l(_keys)?)|lip)|walk(_recursive)?|r(e(duce|verse)|and)|m(ultisort|erge(_recursive)?|ap))))|r(sort|eset|ange)|m(in|ax)|highlight_(string|file)|s(ys_getloadavg|et_(include_path|magic_quotes_runtime)|leep)|c(on(stant|nection_(status|aborted))|all_user_(func(_array)?|method(_array)?))|time_(sleep_until|nanosleep)|i(s_uploaded_file|n(i_(set|restore|get(_all)?)|et_(ntop|pton))|p2long|gnore_user_abort|mport_request_variables)|u(sleep|nregister_tick_function)|error_(log|get_last)|p(hp_strip_whitespace|utenv|arse_ini_file|rint_r)|flush|long2ip|re(store_include_path|gister_(shutdown_function|tick_function))|get(servby(name|port)|opt|_(c(urrent_user|fg_var)|include_path|magic_quotes_(gpc|runtime))|protobyn(umber|ame)|env)|move_uploaded_file|s(tr(nc(asecmp|mp)|c(asecmp|mp)|len)|et_e(rror_handler|xception_handler))|c(lass_exists|reate_function)|trigger_error|i(s_(subclass_of|a)|nterface_exists)|de(fine(d)?|bug_(print_backtrace|backtrace))|zend_version|property_exists|e(ach|rror_reporting|xtension_loaded)|func(tion_exists|_(num_args|get_arg(s)?))|leak|restore_e(rror_handler|xception_handler)|get_(class(_(vars|methods))?|included_files|de(clared_(classes|interfaces)|fined_(constants|vars|functions))|object_vars|extension_funcs|parent_class|loaded_extensions|resource_type)|method_exists|sys_get_temp_dir|copy|t(empnam|mpfile)|u(nlink|mask)|p(close|open)|f(s(canf|tat|eek)|nmatch|close|t(ell|runcate)|ile(_(put_contents|get_contents))?|open|p(utcsv|assthru)|eof|flush|write|lock|read|get(s(s)?|c(sv)?))|r(e(name|a(dfile|lpath)|wind)|mdir)|get_meta_tags|mkdir|stat|c(h(own|grp|mod)|learstatcache)|is_(dir|executable|file|link|writable|readable)|touch|disk_(total_space|free_space)|file(size|ctime|type|inode|owner|_exists|perms|atime|group|mtime)|l(stat|chgrp)|srand|getrandmax|rand|mt_(srand|getrandmax|rand)|hebrev(c)?|s(scanf|imilar_text|tr(s(tr|pn)|natc(asecmp|mp)|c(hr|spn|oll)|i(str|p(slashes|cslashes|os|_tags))|t(o(upper|k|lower)|r)|_(s(huffle|plit)|ireplace|pad|word_count|r(ot13|ep(eat|lace)))|p(os|brk)|r(chr|ipos|ev|pos))|ubstr(_(co(unt|mpare)|replace))?|etlocale)|c(h(unk_split|r)|ount_chars)|nl(2br|_langinfo)|implode|trim|ord|dirname|uc(first|words)|join|pa(thinfo|rse_str)|explode|quotemeta|add(slashes|cslashes)|wordwrap|l(trim|ocaleconv)|rtrim|money_format|b(in2hex|asename))(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>'); $this->_addPattern('/(image(s(y|tring(up)?|et(style|t(hickness|ile)|pixel|brush)|avealpha|x)|c(har(up)?|o(nvolution|py(res(ized|ampled)|merge(gray)?)?|lor(s(total|et|forindex)|closest(hwb|alpha)?|transparent|deallocate|exact(alpha)?|a(t|llocate(alpha)?)|resolve(alpha)?|match))|reate(truecolor|from(string|jpeg|png|wbmp|g(if|d(2(part)?)?)|x(pm|bm)))?)|2wbmp|t(ypes|tf(text|bbox)|ruecolortopalette)|i(struecolor|nterlace)|d(estroy|ashedline)|jpeg|ellipse|p(s(slantfont|copyfont|text|e(ncodefont|xtendfont)|freefont|loadfont|bbox)|ng|olygon|alettecopy)|f(t(text|bbox)|il(ter|l(toborder|ed(polygon|ellipse|arc|rectangle))?)|ont(height|width))|wbmp|a(ntialias|lphablending|rc)|l(ine|oadfont|ayereffect)|r(otate|ectangle)|g(if|d(2)?|ammacorrect|rab(screen|window))|xbm)|jpeg2wbmp|png2wbmp|gd_info)(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>'); $this->_addPattern('/(?i)\\bmysqli_(s(sl_set|t(ore_result|at|mt_(s(tore_result|end_long_data|qlstate)|num_rows|close|in(sert_id|it)|data_seek|p(aram_count|repare)|e(rr(no|or)|xecute)|f(ield_count|etch|ree_result)|a(ttr_(set|get)|ffected_rows)|res(ult_metadata|et)|bind_(param|result)))|e(t_local_infile_(handler|default)|lect_db)|qlstate)|n(um_(fields|rows)|ext_result)|c(ha(nge_user|racter_set_name)|ommit|lose)|thread_(safe|id)|in(sert_id|it|fo)|options|d(ump_debug_info|ebug|ata_seek)|use_result|p(ing|repare)|err(no|or)|kill|f(ield_(seek|count|tell)|etch_(field(s|_direct)?|lengths|row)|ree_result)|warning_count|a(utocommit|ffected_rows)|r(ollback|eal_(connect|escape_string|query))|get_(server_(info|version)|host_info|client_(info|version)|proto_info)|more_results)(?=\\s*\\()/', '<span class="' . $this->_css_prefix . 'function">$1</span>'); }
protected function close($connectionId) { if (isset($this->_handshakes[$connectionId])) { unset($this->_handshakes[$connectionId]); } elseif (isset($this->clients[$connectionId])) { $this->onClose($connectionId); //call user handler } elseif (isset($this->services[$connectionId])) { $this->onServiceClose($connectionId); //call user handler } elseif ($this->getIdByConnection($this->_master) == $connectionId) { $this->onMasterClose($connectionId); //call user handler } parent::close($connectionId); if (isset($this->clients[$connectionId])) { unset($this->clients[$connectionId]); } elseif (isset($this->services[$connectionId])) { unset($this->services[$connectionId]); } elseif ($this->getIdByConnection($this->_server) == $connectionId) { $this->_server = null; } elseif ($this->getIdByConnection($this->_service) == $connectionId) { $this->_service = null; } elseif ($this->getIdByConnection($this->_master) == $connectionId) { $this->_master = null; } unset($this->_write[$connectionId]); unset($this->_read[$connectionId]); }
public function recommendationRestoWS() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : ""; if ($lat == "" or !$lat) { $lat = MenuRevoConstants::$latitude; } if (!Generic::checkLatitude($lat)) { Generic::errorMsg("Latitude must be Numeric!"); } $long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : ""; if ($long == "" or !$long) { $long = MenuRevoConstants::$longitude; } if (!Generic::checklongitude($long)) { Generic::errorMsg("Longitude must be Numeric!"); } $distance = isset($_GET['distance']) ? addslashes($_GET['distance']) : 20; if ($distance == '') { $distance = 20; } $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $begin = ($page - 1) * $limit; $json = array(); $json['status_code'] = 1; global $db; $objRecommendation = new RecommendationModel(); $objRestaurant = new MasterRestaurantModel(); $qdish = "SELECT recom.*, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance FROM {$objRecommendation->table_name} recom LEFT JOIN {$objRestaurant->table_name} resto ON resto.id_restaurant= recom.id_restaurant AND DATE(recom.end) >= DATE(NOW()) AND DATE(recom.start)<= DATE(NOW())HAVING distance < {$distance} ORDER BY distance LIMIT {$begin},{$limit}"; $arrRecom = $db->query($qdish, 2); // if (count($arrRecom) == 0) { // $json['status_code'] = 0; // $json['status_message'] = "No ID Found"; // echo json_encode($json); // die(); // } $json['results']['restaurant'] = array(); foreach ($arrRecom as $recom) { $resto = Generic::getRestaurant($recom->id_restaurant); $resto['distance'] = $recom->distance; $json['results']['restaurant'][] = $resto; } echo json_encode($json); die; }
public function onSetUp() { // mysql from version 5.5.7 does not like to truncate tables with foreign key references: http://bugs.mysql.com/bug.php?id=58788 $this->getConnection()->getConnection()->exec('SET foreign_key_checks = 0'); parent::onSetUp(); $this->getConnection()->getConnection()->exec('SET foreign_key_checks = 1'); }
function remove($file, $appname, $id) { if (!$this->store->remove($appname . '-' . $file)) { $this->error = $this->store->error; return false; } return parent::remove($id); }
/** * regex rules for ini files * * @return void */ protected function _preProcess() { parent::_addStringPattern(); parent::_addMathPattern(); parent::_addNumberPattern(); $this->_addPattern('/(?<![a-zA-Z0-9_])(\\[.*\\])/', '<span class="' . $this->_css_prefix . 'method">$1</span>'); $this->_addPattern('/\\[(.*\\s?\\:\\s?)(.*)\\]/', '[$1<em>$2</em>]'); }
/** * Constructor * @return void */ public function init() { parent::init(); if ($this->isFinished()) { return; } $this->out("\r\n", false); }
/** * Write a record * * @param lang.Generic object * @param string[] fields if omitted, all fields will be written */ public function write(Generic $object, array $fields = array()) { $values = array(); $class = $object->getClass(); // Use the array-cast trick to access private and protected members $array = (array) $object; if ($fields) { foreach ($fields as $name) { $values[] = $this->fieldValue($array, $class->getField($name)); } } else { foreach ($class->getFields() as $f) { $values[] = $this->fieldValue($array, $f); } } return $this->writeValues($values); }
/** * overriding parent process() so we can get php blocks * * @return Html */ public function process() { $this->_tokenizePhp(); parent::process(); foreach ($this->_php_blocks as $key => $value) { $this->_html = str_replace($key, $value, $this->_html); } }
/** * Create instance * * @param string $name The name of the field * @param array $data The data to construct the field */ public function __construct($name, array $data) { parent::__construct($name, $data); if (array_key_exists('placeholder', $data)) { $this->placeholder = $data['placeholder']; } $this->type = 'text'; }
/** * Create instance * * @param string $name The name of the field * @param array $data The data to construct the field */ public function __construct($name, array $data) { parent::__construct($name, $data); if (array_key_exists('label', $data)) { $this->label = $data['label']; } $this->type = 'checkbox'; }
/** * Constructor * @return void */ public function init() { parent::init(); $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0'); $this->header('Expires: ' . date('r', strtotime('+1 year'))); echo "Welcome to SockJS!\n"; $this->finish(); }
/** * Create instance * * @param string $name The name of the field * @param array $data The data to construct the field */ public function __construct($name, array $data) { parent::__construct($name, $data); $this->type = 'multi-select-bucket'; if (array_key_exists('options', $data)) { $this->options = $data['options']; } }
function __construct($subclass_attributes = array()) { $attributes = array("action" => "", "entityname" => "", "modulename" => "", "modifier" => "", "id" => "", "successurl" => "", "failureurl" => ""); # merge the attibutes of the parent and the subclass $newattributes = array_merge($attributes, $subclass_attributes); # load the attributes by calling the parent constructor. This is to prevent changing # attributes at run time parent::__construct($newattributes); }
public function onSetUp() { parent::onSetUp(); $pdo = $this->getConnection()->getConnection(); // update next serial/autoincrement value to max foreach ($pdo->query("SELECT table_name, column_name FROM information_schema.columns WHERE column_default LIKE 'nextval%';")->fetchAll(\PDO::FETCH_ASSOC) as $info) { $query = "SELECT setval((SELECT pg_get_serial_sequence('" . $info['table_name'] . "', '" . $info['column_name'] . "') as sequence), (SELECT max(" . $info['column_name'] . ") FROM " . $info['table_name'] . "));"; $pdo->query($query); } }
public function generate($options) { parent::generate($options); $statement = ''; $statement .= $this->generateDelete($options); $statement .= ' '; $statement .= $this->generateWhere($options); $statement .= ' '; return new \Pvik\Database\SQL\Statement\Statement($statement, $this->parameters); }
protected function close($connectionId) { if (isset($this->_handshakes[$connectionId])) { unset($this->_handshakes[$connectionId]); } elseif (isset($this->clients[$connectionId])) { $this->onClose($connectionId); //вызываем пользовательский сценарий } parent::close($connectionId); }
/** * Send frame * @param string $frame * @return void */ protected function sendFrame($frame) { $c =& $this->attrs->get['c']; if (!is_string($c)) { $this->header('400 Bad Request'); $this->finish(); return; } $this->outputFrame($c . '(' . json_encode($frame, JSON_UNESCAPED_SLASHES) . ");\r\n"); parent::sendFrame($frame); }
/** * regex rules for javascript * * @return void */ protected function _preProcess() { parent::_addStringPattern(); $this->_addPattern('/\\$\\(/', '<span class="' . $this->_css_prefix . 'keyword">$</span>('); $this->_addPattern('/(.*)(\\.)(.*)(\\s?=\\s?)function/', '<span class="' . $this->_css_prefix . 'class">$1</span>$2$3$4function'); $this->_addPattern('/(.*?(\\s)?)=(\\s)?function/', '<span class="' . $this->_css_prefix . 'method">$1</span>=$2function'); $this->_addPattern('/(.*?(\\s)?)\\:(\\s)?function/', '<span class="' . $this->_css_prefix . 'method">$1</span>:$2function'); $this->_addPattern('/\\./', '<span class="' . $this->_css_prefix . 'default">.</span>'); $this->_addPattern('/(document|window)/', '<span class="' . $this->_css_prefix . 'class">$1</span>'); // add the generic code handling stuff parent::_preProcess(); }
function __construct($newattributes = array()) { if (!function_exists('get_instance')) { return "Can't get CI instance"; } $this->CI =& get_instance(); # load the attributes by calling the parent constructor. This is to prevent changing # attributes at run time parent::__construct($newattributes); # the database connection object $this->CI->load->library('kernel/database'); $this->db = $this->CI->database; }
/** * Determines whether access to specific action is allowed or not. * @param string $action the action to which the access is validated * @return boolean true if access to specific action is allowed; false otherwise */ private function CanAccess($action = "") { $superuser = Generic::isSuperAdmin(); if ($superuser) { return true; } if ($action == 'index') { return true; } else { if ($action == 'admin') { return true; } else { if ($action == 'create') { return false; } else { if ($action == 'update') { return true; } else { if ($action == 'delete') { return false; } else { if ($action == 'view') { return true; } else { if ($action == 'activate') { return false; } else { if ($action == 'deactivate') { return false; } else { if ($action == 'checkdata') { return false; } else { if ($action == 'exportdata') { return false; } } } } } } } } } } return false; }
public function extraMenu() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $objHS = new HomeSettingModel(); $json = array(); $json['status_code'] = 1; $search_type = isset($_GET['search_type']) ? addslashes($_GET['search_type']) : ""; if (!$search_type) { Generic::errorMsg("Search Type is blank!"); } $search_term = isset($_GET['search_term']) ? addslashes($_GET['search_term']) : ""; if (!search_term) { Generic::errorMsg("Search Term is blank!"); } }
function Signature($id = false) { parent::Generic('petition_signature', 'id'); if (is_array($id)) { $newkey = $this->add($id); if (is_numeric($newkey)) { $this->setCurrent($this->get($newkey)); } else { $this->setCurrent($this->get($id['id'])); } } elseif (is_object($id)) { $this->setCurrent($id); } elseif ($id) { $this->setCurrent($this->get($id)); } // Signature cascade }
public function setInvitation() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_order = Generic::mustCheck($_GET['id_order'], "NO ID Order found!"); $result = $this->setInvitationStatus("1", $id_order); if ($result) { $json['status_code'] = 1; $json['status_message'] = "Success!"; } else { $json['status_code'] = 0; $json['status_message'] = "Failed!"; } echo json_encode($json); die; }