<?php require_once '../../../../Connections/connBayAreaCont.php'; include '../functions.php'; $Models_General = new Models_General(); $result = array(); try { if (empty($_REQUEST['question'])) { throw new Exception('empty question'); } if (empty($_REQUEST['name'])) { throw new Exception('empty name'); } if (empty($_REQUEST['email'])) { throw new Exception('empty email'); } $data = array(); $data['question'] = $_REQUEST['question']; $data['name'] = $_REQUEST['name']; $data['email'] = $_REQUEST['email']; $data['status'] = 0; $id = $Models_General->addDetails('askquestion', $data); $result = array('success' => 1, 'msg' => 'Question submitted successfully', 'id' => $id, 'data' => $data); mail($_REQUEST['email'], 'New Question Submitted on ' . SITEURL, "\n\nFrom Name: " . $_REQUEST['name'] . "\n\nFrom Email: " . $_REQUEST['email'] . "\n\nQuestion: " . $_REQUEST['question'], 'From:' . FROMNAME . '<' . FROMEMAIL . '>'); mail(ADMINEMAIL, 'New Question Submitted on ' . SITEURL, "\n\nFrom Name: " . $_REQUEST['name'] . "\n\nFrom Email: " . $_REQUEST['email'] . "\n\nQuestion: " . $_REQUEST['question'] . "\n\nhttp://" . SITEURL, 'From:' . FROMNAME . '<' . FROMEMAIL . '>'); } catch (Exception $e) { $result = array('success' => 0, 'msg' => $e->getMessage()); } echo json_encode($result);
<?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 postMessage($approved = 0) { if (!empty($_SESSION['user']['id']) && !empty($_POST['MM_Insert']) && $_POST['MM_Insert'] === 'formMessage') { if (empty($_POST['to_uid'])) { return false; } if (empty($_POST['id'])) { return false; } if (empty($_POST['message'])) { return false; } if (empty($_POST['MM_Insert'])) { return false; } if (empty($_SESSION['user']['id'])) { return false; } $data = array(); $data['message_id'] = guid(); $data['uid'] = $_SESSION['user']['id']; $data['to_uid'] = $_POST['to_uid']; $data['id'] = $_POST['id']; $data['message'] = $_POST['message']; $data['message_approved'] = $approved; $data['message_date'] = date('Y-m-d H:i:s'); $data['module_id'] = !empty($_POST['module_id']) ? $_POST['module_id'] : ''; $modelGeneral = new Models_General(); $modelGeneral->addDetails('help_messages', $data, $_SESSION['user']['id']); mailtoadmin('new message posted', $_POST['message']); } }
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 require_once '../../../../Connections/connBayAreaCont.php'; include '../functions.php'; $Models_General = new Models_General(); $max = 5; $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); }
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; }
if ($client->getAccessToken()) { $pageTitle = 'Login Successfull'; $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
<?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
<?php require_once '../../../../Connections/connBayAreaCont.php'; include '../functions.php'; $Models_General = new Models_General(); $max = 5; $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(); $insertError = null; try { if (isset($_POST['MM_Insert'])) { if (empty($_FILES['beforeFile']['name'])) { $insertError = 'Please choose before work image'; } else { if (empty($_FILES['afterFile']['name'])) { $insertError = 'Please choose after work image'; } } if (empty($insertError)) { $arr = array(); $arr['before_image'] = 's' . time() . '_b_' . $_FILES['beforeFile']['name']; $arr['after_image'] = 's' . time() . '_a_' . $_FILES['afterFile']['name']; move_uploaded_file($_FILES['beforeFile']['tmp_name'], '../images/' . $arr['before_image']);
public function __construct() { parent::__construct(); $this->_connMain->Execute("SET NAMES utf8"); }
<?php require_once '../../../../Connections/connBayAreaCont.php'; include '../functions.php'; $Models_General = new Models_General(); $result = array(); try { $page = 0; if (!empty($_GET['page'])) { $page = $_GET['page']; } $max = 5; $data = $Models_General->ask($max, $page, 1, 0); $result = array('success' => 1, 'data' => $data); } catch (Exception $e) { $result = array('success' => 0, 'msg' => $e->getMessage()); } echo json_encode($result);