public function authorize_with_linkedin() { $this->load->model("loginmodel", "lm", true); $authorization_url = $this->lm->linkedin_authorization_url(); error_log($authorization_url); $util = new utilities(); $util->redirect($authorization_url); }
function create_cobot_user_for_email($email) { error_log("5.a.1. Trying to create Cobot user with email: " . $email); global $cobot_user_default_password; $url = 'https://www.cobot.me/api/users'; $util = new utilities(); $data = array('access_token' => $util->get_current_environment_cobot_access_token(), 'email' => $email, 'password' => $cobot_user_default_password); $result = $this->make_post_request($url, $data); $this->check_cobot_error($result); return $result; }
public function delete_token() { $eb_user_id = $_GET["eb_user_id"]; $this->load->model("eventsmodel", "em", true); if ($this->em->delete_eventbrite_token($eb_user_id) === TRUE) { error_log("Deleted Eventbrite access token successfully"); } else { error_log("Error deleting Eventbrite access token"); } $util = new utilities(); $util->redirect(ROOTMEMBERPATH . 'grind-code/index.php/eventbrite/tokens'); }
public function invoice_cobot_bookings() { error_log('In invoice and charge last 24 hours bookings'); $util = new utilities(); $access_token = $util->get_current_environment_cobot_access_token(); $to = date_create(); $from = date_add(date_create(), date_interval_create_from_date_string("-24 hours")); $from = date_format($from, 'Y-m-d H:i O'); $to = date_format($to, 'Y-m-d H:i O'); $query = $this->db->get("cobot_spaces"); $spaces = $query->result(); foreach ($spaces as $space) { $bookings_url = 'https://' . $space->id . '.cobot.me/api/bookings'; $bookings = $util->do_get($bookings_url, $params = array('access_token' => $access_token, 'from' => rawurlencode($from), 'to' => rawurlencode($to))); if (count($bookings) < 1) { echo " *** No bookings in the last 24 hours for space: " . $space->id . "\r\n"; error_log(" *** No bookings in the last 24 hours for space: " . $space->id); } else { error_log('Bookings for space: ' . $space->id . ' are: ' . json_encode($bookings)); } $memberships = array(); foreach ($bookings as $booking) { $booking = (array) $booking; $membership = $booking['membership']; if ($membership) { if (!isset($memberships[$membership->id])) { $memberships[$membership->id] = 1; } } } $membership_ids = array_keys($memberships); error_log('Memberships to be charged: ' . json_encode($membership_ids)); foreach ($membership_ids as $membership_id) { echo " *** Trying to generate invoice for membership id: " . $membership_id . " for space: " . $space->id . "\r\n"; error_log(" *** Trying to generate invoice for membership id: " . $membership_id . " for space: " . $space->id); $invoice_url = 'https://' . $space->id . '.cobot.me/api/memberships/' . $membership_id . '/charges_based_invoices'; $params = array(); $result = $util->do_post($invoice_url, $params, $access_token); if ($result && count($result) > 0 && !array_key_exists('error', $result)) { error_log('Invoice created with id: ' . $result['id'] . ' and number: ' . $result['invoice_number'] . ' and url: ' . $result['url'] . ' for membership id: ' . $membership_id); echo ' *** Invoice created with id: ' . $result['id'] . ' and number: ' . $result['invoice_number'] . ' and url: ' . $result['url'] . ' for membership id: ' . $membership_id . "\r\n"; $charge_url = 'https://' . $space->id . '.cobot.me/api/invoices/' . $result['invoice_number'] . '/charges'; $charge_result = $util->do_post($charge_url, array(), $access_token); echo " *** Charge made for invoice number: " . $result['invoice_number'] . "\r\n"; error_log(" *** Charge made for invoice number: " . $result['invoice_number']); } } } }
public function postRegister() { Input::merge(array_map('trim', Input::all())); $input = Input::all(); $rules = array('regName' => 'required|max:40', 'regEmail' => 'required|email|max:40', 'regPassword' => 'required|min:6|max:20'); $v = Validator::make($input, $rules); if ($v->passes()) { if (count(DB::table('users')->where('email', '=', $input['regEmail'])->first())) { return Redirect::to(URL::to("/login"))->withInput()->WithErrors("Este Email já está em uso"); } $password = $input['regPassword']; $password = Hash::make($password); $code = str_random(15); $data = array('email' => $input['regEmail'], 'name' => $input['regName']); Mail::send('emails.welcome', array('username' => $data['name'], 'code' => $code, 'email' => $data['email']), function ($message) use($data) { $message->to($data['email'])->subject('Bem vindo!'); }); $user = new User(); $user->email = $input['regEmail']; $user->name = $input['regName']; $user->password = $password; $user->activation_token = $code; $user->save(); $id = DB::table('users')->where('email', '=', $input['regEmail'])->first(); utilities::log("Login", $id->id); return Redirect::to(URL::to("/login"))->With('success', 'Conta criada, Verifica a tua conta com o link que te foi enviado por Email.'); } else { return Redirect::to(URL::to("/login"))->withInput()->WithErrors($v); } }
public static function writecsv($post = []) { $branch = utilities::getAllBranch(); $branch_code = isset($branch['all_ss_branch'][$post['D01_SS_CD']]) ? $branch['all_ss_branch'][$post['D01_SS_CD']] : ''; $branch_name = isset($branch['all_branch'][$branch_code]) ? $branch['all_branch'][$branch_code] : ''; $ss_name = isset($branch['all_ss'][$post['D01_SS_CD']]) ? $branch['all_ss'][$post['D01_SS_CD']] : ''; if ($post['D01_MOBTEL_NO'] && $post['D01_TEL_NO']) { $post['TEL_NUMBER'] = $post['D01_TEL_NO'] . ',' . $post['D01_MOBTEL_NO']; } elseif ($post['D01_MOBTEL_NO']) { $post['TEL_NUMBER'] = $post['D01_MOBTEL_NO']; } elseif ($post['D01_TEL_NO']) { $post['TEL_NUMBER'] = $post['D01_TEL_NO']; } else { $post['TEL_NUMBER'] = ''; } $data[0] = ['保証書番号', '保証期間', '購入日', '購入本数', '顧客名', 'フリガナ', '郵便番号', '住所', '電話番号', '車名', '車番', '右前メーカー', '右前商品名', '右前サイズ', '右前セリアル', '右前本数', '左前メーカー', '左前商品名', '左前サイズ', '左前セリアル', '左前本数', '右後メーカー', '右後商品名', '右後サイズ', '右後セリアル', '右後本数', '左後メーカー', '左後商品名', '左後サイズ', '左後セリアル', '左後本数', 'その他Aメーカー', 'その他A商品名', 'その他Aサイズ', 'その他Aセリアル', 'その他A本数', 'その他Bメーカー', 'その他B商品名', 'その他Bサイズ', 'その他Bセリアル', 'その他B本数', 'POS伝票番号', '支店コード', '支店名', 'SSコード', 'SS名', '作業伝票番号']; $data[1] = ['warranty_card_number' => isset($post['M09_WARRANTY_NO']) ? $post['M09_WARRANTY_NO'] : '', 'warranty_period' => isset($post['warranty_period']) ? $post['warranty_period'] : '', 'purchase_date' => isset($post['M09_INP_DATE']) ? $post['M09_INP_DATE'] : '', 'purchase_no' => isset($post['D05_SURYO']) ? $post['D05_SURYO'] : '', 'D01_CUST_NAMEN' => isset($post['D01_CUST_NAMEN']) ? $post['D01_CUST_NAMEN'] : '', 'D01_CUST_NAMEK' => isset($post['D01_CUST_NAMEK']) ? $post['D01_CUST_NAMEK'] : '', 'D01_YUBIN_BANGO' => isset($post['D01_YUBIN_BANGO']) && trim($post['D01_YUBIN_BANGO']) != '' ? substr($post['D01_YUBIN_BANGO'], 0, 3) . '-' . substr($post['D01_YUBIN_BANGO'], 3, 4) : '', 'D01_ADDR' => isset($post['D01_ADDR']) ? $post['D01_ADDR'] : '', 'TEL_NUMBER' => $post['TEL_NUMBER'], 'D02_MODEL_CD' => isset($post['D02_CAR_NAMEN_' . $post['D02_CAR_SEQ_SELECT']]) ? $post['D02_CAR_NAMEN_' . $post['D02_CAR_SEQ_SELECT']] : '', 'D02_CAR_NO' => isset($post['D02_CAR_NO_' . $post['D02_CAR_SEQ_SELECT']]) ? $post['D02_RIKUUN_NAMEN_' . $post['D02_CAR_SEQ_SELECT']] . ' ' . $post['D02_CAR_ID_' . $post['D02_CAR_SEQ_SELECT']] . ' ' . $post['D02_HIRA_' . $post['D02_CAR_SEQ_SELECT']] . ' ' . $post['D02_CAR_NO_' . $post['D02_CAR_SEQ_SELECT']] : '', 'right_front_manu' => isset($post['right_front_manu']) ? $post['right_front_manu'] : '', 'right_front_product' => isset($post['right_front_product']) ? $post['right_front_product'] : '', 'right_front_size' => isset($post['right_front_size']) ? $post['right_front_size'] : '', 'right_front_serial' => isset($post['right_front_serial']) ? $post['right_front_serial'] : '', 'right_front_no' => isset($post['right_front_no']) && $post['right_front_no'] ? $post['right_front_no'] : '', 'left_front_manu' => isset($post['left_front_manu']) ? $post['left_front_manu'] : '', 'left_front_product' => isset($post['left_front_product']) ? $post['left_front_product'] : '', 'left_front_size' => isset($post['left_front_size']) ? $post['left_front_size'] : '', 'left_front_serial' => isset($post['left_front_serial']) ? $post['left_front_serial'] : '', 'left_front_no' => isset($post['left_front_no']) && $post['left_front_no'] ? $post['left_front_no'] : '', 'right_behind_manu' => isset($post['right_behind_manu']) ? $post['right_behind_manu'] : '', 'right_behind_product' => isset($post['right_behind_product']) ? $post['right_behind_product'] : '', 'right_behind_size' => isset($post['right_behind_size']) ? $post['right_behind_size'] : '', 'right_behind_serial' => isset($post['right_behind_serial']) ? $post['right_behind_serial'] : '', 'right_behind_no' => isset($post['right_behind_no']) && $post['right_behind_no'] ? $post['right_behind_no'] : '', 'left_behind_manu' => isset($post['left_behind_manu']) ? $post['left_behind_manu'] : '', 'left_behind_product' => isset($post['left_behind_product']) ? $post['left_behind_product'] : '', 'left_behind_size' => isset($post['left_behind_size']) ? $post['left_behind_size'] : '', 'left_behind_serial' => isset($post['left_behind_serial']) ? $post['left_behind_serial'] : '', 'left_behind_no' => isset($post['left_behind_no']) && $post['left_behind_no'] ? $post['left_behind_no'] : '', 'other_a_manu' => isset($post['other_a_manu']) ? $post['other_a_manu'] : '', 'other_a_product' => isset($post['other_a_product']) ? $post['other_a_product'] : '', 'other_a_size' => isset($post['other_a_size']) ? $post['other_a_size'] : '', 'other_a_serial' => isset($post['other_a_serial']) ? $post['other_a_serial'] : '', 'other_a_no' => isset($post['other_a_no']) && $post['other_a_no'] ? $post['other_a_no'] : '', 'other_b_manu' => isset($post['other_b_manu']) ? $post['other_b_manu'] : '', 'other_b_product' => isset($post['other_b_product']) ? $post['other_b_product'] : '', 'other_b_size' => isset($post['other_b_size']) ? $post['other_b_size'] : '', 'other_b_serial' => isset($post['other_b_serial']) ? $post['other_b_serial'] : '', 'other_b_no' => isset($post['other_b_no']) && $post['other_b_no'] ? $post['other_b_no'] : '', 'D03_POS_DEN_NO' => isset($post['D03_POS_DEN_NO']) ? $post['D03_POS_DEN_NO'] : '', 'branch_code' => $branch_code, 'branch_name' => $branch_name, 'D01_SS_CD' => isset($post['D01_SS_CD']) ? $post['D01_SS_CD'] : '', 'ss_name' => $ss_name, 'D03_DEN_NO' => isset($post['D03_DEN_NO']) ? $post['D03_DEN_NO'] : '']; utilities::createFolder('data/csv/'); $fp = fopen(getcwd() . '/data/csv/' . $post['D03_DEN_NO'] . '.csv', 'w+'); fputs($fp, $bom = chr(0xef) . chr(0xbb) . chr(0xbf)); foreach ($data as $key => $value) { fputcsv($fp, $value); } fclose($fp); }
public function postVote() { Input::merge(array_map('trim', Input::all())); $input = Input::all(); $rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required'); $v = Validator::make($input, $rules); $sid = $input['sid']; $server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first(); if (!count($server)) { return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor"); } if ($v->passes()) { if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) { return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje"); } if ($server->mcs_votifier == 1) { $votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']); if ($votifier == false) { return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo"); } } if (Auth::check()) { DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1)); utilities::log("Voted On Server " . $server->mcs_name); } DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1)); DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y"))); return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!'); } else { return Redirect::to('/minecraft/' . $sid)->withErrors($v); } }
public static function glob_recursive($pattern, $flags = 0) { $files = glob($pattern, $flags); foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { $files = array_merge($files, utilities::glob_recursive($dir . '/' . basename($pattern), $flags)); } return $files; }
function do_get($url, $environment, $params = array()) { $util = new utilities(); $get_result = array(); $curl = curl_init(); $url = $url . '?access_token=' . $util->get_current_environment_cobot_access_token(); foreach ($params as $key => $value) { $url .= "&" . $key . "=" . $value; } error_log($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); $result_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($result_code >= 200 && $result_code < 300) { $get_result = (array) json_decode($result); } //error_log(json_encode($get_result)); return $get_result; }
public static function getMCBanner($id) { if (!utilities::MCSVhasBanner($id)) { return URL::to('/resources/images/minecraft/banners/default-banner.jpg'); } else { if (file_exists(public_path() . "/resources/images/minecraft/banners/" . $id . ".png")) { return URL::to('/resources/images/minecraft/banners/' . $id . '.png'); } elseif (file_exists(public_path() . "/resources/images/minecraft/banners/" . $id . ".jpg")) { return URL::to('/resources/images/minecraft/banners/' . $id . '.jpg'); } elseif (file_exists(public_path() . "/resources/images/minecraft/banners/" . $id . ".gif")) { return URL::to('/resources/images/minecraft/banners/' . $id . '.gif'); } } }
function parse() { require_once PATH_CORE . '/classes/remotefile.class.php'; $rfObj = new remotePageProperty($this->url); $data = array(); $data['title'] = $this->cleanTitle($rfObj->getPageTitle()); $page = $rfObj->page_content; // to do - grab description from meta tag or story content if (preg_match('/<meta name="description"[^>]*content="([^"]+)"/i', $page, $match)) { $data['description'] = $match[1]; } else { $temp = $rfObj->getPageParagraphs(); require_once PATH_CORE . '/classes/utilities.class.php'; $utilObj = new utilities(); $temp = $utilObj->shorten($temp, LENGTH_LONG_CAPTION); $data['description'] = $temp; //$this->log('Caption from gPP: '.$temp); } $data['images'] = $this->parseImages($rfObj); // to do - grab content // to do - use my code to grab keywords using semantic library return $this->jsonData($data); }
function delete_webhook_subscription($subscription_url) { $util = new utilities(); $data = array('access_token' => $util->get_current_environment_cobot_access_token()); $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_URL, $subscription_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); $result = (array) json_decode($result); error_log(json_encode($result)); $subdomain_start = strpos($subscription_url, '://') + 3; $subdomain_end = strpos($subscription_url, '.cobot.me/api/subscriptions/'); $subdomain = substr($subscription_url, $subdomain_start, $subdomain_end - $subdomain_start); $id_start = strpos($subscription_url, '.cobot.me/api/subscriptions/') + 28; $id = substr($subscription_url, $id_start); $sql = "DELETE FROM cobot_webhook_subscriptions WHERE space_id='" . $subdomain . "' and id='" . $id . "'"; error_log($sql); $this->db->query($sql); return $subscription_url; }
public static function writeconfirm($post = []) { $confirm = confirm::readconfirm(['D03_DEN_NO' => $post['D03_DEN_NO']]); if ($confirm['status'] == 1) { $post['status'] = 1; } if (isset($post['date_1']) && isset($post['date_2']) && isset($post['date_3'])) { $post['date'] = str_pad($post['date_1'], 4, '0', STR_PAD_LEFT) . str_pad($post['date_2'], 2, '0', STR_PAD_LEFT) . str_pad($post['date_3'], 2, '0', STR_PAD_LEFT); } $data[0] = ['タイヤ交換図1', 'タイヤ交換図2', 'タイヤ交換図3', 'タイヤ交換図4', '空気圧_前', '空気圧_後', 'リムバルブ', 'トルクレンチ', 'ホイルキャップ', '持帰ナット', 'オイル量', 'オイルキャップ', 'レベルゲージ', 'ドレンボルト', 'パッキン', 'オイル漏れ', '次回交換目安_date', '次回交換目安_km', 'ターミナル締付', 'ステー取付', 'バックアップ', 'スタートアップ', 'status']; $data[1] = ['tire_1' => isset($post['tire_1']) && $post['tire_1'] ? 1 : 0, 'tire_2' => isset($post['tire_2']) && $post['tire_2'] ? 1 : 0, 'tire_3' => isset($post['tire_3']) && $post['tire_3'] ? 1 : 0, 'tire_4' => isset($post['tire_4']) && $post['tire_4'] ? 1 : 0, 'pressure_front' => isset($post['pressure_front']) ? $post['pressure_front'] : 0, 'pressure_behind' => isset($post['pressure_behind']) ? $post['pressure_behind'] : 0, 'rim' => isset($post['rim']) && $post['rim'] ? 1 : 0, 'torque' => isset($post['torque']) && $post['torque'] ? 1 : 0, 'foil' => isset($post['foil']) && $post['foil'] ? 1 : 0, 'nut' => isset($post['nut']) && $post['nut'] ? 1 : 0, 'oil' => isset($post['oil']) && $post['oil'] ? 1 : 0, 'oil_cap' => isset($post['oil_cap']) && $post['oil_cap'] ? 1 : 0, 'level' => isset($post['level']) && $post['level'] ? 1 : 0, 'drain_bolt' => isset($post['drain_bolt']) && $post['drain_bolt'] ? 1 : 0, 'packing' => isset($post['packing']) && $post['packing'] ? 1 : 0, 'oil_leak' => isset($post['oil_leak']) && $post['oil_leak'] ? 1 : 0, 'date' => isset($post['date']) ? $post['date'] : '', 'km' => isset($post['km']) && $post['km'] ? $post['km'] : '', 'terminal' => isset($post['terminal']) && $post['terminal'] ? 1 : 0, 'stay' => isset($post['stay']) && $post['stay'] ? 1 : 0, 'backup' => isset($post['backup']) && $post['backup'] ? 1 : 0, 'startup' => isset($post['startup']) && $post['startup'] ? 1 : 0, 'status' => isset($post['status']) && $post['status'] ? $post['status'] : 0]; utilities::createFolder('data/confirm/'); $fp = fopen(getcwd() . '/data/confirm/' . $post['D03_DEN_NO'] . '.csv', 'w+'); fputs($fp, $bom = chr(0xef) . chr(0xbb) . chr(0xbf)); foreach ($data as $key => $value) { fputcsv($fp, $value); } fclose($fp); }
function login_callback() { $code = $_GET['code']; $grind_user_id = $_GET['state']; if ($code) { $this->load->model("loginmodel", "lm", true); $access_token = $this->lm->fetch_access_token_for_existing_cobot_user_with_custom_password($code); $cobot_user_id = $this->lm->save_cobot_user_for_access_token($access_token, $grind_user_id); $sql = "SELECT first_name, last_name FROM user where id = " . $grind_user_id; error_log($sql); $query = $this->db->query($sql); $user = current($query->result()); $this->lm->create_cobot_membership($cobot_user_id, $grind_user_id, $user->first_name . ' ' . $user->last_name . ' Virtual Plan'); } $util = new utilities(); $util->redirect(ROOTMEMBERPATH . 'grind-code/index.php/admin/usermanagement/save_cobot_token'); }
<?php return array("name" => "create user", "desc" => "create new user", "group" => "User Management", "programmer" => "Peyman", "created_at" => "", "route" => "/version", "methods" => array("GET"), "input_validation" => array("phone" => "required", "email" => "required"), "input_values" => array(), "response_type" => "object", "access" => "any_person", "callback" => function (array $self, \Klein\Request $request, \Klein\Response $response) { return utilities::response_object(200, "version", array("string" => "jsonui version 0.0.1 alpha")); });
function transmit($timestamp = 0, $limit = 25) { require_once 'utilities.class.php'; $utilObj = new utilities($this->db); // return serialized log info for synchronization $log = array(); /*** Transmit votes - req. ncUid and contentid ***/ $votes = array(); $x = 0; $page = 0; $q = $this->db->query("SELECT Log.*,User.ncUid,Content.contentid FROM Log,User,Content WHERE Log.itemid=Content.siteContentId AND contentid>0 AND User.ncUid<>0 AND Log.userid1=User.userid AND action='vote' AND status='pending' AND Content.isBlocked=0 AND User.isBlocked=0 ORDER BY Log.id DESC"); while ($data = $this->db->readQ($q)) { $votes[$x][contentid] = $data->contentid; $votes[$x][logid] = $data->id; // fetch newscloud id from userid1 $votes[$x][uid] = $data->ncUid; // $this->lookupUid($data->userid1); $x += 1; } $this->narrate('Transmitting votes'); $this->narrate($votes); $log['votes'] = $votes; /*** Transmit new users - req isVerifiedEmail=1 ***/ $newUsers = array(); $x = 0; require_once 'userRemoteSync.class.php'; $rsObj = new userRemoteSync($this->db); require_once PATH_CORE . '/classes/systemStatus.class.php'; $ssObj = new systemStatus($this->db); $partnerid = $ssObj->getState('partnerid'); $q = $rsObj->findUnlinkedAccounts(); while ($data = $this->db->readQ($q)) { $newUsers[$x][partnerid] = $partnerid; $newUsers[$x][userid] = $data->userid; $newUsers[$x][name] = $data->name; $newUsers[$x][email] = $data->email; $newUsers[$x][fbId] = $data->fbId; $newUsers[$x][city] = $data->city; $x += 1; } $log['newUsers'] = $newUsers; $this->narrate('New users to sync with NewsCloud'); $this->narrate($newUsers); // build for users to synchronize - changed bio, changed user level - to do : facebook image /*** Transmit users who change their user level ***/ $levelChanges = array(); $x = 0; require_once 'userRemoteSync.class.php'; $rsObj = new userRemoteSync($this->db); $q = $rsObj->findUserLevelIncreases($timestamp); while ($data = $this->db->readQ($q)) { $levelChanges[$x][logid] = $data->id; $levelChanges[$x][userid] = $data->userid; $levelChanges[$x][uid] = $data->ncUid; $levelChanges[$x][userlevel] = $data->itemid; $x += 1; } $log['levelChanges'] = $levelChanges; $this->narrate('User Level Increases'); $this->narrate($levelChanges); /*** Transmit read story records - req. ncUid and contentid ***/ $q = $this->db->query("SELECT Log.id,Content.contentid,User.ncUid FROM Log,Content,User WHERE action='readStory' AND status='pending' AND User.userid=Log.userid1 AND Log.itemid=Content.siteContentId AND User.ncUid>0 AND Content.contentid>0 AND Content.isBlocked=0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};"); $readStory = array(); $x = 0; while ($data = $this->db->readQ($q)) { $readStory[$x][contentid] = $data->contentid; $readStory[$x][logid] = $data->id; $readStory[$x][uid] = $data->ncUid; $x += 1; } $log['readStory'] = $readStory; /*** Transmit published story to journal - req. ncUid and contentid ***/ $q = $this->db->query("SELECT Log.id,Content.contentid,User.ncUid FROM Log,Content,User WHERE action='publishStory' AND status='pending' AND User.userid=Log.userid1 AND Log.itemid=Content.siteContentId AND User.ncUid>0 AND Content.contentid>0 AND Content.isBlocked=0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};"); $pubStory = array(); $x = 0; while ($data = $this->db->readQ($q)) { $pubStory[$x][contentid] = $data->contentid; $pubStory[$x][logid] = $data->id; $pubStory[$x][uid] = $data->ncUid; $x += 1; } $log['pubStory'] = $pubStory; /*** Transmit posted raw stories - req ncUid ***/ $q = $this->db->queryC("SELECT Log.id,Log.itemid,User.ncUid FROM Log,User WHERE action='publishWire' AND status='pending' AND User.userid=Log.userid1 AND User.ncUid>0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};"); $pubWire = array(); $x = 0; while ($data = $this->db->readQ($q)) { $wireQuery = $this->db->queryC("SELECT * FROM Newswire WHERE id={$data->itemid};"); if ($wireQuery !== false) { $wi = $this->db->readQ($wireQuery); $pubWire[$x][logid] = $data->id; $pubWire[$x][uid] = $data->ncUid; // fetch wire story url $pubWire[$x][url] = $wi->url; $pubWire[$x][siteContentId] = $data->itemid2; $pubWire[$x][wireid] = $wi->wireid; switch ($wi->feedType) { default: // wire $pubWire[$x][feedType] = 'wire'; break; case 'blog': $pubWire[$x][feedType] = 'blog'; $pubWire[$x][title] = $wi->title; $pubWire[$x][date] = $wi->date; $pubWire[$x][caption] = $utilObj->shorten($wi->caption, 500); break; } $x += 1; } else { // story deleted from newswire $this->db->update("Log", "status='error'", "id={$data->id}"); } } $log['pubWire'] = $pubWire; /*** Transmit posted stories, a new user posted story - req ncUid ***/ $q = $this->db->queryC("SELECT Log.id,Log.itemid,User.ncUid FROM Log,User WHERE action='postStory' AND status='pending' AND User.userid=Log.userid1 AND User.ncUid>0 AND User.isBlocked=0 ORDER BY id DESC LIMIT {$limit};"); if ($q !== false) { //$this->db->log('inside poststory'); require_once PATH_CORE . '/classes/content.class.php'; $cObj = new content($this->db); $postStory = array(); $x = 0; while ($data = $this->db->readQ($q)) { $this->db->log($data->id); // fetch contentid from siteContentid $si = $cObj->getById($data->itemid); if ($si !== false) { $postStory[$x][logid] = $data->id; $postStory[$x][siteContentId] = $data->itemid; $postStory[$x][uid] = $data->ncUid; $postStory[$x][title] = $si->title; $postStory[$x][url] = $si->url; $postStory[$x][date] = $si->date; $postStory[$x][caption] = htmlentities($utilObj->shorten(strip_tags($si->caption), 500), ENT_QUOTES); $imageProps = $cObj->getImage($data->itemid); if ($imageProps !== false) { $postStory[$x][imageurl] = $imageProps->url; } $x += 1; } } $log['postStory'] = $postStory; } $this->narrate('Posting stories to NewsCloud'); $this->narrate($postStory); /*** Transmit comments - req. ncUid and contentid ***/ $comments = array(); $q = $this->db->query("SELECT Log.id,Comments.comments,Comments.siteCommentId,Content.contentid,User.ncUid FROM Log,Comments,Content,User WHERE Log.itemid=Comments.siteCommentId AND Comments.siteContentId=Log.itemid2 AND Content.siteContentId=Log.itemid2 AND Content.contentid>0 AND Log.userid1=User.userid AND User.ncUid>0 AND action='comment' AND status='pending' AND Content.isBlocked=0 AND User.isBlocked=0 AND Comments.videoid=0 ORDER BY id DESC LIMIT {$limit};"); $x = 0; while ($data = $this->db->readQ($q)) { $comments[$x][uid] = $data->ncUid; $comments[$x][contentid] = $data->contentid; $comments[$x][logid] = $data->id; $comments[$x][comments] = htmlentities($data->comments, ENT_QUOTES); $comments[$x][siteCommentId] = $data->siteCommentId; $x += 1; // fetch contentid from siteContentid //$contentid=$this->lookupContentId($data->itemid); //if ($contentid!==false AND $contentid<>0) { // fetch newscloud id from userid1 //$ncUid=$this->lookupUid($data->userid1); //if ($ncUid<>0) { //} //} } $log['comments'] = $comments; $this->narrate('Transmitting comments'); $this->narrate($comments); // send serialized array out return serialize($log); }
function loadStory($wire = null, $feed = null) { $this->db->log('entering loadStory '); $this->db->log($wire); // post a story from a feed to Content table for the user who owns the bookmark feed $this->psObj->refreshUrl($wire->url); // $id is feed id, $wire is serialized newswire object, $feed->userid is posted by userid // clean headlines $wire->title = $this->psObj->cleanTitle($wire->title); $this->db->log('clean title:' . $wire->title); // check for duplicates from final url or initial url or title $error = false; $cleanUrl = $this->psObj->cleanUrl($wire->url); $isDup = $this->db->queryC("SELECT siteContentId FROM Content WHERE url = '" . $wire->url . "' OR url = '" . $cleanUrl . "' OR title = '" . $wire->title . "'"); if ($isDup === false) { $wire->url = $cleanUrl; $this->psObj->log('Cleaned url: ' . $cleanUrl . ' <= ' . $wire->url); // load user wire record $this->db->log('not a dup'); require_once PATH_CORE . '/classes/user.class.php'; $userTable = new UserTable($this->db); $user = $userTable->getRowObject(); // to do if $feed->userid==0 use admin if ($feed->userid == 0) { $user->loadWhere("isAdmin=1"); } else { $user->load($feed->userid); } // create temporary content item, temp permalink require_once PATH_CORE . '/classes/utilities.class.php'; $utilObj = new utilities(); require_once PATH_CORE . '/classes/content.class.php'; $cObj = new content($this->db); // clean caption, strip tags, trim for length $wire->caption = $utilObj->shorten($wire->caption, LENGTH_LONG_CAPTION); $wire->source = $this->stripit(parse_url($wire->url, PHP_URL_HOST)); // create permalink $wire->permalink = $cObj->buildPermalink($wire->title); // get images, check size of each and pick most likely candidate with minimum require_once PATH_CORE . '/classes/remotefile.class.php'; $rfObj = new remotePageProperty($wire->url); $imgArr = $this->psObj->parseImages($rfObj, 7500); // 7500 is min jpg size for automatically selecting images // $this->db->log($imgArr); if (count($imgArr) > 0) { $wire->imageUrl = $imgArr[0]; } else { $wire->imageUrl = ''; } // serialize the content $isBlogEntry = 0; $story = $cObj->serialize(0, $wire->title, $wire->caption, $wire->source, $wire->url, $wire->permalink, $user->ncUid, $user->name, $user->userid, '', 1, 0, 0, $wire->imageUrl, 0, $isBlogEntry, 1); //$this->db->log($story); // add to content by this userid $siteContentId = $cObj->add($story); if ($siteContentId !== false) { require_once PATH_CORE . '/classes/log.class.php'; $this->logObj = new log($this->db); // add to user journal $logItem = $this->logObj->serialize(0, $user->userid, 'postStory', $siteContentId); $inLog = $this->logObj->update($logItem); if ($inLog) { $logItem = $this->logObj->serialize(0, $user->userid, 'vote', $siteContentId); $inLog = $this->logObj->update($logItem); } } // set new story loaded flag - so that features can be updated $this->newStoryLoaded = true; } else { $error = true; } }
public function add_drop_in_plan() { $util = new utilities(); if (isset($_POST["submit"])) { $space_id = $_POST["space_id"]; $plan_id = $_POST["plan_id"]; $plan_name = $_POST["plan_name"]; if ($space_id && $plan_id) { $sql = "INSERT INTO drop_in_plans (space_id, plan_id, plan_name) VALUES ('{$space_id}', '{$plan_id}', '{$plan_name}')"; error_log($sql); if ($this->db->query($sql) === TRUE) { error_log("Drop in plan added successfully"); } else { error_log("Error: " . $sql . "<br>" . $this->db->error); } } } $util->redirect(ROOTMEMBERPATH . 'grind-code/index.php/admin/locationmanagement/drop_in_plans'); }
require_once "./class/utilities_class.php"; require_once "./class/phpfiglet_class.php"; require_once "./class/mybb_class.php"; require_once "./class/html_class.php"; require_once "./class/cookie_class.php"; require_once "./class/admin_class.php"; require_once "./class/post_class.php"; /* * Create instance of all available Class object */ $post_inst = new post(); $phpFiglet = new phpFiglet(); $inst_post = new mybb_style(); $htmlinst = new html(); $admin = new adminclass(); $util = new utilities(); $cook = new cookie(); /* * Check if sqlite database file is not existed * If yes, then redirect to create.php */ if (sqlite_file == '' || !file_exists(sqlite_file)) { $htmlinst->change_location("./create.php"); } $_SERVER['REMOTE_ADDR'] = $util->get_client_ip($_SERVER); $phpFiglet->loadFont("./figlet/spliff.flf"); $db = new SQLite3(sqlite_file, SQLITE3_OPEN_READWRITE); $title = $db->query("SELECT Name, Value FROM Options WHERE Name='title';"); $title = $title->fetchArray(SQLITE3_ASSOC); /* * Check if user have old_skkooll cookie
$header = new Header(); ######## Header ######################################## if (isset($_GET['view']) && $_GET['view'] != "") { $file_name = "view/" . $_GET['view'] . ".php"; if (file_exists($file_name)) { include_once $file_name; } else { echo "File not found : <b>" . $file_name . "</b>"; } } else { $file_name = "view/home.php"; include_once $file_name; } ######## Footer ######################################## $footer = new Footer(); ######## Footer ######################################## utilities::destroy(); ?> </body> </html> <script type="text/javascript"> $(document).ready(function(){ $('[data-toggle="popover"]').popover(); }); var browserHeight = $( window ).height(); browserHeight = browserHeight - 120; $('#home-first-half').css({ "height" : browserHeight+"px" }); $('#home-second-half').css({ "height" : browserHeight+"px" }); </script>
public function load_modules() { $modules = array(); $module_files = utilities::glob_recursive($this->root . "*.php", GLOB_NOSORT); foreach ($module_files as $mfile) { if (utilities::module_path_valid($mfile)) { try { $modules[] = (include $mfile); } catch (Exception $ex) { } } else { } } $valid_modules = array(); $invalid_modules = array(); foreach ($modules as $m) { if (utilities::module_valid($m)) { $valid_modules[] = $m; } else { $invalid_modules[] = $m; } } $this->modules = $valid_modules; $this->invalid_modules = $invalid_modules; return $this->modules; }
$server = DB::table('mcservers')->where('mcs_id', '=', $id)->first(); ?> @extends('layout.index') @section('head') <style> .top-img { padding-top: 10px; padding-bottom: 10px; text-align: left; color: #f8f8f8; background: linear-gradient( rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25) ), url(<?php if (!utilities::MCSVhasbackground($server->mcs_id)) { echo URL::to('/resources/images/minecraft/backgrounds/default-background.jpg'); } else { echo URL::to('/resources/images/minecraft/backgrounds/' . $server->mcs_id . '.jpg'); } ?> ) no-repeat center center; } </style> @stop @section('header') @if($server->mcs_header == 1) <!-- Header Carousel --> <header> <div class="top-img"> <div class="container server-background">
function validate($option = 'link') { $this->setupLibraries(); $fData = new stdClass(); $fData->result = true; $fData->state = 'validate'; $fData->url = $_POST['url']; $fData->imageUrl = $_POST['imageUrl']; $fData->videoEmbed = $_POST['videoEmbed']; // Remove microsoft quotes $bad = array('`', '’', '„', '‘', '’', '´'); $good = array('\'', '\'', ',', '\'', '\'', '\''); $title = str_replace($bad, $good, $_POST['title']); $fData->title = stripslashes(strip_tags($title)); // took out mysql_real_escape $fData->tags = $_POST['tags']; $fData->mediatype = $_POST['mediatype']; if (isset($_POST['isFeatureCandidate']) and $_POST['isFeatureCandidate'] == 'on') { $fData->isFeatureCandidate = 1; } else { $fData->isFeatureCandidate = 0; } $fData->isBookmarklet = true; $fData->showPreview = false; $fData->alert = ''; $fData->title = stripslashes(strip_tags($_POST['title'])); $fData->caption = stripslashes($_POST['caption']); //$fData->title=mysql_real_escape_string(addslashes(stripslashes(strip_tags($_POST['title'])))); //$fData->caption=mysql_real_escape_string(stripslashes($_POST['caption']), $this->db->handle); // begin option specific code and error checking switch ($option) { default: $fData->caption = stripslashes(strip_tags($_POST['caption'])); if ($fData->url == '') { $fData->alert = 'Please provide a Web address (URL) for your story.'; $fData->result = false; } if ($fData->caption == '') { $fData->alert = 'Please provide a short caption for your entry.'; $fData->result = false; } if (strlen($fData->caption) > LENGTH_LONG_CAPTION + 5) { $fData->alert = 'Please shorten your caption to ' . LENGTH_LONG_CAPTION . ' characters. Current length: ' . strlen($fData->caption); $fData->result = false; } break; case 'blog': if (isset($_POST['blogid'])) { $fData->blogid = $_POST['blogid']; } $fData->status = 'draft'; // only allowable html, fbml $fData->entry = stripslashes(strip_tags($_POST['entry'], '<p><a><i><br><em><strong><img>')); // <fb:photo><fb:mp3><fb:swf><fb:flv><fb:silverlight> $fData->caption = stripslashes(strip_tags($_POST['caption'])); if ($fData->entry == '' or strlen($fData->entry) < MIN_BLOG_LENGTH) { $fData->alert = 'Please compose a blog post of at least ' . MIN_BLOG_LENGTH . ' characters (not counting HTML tags). Current length: ' . strlen($fData->entry); $fData->result = false; $lengthError = true; } else { $lengthError = false; } if (strlen($fData->entry) > MAX_BLOG_LENGTH) { $fData->alert = 'Please shorten your blog entry to ' . MAX_BLOG_LENGTH . ' characters. Current length: ' . strlen($fData->entry); $fData->result = false; } if ($fData->caption != '') { // if it exists already, then check that it meets the minimum length requirements if (strlen($fData->caption) > LENGTH_LONG_CAPTION + 5) { $temp = $utilObj->shorten($_POST['caption'], LENGTH_LONG_CAPTION); $fData->caption = $temp; } } else { // if it doesn't exist, create require_once PATH_CORE . '/classes/utilities.class.php'; $utilObj = new utilities($this->db); $temp = $utilObj->shorten($fData->entry, CAPTION_LENGTH); if (!$lengthError and strlen($temp) < 100) { $fData->alert = 'Please compose a blog entry for a caption of at least ' . MIN_BLOG_LENGTH . ' characters (not counting HTML tags). Current length: ' . strlen($temp); $fData->result = false; } $fData->caption = $temp; } break; } // tags /* if ($fData->tags=='') { $fData->alert='Please provide at least one tag.'; $fData->result=false; } * */ // check user has minimum # of friends - to prevent spam if (isset($_POST['fb_sig_friends']) and count(explode(',', $_POST['fb_sig_friends'])) < MIN_FRIENDS) { // suspiciously low # of friends to be posting $fData->alert = 'Please add more friends to your Facebook profile before you post stories here. This helps us minimize spam. Sorry for the inconvenience.'; $fData->result = false; } //title if (strcmp(strtoupper($fData->title), $fData->title) == 0) { $fData->title = $temp = ucwords(strtolower($fData->title)); $fData->alert = 'We\'ve modified your headline so that it\'s not all uppercase. Please check it.'; $fData->result = false; } if ($fData->title == '') { $fData->alert = 'Please provide a short headline for your entry.'; $fData->result = false; } if (strlen($fData->title) > $this->titleLimit) { $fData->alert = 'Please shorten your title to ' . $this->titleLimit . ' characters. Current length: ' . strlen($fData->title); $fData->result = false; } /* We might want this later if ($fData->imageUrl=='' ) { $fData->alert='Please provide a Web address (IMAGE URL) for your story image.'; $fData->result=false; } */ // url if ($fData->url != '') { $urlParts = parse_url($fData->url); // make sure url has http:// or other scheme in front of it if ($urlParts['scheme'] == '') { $fData->url = 'http://' . $fData->url; } if (($urlParts['path'] == '' or $urlParts['path'] == '/') and $urlParts['query'] == '') { $fData->alert = 'You seem to be writing about a Web site, not a particular story on a Web site. Please do not submit links to Web sites. Please only submit stories from Web sites and blogs.'; $fData->result = false; } if (preg_match('/^http:\\/\\/www.facebook.com\\/ext\\/share.php/', $fData->url)) { $fData->alert = 'You seem to be posting a shared story from facebook. Please go to the actual story page and post again from there.'; $fData->result = false; } } // Check for rate limits on post story if (!($this->session->u->isAdmin || $this->session->u->isModerator || $this->session->u->isSponser)) { $resp = $this->logObj->checkLimits($this->session->userid, "(action = 'postStory' OR action = 'postBlog')", 'posting'); if ($resp !== false) { $fData->alert = $resp['msg']; $fData->result = false; } } // validate the video if ($fData->videoEmbed != '') { require_once PATH_CORE . '/classes/video.class.php'; $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($fData->videoEmbed)); if (!videos::validateVideoURL($fData->videoEmbed)) { $fData->alert = 'Your video URL or embedding code is invalid. We only support Facebook and YouTube videos at this time.'; $fData->result = false; } } $this->fData =& $fData; return $fData; }
<?php require __DIR__ . '/../vendor/autoload.php'; set_error_handler(function ($error) { echo $error; }); use Klein\Klein; $app = new Klein(); $modules = array(); $module_root = __DIR__ . '/modules/'; $module_files = utilities::glob_recursive($module_root . "*.php", GLOB_NOSORT); foreach ($module_files as $mfile) { $modules[] = (include $mfile); } foreach ($modules as $mj) { if (utilities::module_valid($mj)) { $app->respond($mj['methods'], $mj['route'], function (\Klein\Request $request, \Klein\Response $response) use($mj) { /* TODO: check callback access */ $answer = $mj['callback']($mj, $request, $response); if ($mj['response_type'] === "object") { $response_json = array("result" => array("code" => $answer['code'], "object" => $answer['object']), "data" => $answer['data']); return $response->json($response_json); } else { if ($mj['response_type'] === "array") { $response_json = array("result" => array("code" => $answer['code'], "object" => $answer['object']), "pagination" => array("window" => $answer['window'], "current" => $answer['current'], "next" => $answer['next'], "total" => $answer['total'], "pages" => $answer['pages']), "data" => $answer['data']); return $response->json($response_json); } else { if ($mj['response_type'] == "file") { } } }
public function checkIn2($userId, $locationId, $sign_in_method, $currentTime = "") { /* Logic: If the user is a monthly user, then leave payment to the scheduled agreement already set in Recurly. If the user is a daily user, then auto charge for the current day. If there is an error with the processing, return an error code, otherwise return empty string. */ $this->load->model("issuesmodel"); $result = ""; if ($currentTime == "") { $currentTime = date(DATE_ISO8601); } $um = new UserModel(); $user = $um->init($userId); $daysSinceLastCharge = 1000; try { $account = new Recurly_Account($userId); $charges = new Recurly_AdjustmentList($userId, array('type' => 'charge')); if (count($charges) > 0) { //$then = new DateTime(date("Y-m-d H:i:s O", $charges[0]->start_date)); //$now = new DateTime(date("Y-m-d H:i:s O")); //$interval = $now->diff($then); // doesn't work with php 5.2 //$daysSinceLastCharge = (int) $interval->format("%a"); $then = date("Y-m-d H:i:s O", $charges[0]->start_date); $now = date("Y-m-d H:i:s O"); $interval = utilities::date_diff($then, $now); $daysSinceLastCharge = $interval; } //echo "daysSinceLastCharge = $daysSinceLastCharge<br />"; //$this->issuesmodel->logMemberIssue($userId, "daysSinceLastCharge = $daysSinceLastCharge"); $requirePayment = false; //$this->issuesmodel->logMemberIssue($userId, "\$requirePayment = " . $requirePayment); //$this->issuesmodel->logMemberIssue($userId, "\$user->membership_plan_code = " . $user->membership_plan_code); if ($user->membership_plan_code == "daily") { // charge for today if they haven't been charged $requirePayment = $daysSinceLastCharge > 1; } //$this->issuesmodel->logMemberIssue($userId, "\$requirePayment = " . $requirePayment); if ($requirePayment) { // charge for today if they haven't been charged // TODO: find the user's current reservation and get the cost from there. // If there is not a reservation, check availability. If availability is // good, then get going rate for space. Otherwise, throw NoAvailableSpace // exception. $query = $this->db->get("configuration"); $row = $query->row(); $dailyRate = $row->daily_rate; $details = "[CHK-PARK01-1D]: Charging \$dailyRate for " . date("m-d-Y"); $this->makeSinglePayment($userId, $dailyRate, $details); } } catch (Exception $e) { $issueId = $this->issuesmodel->logMemberIssue($userId, "About to check-in user, but failed attempting to charge them. " . $e->getMessage(), MemberIssueType::BILLING); //$this->issuesmodel->closeMemberIssue($issueId); } //echo $this->userInfo->id; //echo "The date/time is $currentTime<br />"; //$this->issuesmodel->logMemberIssue($userId, "About to insert into the signin_sheet"); $this->db->insert("signin_sheet", array("user_id" => $userId, "location_id" => $locationId, "sign_in_method" => $sign_in_method, "sign_in" => $currentTime)); $result = $this->db->insert_id(); return $result; }
<html> <head> <?php require_once "./config.php"; require_once "./class/utilities_class.php"; require_once "./class/cookie_class.php"; require_once "./class/admin_class.php"; require_once "./class/html_class.php"; require_once "./class/post_class.php"; $inst = new utilities(); $cook = new cookie(); $admcl = new adminclass(); $htmlinst = new html(); $post = new post(); $_SERVER['REMOTE_ADDR'] = $inst->get_client_ip($_SERVER); if (sqlite_file == '') { $htmlinst->change_location("create.php"); } elseif (!file_exists(sqlite_file)) { $htmlinst->change_location("create.php"); } $db = new SQLite3(sqlite_file, SQLITE3_OPEN_READWRITE); $title = $db->query("SELECT Name, Value FROM Options WHERE Name='title';"); $title = $title->fetchArray(SQLITE3_ASSOC); ?> <title><?php echo htmlentities($title['Value']); ?> > ADMiN PANEL</title> <link rel="stylesheet" href="./style.css" /> <script type="text/javascript" src="./js/jstz.min.js"></script> <script type='text/javascript' src="./js/script.js"></script>
public function fetch_cobot_user() { global $cobot_scope; error_log("In fetch_cobot_user"); if (isset($_POST['user'])) { $grind_user_id = $_POST['user']; $this->load->model("loginmodel", 'lgm', true); $cobot_login_url = $this->lgm->get_cobot_login_url($grind_user_id); $util = new utilities(); $util->redirect($cobot_login_url); } }
<html> <head> <?php require_once "./class/utilities_class.php"; require_once "./config.php"; $instance = new utilities(); $_SERVER['REMOTE_ADDR'] = $instance->get_client_ip($_SERVER); ?> <title>FiRST RUN!</title> <link rel="stylesheet" href="./style.css" /> <script type='text/javascript' src='./js/script.js'></script> </head> <body> <br> <br> <br> <?php if (sqlite_file != '') { if (file_exists(sqlite_file)) { $text = "Database already exist!"; ?> <font class='spacer'> <?php $instance->header_line($text); ?> </font> <b><br> <?php $instance->top_text($text); ?> </b><br>
public function postChangePW() { $input = Input::all(); $rules = array('oldpassword' => 'required|min:6|max:20', 'newpassword' => 'required|min:6|max:20', 'g-recaptcha-response' => 'required|recaptcha'); $v = Validator::make($input, $rules); if ($v->passes()) { $oldpassword = $input['oldpassword']; $oldpasswordsql = Auth::user()->password; if ($oldpassword && !Hash::check($oldpassword, $oldpasswordsql)) { return Redirect::to('user')->WithErrors('Password Antiga Errada'); } else { $newpassword = $input['newpassword']; $newpassword = Hash::make($newpassword); DB::table('users')->where('id', '=', Auth::user()->id)->update(array('password' => $newpassword)); utilities::log("Password Changed"); return Redirect::to(URL::to("/user"))->With('success', 'Password Atualizada'); } } else { return Redirect::to(URL::to("/user"))->WithErrors($v); } }
echo $user->first_name . " " . $user->last_name; ?> </span></h2> <table width="100%"> <tr> <th class="date">Date</th> <th class="description">Description</th> <th class="amount">Amount</th> <th class="invoice">Invoice Number</th> </tr> <?php foreach ($charges as $charge) { ?> <tr> <td class="date"><?php echo utilities::grind_date_format($charge->date); ?> </td> <td class="description"><?php echo $charge->description; ?> </td> <td class="amount"><?php echo number_format($charge->amount, 2); ?> </td> <td class="invoice"><?php echo $charge->invoice == "" ? "Not yet invoiced" : $charge->invoice; ?> </td> </tr>