public function execute() { try { $request = $_GET; $data = array(); $Models_General = new Models_General(); if (empty($request['account'])) { throw new Exception(0); } $arr = array(); if (!empty($request['b'])) { $arr['account_balance'] = $request['b']; } if (!empty($request['e'])) { $arr['account_equity'] = $request['e']; } if (!empty($request['f'])) { $arr['account_free_margin'] = $request['f']; } if (!empty($request['c'])) { $arr['account_company'] = $request['c']; } if (!empty($arr)) { $where = sprintf('account_number = %s', $Models_General->qstr($request['account'])); $Models_General->updateDetails('forex_users', $arr, $where); } //history $arr = array(); if (!empty($request['b'])) { $arr['account_balance'] = $request['b']; } if (!empty($request['e'])) { $arr['account_equity'] = $request['e']; } if (!empty($request['f'])) { $arr['account_free_margin'] = $request['f']; } if (!empty($arr) && !empty($request['account'])) { $arr['account_number'] = $request['account']; $Models_General->addDetails('forex_balance_history', $arr); } $cache = 1; if (isset($_GET['cache'])) { $cache = $_GET['cache']; } $params = array(); $params['where'] = sprintf(' AND account_number = %s', $this->qstr($request['account'])); $params['fields'] = '*'; //'forex_user_id as id, account_number, status, open_trades, close_trades'; $params['cacheTime'] = 3600; $result = $Models_General->getDetails('forex_users', $cache, $params); if (empty($result[0])) { throw new Exception(1); } foreach ($result[0] as $value) { echo $value . '|'; } } catch (Exception $e) { echo $e->getMessage(); } exit; }
<?php check_login(); $pageTitle = 'Settings'; $generalMode = new Models_General(); $params = array(); $params['where'] = sprintf('AND uid = %s', $generalMode->qstr($_SESSION['user']['id'])); if (isset($_POST['submit'])) { $data = $_POST; if (!empty($data['dob'])) { $data['dob'] = $data['dob'] . ':00'; } unset($data['submit']); updateSettings($_SESSION['user']['id'], $data); //$where = sprintf('uid = %s', $generalMode->qstr($_SESSION['user']['id'])); //$generalMode->updateDetails('settings', $data, $where); //$settings = $generalMode->getDetails('settings', 0, $params); //$_SESSION['settings'] = $settings[0]; } $settings = $_SESSION['settings']; //include(SITEDIR.'/libraries/addresses/nearby.php'); ?> <link rel="stylesheet" type="text/css" href="<?php echo HTTPPATH; ?> /styles/jquery.datetimepicker.css"/> <style type="text/css"> .custom-date-style { background-color: red !important;
function updateSettings($uid, $paramsData = array()) { if (empty($paramsData)) { return false; } $generalMode = new Models_General(); $where = sprintf('uid = %s', $generalMode->qstr($uid)); $generalMode->updateDetails('settings', $paramsData, $where); $params = array(); $params['where'] = 'AND ' . $where; $settings = $generalMode->getDetails('settings', 0, $params); $_SESSION['settings'] = $settings[0]; return true; }
function getAll($tableName, $tagsTable, $max = 100, $page = 0, $params = array(), $cacheTime = 900) { $status = !empty($params['status']) ? (int) $params['status'] : 1; $searchTerm = !empty($params['q']) ? $params['q'] : ''; $lat = !empty($params['lat']) ? $params['lat'] : ''; $lon = !empty($params['lon']) ? $params['lon'] : ''; $radius = !empty($params['radius']) ? $params['radius'] : 30; $path = !empty($params['path']) ? $params['path'] : null; $distance = ''; $distanceWhere = ''; $order = ' ORDER BY a.id DESC'; if (!empty($lat) && !empty($lon)) { $distance = ", (ROUND(\n\tDEGREES(ACOS(SIN(RADIANS(" . GetSQLValueString($lat, 'double') . ")) * SIN(RADIANS(a.lat)) + COS(RADIANS(" . GetSQLValueString($lat, 'double') . ")) * COS(RADIANS(a.lat)) * COS(RADIANS(" . GetSQLValueString($lon, 'double') . " -(a.lng)))))*60*1.1515,2)) as distance"; $distanceWhere = " AND (ROUND(\n\tDEGREES(ACOS(SIN(RADIANS(" . GetSQLValueString($lat, 'double') . ")) * SIN(RADIANS(a.lat)) + COS(RADIANS(" . GetSQLValueString($lat, 'double') . ")) * COS(RADIANS(a.lat)) * COS(RADIANS(" . GetSQLValueString($lon, 'double') . " -(a.lng)))))*60*1.1515,2)) <= " . GetSQLValueString($radius, 'double'); $order = ' ORDER BY distance ASC'; } $Models_General = new Models_General(); //$Models_General->setDebug(1); $page = (int) $page; $maxRows_rsView = $max; $pageNum_rsView = $page; $startRow_rsView = $pageNum_rsView * $maxRows_rsView; $query_rsView = 'select *, a.id as id ' . $distance . ' FROM ' . $tableName . ' as a LEFT JOIN ' . $tagsTable . ' as b ON a.id = b.id WHERE a.status = ' . $status . ' AND a.deleted = 0' . $distanceWhere; if (!empty($searchTerm)) { $query_rsView .= ' AND b.tag LIKE ' . $Models_General->qstr('%' . $searchTerm . '%'); } if (!empty($path)) { $query_rsView .= ' AND a.path = ' . $Models_General->qstr($path); } if (!empty($params['uid'])) { $query_rsView .= ' AND a.uid = ' . $Models_General->qstr($params['uid']); } if (!empty($params['i1'])) { $query_rsView .= ' AND a.i1 = ' . $Models_General->qstr($params['i1']); } if (!empty($params['i2'])) { $query_rsView .= ' AND a.i2 = ' . $Models_General->qstr($params['i2']); } if (!empty($params['d1'])) { $query_rsView .= ' AND a.d1 = ' . $Models_General->qstr($params['d1']); } if (!empty($params['d2'])) { $query_rsView .= ' AND a.d2 = ' . $Models_General->qstr($params['d2']); } if (!empty($params['vc1'])) { $query_rsView .= ' AND a.vc1 = ' . $Models_General->qstr($params['vc1']); } if (!empty($params['vc2'])) { $query_rsView .= ' AND a.vc2 = ' . $Models_General->qstr($params['vc2']); } if (!empty($params['t1'])) { $query_rsView .= ' AND a.t1 LIKE ' . $Models_General->qstr('%' . $params['t1'] . '%'); } if (!empty($params['t2'])) { $query_rsView .= ' AND a.t2 = ' . $Models_General->qstr($params['t2']); } $query_rsView .= ' GROUP BY a.id'; $query_rsView .= $order; $query_limit_rsView = sprintf("%s LIMIT %d, %d", $query_rsView, $startRow_rsView, $maxRows_rsView); $results = $Models_General->fetchAll($query_limit_rsView, array(), $cacheTime); $queryTotalRows = 'select COUNT(distinct a.id) AS cnt FROM ' . $tableName . ' as a LEFT JOIN ' . $tagsTable . ' as b ON a.id = b.id WHERE a.status = ' . $status . ' AND a.deleted = 0' . $distanceWhere; if (!empty($searchTerm)) { $queryTotalRows .= ' AND b.tag LIKE ' . $Models_General->qstr('%' . $searchTerm . '%'); } if (!empty($path)) { $queryTotalRows .= ' AND a.path = ' . $Models_General->qstr($path); } if (!empty($params['uid'])) { $queryTotalRows .= ' AND a.uid = ' . $Models_General->qstr($params['uid']); } if (!empty($params['i1'])) { $queryTotalRows .= ' AND a.i1 = ' . $Models_General->qstr($params['i1']); } if (!empty($params['i2'])) { $queryTotalRows .= ' AND a.i2 = ' . $Models_General->qstr($params['i2']); } if (!empty($params['d1'])) { $queryTotalRows .= ' AND a.d1 = ' . $Models_General->qstr($params['d1']); } if (!empty($params['d2'])) { $queryTotalRows .= ' AND a.d2 = ' . $Models_General->qstr($params['d2']); } if (!empty($params['vc1'])) { $queryTotalRows .= ' AND a.vc1 = ' . $Models_General->qstr($params['vc1']); } if (!empty($params['vc2'])) { $queryTotalRows .= ' AND a.vc2 = ' . $Models_General->qstr($params['vc2']); } if (!empty($params['t1'])) { $queryTotalRows .= ' AND a.t1 LIKE ' . $Models_General->qstr('%' . $params['t1'] . '%'); } if (!empty($params['t2'])) { $queryTotalRows .= ' AND a.t2 = ' . $Models_General->qstr($params['t2']); } $rowCountResult = $Models_General->fetchRow($queryTotalRows, array(), $cacheTime); $totalRows_rsView = $rowCountResult['cnt']; $totalPages_rsView = ceil($totalRows_rsView / $maxRows_rsView) - 1; $return = array('results' => $results, 'max' => $max, 'page' => $page, 'totalRows' => $totalRows_rsView, 'totalPages' => $totalPages_rsView, 'start' => $startRow_rsView, 'pageNum_rsView' => $pageNum_rsView, 'params' => $params); return $return; }
$page = 0; if (isset($_GET['pageNum_rsView'])) { $page = $_GET['pageNum_rsView']; } $totalRows_rsView = 0; $totalPages_rsView = 0; $maxRows_rsView = $max; $pageNum_rsView = $page; $startRow_rsView = $pageNum_rsView * $maxRows_rsView; $result = array(); try { if (isset($_POST['MM_Update']) && !empty($_POST['answer']) && !empty($_POST['id'])) { $paramsData = array(); $paramsData['answer'] = $_POST['answer']; $paramsData['status'] = 1; $where = sprintf('id = %s', $Models_General->qstr($_POST['id'])); $Models_General->updateDetails('askquestion', $paramsData, $where); mail($_POST['email'], 'New Answer Submitted For Your Question on ' . SITEURL, "\n\nQuestion: " . $_REQUEST['question'] . "\n\nAnswer: " . $_POST['answer'], 'From:' . FROMNAME . '<' . FROMEMAIL . '>'); } if (isset($_GET['delete'])) { $paramsData = array(); $paramsData['deleted'] = 1; $where = sprintf('id = %s', $Models_General->qstr($_GET['id'])); $Models_General->updateDetails('askquestion', $paramsData, $where); } $status = 0; if (!empty($_GET['status'])) { $status = $_GET['status']; } $data = $Models_General->ask($max, $page, $status, 0); $totalRows_rsView = isset($data['totalRows']) ? $data['totalRows'] : 0;
$user = $oauth2->userinfo->get(); include ROOTDIR . '/api/googleauth/save.php'; save($user); $Models_Googleauth = new Models_Googleauth(); $details = $Models_Googleauth->getUser($user['id'], 0); if ($details['status'] != 1) { $error = 'User with id ' . $user['id'] . ' not active'; } else { $_SESSION['user'] = $user; $_SESSION['user']['member_type'] = $details['member_type']; $_SESSION['user']['member_expires'] = $details['member_expires']; $_SESSION['user']['fullname'] = $details['fullname']; $_SESSION['user']['access_level'] = !empty($details['access_level']) ? $details['access_level'] : 'member'; $generalMode = new Models_General(); $params = array(); $params['where'] = sprintf('AND uid = %s', $generalMode->qstr($user['id'])); $settings = $generalMode->getDetails('settings', 0, $params); if (empty($settings)) { $generalMode->addDetails('settings', array('uid' => $user['id']), $user['id']); $settings = $generalMode->getDetails('settings', 0, $params); } $_SESSION['settings'] = $settings[0]; //$me = $plus->people->get('me'); $optParams = array('maxResults' => 100); //$activities = $plus->activities->listActivities('me', 'public',$optParams); // The access token may have been updated lazily. $_SESSION['access_token'] = $client->getAccessToken(); $email = filter_var($user['email'], FILTER_SANITIZE_EMAIL); // get the USER EMAIL ADDRESS using OAuth2 if (isset($_SESSION['redirectUrl'])) { $url = $_SESSION['redirectUrl'];
<?php try { check_login(); include SITEDIR . '/includes/navLeftSideVars.php'; check_city_owner($globalCity['id'], $_SESSION['user']['id']); $Models_General = new Models_General(); if (isset($_GET['change']) && !empty($_GET['change_id'])) { $arr = array(); $arr['admin_status'] = $_GET['change']; $where = sprintf('record_id = %s', $Models_General->qstr($_GET['change_id'])); $Models_General->updateDetails('records', $arr, $where); } include SITEDIR . '/includes/showmap.php'; //getting records $Models_Records = new Models_Records(); $params = array(); $params['city_ids'] = $globalCity['id']; $params['admin_status'] = !empty($_GET['status']) ? 1 : 0; $data = $Models_Records->records_view($params); ?> <div class="row"> <div class="col-lg-12"> <h2>Browse <?php echo !empty($params['admin_status']) ? 'Approved' : 'Pending'; ?> Status Lawyers</h2> <p><a href="<?php echo $currentURL; ?> /manage/lawyers/browse?status=0">Pending Lawyers</a> | <a href="<?php