function ProcessRequest() { $idUnit = $_REQUEST['unit']; $applicationId = Configuration::Instance()->GetValue('application', 'application_id'); $userObj = new AppUser(); $dataGroup = $userObj->GetDataGroupByUnitId("", $idUnit, $applicationId); $return['dataGroup'] = $dataGroup; return $return; }
public function login() { $FWebUser = new AppUser(); if ($this->_identity === null) { $this->_identity = new UserIdentity($this->username, $this->password); $this->_identity->authenticate(); } if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) { $duration = $this->rememberMe ? 3600 * 24 * 30 : 0; // 30 days $FWebUser->login($this->_identity, $duration); return true; } else { return false; } }
protected function install_database() { $tables = NeechyDatabase::create_model_tables(); AppUser::create_on_install(); AppPage::create_on_install(); $this->t->flash('Created database tables.', 'success'); return $tables; }
function ProcessRequest() { $msg = Messenger::Instance()->Receive(__FILE__); $userObj = new AppUser(); $filter_data = !empty($msg[0][0]) ? $msg[0][0] : NULL; $message['content'] = !empty($msg[1][1]) ? $msg[1][1] : NULL; $message['style'] = !empty($msg[1][2]) ? $msg[1][2] : NULL; $view_per_page = Configuration::Instance()->GetValue('application', 'paging_limit'); $view_per_page = 5; if (!isset($_GET['display']) || empty($filter_data)) { $page = 1; $start = 0; $display = $view_per_page; $filter = compact('page', 'display', 'start'); } elseif ($_GET['display']->Raw() != '') { $page = (int) $_GET['page']->SqlString()->Raw(); $display = (int) $_GET['display']->SqlString()->Raw(); if ($page < 1) { $page = 1; } if ($display < 1) { $display = $view_per_page; } $start = ($page - 1) * $display; $filter = compact('page', 'display', 'start'); $filter += $filter_data; } else { $filter = $filter_data; $page = $filter['page']; $display = $filter['display']; $start = $filter['start']; } $post_data = $_POST->AsArray(); if (!empty($post_data)) { foreach ($post_data as $key => $value) { $filter[$key] = $value; } } Messenger::Instance()->Send(Dispatcher::Instance()->mModule, Dispatcher::Instance()->mSubModule, Dispatcher::Instance()->mAction, Dispatcher::Instance()->mType, array($filter), Messenger::UntilFetched); $data = $userObj->getData($filter); $total = $userObj->countData(); $url = Dispatcher::Instance()->GetUrl(Dispatcher::Instance()->mModule, Dispatcher::Instance()->mSubModule, Dispatcher::Instance()->mAction, Dispatcher::Instance()->mType) . '&display=' . $view_per_page; Messenger::Instance()->SendToComponent('paging', 'Paging', 'view', 'html', 'paging_top', array($display, $total, $url, $page), Messenger::CurrentRequest); return compact('data', 'filter', 'message'); }
function ProcessRequest() { $msg = Messenger::Instance()->Receive(__FILE__); if ($msg) { $return['Pesan'] = $msg[0][1]; $return['Data'] = $msg[0]; } else { $return['Pesan'] = null; $return['Data'] = null; } $decUsr = Dispatcher::Instance()->Decrypt($_REQUEST['usr']); if ($decUsr == '') { $decUsr = Dispatcher::Instance()->Decrypt($return['Data']['0']['usr']); } $applicationId = Configuration::Instance()->GetValue('application', 'application_id'); $userObj = new AppUser(); $dataUser = $userObj->GetDataUserById($decUsr); $dataUnitKerja = $userObj->GetComboUnitKerja($applicationId); if (isset($dataUser['0']['unit_kerja_id'])) { $unit_selected = $dataUser['0']['unit_kerja_id']; } else { $unit_selected = $return['Data']['0']['unit_kerja']; } Messenger::Instance()->SendToComponent('combobox', 'Combobox', 'view', 'html', 'unit_kerja', array('unit_kerja', $dataUnitKerja, $unit_selected, 'false', 'onChange="updateGroup();"', false, '', '', '', ''), Messenger::CurrentRequest); if (isset($unit_selected)) { $data_combo_group = $userObj->GetDataGroupByUnitId("", $unit_selected, $applicationId); if ($_REQUEST['usr'] == '') { $group_selected = $return['Data']['0']['group']; } else { $group_selected = $dataUser['0']['group_id']; } } else { $group_selected = null; $data_combo_group = null; } Messenger::Instance()->SendToComponent('combobox', 'Combobox', 'view', 'html', 'group', array('group', $data_combo_group, $group_selected, 'false', '', '', '', ''), Messenger::CurrentRequest); $return['dataUser'] = $dataUser; return $return; }
function updateCat() { $upcategory = AppUser::cleanInput($_POST['uptitle']); $upparent_id = $_POST['upparent_id']; $id = $_POST['id']; $sql = "UPDATE categories SET cat_title=?, parent_id=? WHERE id=?"; $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, $upcategory, PDO::PARAM_STR); $stmt->bindValue(2, $upparent_id, PDO::PARAM_INT); $stmt->bindValue(3, $id, PDO::PARAM_INT); $stmt->execute(); return true; }
function index() { if (isset($_POST['order'])) { $order = AppUser::cleanInput($_POST); $this->order = $order; $model = new Application_Models_Order(); $error = $model->insertBusket($order); if (!empty($error)) { $this->error = $error; } else { Lib_SmalCart::getInstance()->deleteCookies(); } if (empty($error)) { $this->success = 1; } } }
public function build_page_tab_menu($page_title) { $page_tabs = array('page' => $page_title, 'editor' => 'Edit', 'history' => 'History'); $tabs_by_user_status = array('default' => array('page', 'history'), 'logged-in' => array_keys($page_tabs)); $user_status = AppUser::is_logged_in() ? 'logged-in' : 'default'; $user_tabs = $tabs_by_user_status[$user_status]; $tab_links = array(); foreach ($user_tabs as $handler) { $label = $page_tabs[$handler]; $href = NeechyPath::url($this->request->page, $handler); $classes = array($handler); if ($handler == 'page') { $classes[] = 'title'; } if ($handler == $this->request->handler) { $classes[] = 'active'; } if ($this->request->handler == 'editor' && $handler == $this->request->handler && $this->request->action == 'preview') { $label = 'Preview'; } $tab_links[] = $this->build_page_tab_link($label, $href, $classes); } return implode("\n", $tab_links); }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; session_start(); $comments = AppUser::cleanInput($_POST, 'comment'); $feed_back = new Application_Models_Feedback(); $error = $feed_back->isValidCommentData($comments, $_SESSION['id']); if (!empty($error)) { $response = array(); foreach ($error as $key => $value) { if ($value) { $response[$key] = $value; } } } if (empty($error)) { $response = array("success" => "Ваш коментарий будет опубликован!"); unset($_SESSION['bild']); } echo json_encode($response);
static function FetchFromString($string = '') { list($email, $crypted_password) = explode('|', $string); // valid? if (($user = AppUser::FetchUser($email)) instanceof User && $user->crypted_password == $crypted_password) { return AppUser::SetCurrent($user); } else { return false; } }
protected function _beforeRender() { // URL // -------------------------------------------------- /* FIXME replace with single 'registered object' in smarty! */ $this->assign('this', $this); $this->assign('url', Url::$data); Globe::ForLayout('url', Url::$data); // SITE // -------------------------------------------------- Globe::ForLayout('sitename', SITE_NAME); Globe::ForLayout('footer', FOOTER); Globe::ForLayout('time', time()); // ADMIN // -------------------------------------------------- if (Url::GetData('is_admin')) { $this->assign('ADMIN_ROUTE', ADMIN_ROUTE); } // SUBDOMAIN // -------------------------------------------------- if (Url::GetData('is_subdomain') && $this->layout == DEFAULT_LAYOUT) { $this->layout = 'subdomain'; } // NAVIGATION // -------------------------------------------------- // pre/append $this->nav = array_merge($this->nav_prepend, $this->nav, $this->nav_append); // save Globe::ForLayout('nav', $this->nav); // active? Globe::ForLayout('nav_active', ''); foreach ($this->nav as $label => $link) { if (strpos(DS . Url::$data['_url'], $link) === 0) { Globe::ForLayout('nav_active', $label); // FIXME what the hell is this doing in endo?! Globe::ForLayout('title', $label != 'LiveIt! Lessons' ? trim(str_replace('LiveIt!', '', $label)) : 'Lesson ' . $this->View->_tpl_vars['lesson']); } } // AJAX // -------------------------------------------------- $this->assign('is_ajax', $this->is_ajax()); // ACL // -------------------------------------------------- Globe::ForLayout('LoggedIn', $this->assign('LoggedIn', AppUser::Clean($this->LoggedIn))); }
/** * Ensures everythingworks as expected */ public function test__toStringOk() { $appUser = new AppUser($this->_defaultUser); $val = $appUser->__toString(); $this->assertFalse(empty($val)); $this->assertTrue(is_string($val)); }
<nav class="row"> <ol class="breadcrumb "> <li><a href="/">Главная</a></li> <li><a href="/catalog">Каталог</a></li> <?php echo AppUser::getAricleforerunner(); ?> <div id="cart_res" class="pull-right"><img src="img/korzina.jpg" > <a href="#" id="show_busket" data-toggle="modal" data-target=".bs-example-modal-lg" >Корзина</a> Количество товара:<span><?php echo !$_SESSION['total_items'] ? 0 : $_SESSION['total_items']; ?> </span > На сумму:<span><?php echo !$_SESSION['total_price'] ? 0 : $_SESSION['total_price']; ?> грн</span></div><!--cart_res--> </ol> </nav> <div id="gallery"> <div class="album" data-jgallery-album-title="Album 1"> <?php if ($mod1['images'] == true) { $images = unserialize($mod1['images']); foreach ($images as $image) { ?> <a href="<?php echo URL; ?>
function updateComment() { $avatar = $_SESSION['comments'] ? explode('/', $_SESSION['comments']) : ''; if ($avatar) { $avatar = array_pop($avatar); } $update = AppUser::cleanInput($_POST); $sql = "UPDATE comments SET name=?, email=?, comments=?, picture=? WHERE id=?"; $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, $update['name'], PDO::PARAM_STR); $stmt->bindValue(2, $update['email'], PDO::PARAM_STR); $stmt->bindValue(3, $update['comments'], PDO::PARAM_STR); $stmt->bindValue(4, $avatar, PDO::PARAM_STR); $stmt->bindValue(5, $update['id'], PDO::PARAM_INT); $stmt->execute(); return true; }
public function logout($root = DS) { Event::Set($this->LoggedIn, 'logout'); AppUser::UnsetCurrent(); $this->redirect($root); }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; $search = AppUser::cleanInput($_POST); if (isset($_POST['id'])) { $id = $_POST['id']; $model = new Application_Models_Product(); $mod = $model->getProduct($id); $view = new Application_Views_Search(); $view->showWindow($mod); exit; } else { $model = new Application_Models_Search(); $model->getSearch($search['search']); }
<nav class="row"> <ol class="breadcrumb "> <li><a href="/">Главная</a></li> <?php echo AppUser::getBreadcrumb(); ?> <div id="cart_res" class="pull-right"><img src="img/korzina.jpg" > <a href="#" id="show_busket" data-toggle="modal" data-target=".bs-example-modal-lg" >Корзина</a> Количество товара:<span><?php echo !$_SESSION['total_items'] ? 0 : $_SESSION['total_items']; ?> </span > На сумму:<span><?php echo !$_SESSION['total_price'] ? 0 : $_SESSION['total_price']; ?> грн</span></div><!--cart_res--> </ol> </nav> <?php if (!empty($mod1)) { ?> <div class="row"> <div class="btn-group btn-xs col-sm-9 col-sm-offset-3"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> Сортировать по <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li><a href="<?php echo $clearurl;
<?php session_start(); include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; $data = AppUser::cleanInput($_POST); if ($_SESSION['bild']) { ?> <h3>Аватар: </h3> <img src="<?php echo 'uploads/comments/' . $_SESSION['bild']; ?> " "width="70" height="80" class="img-responsive"/> <?php } ?> <h3><strong>Имя: </strong></h3><p><?php echo $data['name']; ?> </p> <h3><strong>отзыв: </strong></h3><p><?php echo $data['message']; ?> </p> </br>
// ======================================================================== // // Api/Api.classes.php // Support for an application that handles API requests // instead of browser requests // // Part of the Methodosity Framework for PHP applications // http://blog.stuartherbert.com/php/mf/ // // Author Stuart Herbert // (stuart@stuartherbert.com) // // Copyright (c) 2008-2010 Stuart Herbert // Released under v3 of the GNU Affero Public License // // ======================================================================== // ======================================================================== // When Who What // ------------------------------------------------------------------------ // 2008-08-13 SLH Created empty file // 2008-10-17 SLH Added empty ApiAuthenticator class // ======================================================================== class ApiAuthenticator extends UserAuthenticator { public function newUser(AppRequest $oRequest, Datastore $oUserDB) { // TODO } } AppUser::authenticateUsing(new ApiAuthenticator());
function updateProduct($images, $update) { $insert = AppUser::cleanInput($update, 'pictures'); if ($insert['author'] != '' && $insert['title'] != '' && $insert['description'] != '' && $insert['body'] != '' && $insert['manufacturer'] != '' && $insert['price'] != '') { $sql = "UPDATE products SET author=?, title=?, description=?, body=?, price=?, id_cat=?, manufacturer_id=?, images=? WHERE id=?"; $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, $insert['author'], PDO::PARAM_STR); $stmt->bindValue(2, $insert['title'], PDO::PARAM_STR); $stmt->bindValue(3, $insert['description'], PDO::PARAM_STR); $stmt->bindValue(4, $insert['body'], PDO::PARAM_STR); $stmt->bindValue(5, $insert['price'], PDO::PARAM_STR); $stmt->bindValue(6, $insert['category'], PDO::PARAM_INT); $stmt->bindValue(7, $insert['manufacturer'], PDO::PARAM_INT); $stmt->bindValue(8, $images, PDO::PARAM_STR); $stmt->bindValue(9, $insert['id'], PDO::PARAM_INT); $stmt->execute(); return true; } else { return false; } }
public static function reset() { # Require these here to avoid circular dependency error. require_once '../app/models/user.php'; require_once '../app/models/page.php'; self::drop_model_tables(); self::create_model_tables(); AppUser::create_on_install(); AppPage::create_on_install(); }
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; session_start(); $message = AppUser::cleanInput($_POST); $model = new Application_Models_Feedback(); $error = $model->isValidData($message); $response = array(); if (!empty($error)) { foreach ($error as $key => $value) { if ($value) { $response[$key] = $value; } } } if (empty($error)) { $response = array("success" => "Ваше письмо отправлено!!!"); $model->sendMail(); } echo json_encode($response); //
function updateAbout() { $about = AppUser::cleanInput($_POST['text']); //$about=$_POST['text']; $sql = "UPDATE background SET about=?"; $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, $about, PDO::PARAM_STR); $stmt->execute(); return true; }