Ejemplo n.º 1
1
 /**
  * send
  * 必有方法,发送时调用.
  *
  * config参数为getOptions取得的所有项的配置结果
  *
  * @param mixed $target ['email']
  * @param mixed $title
  * @param mixed $config
  */
 public function send($target, $title, $content, $config)
 {
     logger::debug(__CLASS__ . var_export(func_get_args(), 1));
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!($email_to = $target['email'])) {
         return false;
     }
     if ($config['sendway'] == 'mail') {
         $this->email = vmc::singleton('desktop_email_email');
     }
     $this->email->Sender = $this->Sender = $config['usermail'];
     $this->email->Subject = $this->Subject = $this->email->inlineCode($title);
     $From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
     $header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
     $body = chunk_split(base64_encode($content));
     $header = $this->email->buildHeader($header);
     $config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
     switch ($config['sendway']) {
         case 'sendmail':
             $result = $this->email->SendmailSend($email_to, $header, $body);
             break;
         case 'mail':
             $result = $this->email->MailSend($email_to, $header, $body);
             break;
         case 'smtp':
             $result = $this->email->SmtpSend($email_to, $header, $body, $config);
             break;
         default:
             $result = false;
             break;
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * 订单创建完成时
  * @params array - 订单完整数据,含ITEMS
  * @return boolean - 执行成功与否
  */
 public function exec($sdf, &$msg = '')
 {
     logger::debug($sdf['order_id'] . 'createfinish exec');
     if ($sdf['is_cod'] == 'Y') {
         $freeze_data = array();
         foreach ($sdf['items'] as $key => $item) {
             //购买数量计数
             vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
             //组织库存冻结数据
             $freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
         }
         //库存冻结
         if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
             logger::error('库存冻结异常!ORDER_ID:' . $sdf['order_id'] . ',' . $msg);
         }
     }
     /* 订单金额为0 **/
     $order_sdf = $sdf;
     if ($order_sdf['order_total'] == '0') {
         // 生成支付账单
         $obj_bill = vmc::singleton('ectools_bill');
         $bill_sdf = array('bill_type' => 'payment', 'pay_object' => 'order', 'pay_mode' => in_array($order_sdf['pay_app'], array('-1', 'cod', 'offline')) ? 'offline' : 'online', 'order_id' => $order_sdf['order_id'], 'pay_app_id' => $order_sdf['pay_app'], 'pay_fee' => $order_sdf['cost_payment'], 'member_id' => $order_sdf['member_id'], 'status' => 'succ', 'money' => $order_sdf['order_total'], 'memo' => '订单0元时自动生成');
         if (!$obj_bill->generate($bill_sdf, $msg)) {
             //TODO 自动支付失败,
             logger::error('订单0元时自动支付失败!' . $msg);
             return;
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 function dispatch($query)
 {
     // 目录遍历漏洞过滤
     $this->check_get($_GET);
     $_GET['ctl'] = $_GET['ctl'] ? $_GET['ctl'] : 'default';
     $_GET['act'] = $_GET['act'] ? $_GET['act'] : 'index';
     $_GET['app'] = $_GET['app'] ? $_GET['app'] : 'desktop';
     logger::debug(sprintf('Desktop access: "app:%s ctl:%s, act:%s"', $_GET['app'], $_GET['ctl'], $_GET['act']));
     $query_args = $_GET['p'];
     $controller = app::get($_GET['app'])->controller($_GET['ctl']);
     $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
     if (app::get('desktop')->getConf('use_ssl') && $_SERVER['SERVER_PORT'] == '80') {
         header("Location:https://" . $server . ':443' . $_SERVER['REQUEST_URI']);
         exit;
     } elseif (!app::get('desktop')->getConf('use_ssl') && $_SERVER['SERVER_PORT'] == '443') {
         header("Location:http://" . $server . $_SERVER['REQUEST_URI']);
         exit;
     }
     $arrMethods = get_class_methods($controller);
     if (in_array($_GET['act'], $arrMethods)) {
         call_user_func_array(array(&$controller, $_GET['act']), (array) $query_args);
     } else {
         call_user_func_array(array(&$controller, 'index'), (array) $query_args);
     }
 }
 public function sitemapAction()
 {
     $this->removeViewRenderer();
     $sitemapFile = $this->_getParam("sitemap");
     if (strpos($sitemapFile, '/') !== FALSE) {
         // / not allowed since site map file name is generated from domain name
         throw new Exception(get_class($this) . ": Attempted access to invalid sitemap [ {$sitemapFile} ]");
     }
     header("Content-type: application/xml");
     $requestedSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/" . $sitemapFile;
     $indexSitemap = PIMCORE_WEBSITE_PATH . "/var/search/sitemap/sitemap.xml";
     if ($this->_getParam("sitemap") and is_file($requestedSitemap)) {
         $content = file_get_contents($requestedSitemap);
         //TODO: strlen($content) takes a few seconds!
         //header("Content-Length: ".strlen($content));
         echo $content;
         exit;
     } else {
         if (is_file($indexSitemap)) {
             $content = file_get_contents($indexSitemap);
             //TODO: strlen($content) takes a few seconds!
             //header("Content-Length: ".strlen($content));
             echo $content;
             exit;
         } else {
             logger::debug(get_class($this) . ": sitemap request - but no sitemap available to deliver");
             exit;
         }
     }
 }
Ejemplo n.º 5
0
 public function send($target, $title, $content, $config)
 {
     $tmpl_data = $config['tmpl_data'];
     $action_name = $config['action_name'];
     $action_name_alias = $config['action_name_alias'];
     $new_msg = array('member_id' => $target['member_id'], 'target' => $target['mobile'], 'subject' => $title, 'content' => $content . $this->platform_config['sms_sign'], 'createtime' => time(), 'msg_type' => 'sms', 'status' => 'sent');
     app::get('b2c')->model('member_msg')->save($new_msg);
     if (!$target['mobile']) {
         return false;
     }
     if (empty($this->platform_config['url']) || empty($this->platform_config['params_tmpl'])) {
         return false;
     }
     $args = array('target' => $target['mobile'], 'content' => $content . $this->platform_config['sms_sign'], 'tmpl_data' => json_encode($tmpl_data), 'time' => date('Y-m-d H:i:s'), 'action' => $action_name, 'action_alias' => $action_name_alias);
     //需要获得access_token
     if (!empty($this->platform_config['access_token_action'])) {
         if (!($args['access_token'] = $this->get_access_token($this->platform_config['access_token_action']))) {
             logger::error($this->platform_config['name'] . 'access_token获得失败,无法调用短信发送API');
             return false;
         }
     }
     $params = $this->gen_params($this->platform_config['params_tmpl'], $args);
     $result = $this->net->post($this->platform_config['url'], $params);
     logger::debug(__CLASS__ . $this->platform_config['url']);
     logger::debug(var_export($params, 1));
     logger::debug(var_export($result, 1));
     return true;
 }
Ejemplo n.º 6
0
 /**
  * 订单发货操作完成时.
  *
  * @delivery_sdf array - 发货单据SDF
  * @msg  异常消息
  *
  * @return bool - 执行成功与否
  */
 public function exec($delivery_sdf, &$msg = '')
 {
     $order_id = $delivery_sdf['order_id'];
     if (!$order_id) {
         $msg = '未知订单id';
         return false;
     }
     $all_send = true;
     $order_items = app::get('b2c')->model('order_items')->getList('*', array('order_id' => $order_id));
     $order_items = utils::array_change_key($order_items, 'item_id');
     foreach ($delivery_sdf['delivery_items'] as $item) {
         $order_items[$item['order_item_id']]['sendnum'] += $item['sendnum'];
         if ($order_items[$item['order_item_id']]['sendnum'] > $order_items[$item['order_item_id']]['nums']) {
             $msg = '发货异常,超出应发数量';
             return false;
         }
         if ($order_items[$item['order_item_id']]['sendnum'] < $order_items[$item['order_item_id']]['nums']) {
             $all_send = false;
             //部分发货
         }
     }
     $order_sdf = array('order_id' => $order_id, 'items' => $order_items, 'ship_status' => $all_send ? '1' : '2');
     if (!app::get('b2c')->model('orders')->save($order_sdf)) {
         $msg = '订单状态修改失败!';
         return false;
     }
     //库存冻结释放,真实扣除库存
     $stock_data = array();
     foreach ($delivery_sdf['delivery_items'] as $key => $value) {
         $stock_data[] = array('sku' => $value['bn'], 'quantity' => $value['sendnum']);
     }
     if (!vmc::singleton('b2c_goods_stock')->unfreeze($stock_data, $msg)) {
         logger::error('库存冻结释放异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     if (!vmc::singleton('b2c_goods_stock')->delivery($stock_data, $msg)) {
         logger::error('库存扣减异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     //订单日志记录
     vmc::singleton('b2c_order_log')->set_operator(array('ident' => $delivery_sdf['op_id'], 'model' => 'shopadmin', 'name' => '操作员'))->set_order_id($order_sdf['order_id'])->success('shipment', '订单' . (!$all_send ? '部分' : '') . '发货成功!', $delivery_sdf);
     /*
      * 消息通知
      * @args1 事件名称
      * @args2 消息模板数据填充
      * @args3 消息目标
      */
     $pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $delivery_sdf['member_id']);
     logger::debug('pam_data' . var_export($pam_data, 1));
     $dlycorp = app::get('b2c')->model('dlycorp')->dump($delivery_sdf['dlycorp_id']);
     $consignee_area = $delivery_sdf['consignee']['area'];
     $consignee_area = explode(':', $consignee_area);
     $consignee_area = $consignee_area[1];
     //消息模板参数
     $env_list = array('order_id' => $delivery_sdf['order_id'], 'consignee_name' => $delivery_sdf['consignee']['name'], 'consignee_area' => $consignee_area, 'consignee_addr' => $delivery_sdf['consignee']['addr'], 'consignee_tel' => $delivery_sdf['consignee']['tel'], 'consignee_mobile' => $delivery_sdf['consignee']['mobile'], 'dlycorp_name' => $dlycorp['name'], 'dlycorp_code' => $dlycorp['corp_code'], 'dlycorp_website' => $dlycorp['website'], 'logistics_no' => $delivery_sdf['logistics_no'], 'timestr' => date('Y-m-d H:i:s', $delivery_sdf['last_modify']));
     vmc::singleton('b2c_messenger_stage')->trigger('orders-shipping', $env_list, array('mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'member_id' => $delivery_sdf['member_id']));
     return true;
 }
Ejemplo n.º 7
0
function __autoload($class_name)
{
    if (file_exists(FS_CLASS . $class_name . ".php")) {
        logger::debug("__autoload: file '" . FS_CLASS . $class_name . ".php" . "' exists. Loading.");
        include_once FS_CLASS . $class_name . ".php";
    } else {
        logger::debug(FS_CLASS . $class_name . ".php" . "' doesn't exists.");
        $class = "class " . $class_name . " {};";
        eval($class);
    }
}
Ejemplo n.º 8
0
 function __construct($url, $args = null)
 {
     $this->args = arr::apply(array('returndom' => false, 'method' => 'get', 'useragent' => config::get(self::KEY_USERAGENT, 'LeptonPHP/1.0 (+http://labs.noccy.com)')), (array) $args);
     $this->url = $url;
     logger::debug('HTTPRequest() query for "%s"', $url);
     if (function_exists('curl_init')) {
         $this->_curlDoRequest();
     } else {
         $this->_streamDoRequest();
     }
 }
Ejemplo n.º 9
0
Archivo: ui.php Proyecto: 453111208/bbc
 function resource($params = null)
 {
     if ($app = $params['app']) {
         $app = app::get($app);
         $path = isset($params['path']) && is_string($params['path']) ? $params['path'] : '';
         $url = $app->res_url . '/' . trim($path, '/');
         logger::debug($url);
         return $url;
     }
     return kernel::base_url(1);
 }
Ejemplo n.º 10
0
 public function exec($sql, $skipModifiedMark = false, $db_lnk = null)
 {
     if ($this->prefix != 'sdb_') {
         //$sql = preg_replace('/([`\s\(,])(sdb_)([a-z\_]+)([`\s\.]{0,1})/is',"\${1}".$this->prefix."\\3\\4",$sql);
         $sql = preg_replace_callback('/([`\\s\\(,])(sdb_)([0-9a-z\\_]+)([`\\s\\.]{0,1})/is', array($this, 'fix_dbprefix'), $sql);
         //todo: 兼容有特殊符号的表名前缀
     }
     if (!$skipModifiedMark && cachemgr::enable() && preg_match('/(?:(delete\\s+from)|(insert\\s+into)|(update))\\s+([]0-9a-z_:"`.@[-]*)/is', $sql, $match)) {
         $table = strtoupper(trim(str_replace('`', '', str_replace('"', '', str_replace("'", '', $match[4])))));
         $now = time();
         $pos = strpos($table, strtoupper($this->prefix));
         if ($pos === 0) {
             $table = substr($table, strlen($this->prefix));
         }
         //todo: 真实表名
         $this->exec('UPDATE sdb_base_cache_expires SET expire = "' . $now . '" WHERE type = "DB" AND name = "' . $table . '"', true);
         if ($this->affect_row()) {
             cachemgr::set_modified('DB', $table, $now);
         }
     }
     if (!is_resource($db_lnk)) {
         if ($this->_rw_lnk) {
             $db_lnk = $this->_rw_lnk;
         } else {
             $db_lnk = $this->_rw_conn();
         }
     }
     if (defined("STRESS_TESTING")) {
         b2c_forStressTest::$sqlAmount++;
         b2c_forStressTest::slowSqlStart();
     }
     if ($rs = mysql_query($sql, $db_lnk)) {
         if (defined("STRESS_TESTING")) {
             b2c_forStressTest::slowSqlEnd($sql);
         }
         self::$mysql_query_executions++;
         logger::debug('sql:' . self::$mysql_query_executions . '.' . $sql);
         $db_result = array('rs' => $rs, 'sql' => $sql);
         return $db_result;
     } else {
         logger::error($sql . ':' . mysql_error($db_lnk));
         trigger_error($sql . ':' . mysql_error($db_lnk), E_USER_WARNING);
         return false;
     }
 }
Ejemplo n.º 11
0
 /**
  * 订单创建完成时
  * @params array - 订单完整数据,含ITEMS
  * @return boolean - 执行成功与否
  */
 public function exec($sdf, &$msg = '')
 {
     logger::debug($sdf['order_id'] . 'createfinish exec');
     if ($sdf['is_cod'] == 'Y') {
         $freeze_data = array();
         foreach ($sdf['items'] as $key => $item) {
             //购买数量计数
             vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
             //组织库存冻结数据
             $freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
         }
         //库存冻结
         if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
             logger::error('库存冻结异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
         }
     }
     return true;
 }
Ejemplo n.º 12
0
 public function query($query = null, $debug = false)
 {
     if ($this->_dbo == null) {
         logger::error("dbo::query: A connection needs to be made with the db server first!");
         exit("Error: A connection needs to be made with the db server first!");
     }
     if ($query === null && $this->_query != "") {
         $query = $this->_query;
     } elseif ($query === null) {
         if ($this->_debug || $debug) {
             logger::warning("dbo::query: No SQL query was provided to execute.");
         }
         return false;
     }
     $this->_query = $query;
     $query = str_replace("##_", $this->_prefix, $query);
     logger::debug("dbo::query: query: {$query}");
     $this->_record_set = $this->_dbo->query($query);
     if ($this->_dbo->errno != 0) {
         logger::error("dbo::query: An error occured executing the query.");
         logger::error("The error is: '" . $this->_dbo->error . "'");
         exit("Error: The query failed. {$query}");
     }
     $this->result_count = $this->_dbo->affected_rows;
     if ($this->_dbo->errno != 0) {
         logger::error("dbo::query: An error occured calculating the number of results.");
         logger::error("The error is: '" . $this->_dbo->error . "'");
         exit("Error: Couldn't count the number of records.");
     }
     $this->fields = array();
     if (strtoupper(substr($query, 0, 6)) == "SELECT") {
         $temp = $this->_record_set->fetch_fields();
         foreach ($temp as $t) {
             $this->fields[] = $t->name;
         }
         if ($this->_dbo->errno != 0) {
             logger::error("dbo::query: An error occured fetching the fields of the result.");
             logger::error("The error is: '" . $this->_dbo->error . "'");
             exit("Error: Couldn't fetch the fields.");
         }
     }
     return $this->_record_set;
 }
Ejemplo n.º 13
0
 /**
  *
  * @param string $group The database group to connect to or the config array
  */
 public function __construct($connectionstring = null)
 {
     if ($connectionstring == null) {
         $connectionstring = 'default';
     }
     if (is_a($connectionstring, 'DatabaseDriver')) {
         $this->conn = $connectionstring;
         logger::debug('%s: Reusing connection...', __CLASS__);
         return;
     }
     if (is_array($connectionstring)) {
         $config = $connectionstring;
         logger::debug("%s: Initializing connection with %s.", __CLASS__, $connectionstring['driver']);
     } else {
         $config = config::get('lepton.db.' . $connectionstring);
         Console::debugEx("%s: Initializing connection for %s.", __CLASS__, $connectionstring);
     }
     $this->conn = DatabaseConnectionPool::getPooledConnection($config);
 }
Ejemplo n.º 14
0
 public function getway_callback($pay)
 {
     $mdl_bills = $this->app->model('bills');
     $obj_bill = vmc::singleton('ectools_bill');
     $params = vmc::singleton('base_component_request')->get_params(true);
     $pay_app_class = key($pay);
     if (!stripos($pay_app_class, '_')) {
         //兼容处理
         $pay_app_class = 'ectools_payment_applications_' . $pay_app_class;
     }
     $pay_app_method = current($pay);
     $pay_app_instance = new $pay_app_class();
     if ($pay_app_class == 'wechat_payment_applications_wxpay') {
         /**
          * 微信支付特殊处理
          */
         $params['_http_raw_post_data_'] = $GLOBALS["HTTP_RAW_POST_DATA"];
     }
     $pay_result = $pay_app_instance->{$pay_app_method}($params);
     logger::debug('支付网关回调params:' . var_export($params, 1) . "\n" . $pay_app_class . "\n" . $pay_app_method . "\n" . var_export($pay_result, 1));
     if (!$pay_result || empty($pay_result['status'])) {
         $pay_result['status'] = 'error';
     }
     if ($pay_result['bill_id'] && ($bill = $mdl_bills->dump($pay_result['bill_id']))) {
         $pay_result = array_merge($bill, $pay_result);
         //update bill
         if (!$obj_bill->generate($pay_result, $msg)) {
             logger::error('支付网关回调后,更新或保存支付单据失败!' . $msg . '.bill_export:' . var_export($pay_result, 1));
         }
     }
     // Redirect page.
     if ($pay_app_method != 'notify' && $pay_result['return_url']) {
         //for ecmobilecenter
         if (preg_match('/^http([^:]*):\\/\\//', $pay_result['return_url'])) {
             header('Location: ' . $pay_result['return_url']);
         } else {
             header('Location: ' . strtolower(vmc::request()->get_schema() . '://' . vmc::request()->get_host()) . $pay_result['return_url']);
         }
     }
 }
Ejemplo n.º 15
0
 public function dispatch($query)
 {
     $this->check_blacklist();
     //黑名单检测
     $page_starttime = $this->microtime_float();
     $this->init_query_info($query);
     $this->init_request_info();
     $this->check_https();
     $this->check_expanded_name();
     $router_cache_options = $this->check_router_cache();
     $page_key = 'SITE_PAGE_CACHE:' . $this->_request->get_request_uri();
     if (!$this->is_need_cache() || $this->is_need_cache() && !cachemgr::get($page_key, $page, $router_cache_options['skipvary'])) {
         $cache_log = 'cache missed on ' . date('Y-m-d H:i:s');
         logger::info($cache_log . ',URL:' . $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
         cachemgr::co_start();
         $this->default_dispatch();
         //执行控制器
         $page['html'] = implode("\n", $this->_response->get_bodys());
         $page['date'] = date('Y-m-d H:i:s');
         $page['times'] = sprintf('%0.2f', $this->microtime_float() - $page_starttime);
         if ($this->is_need_cache() && $this->_response->get_http_response_code() == 200 && $this->has_page_cache_control() === true) {
             $page_cache = true;
             $cache_log = 'cache refreshed on ' . $page['date'] . ',page speed:' . $page['times'];
             //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
             $this->_response->set_header('X-Page-Cache', $cache_log, true);
             $page['headers'] = $this->_response->get_headers();
             $page['raw_headers'] = $this->_response->get_raw_headers();
             $page['etag'] = md5($page['html']);
             $cache_options = cachemgr::co_end();
             if ($router_cache_options['expires']) {
                 $cache_options['expires'] = $cache_options['expires'] && $cache_options['expires'] < $router_cache_options['expires'] ? $cache_options['expires'] : $router_cache_options['expires'];
             }
             $cache_options['expires'] = $cache_options['expires'] > time() ? $cache_options['expires'] : 0;
             cachemgr::set($page_key, $page, $cache_options);
         } else {
             $page_cache = false;
             cachemgr::co_end();
         }
     } else {
         $page_cache = true;
         $this->_response->clean_headers();
         if (isset($page['headers'])) {
             foreach ($page['headers'] as $header) {
                 $this->_response->set_header($header['name'], $header['value'], $header['replace']);
             }
         }
         if (isset($page['raw_headers'])) {
             foreach ($page['raw_headers'] as $raw_header) {
                 $this->_response->set_raw_headers($raw_header);
             }
         }
         $cache_log = 'cache hit on ' . $page['date'] . ',page speed:' . $page['times'];
         //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
     }
     if ($page_cache === true) {
         $etag = $page['etag'] ? $page['etag'] : md5($page['html']);
         //todo: 兼容
         $this->_response->set_header('Etag', $etag);
         $matchs = explode(',', $_ENV['HTTP_IF_NONE_MATCH']);
         foreach ($matchs as $match) {
             if (trim($match) == $etag) {
                 $this->_response->clean_headers();
                 $this->_response->set_header('Content-length', '0');
                 $this->_response->set_http_response_code(304)->send_headers();
                 exit;
             }
         }
     }
     $this->set_vary_cookie();
     $this->_response->send_headers();
     echo $page['html'];
     logger::debug('This page created by ' . $page['date']);
     logger::debug('Kvstore queries count:' . base_kvstore::$__fetch_count);
     logger::debug('Page speed: ' . $page['times']);
 }
Ejemplo n.º 16
0
 /**
  *
  */
 static function load($module, $optional = false)
 {
     // Check if the path is globbed
     if (strpos($module, '*') == strlen($module) - 1) {
         $path = self::_mangleModulePath($module);
         Console::debugEx(LOG_EXTENDED, __CLASS__, "Looking for modules matching %s from %s", $module, $path);
         $f = glob($path);
         sort($f);
         $failed = false;
         foreach ($f as $file) {
             if (!ModuleManager::load(str_replace('*', basename($file, '.php'), $module))) {
                 $failed = true;
             }
         }
         return !$failed;
     }
     // Check if the module is already loaded
     if (ModuleManager::has($module)) {
         logger::debug("Already loaded %s.", $module);
         return true;
     }
     // Otherwise mangle the path
     $path = self::_mangleModulePath($module);
     /*
      if (file_exists(APP_PATH.$modpath)) {
      $path = APP_PATH.$modpath;
      } elseif (file_exists(SYS_PATH.$modpath)) {
      $path = SYS_PATH.$modpath;
      } else {
      $path = null;
      }
     */
     if ($path) {
         if (file_exists(basename($path, '.php') . '.class.php')) {
             $path = basename($path, '.php') . '.class.php';
         }
         if (file_exists($path)) {
             self::$_lastmodule = $module;
             Console::debugEx(LOG_BASIC, __CLASS__, "Loading %s (%s).", $module, str_replace(BASE_PATH, '', $path));
             try {
                 ModuleManager::$_modules[strtolower($module)] = array();
                 ModuleManager::$_order[] = strtolower($module);
                 // Console::debugEx(LOG_DEBUG2,__CLASS__,"  path = %s", $path);
                 require $path;
                 array_pop(ModuleManager::$_order);
             } catch (ModuleException $e) {
                 Console::debugEx(LOG_BASIC, __CLASS__, "Exception loading %s!", $module);
                 throw $e;
                 return false;
             }
             return true;
         } else {
             throw new ModuleException("Could not load module " . $module . ": Path not found");
             return false;
         }
     } else {
         Console::debugEx(LOG_BASIC, __CLASS__, "Failed to load %s.", $module);
         return false;
     }
 }
Ejemplo n.º 17
0
 /**
  * 订单支付后的处理.
  *
  * @params array 支付完的信息
  * @params 支付时候成功的信息
  */
 public function exec(&$bill, &$msg = '')
 {
     logger::debug($bill['order_id'] . 'payfinish exec');
     if ($bill['status'] != 'succ' && $bill['status'] != 'progress') {
         $msg = '支付其实没有完成!';
         return false;
     }
     $order_id = $bill['order_id'];
     if (!$order_id) {
         $msg = '未知订单ID';
         return false;
     }
     $omath = vmc::singleton('ectools_math');
     $mdl_orders = $this->app->model('orders');
     $order_sub_sdf = array('items' => array('*'));
     $order_sdf = $mdl_orders->dump($order_id, '*', $order_sub_sdf);
     //$order_sdf = $mdl_orders->dump($order_id);
     if (!$order_sdf) {
         $msg = '未知订单';
         return false;
     }
     if ($order_sdf['pay_status'] == '1') {
         $msg = '重复在支付订单' . date('Y-m-d H:i:s');
         return fasle;
     }
     if ($order_sdf['pay_status'] == '2' && $bill['status'] == 'progress') {
         $msg = '重复在支付订单' . date('Y-m-d H:i:s');
         return fasle;
     }
     $payed = $omath->number_plus(array($bill['money'], $order_sdf['payed']));
     switch ($bill['status']) {
         case 'succ':
             $update['pay_status'] = '1';
             //支付完成
             if ($payed < $order_sdf['order_total']) {
                 $update['pay_status'] = '3';
                 //部分支付
             }
             break;
         case 'progress':
             $update['pay_status'] = '2';
             //付款到了担保方
             break;
         default:
             return false;
     }
     $update['payed'] = $payed;
     if (!$mdl_orders->update($update, array('order_id' => $order_id))) {
         $msg = '订单主单据信息更新失败!';
         return false;
     }
     //订单日志记录
     vmc::singleton('b2c_order_log')->set_operator(array('ident' => $order_sdf['member_id'], 'model' => 'members', 'name' => '会员'))->set_order_id($order_sdf['order_id'])->success('payment', '订单支付成功', $bill);
     //积分兑现
     $integral_change_flag = vmc::singleton('b2c_member_integral')->change(array('member_id' => $order_sdf['member_id'], 'order_id' => $order_sdf['order_id'], 'change' => $order_sdf['score_g'], 'change_time' => time(), 'change_reason' => 'order', 'op_model' => $bill['op_id'] ? 'shopadmin' : 'member', 'op_id' => $bill['op_id']), $msg);
     if (!$integral_change_flag) {
         logger::error('积分兑现失败!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     //经验值  经验值变更会自动check 会员等级
     if (!vmc::singleton('b2c_member_exp')->renew($order_sdf['member_id'])) {
         logger::error('经验值兑现失败!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
     }
     //消息通知
     $pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $order_sdf['member_id']);
     $pay_app = app::get('ectools')->model('payment_applications')->dump($bill['pay_app_id']);
     $env_list = array('order_id' => $bill['order_id'], 'bill_id' => $bill['bill_id'], 'pay_app_name' => $pay_app['display_name'], 'out_trade_no' => $bill['out_trade_no'], 'money' => ectools_cur::format($bill['money']), 'timestr' => date('Y-m-d H:i:s', $bill['last_modify']));
     vmc::singleton('b2c_messenger_stage')->trigger('orders-payed', $env_list, array('email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'member_id' => $order_sdf['member_id'], 'mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile']));
     if ($order_sdf['is_cod'] != 'Y') {
         $freeze_data = array();
         foreach ($order_sdf['items'] as $key => $item) {
             //购买计数
             vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
             //组织冻结库存数组
             $freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
         }
         //库存冻结
         if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
             logger::error('库存冻结异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
         }
     }
     return true;
 }
Ejemplo n.º 18
0
 /**
  * @param  string $link
  * @param  Zend_Http_Response $response
  * @param string $host
  * @param string $protocol
  * @param Zend_Http_CookieJar
  * @param integer $depth
  * @return boolean
  */
 protected function parseHtml($link, $response, $host, $protocol, $cookieJar, $depth)
 {
     $html = $response->getBody();
     $canonicalLink = $this->checkForCanonical($html);
     if ($canonicalLink and $canonicalLink != $link) {
         $this->processFoundLink($canonicalLink, $protocol, $host, $link, $depth, $cookieJar);
         logger::debug(get_class($this) . ": Stopping to parse html at [ {$link} ], processing canonical link [ {$canonicalLink} ] instead");
         return true;
     }
     //TODO: robots.txt
     /*
             //legacy ...
             $links = array();
             preg_match_all('/href=[\'"]+?\s*(?P<link>\S+)\s*[\'"]+?/', $html, $links);
     $links = $links['link'];
     */
     Zend_Search_Lucene_Document_Html::setExcludeNoFollowLinks(true);
     $doc = Zend_Search_Lucene_Document_Html::loadHTML($html, false, "utf-8");
     $links = $doc->getLinks();
     $robotsMeta = $this->getRobotsMetaInfo($html);
     if (in_array("nofollow", $robotsMeta)) {
         //no links to follow
         $links = array();
         logger::debug(get_class($this) . ": not following links on [ {$link} ] because it has robots nofollow");
     }
     if (!in_array("noindex", $robotsMeta)) {
         //now limit to search content area if indicators are set and found in this document
         if (!empty($this->searchStartIndicator)) {
             $documentHasDelimiter = strpos($html, $this->searchStartIndicator) !== FALSE;
         }
         if ($documentHasDelimiter and !empty($this->searchStartIndicator) and !empty($this->searchEndIndicator)) {
             //get part before html head starts
             $top = explode("<head>", $html);
             //get html head
             $htmlHead = array();
             preg_match_all('@(<head[^>]*?>.*?</head>)@si', $html, $htmlHead);
             $head = $top[0] . "<head></head>";
             if (is_array($htmlHead[0])) {
                 $head = $top[0] . $htmlHead[0][0];
             }
             //get snippets within allowed content areas
             $htmlSnippets = array();
             $minified = str_replace(array("\r\n", "\r", "\n"), "", $html);
             $minified = preg_replace('@[ \\t\\n\\r\\f]+@', " ", $minified);
             preg_match_all('%' . $this->searchStartIndicator . '(.*?)' . $this->searchEndIndicator . '%si', $minified, $htmlSnippets);
             $html = $head;
             if (is_array($htmlSnippets[0])) {
                 foreach ($htmlSnippets[0] as $snippet) {
                     $html .= " " . $snippet;
                 }
             }
             //close html tag
             $html .= "</html>";
         }
         $this->addHtmlToIndex($html, $link, $this->getLanguageFromResponse($response), $this->getEncodingFromResponse($response), $host);
         logger::info(get_class($this) . ": Added to indexer stack [ {$link} ]");
     } else {
         $this->addNoIndexPage($link);
         logger::debug(get_class($this) . ": not indexing [ {$link} ] because it has robots noindex");
     }
     if (count($links) > 0) {
         foreach ($links as $foundLink) {
             $this->processFoundLink($foundLink, $protocol, $host, $link, $depth, $cookieJar);
         }
     } else {
         logger::debug(get_class($this) . ": No links found on page at [ {$link} ] ");
     }
     //TODO: for now we always return true - as success ... are there any unsuccessful states?
     return true;
 }
Ejemplo n.º 19
0
 public function __set($key, $val)
 {
     switch ($key) {
         case 'blocking':
             $val = $val == true;
             logger::debug('Socket->%s set to %s', $key, $val);
             stream_set_blocking($this->fsh, $val);
             break;
         default:
             throw new BadPropertyException(__CLASS__, $key);
     }
 }
Ejemplo n.º 20
0
 /**
  * Return the authentication backend
  *
  * @return AuthenticationBackend The backend instance
  */
 static function getAuthenticationBackend()
 {
     // Resolve the authentication backend
     $auth_backend = config::get('lepton.user.authbackend', 'default');
     if (strpos(strtolower($auth_backend), 'authbackend') === false) {
         $auth_backend .= 'AuthBackend';
     }
     logger::debug('Creating auth backend instance %s', $auth_backend);
     $auth_class = new $auth_backend();
     return $auth_class;
 }
Ejemplo n.º 21
0
 public function store($key, $value, $ttl = 0, $persistent = true)
 {
     self::$__store_count++;
     if ($persistent && (defined('KV_PERSISTENT') && constant('KV_PERSISTENT')) && self::$__persistent && get_class($this->get_controller()) != 'base_kvstore_mysql' && vmc::is_online()) {
         $this->persistent($key, $value, $ttl);
     }
     logger::debug('kvstore:' . self::$__fetch_count . '.' . ' instance:' . $this->get_prefix() . ' store key:' . $key);
     return $this->get_controller()->store($key, $value, $ttl);
 }
Ejemplo n.º 22
0
 function checkPidFile($pidfile = null)
 {
     if ($pidfile == null) {
         if ($this->_pidfile) {
             $pidfile = $this->_pidfile;
         } else {
             $pidfile = $this->getName() . '.pid';
         }
     }
     logger::debug('Checking pidfile: %s', $pidfile);
     // Check if the process exist
     if (file_exists($pidfile)) {
         $pid = file_get_contents($pidfile);
         $p = new Process($pid);
         logger::debug(' - Inspecting pid %d', $pid);
         if ($p->exists()) {
             // Already running
             return self::PROCESS_RUNNING;
         }
         unlink($pidfile);
         $retval = self::PROCESS_STALE;
     } else {
         $retval = self::PROCESS_CLEAR;
     }
     $tp = new Process();
     file_put_contents($pidfile, $tp->getPid());
     $this->_pidfile = $pidfile;
     return $retval;
 }
Ejemplo n.º 23
0
 /**
  * Call a method on the server. The result is returned decoded as
  * native PHP data.
  *
  * @param string $method The method to call
  * @param any $data The data
  * @return any The result data
  */
 function call($method, $args = null)
 {
     logger::debug("Sending XmlrpcRequest to %s ...", $method);
     $req = xmlrpc_encode_request($method, $args);
     logger::debug('%s', $req);
     $opts = array('method' => 'post', 'parameters' => $req, 'content-type' => 'text/xml');
     if ($this->username) {
         $opts['username'] = $this->username;
         $opts['password'] = $this->password;
     }
     $opts = array_merge($opts, $this->httpopts);
     $ret = new HttpRequest($this->url, $opts);
     logger::debug('Response: %s', $ret->responseText());
     $mtd = null;
     $dec = xmlrpc_decode_request($ret->responseText(), $mtd);
     /*
          if ($dec && arr::hasKey($dec,'faultCode')) {
          	printf("Fault\n");
          }
     */
     return $dec;
     /*
         // Encode the request
         $xml = xmlrpc_encode_request( $method, $args );
     
         // Send it to the server
         $sparams = array('http' => array(
             'method' => 'POST',
             'content' => $xml,
             'header' => array(
                 'content-type' => 'text/xml'
             )
         ));
         $ctx = stream_context_create($params);
         $fp = @fopen($this->url, 'rb', false, $ctx);
         if (!$fp) {
             throw new Exception("Problem with $this->url, $php_errormsg");
         }
         $response = @stream_get_contents($fp);
         if ($response === false) {
             throw new Exception("Problem reading data from $url, $php_errormsg");
         }
     
         // Parse the output
         $ret = xmlrpc_decode_request($response,$mtd);
         return $ret;
     */
 }
Ejemplo n.º 24
0
Archivo: image.php Proyecto: rair/yacs
 /**
  * Open a image and get informations
  * @param string $path to file image
  * @return array with image, width and height, or false
  */
 private static function open($path)
 {
     // get file name
     $file_name = basename($path);
     if (Image::use_magic()) {
         logger::debug('imagick available');
         $image = new Imagick($path);
         $image_information = array($image->getimagewidth(), $image->getimageheight());
     } else {
         logger::debug('imagick NOT available');
         // ensure this is a valid file
         if (!($image_information = Safe::GetImageSize($path))) {
             if ($verbose) {
                 Logger::error(sprintf(i18n::s('No image information in %s.'), $file_name));
             }
             return FALSE;
         }
         // GIF image
         if ($image_information[2] == 1 && is_callable('ImageCreateFromGIF')) {
             $image = ImageCreateFromGIF($path);
         } elseif ($image_information[2] == 2 && is_callable('ImageCreateFromJPEG')) {
             $image = ImageCreateFromJPEG($path);
         } elseif ($image_information[2] == 3 && is_callable('ImageCreateFromPNG')) {
             $image = ImageCreateFromPNG($path);
         }
         // sanity check
         if (!isset($image)) {
             if ($verbose) {
                 Logger::error(sprintf(i18n::s('No GD support, or unknown image type in %s.'), $file_name));
             }
             return FALSE;
         }
     }
     $info = array($image, $image_information);
     return $info;
 }
Ejemplo n.º 25
0
require "./framework/classloader.php";
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);
date_default_timezone_set('Asia/Chongqing');
// 初始化类加载器
$loader = new classloader();
// 日志的使用
// 初始化
logger::init(array());
//参数: ($msg, $moduleName)
logger::info("testing mes", "index.php");
logger::warn("oh no warning", "index.php");
logger::trace("hei hei tracing", "index.php");
logger::debug("just debug", "index");
logger::debug("just debug, 只是debug,不用怕", "index");
// 配置信息
$config = array("dbhost" => "localhost", "dbuser" => "root", "dbpwd" => "", "dbname" => "test", "dbcharset" => "utf-8", "pconnect" => 0);
// 初始化
try {
    database::init($config);
} catch (DbException $dbe) {
    echo 'can not connect to database' . $dbe;
}
// 主要四个方法:
// database::execute($sql)
// database::fetch_all($sql)
// database::fetch_one($sql)
try {
    // 开始事务
    database::begin_tx();
Ejemplo n.º 26
0
Archivo: bill.php Proyecto: noikiy/snk
 /**
  * 创建账单
  * @params array - 账单数据
  * @params string - 支付单生成的记录
  * @return boolean - 创建成功与否
  */
 public function generate(&$sdf, &$msg = '')
 {
     if (!$sdf['bill_id']) {
         try {
             $sdf['bill_id'] = $this->mdl_bills->apply_id($sdf);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             return false;
         }
     }
     if ($sdf['pay_object'] == 'order' && empty($sdf['order_id'])) {
         $msg = '未知订单号';
         return false;
     }
     if (empty($sdf['money']) || $sdf['money'] < 0) {
         $msg = '金额错误';
         return false;
     }
     $sdf['ip'] = base_request::get_remote_addr();
     $sdf['pay_mode'] = $sdf['pay_mode'] ? $sdf['pay_mode'] : (in_array($order_sdf['pay_app_id'], array('-1', 'cod', 'offline')) ? 'offline' : 'online');
     switch ($sdf['pay_mode']) {
         case 'online':
             if ($sdf['bill_type'] == 'payment' && empty($sdf['pay_app_id'])) {
                 $msg = "未知在线付款应用程序";
                 return false;
             }
             break;
         case 'offline':
             $sdf['status'] = 'succ';
             //case 'deposit':
             break;
         default:
             $msg = "暂不支持" . $sdf['pay_mode'];
             return false;
     }
     if (!$this->mdl_bills->save($sdf)) {
         $msg = '单据保存失败';
         return fasle;
     } else {
         switch ($sdf['status']) {
             case 'succ':
             case 'progress':
                 $service_key = implode('.', array("ectools.bill", $sdf['bill_type'], $sdf['pay_object'], $sdf['status']));
                 /*
                  *订单付款成功  ectools.bill.payment.order.succ
                  *订单付款到担保方成功  ectools.bill.payment.order.progress
                  *订单退款成功  ectools.bill.refund.order.succ
                  *订单退款到担保方成功  ectools.bill.refund.order.progress
                  */
                 logger::debug('支付单据保存成功,支付成功!service_key:' . $service_key);
                 foreach (vmc::servicelist($service_key) as $service) {
                     if (!$service->exec($sdf, $msg)) {
                         logger::error('支付成功回调service出错:' . $msg . '|bill_id:' . $sdf['bill_id']);
                         break;
                     }
                 }
                 break;
             default:
                 logger::debug('支付单据保存成功!' . var_export($sdf, 1));
                 break;
         }
     }
     return true;
 }
Ejemplo n.º 27
0
	implementations including Google Contacts which is built into Android.
*/
if ($config["SMStoXMPP"]["contacts_lookup"] == true) {
    $pid_contacts = pcntl_fork();
    if (!$pid_contacts) {
        /*
        	We are the fork!
        	* Validate configuration provided
        	* Establish a connection to the CardDAV backend
        	* Listen on the message queue for incomming contact lookup requests
        	* Pull contact name from CardDAV
        	* Save into cache (just an array) for next time.
        */
        $pid_child = getmypid();
        $log->info("[contacts] Launched CardDAV contacts/address book lookup worker fork");
        $log->debug("[child {$pid_child}] is contacts worker ");
        // verify installed modules
        if (!class_exists('XMLWriter')) {
            $log->error_fatal("PHP XMLWriter module must be installed to enable CardDAV functionality");
        }
        // verify configuration
        if (!$config["SMStoXMPP"]["contacts_url"]) {
            $log->error_fatal("[contacts] No contacts_url provided to query for CardDAV contacts.");
        }
        if (!$config["SMStoXMPP"]["contacts_store"]) {
            $log->error_fatal("[contacts] No contacts_store provided to store downloaded contacts to avoid large re-syncs");
        } else {
            if (!file_exists($config["SMStoXMPP"]["contacts_store"])) {
                // attempt to create the directory, we may just be missing the top level dir and have rights to create
                if (mkdir($config["SMStoXMPP"]["contacts_store"])) {
                    @chmod($config["SMStoXMPP"]["contacts_store"], 0770);
Ejemplo n.º 28
0
 public function dispatch($query)
 {
     $this->check_blacklist();
     //黑名单检测
     $page_starttime = $this->microtime_float();
     /** 影响性能暂时去掉
         	foreach(kernel::servicelist('site.router.predispatch') as $obj)	{
     			$query = $obj->router_predispatch($query);
             **/
     $this->init_query_info($query);
     $this->init_request_info();
     $this->check_https();
     $this->check_expanded_name();
     $router_cache_options = $this->check_router_cache();
     $page_key = 'SITE_PAGE_CACHE:' . $this->_request->get_request_uri();
     logger::debug('page: ' . $this->_request->get_request_uri());
     if (!$this->is_need_cache() || $this->is_need_cache() && !cachemgr::get($page_key, $page, $router_cache_options['skipvary'])) {
         if (WITHOUT_CACHE !== true) {
             logger::info('page cache miss:' . $this->_request->get_request_uri());
         }
         cachemgr::co_start();
         $this->default_dispatch();
         $page['html'] = join("\n", $this->_response->get_bodys());
         $page['date'] = date("Y-m-d H:i:s");
         $page['times'] = sprintf('%0.2f', $this->microtime_float() - $page_starttime);
         if ($this->is_need_cache() && $this->_response->get_http_response_code() == 200 && $this->has_page_cache_control() === true) {
             $page_cache = true;
             $this->_response->set_header('X-Cache', 'HIT from ecos-pagecache ' . $page['date']);
             //todo:记录x-cache
             $page['headers'] = $this->_response->get_headers();
             $page['raw_headers'] = $this->_response->get_raw_headers();
             $page['etag'] = md5($page['html']);
             $cache_options = cachemgr::co_end();
             if ($router_cache_options['expires']) {
                 $cache_options['expires'] = $cache_options['expires'] && $cache_options['expires'] < $router_cache_options['expires'] ? $cache_options['expires'] : $router_cache_options['expires'];
             }
             $cache_options['expires'] = $cache_options['expires'] > time() ? $cache_options['expires'] : 0;
             //$cache_options['skip_vary'] = $cache_expires;
             cachemgr::set($page_key, $page, $cache_options);
         } else {
             $page_cache = false;
             cachemgr::co_end();
         }
     } else {
         $page_cache = true;
         $this->_response->clean_headers();
         if (isset($page['headers'])) {
             foreach ($page['headers'] as $header) {
                 $this->_response->set_header($header['name'], $header['value'], $header['replace']);
             }
         }
         if (isset($page['raw_headers'])) {
             foreach ($page['raw_headers'] as $raw_header) {
                 $this->_response->set_raw_headers($raw_header);
             }
         }
         if (WITHOUT_CACHE !== true) {
             logger::info('page cache hit:' . $this->_request->get_request_uri());
         }
     }
     if ($page_cache === true) {
         $etag = $page['etag'] ? $page['etag'] : md5($page['html']);
         //todo: 兼容
         $this->_response->set_header('Etag', $etag);
         $matchs = explode(',', $_ENV['HTTP_IF_NONE_MATCH']);
         foreach ($matchs as $match) {
             if (trim($match) == $etag) {
                 $this->_response->clean_headers();
                 $this->_response->set_header('Content-length', '0');
                 $this->_response->set_http_response_code(304)->send_headers();
                 exit;
             }
         }
     }
     $this->set_vary_cookie();
     $this->_response->send_headers();
     echo $page['html'];
     logger::debug('This page created by ' . $page['date']);
     logger::debug('Mysql queries count:' . base_db_connections::$mysql_query_executions);
     logger::debug('Kvstore queries count:' . base_kvstore::$__fetch_count);
     logger::debug('Page Times: ' . $page['times']);
 }
Ejemplo n.º 29
0
 function getRandom($bytes)
 {
     logger::debug(__CLASS__ . ': Asking urandom for %d bytes', $bytes);
     $rd = fread($this->fh, $bytes);
     return $rd;
 }
Ejemplo n.º 30
0
Archivo: mysql.php Proyecto: noikiy/snk
 public function rollBack()
 {
     if (!isset($this->_rw_lnk)) {
         $this->_rw_lnk = $this->_rw_conn();
     }
     if ($this->_rw_lnk->inTransaction() && $this->_rw_lnk->rollBack()) {
         $this->_in_transaction = false;
         logger::debug('rollBack...');
         return true;
     }
     return false;
 }