Beispiel #1
0
    /**
     * Paint the result of a send operation
     * @param string The email address that was tried
     * @param boolean True if the message was successfully sent
     */
    public function paintResult($address, $result)
    {
        $this->count++;
        $color = $result ? "#51c45f" : "#d67d71";
        $result_text = $result ? "PASS" : "FAIL";
        ?>
<div style="color: #ffffff; margin: 2px; padding: 3px; 
      font-weight: bold; background: <?php 
        echo $color;
        ?>
;">
	<span style="float: right; text-decoration: underline;"> <?php 
        echo $result_text;
        ?>
	</span> Recipient (
	<?php 
        echo $this->count;
        ?>
	):
	<?php 
        echo $address;
        ?>
</div>
	<?php 
        flush();
    }
Beispiel #2
0
function allTests($communicator)
{
    global $NS;

    echo "testing type names... ";
    flush();
    $a = $NS ? constant("_and\\_array::_as") : constant("and_array::_as");
    $b = $NS ? eval("return new _and\\_xor();") : eval("return new and_xor();");
    test($b->_abstract == 0);
    test($b->_clone == 0);
    test($b->_private == 0);
    test($b->_protected == 0);
    test($b->_public == 0);
    test($b->_this == 0);
    test($b->_throw == 0);
    test($b->_use == 0);
    test($b->_var == 0);
    $p = $communicator->stringToProxy("test:tcp -p 10000");
    $c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") :
               eval("return and_functionPrxHelper::uncheckedCast(\$p);");
    $d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") :
               eval("return and_diePrxHelper::uncheckedCast(\$p);");
    $e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") :
               eval("return and_echoPrxHelper::uncheckedCast(\$p);");
    $e1 = new echoI();
    $f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") :
               eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);");
    $f1 = new enddeclareI();
    $g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();");
    $h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();");
    $i = $NS ? constant("_and\\_or") : constant("and_or");
    $j = $NS ? constant("_and\\_print") : constant("and_print");
    $j = $NS ? constant("_and\\_require_once") : constant("and_require_once");
    echo "ok\n";
}
 public function finishTurn()
 {
     echo "go\n";
     $this->debug("Remaining Time: " . $this->timeRemaining() . "\n");
     $this->debug("-------TURN-------\n");
     flush();
 }
Beispiel #4
0
function updateInfo($percent, $infoText, $debug = true) {
    global $command_line;

    if ($debug) {
        Debug::message($infoText, Debug::WARNING);
    }
    $percentageText = ($percent == 1)? '100': sprintf('%2.0f', $percent * 100);
    if (isset($command_line) and $command_line) {
        if ($percent < 0) {
            $percentageText = ' * ';
        } else {
            $percentageText .= '%';
        }
        echo $percentageText, ' ', $infoText, "\n";
    } else {
        echo '<script>';
        if ($percent >= 0) {
            echo 'document.getElementById("progress-bar").style="width:' . ($percent * 100) . '%;";', "\n",
                 'document.getElementById("progress-bar").innerHTML ="' . $percentageText . '%";', "\n";
        }
        if ($percent == 1) {
            echo 'document.getElementById("progress-bar").className = "progress-bar progress-bar-striped";';
        }
        echo 'document.getElementById("progressbar-info").innerHTML="' . addslashes($infoText) . '";</script>';
    }

    // This is for the buffer achieve the minimum size in order to flush data
    //    echo str_repeat(' ', 1024 * 64);

    // Send output to browser immediately
    flush();
}
Beispiel #5
0
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);
    }
}
Beispiel #6
0
function testdb(&$db, $createtab = "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
{
    global $ADODB_version, $ADODB_FETCH_MODE;
    adodb_backtrace();
    $max = 100;
    $sql = 'select * from ADOXYZ';
    $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
    //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i> &nbsp; Database: <i>$db->database</i></h3>";
    // perform query once to cache results so we are only testing throughput
    $rs = $db->Execute($sql);
    if (!$rs) {
        print "Error in recordset<p>";
        return;
    }
    $arr = $rs->GetArray();
    //$db->debug = true;
    global $ADODB_COUNTRECS;
    $ADODB_COUNTRECS = false;
    $start = microtime();
    for ($i = 0; $i < $max; $i++) {
        $rs =& $db->Execute($sql);
        $arr =& $rs->GetArray();
        //		 print $arr[0][1];
    }
    $end = microtime();
    $start = explode(' ', $start);
    $end = explode(' ', $end);
    //print_r($start);
    //print_r($end);
    //  print_r($arr);
    $total = $end[0] + trim($end[1]) - $start[0] - trim($start[1]);
    printf("<p>seconds = %8.2f for %d iterations each with %d records</p>", $total, $max, sizeof($arr));
    flush();
    //$db->Close();
}
function debug($texto)
{
    file_put_contents(TEMPLATEPATH . '/log.log', date('d/m/Y H:i:s') . ' - ' . $texto . "\n", FILE_APPEND);
    //echo date('d/m/Y H:i:s').' - '.$texto."<br>";
    flush();
    return;
}
Beispiel #8
0
 /**
  * @param ContextInterface $context
  * @param StepExecutor     $executor
  *
  * @return \Closure
  */
 protected function exportCallback(ContextInterface $context, StepExecutor $executor)
 {
     return function () use($executor) {
         flush();
         $executor->execute();
     };
 }
Beispiel #9
0
 function importFromRedshop()
 {
     @ob_clean();
     echo $this->getHtmlPage();
     $this->token = hikashop_getFormToken();
     flush();
     if (isset($_GET['import']) && $_GET['import'] == '1') {
         $time = microtime(true);
         $processed = $this->doImport();
         if ($processed) {
             $elasped = microtime(true) - $time;
             if (!$this->refreshPage) {
                 echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=redshop&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>';
             }
             echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>';
         } else {
             echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>';
         }
     } else {
         echo $this->getStartPage();
     }
     if ($this->refreshPage) {
         echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>";
     }
     echo '</body></html>';
     exit;
 }
Beispiel #10
0
function flushPause($pause = 0)
{
    echo ob_get_clean();
    @ob_flush();
    flush();
    usleep($pause * 1000000);
}
Beispiel #11
0
 /**
  * function sMain ()
  * Khoi tao 
  **/
 function sMain()
 {
     global $ttH;
     $ttH->func->load_language($this->modules);
     $fun = isset($ttH->post['f']) ? $ttH->post['f'] : '';
     flush();
     switch ($fun) {
         case "load_country_op":
             echo $this->do_load_country_op();
             exit;
             break;
         case "load_province_op":
             echo $this->do_load_province_op();
             exit;
             break;
         case "load_district_op":
             echo $this->do_load_district_op();
             exit;
             break;
         case "load_ward_op":
             echo $this->do_load_ward_op();
             exit;
             break;
         default:
             echo '';
             exit;
             break;
     }
     exit;
 }
function GAL_getImageInfo($folder, $file)
{
    $thumbFolder = $folder . $GLOBALS['GAL_thumbnail_folder'];
    $fileName = $file . '.meta';
    $ret = array();
    $ret['dateLastModified'] = -1;
    clearstatcache();
    if (!file_exists($thumbFolder . $fileName)) {
        $dateLastModified = @filemtime($folder . $file);
        $f = @fopen($thumbFolder . $fileName, 'wb');
        if (is_resource($f)) {
            fwrite($f, $dateLastModified);
            fclose($f);
        }
        $ret['dateLastModified'] = $dateLastModified;
    } else {
        $f = @fopen($thumbFolder . $fileName, 'rb');
        if (is_resource($f)) {
            $dateLastModified = trim(@fread($f, filesize($thumbFolder . $fileName)));
            fclose($f);
        }
        $ret['dateLastModified'] = $dateLastModified;
    }
    flush();
    return $ret;
}
Beispiel #13
0
function CreateConfigFile()
{
    global $dbUser, $dbPass, $dbHost, $dbName, $user, $md5pass;
    $config = <<<DATA
<?php

define('MYSQL_HOST', '{$dbHost}');
define('MYSQL_LOGIN', '{$dbUser}');
define('MYSQL_PASSWORD', '{$dbPass}');
define('MYSQL_DB', '{$dbName}');

define('USER', '{$user}');
define('PASS', '{$md5pass}');

//define('DEBUG', true);
//define('MYSQL_DEBUG', true);
//define('TIME_DEBUG', true);

DATA;
    $fh = @fopen('config.php', 'wb');
    if (false === $fh) {
        echo "Can't create config.php. Create it manually with next content:\n<hr><pre>";
        echo htmlspecialchars($config);
        flush();
        exit;
    }
    fwrite($fh, $config);
}
Beispiel #14
0
 /**
  * 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 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
 }
Beispiel #16
0
 public function download($filename = null)
 {
     if (empty($filename)) {
         $this->redirect();
     }
     $local_file = './assets/materi/' . base64_decode($filename);
     $download_file = base64_decode($filename);
     // set the download rate limit (=> 20,5 kb/s)
     $download_rate = 20.5;
     if (file_exists($local_file) || is_file($local_file)) {
         // ambil satu data berdasarkan nama file
         $data = $this->model->m_materi()->ambilSatu(array('file' => $download_file));
         // counting tiap download
         $this->model->m_materi()->countDownload($data->materi_id);
         header('Cache-control: private');
         header('Content-Type: application/octet-stream');
         header('Content-Length: ' . filesize($local_file));
         header('Content-Disposition: filename=' . $download_file);
         flush();
         $file = fopen($local_file, "r");
         while (!feof($file)) {
             // send the current file part to the browser
             print fread($file, round($download_rate * 1024));
             // flush the content to the browser
             flush();
             // sleep one second
             sleep(1);
         }
         fclose($file);
     } else {
         die('Error: The file ' . $local_file . ' does not exist!');
     }
     // $this->redirect($this->uri->baseUri.'assets/materi/'.base64_decode($filename));
 }
Beispiel #17
0
 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;
 }
 /**
  * send the PDF to the browser.
  * @return boolean    true if it's ok
  */
 public function output()
 {
     if (!$this->html2pdf instanceof jHtml2Pdf) {
         throw new jException('jtcpdf~errors.reptcpdf.not_a_jtcpdf');
     }
     $pdf_data = $this->html2pdf->Output('', 'S');
     // headers to disable cache
     $this->addHttpHeader('Cache-Control', 'public, must-revalidate, max-age=0', false);
     // HTTP/1.1
     $this->addHttpHeader('Pragma', 'public', false);
     $this->addHttpHeader('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT', false);
     // Date in the past
     $this->addHttpHeader('Last-Modified', gmdate("D, d M Y H:i:s") . " GMT", false);
     $this->addHttpHeader('Content-Length', strlen($pdf_data));
     if ($this->doDownload) {
         $this->addHttpHeader("Content-Type", "application/force-download");
         $this->addHttpHeader("Content-Type", "application/octet-stream", -1);
         $this->addHttpHeader("Content-Transfer-Encoding", "binary");
         $this->addHttpHeader('Content-Disposition', 'attachment; filename="' . str_replace('"', '\\"', $this->outputFileName) . '";');
     } else {
         $this->addHttpHeader('Content-Type', 'application/pdf');
         $this->addHttpHeader('Content-Disposition', 'inline; filename="' . str_replace('"', '\\"', $this->outputFileName) . '";');
     }
     $this->sendHttpHeaders();
     echo $pdf_data;
     flush();
     return true;
 }
 /**
  * send the content or the file to the browser.
  * @return boolean    true it it's ok
  */
 public function output()
 {
     if ($this->doDownload) {
         $this->mimeType = 'application/forcedownload';
         if (!strlen($this->outputFileName)) {
             $f = explode('/', str_replace('\\', '/', $this->fileName));
             $this->outputFileName = $f[count($f) - 1];
         }
     }
     if ($this->hasErrors()) {
         return false;
     }
     $this->addHttpHeader("Content-Type", $this->mimeType, $this->doDownload);
     if ($this->doDownload) {
         $this->_downloadHeader();
     }
     if ($this->content === null) {
         if (is_readable($this->fileName) && is_file($this->fileName)) {
             $this->_httpHeaders['Content-Length'] = filesize($this->fileName);
             $this->sendHttpHeaders();
             readfile($this->fileName);
             flush();
             return true;
         } else {
             throw new jException('jelix~errors.repbin.unknow.file', $this->fileName);
             return false;
         }
     } else {
         $this->_httpHeaders['Content-Length'] = strlen($this->content);
         $this->sendHttpHeaders();
         echo $this->content;
         flush();
         return true;
     }
 }
Beispiel #20
0
function getMessage($currentTime, $currentLineCount)
{
    $filename = 'log.txt';
    $fileTime = filemtime($filename);
    $counter = 0;
    $contents = '';
    $lineCount = 0;
    $text = '';
    if ($fileTime != $currentTime) {
        $contents = file_get_contents($filename);
    }
    if ($contents != '') {
        $lines = explode("\n", trim($contents));
        $lineCount = count($lines);
        for ($index = $currentLineCount; $index < $lineCount; $index++) {
            $text = $text . $lines[$index] . "\n";
        }
    }
    $response = array();
    $response['text'] = $text;
    $response['fileTime'] = $fileTime;
    $response['lineCount'] = $lineCount;
    echo json_encode($response);
    flush();
}
Beispiel #21
0
	function __construct(){
		$this->cache_token = obcer::cache_token((COUCH?'db':NULL));
		$this->start_time = (float) array_sum(explode(' ',microtime()));
		$this->oh_memory = round(memory_get_usage() / 1024);
		// set up the 'filter' variable to determine what columns to show
		if(SHOW_ALL == FALSE){
			if(SHOW_LANGUAGE == false  ) $this->c_filter []='language';
			if(SHOW_SUPPRESS == false) $this->c_filter []='suppress';
			if(SHOW_RXCUI == false) $this->c_filter []='rxcui';
			if(SHOW_NAME == false) $this->c_filter []='name';
			if(SHOW_ALL_SYNONYM == FALSE) $this->c_filter []= 'synonym';
			if(SHOW_TTY == false) $this->c_filter []='tty';
			if(SHOW_UML == false) $this->c_filter []= 'umlscui';
		}
		// of course I could make a checkbox panel to allow for any combination of display fields, and cache entire returned xml results to do manipulations
		if(PROGRESSIVE_LOAD){
   	 	    @apache_setenv('no-gzip', 1);
			@ini_set('zlib.output_compression', 0);
			@ini_set('implicit_flush', 1);
			for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
			flush();
			ob_implicit_flush(1);
			ob_start();
		}
		// process any post if existant
		if($_POST) self::post_check();

		// if we haven't died by now then close and flush the ob cache for the final time

		// echo the footer and stats to screen.
		echo '<div id="stats">' . $this->stats().'</div>';

	}
Beispiel #22
0
function buffer_flush()
{
    echo '<!-- -->';
    // ?
    ob_flush();
    flush();
}
 /**
  * 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();
 }
 public function send_to_browser($destination_file_name, $redirect_to_referer = TRUE)
 {
     if (headers_sent()) {
         error_log("Headers already sent.  Download of {$this->full_path} failed.");
         die('Headers already sent');
     }
     // Required for some browsers
     if (ini_get('zlib.output_compression')) {
         ini_set('zlib.output_compression', 'Off');
     }
     // File Exists?
     if (is_dir($this->full_path) || !file_exists($this->full_path)) {
         return FALSE;
         # To stop hitting the 'exit' command at the bottom of this function.
     }
     if (ob_get_contents()) {
         # Make sure no junk is included in the file
         ob_end_clean();
     }
     header("Content-type: {$this->mime_type}");
     header('Content-Disposition: attachment; filename="' . $destination_file_name . '"');
     header('Cache-Control: no-store, no-cache');
     if (ob_get_contents()) {
         # Make __absolutely__ :) sure no junk is included in the file
         ob_end_flush();
         flush();
     }
     readfile($this->full_path);
     die;
 }
Beispiel #25
0
 /**
  * 全量创建索引
  */
 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());
     }
 }
Beispiel #26
0
function checkETag($withDB = true, $keyPrefix = "", $cacheValidity = 0)
{
    $key = $keyPrefix . '$Revision$' . $_SERVER["REQUEST_URI"];
    if ($withDB) {
        list($dt) = rss_fetch_row(rss_query('select timestamp from ' . getTable('cache') . " where cachekey='data_ts'"));
        $key .= $dt;
    }
    if (array_key_exists(RSS_USER_COOKIE, $_REQUEST)) {
        $key .= $_REQUEST[RSS_USER_COOKIE];
    }
    $key = md5($key);
    if (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && $_SERVER['HTTP_IF_NONE_MATCH'] == $key) {
        header("HTTP/1.1 304 Not Modified");
        header("X-RSS-CACHE-STATUS: HIT");
        header("ETag: {$key}");
        flush();
        exit;
    } else {
        header("ETag: {$key}");
        header("X-RSS-CACHE-STATUS: MISS");
        if ($cacheValidity) {
            header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cacheValidity * 3600) . 'GMT');
        }
    }
}
Beispiel #27
0
 public function dwld()
 {
     $this->min();
     if (is_numeric($this->getParam("id"))) {
         $this->download->newDownload();
         if ($this->download->getIsLocal()) {
             $url = OWEB_DIR_DATA . "/downloads/" . $this->download->getUrl();
             header('Content-Description: File Transfer');
             header('Content-Type: application/octet-stream');
             header('Content-Disposition: attachment; filename="' . basename($url) . '";');
             readfile($url);
         } else {
             $url = OWEB_DIR_DATA . "/downloads/" . $this->download->getUrl();
             header("Content-Disposition: attachment; filename=" . basename($url));
             header("Content-Type: application/force-download");
             header("Content-Type: application/octet-stream");
             header("Content-Type: application/download");
             header("Content-Description: File Transfer");
             header("Content-Length: " . filesize($url));
             flush();
             // this doesn't really matter.
             $fp = fopen($url, "r");
             while (!feof($fp)) {
                 echo fread($fp, 65536);
                 flush();
                 // this is essential for large downloads
             }
             fclose($fp);
         }
     } else {
         throw new \Model\downloads\exception\DownloadCantBeFind("No Download ID given");
     }
 }
Beispiel #28
0
 public function export()
 {
     // @rule: Test for user access if on 1.6 and above
     if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('easyblog.manage.setting', 'com_easyblog')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     $db = JFactory::getDBO();
     $query = 'SELECT `params` FROM ' . $db->quoteName('#__easyblog_configs') . ' WHERE `name` = ' . $db->Quote('config');
     $db->setQuery($query);
     $data = $db->loadResult();
     // Get the file size
     $size = strlen($data);
     header('Content-Description: File Transfer');
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: attachment; filename=settings.json');
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Content-Length: ' . $size);
     ob_clean();
     flush();
     echo $data;
     exit;
 }
Beispiel #29
0
 /**
  * Check that the user has sufficient permissions, or die in error
  *
  */
 private function _checkPermissions()
 {
     // Is frontend backup enabled?
     $febEnabled = Platform::getInstance()->get_platform_configuration_option('failure_frontend_enable', 0) != 0;
     // Is the Secret Key strong enough?
     $validKey = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', '');
     if (!\Akeeba\Engine\Util\Complexify::isStrongEnough($validKey, false)) {
         $febEnabled = false;
     }
     if (!$febEnabled) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_NOT_ENABLED');
         flush();
         JFactory::getApplication()->close();
     }
     // Is the key good?
     $key = $this->input->get('key', '', 'none', 2);
     $validKeyTrim = trim($validKey);
     if ($key != $validKey || empty($validKeyTrim)) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_INVALID_KEY');
         flush();
         JFactory::getApplication()->close();
     }
 }
Beispiel #30
0
function update_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    debug_for_backend();
    $program = $sgbl->__var_program_name;
    $login = new Client(null, null, 'upgrade');
    $opt = parse_opt($argv);
    print "Getting Version Info from the Server...\n";
    if (isset($opt['till-version']) && $opt['till-version'] || lxfile_exists("__path_slave_db")) {
        $sgbl->slave = true;
        $upversion = findNextVersion($opt['till-version']);
        $type = 'slave';
    } else {
        $sgbl->slave = false;
        $upversion = findNextVersion();
        $type = 'master';
    }
    print "Connecting... Please wait....\n";
    if ($upversion) {
        do_upgrade($upversion);
        print "Upgrade Done.. Executing Cleanup....\n";
        flush();
    } else {
        print "{$program} is the latest version\n";
    }
    if (is_running_secondary()) {
        print "Not running Update Cleanup, because this is running secondary \n";
        exit;
    }
    lxfile_cp("htmllib/filecore/php.ini", "/usr/local/lxlabs/ext/php/etc/php.ini");
    $res = pcntl_exec("/bin/sh", array("../bin/common/updatecleanup.sh", "--type={$type}"));
    print "Done......\n";
}