$notify = $db->ls("SELECT * FROM api_services\n INNER JOIN api_usuarios ON api_usuarios.id_usuario = api_services.id_usuario\n WHERE activo = 1\n AND proximo_corte < DATE_ADD(NOW(),INTERVAL 14 DAY)\n AND last_remember < DATE_SUB(NOW(),INTERVAL 2 DAY)\n LIMIT 30\n ", array(), false); if ($notify) { foreach ($notify as $n) { sendNotify($n); } } $notify = $db->ls("SELECT * FROM api_services\n WHERE activo = 1\n AND proximo_corte < DATE_ADD(NOW(),INTERVAL 7 DAY)\n AND last_remember < DATE_SUB(NOW(),INTERVAL 2 DAY)\n LIMIT 30\n ", array(), false); if ($notify) { foreach ($notify as $n) { sendNotify($n); } } $notify = $db->ls("SELECT * FROM api_services\n WHERE activo = 1\n AND proximo_corte < DATE_ADD(NOW(),INTERVAL 2 DAY)\n AND last_remember < DATE_SUB(NOW(),INTERVAL 2 DAY)\n LIMIT 30\n ", array(), false); if ($notify) { foreach ($notify as $n) { sendNotify($n); } } $mp_pending = $db->ls("SELECT * FROM api_invoices\n WHERE\n payment_status = 'pending'\n AND\n payment_name = 'mercadopago-ve'\n LIMIT 30\n ", array(), false); if ($mp_pending) { foreach ($mp_pending as $invoice) { $result = validateMercadoPago($invoice['payment_reference']); if (isset($result['order_id']) && isset($result['status']) && $result['status'] != 'Pending') { $custom = preg_split('/-/', $result['order_id']); $id_plan = (int) $custom[0]; $id_service = (int) $invoice['id_service']; $service = $db->ls("SELECT * FROM api_services WHERE id_service = %d", array($id_service), true); $user = User::getUserByID($service['id_usuario']); $plan_db = $user ? $db->ls("SELECT planes.*, precios.* FROM api_planes planes INNER JOIN api_precio_planes precios ON planes.id_plan = precios.id_plan WHERE precios.currency = '%s' AND precios.id_plan = '%d'" . ($user->rol == 1 ? '' : ' AND planes.activo = 1'), array(secInjection($result['currency']), (int) $id_plan), true) : false; if ($result['status'] == 'Completed') { email($user->mail, 'Pago Aceptado', 'Su pago fue aceptado y ya fue creado su APP para poder disfrutar de nuestro servicios, ingrese a "Registro / Login" en http://cedula.com.ve/ para mayor información.');
$hourinsec = 60 * 60 * 24; $diff = ($meetdt - $cur_dt) / $hourinsec; error_log("HOURS TILL MEET DATE: " . $diff); if ($diff == 1) { $u1name = "eDart User"; $u2name = $u1name; $u1q = mysqli_query($con, "SELECT * FROM usr WHERE id='" . mysqli_real_escape_string($con, $r["user1id"]) . "'"); $u2q = mysqli_query($con, "SELECT * FROM usr WHERE id='" . mysqli_real_escape_string($con, $r["user2id"]) . "'"); while ($ur1 = mysqli_fetch_array($u1q)) { $u1name = $ur1["fname"] . " " . $ur1["lname"]; } while ($ur2 = mysqli_fetch_array($u2q)) { $u2name = $ur2["fname"] . " " . $ur2["lname"]; } $locarr = json_decode($r["meetloc"], true); $addstr = $locarr["stadd1"] . ", "; $stadd2 = $locarr["stadd2"]; if (trim($stadd2) != "") { $addstr .= $stadd2 . ", "; } $addstr .= $locarr["citytown"] . ", " . $locarr["state"]; $gmapslnk = "http://maps.google.com/?q=" . urlencode($addstr); $msg = "You have an exchange with %s tomorrow"; $u1msg = sprintf($msg, $u2name); $u2msg = sprintf($msg, $u1name); $link = "exchange.php?offerid=" . $r["offerid"]; $gmaplnktxt = " at " . date("g:i A", $meetdt) . " at <a href=\"" . $gmapslnk . "\">" . $locarr["stadd1"] . "</a>"; sendNotify($r["user1id"], $u1msg . $gmaplnktxt, $link, trim($u1msg)); sendNotify($r["user2id"], $u2msg . $gmaplnktxt, $link, trim($u2msg)); } }
/** * Форма обратной связи * */ function showContactForm(&$params) { $ret = array(); $page =& Registry::get('TPage'); $titles = array('Заявка на покупку', 'Заявка на продажу', 'Заявка на аренду', 'Вопрос', 'Предложение о сотрудничестве', 'Неточность на сайте', 'Жалоба, предложение', 'Благодарность', 'Консультации', 'Другое'); $form = new TForm(null, $this); $form->form_name = 'content'; $form->elements = array('title' => array('name' => 'title', 'type' => 'select', 'options' => $titles, 'text' => 'Тема сообщения', 'req' => 0, 'atrib' => 'style="width: 100%"', 'value' => isset($_POST['fld']['title'][0]) ? $_POST['fld']['title'][0] : ($page->content['page'] == 'consulting' ? '8' : '0')), 'name' => array('name' => 'name', 'type' => 'text', 'req' => 1, 'atrib' => 'style="width: 100%" class="input_text"'), 'email' => array('name' => 'email', 'type' => 'text', 'req' => 0, 'check' => 'email', 'onerror' => '{#msg_err_invalid_email#}', 'atrib' => 'style="width: 100%" class="input_text"'), 'phone' => array('name' => 'phone', 'type' => 'text', 'req' => 1, 'check' => 'phone', 'onerror' => '{#msg_err_invalid_phone#}', 'atrib' => 'style="width: 50%" class="input_text"'), 'message' => array('name' => 'message', 'type' => 'textarea', 'text' => 'Текст сообщения', 'req' => 1, 'atrib' => 'style="width: 100%; height: 120px;" class="input_text"'), 'captcha' => array('name' => 'captcha', 'type' => 'html', 'req' => 1, 'value' => ' <table width="100%"><tr> <td width="40%" align="right">{#content_fld_captcha#}<font color=red>*</font>:</b></td> <td width="60%"><input type="text" name="fld[captcha]" style="width: 162px; margin-right: 10px"><img src="' . $page->content['href'] . '?a=captcha" align="middle" title="Щелкните на картинце, чтобы загрузить другой код" onclick="document.getElementById(\'captcha\').src=\'' . $page->content['href'] . '?a=captcha&\'+1000*Math.random()" id="captcha"></td> </tr></table>'), array('name' => 'button1', 'type' => 'submit', 'value' => $page->tpl->get_config_vars("send"), 'group' => 'system', 'atrib' => 'class="Button"'), array('name' => 'button2', 'type' => 'reset', 'value' => $page->tpl->get_config_vars("reset"), 'group' => 'system', 'atrib' => 'class="Button"')); $fdata = $form->generate(); $fdata['form']['action'] = $page->content['href']; $fdata['form']['width'] = '80%'; if (empty($fdata['form']['errors']) && isset($_POST['fld'])) { $keystring = $_SESSION['captcha_keystring']; unset($_SESSION['captcha_keystring']); if (!empty($_POST['fld']['captcha']) && (empty($keystring) || $_POST['fld']['captcha'] !== $keystring)) { $fdata['form']['result'] = 'msg_captcha_error'; // Ошибка при вводе проверочной комбинации } else { $_POST['fld']['title'] = $titles[$_POST['fld']['title'][0]]; if (sendNotify('CONTACT_FORM', 0, $_POST['fld'])) { redirect($page->content['href'] . '?msg=msg_send_email'); } redirect($page->content['href'] . '?msg=msg_not_send_email'); } } $ret['fdata'] = $fdata; return $ret; }
//If the array is null, make a new one if (!is_array($userRank)) { $userRank = array(); } //Generate a master array $master_array = array("points" => $points, "description" => $_POST["rate_desc"]); //Push it array_push($userRank, $master_array); //Set the new ranking array //Because we're changing someone else's information, we can't use the API $query = "UPDATE `usr` SET `rank`='" . mysqli_real_escape_string($con, json_encode($userRank)) . "' WHERE `id`='" . mysqli_real_escape_string($con, $otherInfo[0]["id"]) . "'"; mysqli_query($con, $query); //Add the user to the array of people who ranked array_push($who_ranked, $_SESSION["userid"]); mysqli_query($con, "UPDATE `exchange` SET `who_ranked`='" . mysqli_real_escape_string($con, json_encode($who_ranked)) . "' WHERE `id`='" . mysqli_real_escape_string($con, $oid) . "'"); sendNotify($other_id, "Someone has ranked you!", "profile.php?id={$other_id}"); header("Location:/"); } /* * * END USER RANKING SCRIPT * * */ HTML::begin(); Head::make("Exchange with {$other_fname} {$other_lname} | {$i1name} for {$i2name}", false); Body::add_action("pre_exchange()"); Body::add_action("codeAddress('{$address}')"); Body::begin(); //This converts the first name of the other user to a JavaScript variable for us to use later. echo "<script>var fname = \"{$other_fname}\";</script>"; ?> <style type="text/css"> #banner { border-bottom:none !important; } </style>
private function set($id, $timestamp) { global $con; $exchangeInfo = $this->get($id); if (!isset($id) || !isset($timestamp)) { return 401; } else { if (is_array($exchangeInfo) && count($exchangeInfo) > 0) { $exchangeInfo = $exchangeInfo[0]; $availability_array = json_decode($exchangeInfo["availability"], true); $date_array = array(); if (is_array($availability_array) && count($availability_array) > 0) { foreach ($availability_array as $user => $dates) { foreach ($dates as $d) { if (in_array($timestamp, $date_array)) { $item1 = new Item(array("action" => "get", "filter" => array("id" => $exchangeInfo["item1"]))); $item1_info = $item1->run(); $item1_info = $item1_info[0]; $item2 = new Item(array("action" => "get", "filter" => array("id" => $exchangeInfo["item2"]))); $item2_info = $item2->run(); $item2_info = $item2_info[0]; if ($item1_info["usr"] == $_SESSION["userid"] || $item2_info["usr"] == $_SESSION["userid"]) { $other_usr = $item1_info["usr"] == $_SESSION["userid"] ? $item2_info["usr"] : $item1_info["usr"]; $other_item = $item1_info["usr"] == $_SESSION["userid"] ? $item2_info : $item1_info; $my_item = $item1_info["usr"] == $_SESSION["userid"] ? $item1_info : $item2_info; $meUser = new User(array("action" => "get", "id" => $_SESSION["userid"])); $myInfo = $meUser->run(true); $myInfo = $myInfo[0]; $oUser = new User(array("action" => "get", "id" => $other_usr)); $oInfo = $oUser->run(true); $oInfo = $oInfo[0]; mysqli_query($con, "UPDATE `exchange` SET `date`='" . mysqli_real_escape_string($con, $timestamp) . "'"); sendNotify($other_usr, $myInfo["fname"] . " selected a date for you to exchange your " . $other_item["name"] . " for a " . $my_item["name"], "exchange.php?offerid=" . $id, "Meeting date selected!"); return 200; } else { return 406; } } else { array_push($date_array, $d); } } } } } } return 400; }
private function offer($id, $offer) { global $con; if (!isset($id) || !isset($offer)) { return 401; } else { if (!isset($_SESSION)) { return 403; } else { $offer_info = $this->get(array("id" => $offer)); if (trim($offer_info[0]["usr"]) != $_SESSION["userid"]) { return 406; exit; } $item_info = $this->get(array("id" => $id)); $offer_array = json_decode($item_info[0]["offers"], true); if (!is_array($offer_array)) { $offer_array = array(); } $msg = ""; $remindex = -1; for ($i = 0; $i < count($offer_array); $i++) { if ($offer_array[$i]["id"] == $offer) { $remindex = $i; } } if ($remindex == -1) { $new_offer = array("id" => $offer, "timestamp" => time()); array_push($offer_array, $new_offer); $this->update($offer, array("status" => "2"), array()); $update_query = "UPDATE `item` SET `offers`='" . mysqli_real_escape_string($con, json_encode($offer_array)) . "' WHERE `id`='" . mysqli_real_escape_string($con, $id) . "'"; mysqli_query($con, $update_query); $offeredItem = new Item(array("action" => "get", "filter[id]" => $offer)); $offeredInfo = $offeredItem->run(); $name = $offeredInfo[0]["name"]; if (!$_SESSION["userid"] || $_SESSION["userid"] != $offeredInfo[0]["usr"]) { return 401; exit; } $offerAuth = new User(array("action" => "get", "id" => $offeredInfo[0]["usr"])); $authInfo = $offerAuth->run(); $offermsg = $authInfo[0]["fname"] . " made an offer on your item: " . $item_info[0]["name"]; $link = "view.php?itemid=" . $item_info[0]["id"] . "&userid=" . $item_info[0]["usr"]; sendNotify($item_info[0]["usr"], $offermsg, $link); $vowels = array('a', 'e', 'i', 'o', 'u'); $a_str = in_array($item_info[0]["name"][0], $vowels) ? "an" : "a"; $pronoun = Lookup::Pronoun($authInfo[0]["gender"]); $feed = new Feed(); $feed->add($_SESSION["userid"], "offered {$pronoun} {$offeredInfo[0]["name"]} for {$a_str} {$item_info[0]["name"]}", time(), $link); } else { $query = "UPDATE `item` SET `status`='1' WHERE `id`='" . mysqli_real_escape_string($con, $offer) . "'"; mysqli_query($con, $query); unset($offer_array[$remindex]); } return 200; } } }