protected function after_output() { # flush once, because we're nice if (ob_get_length()) { ob_flush(); } }
public function action_messages($route_id, &$data, $args) { $uimessages = $_MIDCOM->serviceloader->load('uimessages'); if (!$uimessages->supports('comet') || !$uimessages->can_view()) { return; } $type = null; $name = null; if (isset($_MIDCOM->dispatcher->get["cometType"])) { $type = $_MIDCOM->dispatcher->get["cometType"]; } if (isset($_MIDCOM->dispatcher->get["cometName"])) { $name = $_MIDCOM->dispatcher->get["cometName"]; } if ($type == null && $name == null) { throw new midcom_exception_notfound("No comet name or type defined"); } if (ob_get_level() == 0) { ob_start(); } while (true) { $messages = ''; if ($uimessages->has_messages()) { $messages = $uimessages->render_as('comet'); } else { $uimessages->add(array('title' => 'Otsikko from comet', 'message' => 'viesti from comet...')); } midcom_core_helpers_comet::pushdata($messages, $type, $name); ob_flush(); flush(); sleep(5); } // $data['messages'] = $messages; }
function add_sites($array) { global $db, $spider; foreach ($array as $value) { $row = $db->get_one("select * from ve123_links where url='" . $value . "'"); if (empty($row)) { echo $value . "<br>"; $spider->url($value); $title = $spider->title; $fulltxt = $spider->fulltxt(800); $keywords = $spider->keywords; $description = $spider->description; $pagesize = $spider->pagesize; $htmlcode = $spider->htmlcode; $array = array('url' => $value, 'title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'addtime' => time(), 'updatetime' => time()); //echo $fulltxt; $db->insert("ve123_links", $array); file_put_contents(PATH . "k/www/" . base64_encode($value), $htmlcode); //echo $htmlcode; } else { echo "已存在:" . $value . "<br>"; } ob_flush(); flush(); sleep(1); } }
/** * Redirige a una url * @param mixed $url Url o arreglo que especifica prefijo, controlador y accion */ public static function redirect($url = null) { ob_start(); header('Location:' . \Supernova\Route::generateUrl($url)); ob_flush(); die; }
function buffer_flush() { echo '<!-- -->'; // ? ob_flush(); flush(); }
/** * post Note Action * * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ function postNote($httpData) { require_once "classes/model/AppNotes.php"; //extract(getExtJSParams()); if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; } else { $appUid = $_SESSION['APPLICATION']; } if (!isset($appUid)) { throw new Exception('Can\'t resolve the Apllication ID for this request.'); } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $noteContent = addslashes($httpData->noteText); //Disabling the controller response because we handle a special behavior $this->setSendResponse(false); //Add note case $appNote = new AppNotes(); $response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail)); //Send the response to client @ini_set("implicit_flush", 1); ob_start(); echo G::json_encode($response); @ob_flush(); @flush(); @ob_end_flush(); ob_implicit_flush(1); }
function flushPause($pause = 0) { echo ob_get_clean(); @ob_flush(); flush(); usleep($pause * 1000000); }
function index_f() { $id = $this->trans_lib->int("id"); if (!$id) { error($this->lang["download_error"], $this->url()); } $rs = $this->upfile_m->get_one($id); //执行下载操作 if (!file_exists(ROOT . $rs["filename"]) || !$rs["filename"] || !is_file(ROOT . $rs["filename"])) { error($this->lang["download_empty"], $this->url()); } $filesize = filesize(ROOT . $rs["filename"]); if (!$rs["title"]) { $rs["title"] = $rs["filename"]; } $tmpname = str_replace("." . $rs["ftype"], "", $rs["title"]); $tmpname = $tmpname . "." . $rs["ftype"]; ob_end_clean(); header("Date: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT"); header("Content-Encoding: none"); header("Content-Disposition: attachment; filename=" . rawurlencode($tmpname)); header("Content-Length: " . $filesize); header("Accept-Ranges: bytes"); readfile($rs["filename"]); flush(); ob_flush(); }
public function show_captcha() { if (session_id() == "") { session_name("CAKEPHP"); session_start(); } $vendor_path = App::path('Vendor'); $path = $vendor_path[0] . 'captcha'; $imgname = 'bg.jpg'; $imgpath = $path . DS . 'images' . DS . $imgname; $captchatext = md5(time()); $captchatext = substr($captchatext, 0, 5); $_SESSION['captcha'] = $captchatext; if (file_exists($imgpath)) { $im = imagecreatefromjpeg($imgpath); $grey = imagecolorallocate($im, rand(1, 128), 128, 128); $font = $path . DS . 'fonts' . DS . '3D_Noise.ttf'; imagettftext($im, 36, 0, 0, 55, $grey, $font, $captchatext); header('Content-Type: image/jpeg'); header("Cache-control: private, no-cache"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Pragma: no-cache"); imagejpeg($im); imagedestroy($im); ob_flush(); flush(); } else { echo 'captcha error'; exit; } }
function download_f() { $file = $this->get("file"); $id = $this->get("id"); if (!$id && !$file) { error(P_Lang('未指定ID'), "", "error"); } if ($id) { $rs = $this->model('res')->get_one($id); $file = $rs["filename"]; $title = $rs["title"] . "." . $rs["ext"]; } else { $title = basename($file); } if (!$file) { error(P_Lang('未指定附件'), "", "error"); } if (substr($file, 0, 7) != "http://" && substr($file, 0, 8) != "https://") { $file = $this->dir_root . $file; } if (!file_exists($file)) { error(P_Lang('附件不存在'), "", "error"); } $filesize = filesize($file); ob_end_clean(); header("Date: " . gmdate("D, d M Y H:i:s", $this->system_time) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $this->system_time) . " GMT"); header("Content-Encoding: none"); header("Content-Disposition: attachment; filename=" . rawurlencode($title)); header("Content-Length: " . $filesize); header("Accept-Ranges: bytes"); readfile($file); flush(); ob_flush(); }
public function flush(\JsonSerializable $object) { echo json_encode($object) . "\n"; flush(); ob_flush(); usleep(333); }
/** * Inlude a view path **/ function backview($view, $variables = array()) { extract($variables); ob_flush(); include_once views('backend/' . $view); ob_clean(); }
function display() { $focus = new Insurances(); $ss = new Sugar_Smarty(); $db = DBManagerFactory::getInstance(); // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN; // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : ''; $template = file_get_contents('modules/Insurances/tpls/export.tpl'); $name = ""; $start = ""; $end = ""; $canhan = ""; $giadinh = ""; $canhan = $focus->get_data_insurances_canhan($record, $name, $start, $end); $giadinh = $focus->get_data_insurances_giadinh($record, $name, $start, $end); $template = str_replace("{CANHAN}", $canhan, $template); $template = str_replace("{GIADINH}", $giadinh, $template); $template = str_replace("{TITLE}", $name, $template); $template = str_replace("{NGAYBATDAU}", $start, $template); $template = str_replace("{NGAYKETTHUC}", $end, $template); $size = strlen($template); $filename = strtoupper($name) . ".doc"; ob_end_clean(); header("Cache-Control: private"); header("Content-Type: application/force-download;"); header("Content-Disposition:attachment; filename=\"{$filename}\""); header("Content-length:{$size}"); echo $template; ob_flush(); }
function do_it($image, $ImgWaterPath, $ImgWaterPos, $ImageWaterAlpha, $i) { echo "正在处理第" . $i . "张图片:" . $image . "<br/>"; flush(); ob_flush(); Image::water($image, $ImgWaterPath, $ImgWaterPos, '', $ImageWaterAlpha); }
public function download($file, $name = '', $size = 0, $reload = false) { if ($name == '') { $name = basename($file); } $fp = fopen($file, 'rb'); if (!$size) { $size = filesize($file); } $ranges = $this->getRange($size); if ($reload && $ranges != null) { header('HTTP/1.1 206 Partial Content'); header('Accept-Ranges:bytes'); header(sprintf('content-length:%u', $ranges['end'] - $ranges['start'])); header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $size)); fseek($fp, sprintf('%u', $ranges['start'])); } else { header('HTTP/1.1 200 OK'); header('content-length:' . $size); } while (!feof($fp)) { echo fread($fp, round($this->_speed * 1024, 0)); ob_flush(); flush(); //sleep(1); } $fp != null && fclose($fp); }
function status($message) { echo $message; @ob_flush(); flush(); @ob_end_flush(); }
private static function Status($Message) { echo $Message; @ob_flush(); flush(); @ob_end_flush(); }
function rmdirr($dirname) { ob_start(); if (!is_dir($dirname)) { return false; } $dscan = array(realpath($dirname)); $darr = array(); while (!empty($dscan)) { $dcur = array_pop($dscan); $darr[] = $dcur; if ($d = opendir($dcur)) { while ($f = readdir($d)) { if ($f == '.' || $f == '..') { continue; } $f = $dcur . '/' . $f; if (is_dir($f)) { $dscan[] = $f; } else { unlink($f); } } closedir($d); } } for ($i = count($darr) - 1; $i >= 0; $i--) { @rmdir($darr[$i]); } ob_flush(); return !is_dir($dirname); }
function ddd() { // Convert the non-string arguments into lovely code blocks. $args = func_get_args(); foreach ($args as $index => $arg) { $export = false; $export |= is_bool($arg); $export |= is_array($arg); $export |= is_object($arg); if ($export) { $args[$index] = sprintf('%s', var_dump($arg, true)); } } $text = $args[0]; if (strpos($text, '%') !== false) { // Put all of the arguments into one string. $text = @call_user_func_array('sprintf', $args); if ($text == '') { $text = $args[0]; } } else { $text = implode("<br/>\n", $args); } // Date class: string $text = sprintf('<pre>%s %s%s</pre>', date('H:i:s'), $text, "\n"); echo $text; ob_flush(); }
public function queueOp() { if (ob_get_level()) { ob_end_clean(); } $model_queue = Model('queue', BASE_PATH); $worker = new Uk86QueueServer(); while (true) { $list_key = $worker->scan(); if (!empty($list_key) && is_array($list_key)) { foreach ($list_key as $key) { $content = $worker->pop($key); if (empty($content)) { continue; } $method = key($content); $arg = current($content); $model_queue->{$method}($arg); echo date('Y-m-d H:i:s', time()) . ' ' . $method . "\n"; // $content['time'] = date('Y-m-d H:i:s',time()); // print_R($content); // echo "\n"; flush(); ob_flush(); } } sleep(1); } }
public function __construct() { parent::__construct(); $this->pluginname = _('Advanced Setup Odroid U3'); if ($_GET['ajax'] == 1 && $_GET['action'] == 'upgradeSystem') { //Function to get Progress of Installation $this->_upgradeSystem(true); ob_end_clean(); echo implode('<br />', $this->view->message); ob_flush(); die; } if (isset($_GET['action'])) { if ($_GET['action'] == 'disableLEDBlink') { $this->_setLEDBlink(); } if ($_GET['action'] == 'configurePowerButton') { $this->_configurePowerButton(); } if ($_GET['action'] == 'upgradeSystem') { $this->_upgradeSystem(); } if ($_GET['action'] == 'checkUpgrade') { $this->_checkUpgrade(); } if ($_GET['action'] == 'installFlash') { $this->_installFlash(); } if ($_GET['action'] == 'installFan') { $this->_installFanXU4(); } } $this->_getPowerButton(); $this->_getDebug(); }
function readfile_chunked($filename, $retbytes = true) { $chunksize = 1 * (1024 * 1024); // how many bytes per chunk $buffer = ''; $cnt = 0; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; ob_flush(); flush(); if ($retbytes) { $cnt += strlen($buffer); } } $status = fclose($handle); if ($retbytes && $status) { return $cnt; // return num. bytes delivered like readfile() does. } return $status; }
private function t2($content) { // deal with this later w/ upload, why else have a progress bar? echo $content; // flush(); ob_flush(); }
/** * Gets header template * @return {string} */ function get_header_tmpl() { ob_start(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta content="width=device-width" name="viewport"> <link rel="stylesheet" href="/app.css"> <meta name="application-name" content="<%= name %>"/> <title><%= name %></title> </head> <!--[if IE]> <body class="no-script is-ie"> <![endif]--> <!--[if !IE]> --> <body class="no-script"> <!-- <![endif]--> <div id="body-wrapper"> <div id="outdated"> <h6>Your browser is out-of-date!</h6> <p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update my browser now </a></p> <p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">×</a></p> </div> <?php $output = ob_get_clean(); ob_flush(); return $output; }
function send($newsletter_id) { global $db; $audience_select = get_audience_sql_query($this->query_name, 'newsletters'); $audience = $db->Execute($audience_select['query_string']); $records = $audience->RecordCount(); if ($records == 0) { return 0; } $i = 0; while (!$audience->EOF) { $i++; $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $audience->fields['customers_lastname']; $html_msg['EMAIL_GREET'] = EMAIL_GREET; $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html; zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters'); echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']); //force output to the screen to show status indicator each time a message is sent... if (function_exists('ob_flush')) { @ob_flush(); } @flush(); $audience->MoveNext(); } $newsletter_id = zen_db_prepare_input($newsletter_id); $db->Execute("update " . TABLE_NEWSLETTERS . "\r\n set date_sent = now(), status = '1'\r\n where newsletters_id = '" . zen_db_input($newsletter_id) . "'"); return $records; //return number of records processed whether successful or not }
function flush_buffers() { ob_end_flush(); ob_flush(); flush(); ob_start(); }
/** * Registered callback function for the WordPress Importer * * Manages the three separate stages of the CSV import process */ function dispatch() { $this->header(); if (!empty($_POST['delimiter'])) { $this->delimiter = stripslashes(trim($_POST['delimiter'])); } if (!$this->delimiter) { $this->delimiter = ','; } $step = empty($_GET['step']) ? 0 : (int) $_GET['step']; switch ($step) { case 0: $this->greet(); break; case 1: check_admin_referer('import-upload'); if ($this->handle_upload()) { if ($this->id) { $file = get_attached_file($this->id); } else { $file = ABSPATH . $this->file_url; } add_filter('http_request_timeout', array($this, 'bump_request_timeout')); if (function_exists('gc_enable')) { gc_enable(); } @set_time_limit(0); @ob_flush(); @flush(); $this->import($file); } break; } $this->footer(); }
function info($message) { echo $message; flush(); ob_flush(); ob_implicit_flush(); }
/** * 全量创建索引 */ public function xs_createOp() { if (!C('fullindexer.open')) { return; } $this->_ini_xs(); try { //每次批量更新商品数 $step_num = 200; $model_goods = Model('goods'); $count = $model_goods->getGoodsOnlineCount(array(), "distinct CONCAT(goods_commonid,',',color_id)"); echo 'Total:' . $count . "\n"; $fields = "*,CONCAT(goods_commonid,',',color_id) as nc_distinct"; for ($i = 0; $i <= $count; $i = $i + $step_num) { $goods_list = $model_goods->getGoodsOnlineList(array(), $fields, 0, '', "{$i},{$step_num}", 'nc_distinct'); $this->_build_goods($goods_list); echo $i . " ok\n"; flush(); ob_flush(); } if ($count > 0) { sleep(2); $this->_index->flushIndex(); sleep(2); $this->_index->flushLogging(); } } catch (XSException $e) { $this->log($e->getMessage()); } }
public function mongoShardAction() { $mongo = $this->mongo->load('Foo_Foo'); // test create echo "<b>TEST CREATE :</b>"; $result = $mongo->create(array('foo' => 1, 'val' => 1, '_time' => time())); Hush_Util::dump($result); usleep(10000); $result = $mongo->read(array('foo' => 1)); Hush_Util::dump(iterator_to_array($result)); usleep(10000); // test update echo "<b>TEST UPDATE :</b>"; $result = $mongo->update(array('foo' => 1), array('foo' => 1, 'val' => 2, '_time' => time())); Hush_Util::dump($result); usleep(10000); $result = $mongo->read(array('foo' => 1)); Hush_Util::dump(iterator_to_array($result)); usleep(10000); // test delete echo "<b>TEST DELETE :</b>"; $result = $mongo->delete(array('foo' => 1)); Hush_Util::dump($result); usleep(10000); $result = $mongo->read(array('foo' => 1)); Hush_Util::dump(iterator_to_array($result)); ob_flush(); flush(); }