/** * 初始化数据库配置 * @param string $table * @param boolean $isMaster * @param boolean $isPersistent * @return Base_Db */ public function prepare($table, $isMaster = false, $isPersistent = false) { $t = explode(".", $table); $table = $t[count($t) - 1]; if (!isset($this->tableConf[$table])) { echo $table . "<br>"; print_R($this->tableConf); die($table . ' to database config error'); } $dbKey = $this->tableConf[$table]['db']; $db_count = count($this->dbConf[$dbKey]); $writeConf = array('host' => $this->dbConf[$dbKey][0]['host'], 'user' => $this->dbConf[$dbKey][0]['user'], 'password' => $this->dbConf[$dbKey][0]['password'], 'port' => empty($this->dbConf[$dbKey][0]['port']) ? 3306 : $this->dbConf[$dbKey][0]['port'], 'database' => $this->dbConf[$dbKey][0]['database']); //if (isset($this->dbConf[$dbKey][1])) if ($db_count >= 2) { $rand = rand(1, $db_count - 1); $readConf = array('host' => $this->dbConf[$dbKey][$rand]['host'], 'user' => $this->dbConf[$dbKey][$rand]['user'], 'password' => $this->dbConf[$dbKey][$rand]['password'], 'port' => empty($this->dbConf[$dbKey][$rand]['port']) ? 3306 : $this->dbConf[$dbKey][$rand]['port'], 'database' => $this->dbConf[$dbKey][$rand]['database']); } else { $readConf = $writeConf; } $key = md5($writeConf['host'] . ':' . $writeConf['port'] . ';' . $writeConf['user'] . ':' . $writeConf['password']); if (isset($this->oDbArr[$key]) && is_object($this->oDbArr[$key])) { if ($isMaster) { $this->oDbArr[$key]->setIsMaster($isMaster); } } else { $oDb = new Base_Db(); $oDb->setReadConf($readConf); $oDb->setWriteConf($writeConf); $oDb->setIsMaster($isMaster); $isPersistent = $isPersistent || $this->dbConf['isPersistent']; $oDb->setIsPersistent($isPersistent); $this->oDbArr[$key] = $oDb; } return $this->oDbArr[$key]; }
/** * method to execute the query * it's called automatically by the api main controller */ public function execute() { Billrun_Factory::log()->log("Execute api query billrun", Zend_Log::INFO); $request = $this->getRequest()->getRequest(); // supports GET / POST requests Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::INFO); if (!isset($request['aid'])) { $this->setError('Require to supply aid or sid', $request); return true; } $find = array(); $max_list = 1000; if (isset($request['aid'])) { $aids = Billrun_Util::verify_array($request['aid'], 'int'); if (count($aids) > $max_list) { $this->setError('Maximum of aid is ' . $max_list, $request); return true; } $find['aid'] = array('$in' => $aids); } if (isset($request['billrun'])) { $find['billrun_key'] = $this->getBillrunQuery($request['billrun']); } $options = array('sort' => array('aid', 'billrun_key')); $cacheParams = array('fetchParams' => array('options' => $options, 'find' => $find)); $this->setCacheLifeTime(604800); // 1 week $results = $this->cache($cacheParams); Billrun_Factory::log()->log("query success", Zend_Log::INFO); $ret = array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'details' => $results)); $this->getController()->setOutput($ret); }
public function Create($team, $user) { $locationFormat = $this->Parent->RootDomain . "{apiKey}/v{apiVersion}/team/" . $team['teamShortName']; $url = $this->BuildUrl($locationFormat); $payload = json_encode($team); $fh = fopen('php://temp', 'r+'); fwrite($fh, $payload); rewind($fh); $this->curlWrapper->resetAll(); $this->curlWrapper->setDefaults(); if ($this->Parent->Debug) { $this->curlWrapper->addOption(CURLOPT_VERBOSE, 1); } $this->curlWrapper->addOption(CURLOPT_USERPWD, $this->Parent->Username . ":" . $this->Parent->Password); $this->curlWrapper->addOption(CURLOPT_PUT, true); $this->curlWrapper->addOption(CURLOPT_INFILE, $fh); $this->curlWrapper->addOption(CURLOPT_INFILESIZE, strlen($payload)); $this->curlWrapper->addHeader(array('Accept' => 'application/json', 'Content-type' => 'application/json', 'Authorize' => 'Basic ' . $user, 'Authorization' => 'Basic ' . $user)); $json = $this->curlWrapper->put($url); $cntent = print_R($this->curlWrapper, true); if ($this->curlWrapper->getTransferInfo('http_code') == 200) { //updated return true; } elseif ($this->curlWrapper->getTransferInfo('http_code') == 201) { //created return true; } else { return false; //$this->curlWrapper->getTransferInfo(); } }
public function test() { $aModel = TuiyoLoader::model("applications", true); $aUser = TuiyoAPI::get("user", null); $aDocument = TuiyoAPI::get("document", null); $aParams = $aModel->getSingleUserPlugin($aUser->id, "twitter"); if (!is_object($aParams)) { $aDocument->enqueMessage(_("Cannot Load the service for this user"), "error"); return false; } echo $aParams->get("oauth_verifier"); /* Build TwitterOAuth object with client credentials. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); $view =& $this->getView("twitter", "html"); /* Get temporary credentials. */ $access_token = $connection->getAccessToken($aParams->get('oauth_verifier', false)); /* Create a TwitterOauth object with consumer/user tokens. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); /* If method is set change API call made. Test is called by default. */ $content = $connection->get('account/verify_credentials'); //print_R($content); $user = $connection->get('account/verify_credentials'); $userPublicFeeds = $connection->get('statuses/public_timeline'); print_R($userPublicFeeds); }
function applyFilters($q, $au) { if (!empty($q['query']['_sync'])) { // use the basic builder modules for this project based on configurion. // what do we have.. //DB_DataObject::DebugLevel(1); $x = DB_DataObject::factory('builder_modules'); $modpaths = $x->fetchAll('name', 'path'); $ff = HTML_FlexyFramework::get(); foreach ($ff->enableArray as $m) { if (isset($modpaths[$m])) { continue; } if (file_exists($ff->baseDir . '/' . $m)) { $x = DB_DataObject::factory('builder_modules'); $x->setFrom(array('name' => $m, 'path' => $ff->baseDir . '/' . $m, 'public' => 0)); $x->insert(); } } $ff->page->jok("Synced"); //$mods = $ff->enableArray; echo '<PRE>'; print_R($ff); exit; } }
public function show() { $sql = 'SELECT * FROM ' . DB_PREFIX . 'user_queue '; $orderby = ' ORDER BY update_time ASC'; $limit = ' limit 0,' . CHARGE_LIMIT; $query = $this->db->query($sql . $orderby . $limit); $queue = array(); while ($row = $this->db->fetch_array($query)) { $queue[] = $row; } if ($queue) { foreach ($queue as $v) { if (!$v['bucket_name'] || !$v['domain']) { continue; } $param = array('bucket_name' => $v['bucket_name'], 'domain' => $v['domain'], 'start_day' => '', 'period' => 1); //查询流量 $status = $this->upyun->BucketStatus($param); print_R($status); exit; if ($status['discharge']) { $total = 0; foreach ($status['discharge'] as $val) { $total = $total + $val; } $charge = $total / 1024 / 1024 / 1024 * DISCHARGE; } $sql = 'REPLACE INTO ' . DB_PREFIX . 'realtime_charge VALUE(' . $v['user_id'] . ',' . $charge . ',' . TIMENOW . ')'; $this->db->query($sql); $sql = 'UPDATE ' . DB_PREFIX . 'user_queue SET update_time=' . TIMENOW . ' WHERE user_id=' . $v['user_id']; $this->db->query($sql); } } }
public static function actionAccessToken($get = false) { $ret = Wxaccesstoken::model()->findByAttributes(array('appid' => APP_ID)); if (!$ret) { $ret = new Wxaccesstoken(); $ret->appid = APP_ID; $ret->appsecret = APP_SECRET; $ret->create_at = date("Y-m-d H:i:s", time()); $ret->save(); } if (empty($ret->accesstoken) || $ret->expire_at < time() || $get) { $app_id = APP_ID; $app_sec = APP_SECRET; $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$app_id}&secret={$app_sec}"; $response = Yii::app()->curl->get($url); $response = json_decode($response, true); if (isset($response['errcode'])) { Yii::trace(CVarDumper::dumpAsString($response), 'get accesstoken ERROR'); } else { $ret->accesstoken = $response['access_token']; $ret->expire_at = time() + $response['expires_in'] - 300; if (!$ret->save()) { print_R($ret->errors); } } } return $ret->accesstoken; }
public function indexAction() { $Base = \AliOSS\Base::Instance(); $Base->getALIOSSSDK()->setEnableDomainStyle(true); $data['list'] = $Base->getALIOSSSDK()->listBucket(); print_R($data); /** *列出Bucket内所有文件 *递归列出目录下所有文件 */ $prefix = ''; $marker = ''; $delimiter = ''; $next_marker = ''; $maxkeys = 1000; $index = 1; while (true) { $options = array('delimiter' => $delimiter, 'prefix' => $prefix, 'max-keys' => $maxkeys, 'marker' => $next_marker); $res = $Base->getALIOSSSDK()->listObject($Base->getBucketName(), $options); $msg = "列出Bucket内所有文件" . $Base->getBucketName(); if ($res->isOk()) { $body = $res->body; $tmp_object_list = OSSUtil::get_object_list_marker_from_xml($body, $next_marker); //打印出所有的object名称 foreach ($tmp_object_list as $key) { $data['file'][$index] = $key; $index++; } } } print_R($data); }
/** * method to execute remove of billing lines (only credit and active) * it's called automatically by the api main controller */ public function execute() { Billrun_Factory::log()->log("Execute api remove", Zend_Log::INFO); $request = $this->getRequest()->getRequest(); // supports GET / POST requests Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::INFO); $stamps = array(); foreach ($request['stamps'] as $line_stamp) { $clear_stamp = Billrun_Util::filter_var($line_stamp, FILTER_SANITIZE_STRING, FILTER_FLAG_ALLOW_HEX); if (!empty($clear_stamp)) { $stamps[] = $clear_stamp; } } if (empty($stamps)) { Billrun_Factory::log()->log("remove action failed; no correct stamps", Zend_Log::INFO); $this->getController()->setOutput(array(array('status' => false, 'desc' => 'failed - invalid stamps input', 'input' => $request))); return true; } $model = new LinesModel(); $query = array('source' => 'api', 'stamp' => array('$in' => $stamps), '$or' => array(array('billrun' => array('$gte' => Billrun_Billrun::getActiveBillrun())), array('billrun' => array('$exists' => false)))); $ret = $model->remove($query); if (!isset($ret['ok']) || !$ret['ok'] || !isset($ret['n'])) { Billrun_Factory::log()->log("remove action failed pr miscomplete", Zend_Log::INFO); $this->getController()->setOutput(array(array('status' => false, 'desc' => 'remove failed', 'input' => $request))); return true; } Billrun_Factory::log()->log("remove success", Zend_Log::INFO); $this->getController()->setOutput(array(array('status' => $ret['n'], 'desc' => 'success', 'input' => $request))); }
/** * method to send * * @param type $message * @param type $recipients * @return \Billrun_Sms|boolean */ public function send($message, $recipients) { if (empty($message) || empty($recipients)) { Billrun_Factory::log()->log("can not send the sms, there are missing params - txt: " . $this->data['message'] . " recipients: " . print_r($this->data['recipients'], TRUE) . " from: " . $this->data['from'], Zend_Log::WARN); return false; } $unicode_text = $this->sms_unicode($message); if (!empty($message) && empty($unicode_text)) { $language = '1'; } else { $language = '2'; } // Temporary - make sure is not 23 chars long $text = str_pad($message, 24, '+'); $period = 120; foreach ($recipients as $recipient) { $send_params = array('message' => $text, 'to' => $recipient, 'from' => $this->data['from'], 'language' => $language, 'username' => $this->data['user'], 'password' => $this->data['pwd'], 'acknowledge' => "false", 'period' => $period, 'channel' => "SRV"); $url = $this->data['provisioning'] . "?" . http_build_query($send_params); $sms_result = Billrun_Util::sendRequest($url); $exploded = explode(',', $sms_result); $response = array('error-code' => empty($exploded[0]) ? 'error' : 'success', 'cause-code' => $exploded[1], 'error-description' => $exploded[2], 'tid' => $exploded[3]); Billrun_Factory::log()->log("phone: " . $recipient . " encoded_text: " . $message . " url: " . $url . " result" . print_R($response, 1), Zend_Log::INFO); } return $response['error-code'] == 'success' ? true : false; }
/** * 亿美短信发送接口 * @param unknown $mobile 手机号 * @param unknown $content 短信内容 */ private function _sendEmay($mobile, $content) { set_time_limit(0); define('SCRIPT_ROOT', BASE_DATA_PATH . '/api/emay/'); require_once SCRIPT_ROOT . 'include/Client.php'; /** * 网关地址 */ $gwUrl = C('sms.gwUrl'); /** * 序列号,请通过亿美销售人员获取 */ $serialNumber = C('sms.serialNumber'); /** * 密码,请通过亿美销售人员获取 */ $password = C('sms.password'); /** * 登录后所持有的SESSION KEY,即可通过login方法时创建 */ $sessionKey = C('sms.sessionKey'); /** * 连接超时时间,单位为秒 */ $connectTimeOut = 2; /** * 远程信息读取超时时间,单位为秒 */ $readTimeOut = 10; /** $proxyhost 可选,代理服务器地址,默认为 false ,则不使用代理服务器 $proxyport 可选,代理服务器端口,默认为 false $proxyusername 可选,代理服务器用户名,默认为 false $proxypassword 可选,代理服务器密码,默认为 false */ $proxyhost = false; $proxyport = false; $proxyusername = false; $proxypassword = false; $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut); /** * 发送向服务端的编码,如果本页面的编码为GBK,请使用GBK */ $client->setOutgoingEncoding("UTF-8"); $statusCode = $client->login(); if ($statusCode != null && $statusCode == "0") { } else { //登录失败处理 // echo "登录失败,返回:".$statusCode;exit; } $statusCode = $client->sendSMS(array($mobile), $content); if ($statusCode != null && $statusCode == "0") { return true; } else { return false; print_R($statusCode); echo "处理状态码:" . $statusCode; } }
public function AjaxDataRoam() { print_R($_REQUEST); $soucemodel = $_REQUEST['val'][0]['sourcemodel']; $sourceid = $_REQUEST['val'][0]['sourceid']; $targetmodel = $_REQUEST['val'][0]['targetmodel']; $this->lookupDataRoamPull($soucemodel, $sourceid, $targetmodel); }
public function prr($arr, $exit = null) { echo '<pre>'; print_R($arr); echo '</pre>'; if (!is_null($exit)) { exit; } }
static function debug($s, $e = 0) { if (!$GLOBALS['_XML_SVGTOPDF']['options']['debug']) { return; } echo "<PRE>" . print_R($s, true) . "</PRE>"; if ($e) { exit; } }
/** * method to execute the query * it's called automatically by the api main controller */ public function execute() { Billrun_Factory::log()->log("Execute api query aggregate", Zend_Log::INFO); $request = $this->getRequest()->getRequest(); // supports GET / POST requests Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::DEBUG); if (!isset($request['aid']) && !isset($request['sid'])) { $this->setError('Require to supply aid or sid', $request); return true; } $find = array(); $max_list = 1000; if (isset($request['aid'])) { $aids = Billrun_Util::verify_array($request['aid'], 'int'); if (count($aids) > $max_list) { $this->setError('Maximum of aid is ' . $max_list, $request); return true; } $find['aid'] = array('$in' => $aids); } if (isset($request['sid'])) { $sids = Billrun_Util::verify_array($request['sid'], 'int'); if (count($sids) > $max_list) { $this->setError('Maximum of sid is ' . $max_list, $request); return true; } $find['sid'] = array('$in' => $sids); } if (isset($request['billrun'])) { $find['billrun'] = $this->getBillrunQuery($request['billrun']); } if (isset($request['query'])) { $query = $this->getArrayParam($request['query']); $find = array_merge($find, (array) $query); } if (isset($request['groupby'])) { $groupby = array('_id' => $this->getArrayParam($request['groupby'])); } else { $groupby = array('_id' => null); } if (isset($request['aggregate'])) { $aggregate = $this->getArrayParam($request['aggregate']); } else { $aggregate = array('count' => array('$sum' => 1)); } $group = array_merge($groupby, $aggregate); $options = array('sort' => array('urt'), 'page' => isset($request['page']) && $request['page'] > 0 ? (int) $request['page'] : 0, 'size' => isset($request['size']) && $request['size'] > 0 ? (int) $request['size'] : 1000); $cacheParams = array('fetchParams' => array('options' => $options, 'find' => $find, 'group' => $group, 'groupby' => $groupby)); $this->setCacheLifeTime(604800); // 1 week $results = $this->cache($cacheParams); Billrun_Factory::log()->log("Aggregate query success", Zend_Log::INFO); $ret = array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'details' => $results)); $this->getController()->setOutput($ret); }
function ppr($val, $needReturn = false) { $return = '<pre>'; $return .= print_R($val, true); $return .= '</pre>'; if ($needReturn) { return $return; } else { echo $return; } }
public function getPath() { $parents = array(); $parent = $this; print_R($this->getParentCommunities()->toArray()); die; while ($parent = $parent->getParentCommunities()->getFirst()) { print_r($parent->toArray()); } return $parents; }
function profile($login, $fname = '', $lname = '', $email = '') { print_R($_FILES); global $dbPdo; $tmp = $_FILES['img']['tmp_name']; //$filename = $_FILES['img']['name']; $saved = "files/" . $login; move_uploaded_file($tmp, $saved); $sql = "UPDATE users SET fname='{$fname}', lname='{$lname}', email='{$email}', img='{$login}' WHERE login='******'"; $dbPdo->exec($sql); header("Location: index.php?profile={$login}"); }
public function passport_check($data) { $result = array('flag' => false, 'info' => ''); $tst = time(); $data = array('tp' => $this->tp, 'pp' => $data['username'], 'pwd' => md5($data['pwd']), 'tst' => $tst, 'key' => md5($data['username'] . $tst . $this->secret_key)); $yanxiu_return_msg = $this->postdatacurl($data, 'http://pp.yanxiu.com/reg/loginValidate.tc'); print_R($yanxiu_return_msg); if (trim($yanxiu_return_msg->code) == 0) { $data_userinfo = array('tp' => $this->tp, 'pp' => $data['username'], 'tst' => $tst, 'key' => md5($data['username'] . $this->tp . $tst . $this->secret_key)); $userinfo = $this->postdatacurl($data, 'http://pp.yanxiu.com/reg/getUserInfo.tc'); $result = array('flag' => true, 'info' => $userinfo); } return $result; }
function k($str) { if ($_SERVER['REMOTE_ADDR'] == '14.161.35.175' || $_SERVER['REMOTE_ADDR'] == '::1' || $_SERVER['SERVER_NAME'] == 'localhost') { if ($str) { echo "<pre>"; print_R($str); echo "</pre>"; } else { echo "<pre>"; var_dump($str); echo "</pre>"; } } }
public function runBinaryPreferredReport() { // $dayFirst = date("Y-09-01 00:00:00"); // $filterDay = date("Y-09-01 08:00:00"); // $dayLast = date("Y-09-30 23:59:59"); $dayFirst = date("Y-m-d 00:00:00", strtotime("first day of last month")); $filterDay = date("Y-m-d 08:00:00", strtotime("first day of last month")); $dayLast = date("Y-m-d 23:59:59", strtotime("last day of last month")); // $preferred = array(array('customer_id'=> 1317));//$this->preferred(); $preferred = $this->preferred(); $historial = Mage::getResourceModel('sales/order_status_history_collection')->addAttributeToSelect('parent_id')->addAttributeToFilter('main_table.status', array('eq' => 'complete'))->addAttributeToFilter('main_table.created_at', array('from' => $dayFirst, 'to' => $dayLast))->addAttributeToFilter('main_table.entity_name', array('in' => array('invoice', 'shipment'))); $affiliate_parent = array(); foreach ($preferred as $key => $value) { $customer_info = Mage::getModel('affiliate/affiliatecustomers')->getCollection()->addFieldToFilter('customer_id', $value['customer_id'])->getFirstItem()->getData(); $parent_info = Mage::getModel('affiliate/affiliatecustomers')->getCollection()->addFieldToFilter('referral_code', $customer_info['referral_sponsor'])->getFirstItem()->getData(); $sale = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', array('in' => array($value['customer_id'])))->addAttributeToFilter('entity_id', array('in' => array($historial->getData('parent_id'))))->addAttributeToFilter('affiliate_network', array('eq' => 2))->addAttributeToFilter('affiliate_sale_type', array('nin' => 0)); $sale_parent = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', array('in' => array($parent_info['customer_id'])))->addAttributeToFilter('entity_id', array('in' => array($historial->getData('parent_id'))))->addAttributeToFilter('affiliate_network', array('eq' => 2))->addAttributeToFilter('affiliate_sale_type', array('nin' => 0))->getData(); if ($sale->getData() && sizeof($sale_parent) > 0) { $store_id = $value['store_id']; $package = array(); $percentage = 0; $currency = 0; foreach ($sale as $k => $order) { $total = 0; $totala = 0; $store_id = $order->getStoreId(); $available = explode(",", Mage::getStoreConfig('binary/preferred/products', $store_id)); $payment_percentage = Mage::getStoreConfig('binary/preferred/percentage', $store_id); $increment = $order->getIncrementId(); $items = $order->getAllVisibleItems(); foreach ($items as $item) { $product = $item->getData(); $sku = $product['sku']; if (in_array($sku, $available)) { $total = $total + $product['qty_shipped'] * $product['price'] * $payment_percentage; } } $percentage = $percentage + $total; array_push($package, array($increment, $order->getAffiliateSaleType(), $order->getBaseCurrencyCode(), $order->getEntityId(), $total)); } $insert = array("preferred_id" => $value['customer_id'], "profit" => $percentage, "currency" => $order->getBaseCurrencyCode(), "package" => json_encode($package), "customer_id" => $parent_info['customer_id'], "start_date" => $filterDay, "end_date" => $dayLast); $model = Mage::getModel('affiliate/affiliatebinarypreferred')->addData($insert); $model->save(); echo "<pre>"; print_R($insert); echo '</pre>'; } } }
/** * method to execute the query * it's called automatically by the api main controller */ public function execute() { Billrun_Factory::log()->log("Execute api query", Zend_Log::INFO); $request = $this->getRequest()->getRequest(); // supports GET / POST requests Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::INFO); if (!isset($request['aid']) && !isset($request['sid'])) { $this->setError('Require to supply aid or sid', $request); return true; } $find = array(); $max_list = 1000; if (isset($request['aid'])) { $aids = Billrun_Util::verify_array($request['aid'], 'int'); if (count($aids) > $max_list) { $this->setError('Maximum of aid is ' . $max_list, $request); return true; } $find['aid'] = array('$in' => $aids); } if (isset($request['sid'])) { $sids = Billrun_Util::verify_array($request['sid'], 'int'); if (count($sids) > $max_list) { $this->setError('Maximum of sid is ' . $max_list, $request); return true; } $find['sid'] = array('$in' => $sids); } if (isset($request['billrun'])) { $find['billrun'] = $this->getBillrunQuery($request['billrun']); } if (isset($request['query'])) { $query = $this->getArrayParam($request['query']); $find = array_merge($find, (array) $query); } $options = array('sort' => array('urt'), 'page' => isset($request['page']) && $request['page'] > 0 ? (int) $request['page'] : 0, 'size' => isset($request['size']) && $request['size'] > 0 ? (int) $request['size'] : 1000); $model = new LinesModel($options); if (isset($request['distinct'])) { $lines = $model->getDistinctField((string) $request['distinct'], $find); } else { $lines = $model->getData($find); foreach ($lines as &$line) { $line = $line->getRawData(); } } Billrun_Factory::log()->log("query success", Zend_Log::INFO); $ret = array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'details' => $lines)); $this->getController()->setOutput($ret); }
/** * destructor, outputs Total Render time if DEBUG>0 */ function __destruct() { if (DEBUG > 0) { kataDebugOutput('Total Render Time (including Models) ' . (microtime(true) - $this->starttime) . ' secs'); kataDebugOutput('Memory used ' . number_format(memory_get_usage(true)) . ' bytes'); kataDebugOutput('Parameters ' . print_R($this->params, true)); if (function_exists('xdebug_get_profiler_filename')) { $fn = xdebug_get_profiler_filename(); if (false !== $fn) { kataDebugOutput('profilefile:' . $fn); } } kataDebugOutput('Loaded classes: ' . implode(' ', array_keys(classRegistry::getLoadedClasses()))); } }
function dopost($postXml) { $postArray = xml2array($postXml); $postData = $postArray['xml']; error_log('token验证:' . print_R($postData, true), 3, dirname(__FILE__) . '/pay.log'); switch ($postData['MsgType']) { case 'event': $paramsData['Content'] = '欢迎访问WEB人生百科'; $paramsData['MsgType'] = 'text'; send_msg($postData, $paramsData); break; default: commonMsg($postData); } }
/** * @param Node $node * @param $context * @return AbstractTranspiler * @throws NotImplementedException */ public static function create(Node $node, $context) { if ($context === null) { throw new ContextNotProvidedException('You have to provide the context'); } $type = $node->getType(); if (!array_key_exists($type, self::$transpilersMap)) { print_R($type); die; throw new NotImplementedException("'" . $node->getType() . "' not implemented."); } $className = "\\Php2js\\Transpilers\\" . self::$transpilersMap[$type] . 'Transpiler'; $transpiler = new $className($node); $transpiler->setContext($context); return $transpiler; }
function user_login($username, $password, $ishashed = 0) { $twtapi = user_getTWTAPI(); //print_R($twtapi); $result = $twtapi->query('twt.login', array('username' => $username, 'password' => $password, 'ishashed' => $ishashed)); print_R($result); if ($result) { //这里表示的是该用户确实存在....下面我们要判断该用户是老师还是学生... $usernumb = $result->usernumb; //这里表示的是老师...但是有的老师确实是支部的干部,,这里还是得确认... $query = " where partybranch_secretary ='" . $usernumb . "' or partybranch_organizer ='" . $usernumb . "' or partybranch_propagator ='" . $usernumb . "'"; $query_r = getByWhere('partybranch', $query); if ($query_r) { $is_gangbu = 1; $partybranch_id = $query_r['partybranch_id']; print_R($partybranch_id); print_R('<br>'); } else { $is_gangbu = 0; //这里要注意了:如果这里的人是老师的话,他不是支部委员,也不在info表中,那么这个人将没有 //支部信息....也就是没有支部id....和那些没有支部的人登陆是一样的,,无法看到支部成员的//的内容.但是如果他有个人发展流程图,和上传资料还是可以看到的..... $query1 = " where sno ='" . $usernumb . "'"; $query1_r = getByWhere('student_info', $query1); if ($query1_r['partybranch_id']) { //表示有内容... $partybranch_id = $query1_r['partybranch_id']; } else { $partybranch_id = 0; } //end of else.. } //end of else... //下面判断的非常多...当老师和同学进入的时候,看到的是不同的页面..... if (strlen($usernumb) == 6) { $is_teacher = 1; //是干部 } elseif (strlen($usernumb) == 10) { $is_teacher = 0; //不是干部... } //下面判断该用户是属于哪个支部的..... user_touch($result->twtname, $result->realname, $result->usernumb, $is_gangbu, $is_teacher, $partybranch_id); } //end of if result..... //print_R($manager); return $result; }
function get($args, $opts) { print_R($opts); exit; require_once 'Pman/Builder/Generator.php'; ini_set('pcre.backtrack_limit', 2000000); ini_set('pcre.recursion_limit', 2000000); $this->init(); $lastarg = $this->cli ? array_pop($_SERVER['argv']) : ''; if (preg_match('/RunGenerator/', $lastarg)) { $lastarg = ''; } $x = new Pman_Builder_Generator(); // $x->page = clone($this); $x->start($this->cli, $args, $lastarg); die("done!"); }
/** * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if ($_GET['apiname'] != "") { $client = new Maestrano_Connec_Client("cld-2"); $resp = $client->get('/' . $_GET['apiname']); if ($resp['code'] != 200) { die($this->module->l('Error Code: ' . $resp['code'])); } else { echo '<pre>'; print_R(json_decode($resp['body'])); echo '</pre>'; die; } } else { die($this->module->l('API Name is Mandatory')); } }
public function displayValues($content_node, $transient_options, $action) { print_R($this->storage->getAsArray()); if (!($mainNode = $this->template->appendFileByNode('swiss_mapped_limits.html', 'div', $content_node)) instanceof DOMNode || !($limitsNode = $this->template->getElementByName('limits', 0, $mainNode))) { I2CE::raiseError("Could not load swiss_mapped_limits.html"); return false; } $this->renameInputs(array('new'), $mainNode); foreach ($this->storage->getKeys() as $name) { $limitsNode->appendChild($liNode = $this->template->createElement('li')); if (!($limitNode = $this->template->appendFileByNode('swiss_mapped_limits_each.html', 'div', $liNode)) instanceof DOMNode || !($swissLimit = $this->getChild($name)) instanceof I2CE_Swiss) { continue; } $this->template->setDisplayDataImmediate('name', $name, $limitNode); $swissLimit->addAjaxLink('limit_link', 'relationship_where_container', 'limit_ajax', $limitNode, $action, $transient_options); $delete_link = $swissLimit->getURLRoot('delete_class') . $swissLimit->path; $this->template->setDisplayDataImmediate('delete_link', $delete_link, $limitNode); } return true; }
protected function setUp() { $logger = new \Monolog\Logger('rendertest'); $logger->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG)); $inputFileType = \PHPExcel_IOFactory::identify(__DIR__ . '/../metadata/template/singlelevel.xlsx'); $objReader = \PHPExcel_IOFactory::createReader($inputFileType); $template = $objReader->load(__DIR__ . '/../metadata/template/singlelevel.xlsx'); $this->output = new \PHPExcel(); $outputSheet = $this->output->getActiveSheet(); $templateSheet = $this->output->addExternalSheet($template->getSheetByName('TEMPLATE')); $namedRange = $this->output->getNamedRange('ROOT'); $rangeData = $templateSheet->rangeToArray($namedRange->getRange(), null, false, true, true); print_R($rangeData); $namedRange = $this->output->getNamedRange('LEVEL1'); $rangeData = $templateSheet->rangeToArray($namedRange->getRange(), null, false, true, true); print_R($rangeData); die; $reportSheet = new \PHPExcelReport\Report\ReportSheet($outputSheet); $this->sut = new \PHPExcelReport\Report\Writer\VerticalRangeWriter($templateSheet, $reportSheet, $logger); }