public function load_stored_repo($repo) { return query_assoc("SELECT * FROM repo WHERE name = '" . escape($repo) . "'"); }
function zayav_info() { if (!($zayav_id = _num(@$_GET['id']))) { return _err('Страницы не существует'); } $sql = "SELECT *\n\t\t\tFROM `zayav`\n\t\t\tWHERE `ws_id`=" . WS_ID . "\n\t\t\t AND !`deleted`\n\t\t\t AND `id`=" . $zayav_id; if (!($z = query_assoc($sql))) { return _err('Заявки не существует.'); } $z['pre_cost'] = _cena($z['pre_cost']); $status = _zayavStatus(); unset($status[0]); $history = _history(array('zayav_id' => $zayav_id)); return '<script type="text/javascript">' . 'var ZAYAV={' . 'id:' . $zayav_id . ',' . 'nomer:' . $z['nomer'] . ',' . 'head:"№<b>' . $z['nomer'] . '</b>",' . 'client_id:' . $z['client_id'] . ',' . 'client_link:"' . addslashes(_clientVal($z['client_id'], 'link')) . '",' . 'status:' . $z['status'] . ',' . 'status_sel:' . _selJson($status) . ',' . 'name:"' . addslashes($z['name']) . '",' . 'about:"' . addslashes($z['about']) . '",' . 'count:' . $z['count'] . ',' . 'adres:"' . addslashes($z['adres']) . '",' . 'pre_cost:' . $z['pre_cost'] . '};' . '</script>' . '<div id="zayav-info">' . '<div id="dopLinks">' . '<a class="link a-page sel">Информация</a>' . '<a class="link" id="edit">Редактирование</a>' . '<a class="link _accrual-add">Начислить</a>' . '<a class="link _income-add">Принять платёж</a>' . '<a class="link a-page">История</a>' . '</div>' . '<div class="page">' . '<div class="headName">' . 'Заявка №' . $z['nomer'] . '<input type="hidden" id="zayav-action" />' . '</div>' . '<table id="tab">' . '<tr><td class="label">Клиент:<td>' . _clientVal($z['client_id'], 'go') . '<tr><td class="label">Название:<td><b>' . $z['name'] . '</b>' . '<tr><td class="label">Описание:<td>' . $z['about'] . '<tr><td class="label">Количество:<td><b>' . $z['count'] . '</b> шт.' . ($z['adres'] ? '<tr><td class="label">Адрес:<td>' . $z['adres'] : '') . ($z['pre_cost'] ? '<tr><td class="label">Стоимость:<td><b>' . $z['pre_cost'] . '</b> руб.' : '') . '<tr><td class="label">Дата приёма:' . '<td class="dtime_add' . _tooltip('Заявку ' . _viewerAdded($z['viewer_id_add']), -70) . FullDataTime($z['dtime_add']) . '<tr><td class="label">Статус:<td>' . _zayavStatusButton($z) . '</table>' . _zayavInfoAccrual($zayav_id) . _zayav_expense($zayav_id) . _remind_zayav($zayav_id) . _zayavInfoMoney($zayav_id) . _vkComment('zayav', $zayav_id) . '</div>' . '<div class="page dn">' . '<div class="headName">Заявка №' . $z['nomer'] . ' - история действий</div>' . $history['spisok'] . '</div>' . '</div>'; }
public function coloredcoins_api($address) { // var bitcoin = require('bitcoinjs-lib'); //var request = require('request'); $address1 = '1F1HBDk5TNiP2sLipuJ91cZcsD1T8KaUux'; $amount = 0.01 * 100000000; $g = query_assoc("SELECT * FROM asset WHERE asset_id = '1'"); $url = 'http://testnet.api.coloredcoins.org:80/v2/issue'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); // send parameters $asset = "{\n \"issueAddress\": \"{$address1}\",\n \"amount\": {$amount},\n \"divisibility\": " . $g['divisibility'] . ",\n \"fee\": 1000,\n \"transfer\": [{\n\t\"address\": \"{$address1}\",\n\t\"amount\": {$amount}\n }],\n \"metadata\": {\n \"assetId\": \"1\",\n \"assetName\": \"Asset Name\",\n \"issuer\": \"Asset Issuer\",\n \"description\": \"My Description\",\n \"userData\": {\n \"meta\" : [\n {\"key\": \"Item ID\", \"value\": 2, \"type\": \"Number\"},\n {\"key\": \"Item Name\", \"value\": \"Item Name\", \"type\": \"String\"},\n {\"key\": \"Company\", \"value\": \"My Company\", \"type\": \"String\"},\n {\"key\": \"Address\", \"value\": \"San Francisco, CA\", \"type\": \"String\"}\n ]\n }\n }\n}"; //header("Content-type: text/plain"); print_r(json_decode($asset);die(); //die($asset); curl_setopt($ch, CURLOPT_POSTFIELDS, $asset); $response = curl_exec($ch); $this->curlinfo = curl_getinfo($ch); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $this->header = substr($ret, 0, $header_size); $ret = substr($response, $header_size); die($ret); }
break; case 'zayav_spisok': $_POST['find'] = win1251($_POST['find']); $data = zayav_spisok($_POST); if ($data['filter']['page'] == 1) { $send['all'] = utf8($data['result']); } $send['spisok'] = utf8($data['spisok']); jsonSuccess($send); break; case 'zayav_status': if (!($zayav_id = _num($_POST['zayav_id']))) { jsonError(); } if (!($zayav_status = _num($_POST['status']))) { jsonError(); } $sql = "SELECT * FROM `zayav` WHERE `ws_id`=" . WS_ID . " AND !`deleted` AND `id`=" . $zayav_id; if (!($z = query_assoc($sql))) { jsonError(); } if ($z['status'] == $zayav_status) { jsonError(); } $sql = "UPDATE `zayav`\n\t\t\t\tSET `status`=" . $zayav_status . ",\n\t\t\t\t\t`status_dtime`=CURRENT_TIMESTAMP\n\t\t\t\tWHERE `id`=" . $zayav_id; query($sql); _history(array('type_id' => 71, 'client_id' => $z['client_id'], 'zayav_id' => $zayav_id, 'v1' => $z['status'], 'v2' => $zayav_status)); jsonSuccess(); break; } jsonError();
function search_deal($deal, $url, $image_url, $business, $expiration, $percent_discount, $max_discount, $one_per, $claimed, $city, $fine_print, $columns, &$count) { $query = "select "; if (is_null($columns)) { $query .= "*"; } else { $query .= db_escape(implode(',', $columns)); } $query .= " from tb_deal where true "; $deal = db_prep_positive_int($deal); $business = db_prep_positive_int($business); $percent_discount = db_prep_positive_int($percent_discount); $max_discount = db_prep_positive_int($max_discount); $claimed = db_prep_positive_int($claimed); $url = db_prep_string(db_escape($url)); $image_url = db_prep_string(db_escape($image_url)); $expiration = db_prep_string(db_escape($expiration)); $one_per = db_prep_string(db_escape($one_per)); $city = db_prep_string(db_escape($city)); $fine_print = db_prep_string(db_escape($fine_print)); fb($city, '$city'); if (strcmp($deal, 'null')) { $query .= "and deal = {$deal} "; } if (strcmp($url, 'null')) { $query .= "and url = {$url} "; } if (strcmp($image_url, 'null')) { $query .= "and image_url = {$image_url} "; } if (strcmp($business, 'null')) { $query .= "and business = {$business} "; } if (strcmp($expiration, 'null')) { $query .= "and expiration = {$expiration} "; } if (strcmp($percent_discount, 'null')) { $query .= "and percent_discount = {$percent_discount} "; } if (strcmp($max_discount, 'null')) { $query .= "and max_discount >= {$max_discount} "; } if (strcmp($one_per, 'null')) { $query .= "and one_per = {$one_per} "; } if (strcmp($claimed, 'null')) { $query .= "and claimed >= {$claimed} "; } if (strcmp($city, 'null')) { $query .= "and city = {$city} "; } if (strcmp($fine_print, 'null')) { $query .= "and fine_print regexp {$fine_print} "; } fb($query, '$query'); $retval = query_assoc($query, $count); return $retval; //fb( $retval, '$retval search_deal' ); //fb( $count, '$count' ); }
public function check_status($addr) { $q = "SELECT * FROM incoming WHERE input_address = '" . escape($addr) . "' ORDER BY incoming_id DESC"; if (!query_count($q)) { return -1; } else { $arr = query_assoc($q); $this->transaction_hash = $arr['transaction_hash']; query("UPDATE address SET status = ' " . escape($arr['confirmations']) . "' WHERE input_address = '" . escape($addr) . "'"); return $arr['confirmations']; } }