コード例 #1
1
ファイル: Session.php プロジェクト: pdanver/mir-ndv
 static function start()
 {
     include_once __DIR__ . '/sessionDrivers/' . Settings::$sessionDriver . '.php';
     //self::$driver = new Settings::$sessionDriver();
     //session_set_save_handler(array(self::$driver, 'open'),array(self::$driver, 'close'),array(self::$driver, 'read'),
     //            array(self::$driver, 'write'),array(self::$driver, 'destroy'),array(self::$driver, 'gc'));
     register_shutdown_function('session_write_close');
     if (in_array(Settings::$session_hash, hash_algos())) {
         ini_set('session.hash_function', Settings::$session_hash);
     }
     ini_set('session.hash_bits_per_character', Settings::$hash_bits_per_character);
     $cookieParams = session_get_cookie_params();
     session_set_cookie_params(Settings::$sessionLifetime, $cookieParams["path"], $cookieParams["domain"], Settings::$secure, Settings::$httpOnly);
     session_name(Settings::$NAME);
     //буферизуем заголовок
     ob_start();
     //включаем CORS, если указано в настройках /*
     if (isset(Settings::$CORS) && Settings::$CORS && !empty($_SERVER['HTTP_ORIGIN'])) {
         header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
         header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
         header('Access-Control-Max-Age: 1000');
         header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
     }
     //включаем сессию
     session_start();
     ob_end_flush();
     //посылаем заголовок
 }
コード例 #2
1
ファイル: Engine.php プロジェクト: hecrj/sea_core
 public function render($template = null, array $arguments = null)
 {
     if (null === $template) {
         return false;
     }
     $parentTemplate = $this->currentTemplate;
     $this->currentTemplate = $this->totalTemplates = $this->totalTemplates + 1;
     $path = $this->finder->getPath($template);
     if (!is_file($path)) {
         throw new \RuntimeException('The requested view file doesn\'t exist in: <strong>' . $path . '</strong>', 404);
     }
     ob_start();
     try {
         $this->requireInContext($path, $arguments);
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     if (isset($this->parent[$this->currentTemplate])) {
         $this->data['content'] = ob_get_contents();
         ob_end_clean();
         $this->render($this->parent[$this->currentTemplate], $arguments);
     } else {
         ob_end_flush();
     }
     if ($parentTemplate == 0) {
         $this->clean();
     } else {
         $this->currentTemplate = $parentTemplate;
     }
 }
コード例 #3
0
 function dump_post()
 {
     global $post;
     ob_start('kint_debug_globals');
     d($post);
     ob_end_flush();
 }
コード例 #4
0
function redirect($url)
{
    ob_start();
    header('Location: ' . $url);
    ob_end_flush();
    die;
}
コード例 #5
0
ファイル: FileController.php プロジェクト: segphault/storytlr
 public function viewAction()
 {
     // We view a file, so we should disable layout
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $key = $this->_getParam('key');
     $size = $this->_getParam('size');
     $inline = $this->_getParam('inline');
     if (strpos($key, '.')) {
         $key = substr($key, 0, strpos($key, '.'));
     }
     $files = new Files();
     if (!($file = $files->getFileFromKey($key))) {
         throw new Stuffpress_Exception("No such file for key {$key}");
     }
     if ($size == 'thumbnail') {
         $folder = '/thumbnails/';
     } else {
         if ($size == 'small') {
             $folder = '/small/';
         } else {
             if ($size == 'medium') {
                 $folder = '/medium/';
             } else {
                 if ($size == 'large') {
                     $folder = '/large/';
                 } else {
                     $folder = '/';
                 }
             }
         }
     }
     $root = Zend_Registry::get("root");
     $config = Zend_Registry::get("configuration");
     if (isset($config) && isset($config->path->upload)) {
         $upload = $config->path->upload;
     } else {
         $upload = $root . "/upload/";
     }
     $path = $upload . "/{$folder}{$file->key}";
     if ($folder != '/' && !file_exists($path)) {
         $path = $upload . "/{$file->key}";
     }
     // Dump the file
     if (!$inline) {
         header("Content-Disposition: attachment; filename=\"{$file->name}\"");
     }
     header("Content-type: {$file->type}");
     header('Content-Length: ' . filesize($path));
     /*$this->getResponse()->setHeader('Expires', '', true);
        $this->getResponse()->setHeader('Cache-Control', 'public', true);
      	$this->getResponse()->setHeader('Cache-Control', 'max-age=3800');
        $this->getResponse()->setHeader('Pragma', '', true);*/
     // We turn off output buffering to avoid memory issues
     // when dumping the file
     ob_end_flush();
     readfile($path);
     // Die to make sure that we don't screw up the file
     die;
 }
コード例 #6
0
ファイル: bug61728.php プロジェクト: badlamer/hhvm
function write($id, $sess_data)
{
    ob_start("output_html");
    echo "laruence";
    ob_end_flush();
    return true;
}
コード例 #7
0
ファイル: actions.class.php プロジェクト: lendji4000/compose
 public function executeDownload(sfWebRequest $request)
 {
     $this->checkProject($request);
     $this->checkProfile($request, $this->ei_project);
     $this->checkAttachment($request);
     //throw new Exception($this->ei_subject_attachment->getPath());
     $filePath = sfConfig::get('sf_upload_dir') . '/subjectAttachements/' . $this->ei_subject_attachment->getPath();
     //$mimeType = mime_content_type($this->ei_subject_attachment->getPath());
     /** @var $response sfWebResponse */
     $response = $this->getResponse();
     $response->clearHttpHeaders();
     //$response->setContentType($mimeType);
     $response->setHttpHeader('Content-Disposition', 'attachment; filename="' . $this->ei_subject_attachment->getFileName() . '"');
     $response->setHttpHeader('Content-Description', 'File Transfer');
     $response->setHttpHeader('Content-Transfer-Encoding', 'binary');
     $response->setHttpHeader('Content-Length', filesize($filePath));
     $response->setHttpHeader('Cache-Control', 'public, must-revalidate');
     // if https then always give a Pragma header like this  to overwrite the "pragma: no-cache" header which
     // will hint IE8 from caching the file during download and leads to a download error!!!
     $response->setHttpHeader('Pragma', 'public');
     //$response->setContent(file_get_contents($filePath)); # will produce a memory limit exhausted error
     $response->sendHttpHeaders();
     ob_end_flush();
     return $this->renderText(readfile($filePath));
 }
コード例 #8
0
 public function widget($args, $instance)
 {
     $cache = array();
     if (!$this->is_preview()) {
         $cache = wp_cache_get($this->cache_key, 'widget');
     }
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     if (isset($cache[$args['widget_id']])) {
         echo balanceTags($cache[$args['widget_id']]);
         return;
     }
     ob_start();
     $default = array('title' => 'Filter By:', 'show_attribute' => '', 'st_search_fields' => '', 'style' => 'dark');
     $instance = wp_parse_args($instance, $default);
     echo st()->load_template('rental/filter', null, array('instance' => $instance));
     if (!$this->is_preview()) {
         $cache[$args['widget_id']] = ob_get_flush();
         wp_cache_set($this->cache_key, $cache, 'widget');
     } else {
         ob_end_flush();
     }
 }
コード例 #9
0
 function print_gzipped_page()
 {
     $HTTP_ACCEPT_ENCODING = getenv("HTTP_ACCEPT_ENCODING");
     if (headers_sent()) {
         $encoding = false;
     } elseif (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) {
         $encoding = 'x-gzip';
     } elseif (strpos($HTTP_ACCEPT_ENCODING, 'gzip') !== false) {
         $encoding = 'gzip';
     } else {
         $encoding = false;
     }
     if ($encoding) {
         $contents = ob_get_contents();
         ob_end_clean();
         header('Content-Encoding: ' . $encoding);
         header("ETag: " . md5($contents));
         // ETag im Header senden
         header("Expires: " . date("r", mktime(0, 0, 0, date("n"), date("j") + 365)));
         print "�";
         $size = strlen($contents);
         $contents = gzcompress($contents, 9);
         $contents = substr($contents, 0, $size);
         print $contents;
         //             exit();
     } else {
         ob_end_flush();
         //             exit();
     }
 }
コード例 #10
0
function flush_buffers()
{
    ob_end_flush();
    ob_flush();
    flush();
    ob_start();
}
コード例 #11
0
 /**
  * Code ran after the event handler, adds headers etc to the request
  * If noHeaders is false, it adds all the correct http/1.1 headers to the request
  * and deals with modified/expires/e-tags/etc. This makes the server behave more like
  * a real http server.
  */
 public function __destruct()
 {
     if (!$this->noHeaders) {
         header("Content-Type: {$this->contentType}" . (!empty($this->charset) ? "; charset={$this->charset}" : ''));
         header('Accept-Ranges: bytes');
         if ($this->noCache) {
             header("Cache-Control: no-cache, must-revalidate", true);
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT", true);
         } else {
             // attempt at some propper header handling from php
             // this departs a little from the shindig code but it should give is valid http protocol handling
             header('Cache-Control: public,max-age=' . $this->cacheTime, true);
             header("Expires: " . gmdate("D, d M Y H:i:s", time() + $this->cacheTime) . " GMT", true);
             // Obey browsers (or proxy's) request to send a fresh copy if we recieve a no-cache pragma or cache-control request
             if (!isset($_SERVER['HTTP_PRAGMA']) || !strstr(strtolower($_SERVER['HTTP_PRAGMA']), 'no-cache') && (!isset($_SERVER['HTTP_CACHE_CONTROL']) || !strstr(strtolower($_SERVER['HTTP_CACHE_CONTROL']), 'no-cache'))) {
                 if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $this->lastModified && !isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
                     $if_modified_since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
                     if ($this->lastModified <= $if_modified_since) {
                         header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->lastModified) . ' GMT', true);
                         header("HTTP/1.1 304 Not Modified", true);
                         header('Content-Length: 0', true);
                         ob_end_clean();
                         die;
                     }
                 }
                 header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->lastModified ? $this->lastModified : time()) . ' GMT', true);
             }
         }
     } else {
         ob_end_flush();
     }
 }
コード例 #12
0
 function display()
 {
     global $current_language;
     if (empty($this->container_id)) {
         $child_reports = ReportContainer::get_root_reports();
     } else {
         $container = new ReportContainer();
         $container->retrieve($this->container_id);
         $child_reports = $container->get_linked_beans("reports", "ZuckerReport");
     }
     $mod_strings = return_module_language($current_language, "ZuckerReports");
     require_once 'include/ListView/ListView.php';
     $lv = new ListView();
     $lv->initNewXTemplate('modules/ZuckerReportContainer/DetailView.html', $mod_strings);
     $lv->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path . 'delete_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $lv->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path . 'edit_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'));
     $lv->xTemplateAssign("RETURN_URL", "&return_module=ZuckerReportContainer&return_action=DetailView&return_id=" . $container->id);
     $lv->setHeaderTitle("");
     $lv->setHeaderText("");
     ob_start();
     $lv->processListViewTwo($child_reports, "reports", "REPORT");
     $str = ob_get_clean();
     ob_end_flush();
     return parent::display() . $str;
 }
コード例 #13
0
ファイル: View.php プロジェクト: nicebro/wf-test-task
 /**
  * Render the template, returning it's content.
  */
 public function render($template, $variables = [])
 {
     extract($variables);
     ob_start();
     include views_path() . '/' . $template . '.php';
     return ob_end_flush();
 }
コード例 #14
0
 public function init()
 {
     if (file_exists($this->sock)) {
         $this->log->error("Sock file already exists, concurrent process cannot be started");
         exit;
     }
     $this->log->info('Streamer initialization');
     // connection keep-alive, in other case browser will close it when receive last frame
     header('Connection: keep-alive');
     // disable caches
     header('Cache-Control: no-cache');
     header('Cache-Control: private');
     header('Pragma: no-cache');
     // x-mixed-replace to stream JPEG images
     header('Content-type: multipart/x-mixed-replace; boundary=' . self::$BOUNDARY);
     // set unlimited so PHP doesn't timeout during a long stream
     set_time_limit(0);
     // ignore user abort script
     ignore_user_abort(true);
     @apache_setenv('no-gzip', 1);
     // disable apache gzip compression
     @ini_set('zlib.output_compression', 0);
     // disable PHP zlib compression
     @ini_set('implicit_flush', 1);
     // flush all current buffers
     $k = ob_get_level();
     for ($i = 0; $i < $k; $i++) {
         ob_end_flush();
     }
     register_shutdown_function(array($this, 'shutdown'));
     fclose(fopen($this->sock, 'w'));
     $this->initialized = true;
 }
コード例 #15
0
ファイル: RlxCache.php プロジェクト: relax4o/RlxWork
 /** Завършваме кеша и извеждаме на екрана **/
 public function endCache()
 {
     if ($this->caching) {
         file_put_contents($this->getFullPath(), ob_get_contents());
         ob_end_flush();
     }
 }
コード例 #16
0
ファイル: ob_start_basic_005.php プロジェクト: badlamer/hhvm
function checkAndClean()
{
    print_r(ob_list_handlers());
    while (ob_get_level() > 0) {
        ob_end_flush();
    }
}
コード例 #17
0
 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;
 }
コード例 #18
0
 private static function Status($Message)
 {
     echo $Message;
     @ob_flush();
     flush();
     @ob_end_flush();
 }
コード例 #19
0
 /**
  * Sends a response for the given Exception.
  *
  * To be as fail-safe as possible, the exception is first handled
  * by our simple exception handler, then by the user exception handler.
  * The latter takes precedence and any output from the former is cancelled,
  * if and only if nothing bad happens in this handling path.
  */
 public function handle(\Exception $exception)
 {
     if (null === $this->handler || $exception instanceof OutOfMemoryException) {
         $this->failSafeHandle($exception);
         return;
     }
     $caughtLength = $this->caughtLength = 0;
     ob_start(array($this, 'catchOutput'));
     $this->failSafeHandle($exception);
     while (null === $this->caughtBuffer && ob_end_flush()) {
         // Empty loop, everything is in the condition
     }
     if (isset($this->caughtBuffer[0])) {
         ob_start(array($this, 'cleanOutput'));
         echo $this->caughtBuffer;
         $caughtLength = ob_get_length();
     }
     $this->caughtBuffer = null;
     try {
         call_user_func($this->handler, $exception);
         $this->caughtLength = $caughtLength;
     } catch (\Exception $e) {
         if (!$caughtLength) {
             // All handlers failed. Let PHP handle that now.
             throw $exception;
         }
     }
 }
コード例 #20
0
 /**
  * Starts the cache object; must call this function at the beginning of the content/page
  * you are trying to cache, then call the end function at the (duh) end of it.
  */
 function end()
 {
     if ($this->caching) {
         file_put_contents($this->cacheFileName, ob_get_contents());
         ob_end_flush();
     }
 }
コード例 #21
0
ファイル: ob_start_error_005.php プロジェクト: lihuibin/jphp
function f($str)
{
    ob_start();
    echo "hello";
    ob_end_flush();
    return $str;
}
コード例 #22
0
ファイル: appProxy.php プロジェクト: rodrigoivan/processmaker
 /**
  * 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);
 }
コード例 #23
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>';

	}
 /**
  * Output file to the browser.
  * For performance reasons, we avoid SS_HTTPResponse and just output the contents instead.
  */
 public function sendFile($file)
 {
     $path = $file->getFullPath();
     if (SapphireTest::is_running_test()) {
         return file_get_contents($path);
     }
     header('Content-Description: File Transfer');
     // Quotes needed to retain spaces (http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download)
     header('Content-Disposition: inline; filename="' . basename($path) . '"');
     header('Content-Length: ' . $file->getAbsoluteSize());
     header('Content-Type: ' . HTTP::get_mime_type($file->getRelativePath()));
     header('Content-Transfer-Encoding: binary');
     // Fixes IE6,7,8 file downloads over HTTPS bug (http://support.microsoft.com/kb/812935)
     header('Pragma: ');
     if ($this->config()->min_download_bandwidth) {
         // Allow the download to last long enough to allow full download with min_download_bandwidth connection.
         increase_time_limit_to((int) (filesize($path) / ($this->config()->min_download_bandwidth * 1024)));
     } else {
         // Remove the timelimit.
         increase_time_limit_to(0);
     }
     // Clear PHP buffer, otherwise the script will try to allocate memory for entire file.
     while (ob_get_level() > 0) {
         ob_end_flush();
     }
     // Prevent blocking of the session file by PHP. Without this the user can't visit another page of the same
     // website during download (see http://konrness.com/php5/how-to-prevent-blocking-php-requests/)
     session_write_close();
     readfile($path);
     die;
 }
コード例 #25
0
ファイル: SignIn.php プロジェクト: nodots/DIY
 protected function init()
 {
     if ($this->status_uid == 'people_signintolist_200' && !$this->unlocked) {
         // unlock the element
         $this->unlock();
     }
     if ($this->sessionGet('initialized_element_' . $this->element_id, 'script')) {
         // element is initialized, meaning this is the closing embed
         // unset element initialized state:
         $this->sessionClear('initialized_element_' . $this->element_id, 'script');
         if ($this->unlocked) {
             // unlocked, so clean out the buffer and don't display anything further
             $this->status_uid = 'empty';
             if (ob_get_level()) {
                 ob_end_flush();
             }
         } else {
             // locked, delete the protected output and send an empty string
             $this->status_uid = 'empty';
             if (ob_get_level()) {
                 ob_end_clean();
             }
         }
     } else {
         if ($this->unlocked) {
             // element already unlocked. do nothing.
             $this->status_uid = 'empty';
         } else {
             // element is locked. mark element as initialized, start output buffering, and display default markup
             $this->sessionSet('initialized_element_' . $this->element_id, true, 'script');
             ob_start();
         }
     }
 }
コード例 #26
0
ファイル: c_users.php プロジェクト: rupeshmore85/dwa
 public function p_signup()
 {
     # Dump out the results of POST to see what the form submitted
     # print_r($_POST);
     # Encrypt the password
     $_POST['password'] = sha1(PASSWORD_SALT . $_POST['password']);
     # More data we want stored with the user
     $_POST['created'] = Time::now();
     $_POST['modified'] = Time::now();
     $_POST['token'] = sha1(TOKEN_SALT . $_POST['email'] . Utils::generate_random_string());
     # Variables to store the first name & email of the user
     $firstname = $_POST['first_name'];
     $email = $_POST['email'];
     # Variable which will store the email which is fetched from database
     $email_verify = DB::instance(DB_NAME)->select_row("SELECT email FROM users WHERE email = '" . $_POST['email'] . "'");
     # print_r($email_verify);
     if ($email_verify == "") {
         # Insert this user into the database
         $user_id = DB::instance(DB_NAME)->insert("users", $_POST);
         # Confirmation to the user on successfully signing up
         echo "Congratulations {$firstname} !! You have successfully signed up</br></br>";
         # Login again in order to follow users
         echo "You need to login again in order to follow users </br>";
         echo "<a href='/users/login'> Login </a>";
     } else {
         #To Display to the user that the email records exist in database.
         echo " {$firstname}, Your email '{$email}' matches with our records in database.</br>\n         \tYou will be redirected to the signup page in 10 seconds. </br></br>";
         echo "<a href='/users/signup'> Signup </a> </br></br>";
         echo "<a href='/users/login'> Login </a>";
         #Refresh the page and redirect to signup page after 10 secs.
         header('Refresh: 10; URL=/users/signup');
         ob_end_flush();
     }
 }
コード例 #27
0
 public function exec()
 {
     if (!$this->value) {
         echo "Exec " . $this->text . ": SKIP\n";
     }
     if ($this->_exec instanceof \Closure && $this->value) {
         echo "Exec " . $this->text . ": ";
         ob_start();
         $transaction = Yii::$app->db->beginTransaction();
         $res = call_user_func($this->_exec, $this);
         if ($res) {
             $transaction->commit();
         } else {
             $transaction->rollBack();
         }
         ob_clean();
         ob_end_flush();
         echo ($res ? "OK" : "FAIL") . "\n";
     }
     if ($this->items) {
         foreach ($this->items as $child) {
             $child->exec();
         }
     }
 }
コード例 #28
0
ファイル: media.php プロジェクト: neerajcse/fcommerce
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -  
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in 
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     //$backkey = $_SERVER['HTTP_JSESSIONID'];
     $backkey = "XXYUJAHAH1123444ASDF";
     $this->load->helper('file');
     $this->load->library('encrypt');
     $string = read_file('./media/mp3/song-encrypt.mp3');
     $decrypted_file = $this->encrypt->decode($string, $backkey);
     if (!write_file('./media/mp3/song-dencrypt.mp3', $decrypted_file)) {
         die('Unable to write the file');
     } else {
         echo 'File written!';
     }
     //
     //ob_start();
     //header("Content-Type: audio/mpeg");
     //print $decypted_file;
     //ob_end_flush();
     ob_start();
     header("Expires: Mon, 20 Dec 1977 00:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     header("Content-Type: application/octer-stream");
     print $decrypted_file;
     ob_end_flush();
 }
コード例 #29
0
 /**
  * Output the content of the resource
  *
  * @param array $options An array of options for the output
  */
 public function outputContent(array $options = array())
 {
     if (empty($options['rpc_type'])) {
         $options['rpc_type'] = 'XML';
     }
     $resourceClass = 'mod' . $options['rpc_type'] . 'RPCResource';
     if (!$this->modx->resource instanceof $resourceClass) {
         $this->modx->log(modX::LOG_LEVEL_FATAL, 'Could not load ' . $options['rpc_type'] . '-RPC Server class.');
     }
     $this->modx->resource->process();
     $this->modx->resource->_output = $this->modx->resource->_content;
     /* collect any uncached element tags in the content and process them */
     $this->modx->getParser();
     $maxIterations = intval($this->modx->getOption('parser_max_iterations', null, 10));
     $this->modx->parser->processElementTags('', $this->modx->resource->_output, true, false, '[[', ']]', array(), $maxIterations);
     $this->modx->parser->processElementTags('', $this->modx->resource->_output, true, true, '[[', ']]', array(), $maxIterations);
     if (!$this->getServer()) {
         $this->modx->log(modX::LOG_LEVEL_FATAL, 'Could not load ' . $options['rpc_type'] . '-RPC Server.');
     }
     $this->server->service();
     ob_get_level() && @ob_end_flush();
     while (ob_get_level() && @ob_end_clean()) {
     }
     exit;
 }
コード例 #30
0
ファイル: ChangesFeed.php プロジェクト: rocLv/conference
 /**
  * Generates feed's content
  *
  * @param $feed ChannelFeed subclass object (generally the one returned by getFeedObject())
  * @param $rows ResultWrapper object with rows in recentchanges table
  * @param $lastmod Integer: timestamp of the last item in the recentchanges table (only used for the cache key)
  * @param $opts FormOptions as in SpecialRecentChanges::getDefaultOptions()
  * @return null or true
  */
 public function execute($feed, $rows, $lastmod, $opts)
 {
     global $messageMemc, $wgFeedCacheTimeout;
     global $wgSitename, $wgLang;
     if (!FeedUtils::checkFeedOutput($this->format)) {
         return;
     }
     $timekey = wfMemcKey($this->type, $this->format, 'timestamp');
     $optionsHash = md5(serialize($opts->getAllValues()));
     $key = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash);
     FeedUtils::checkPurge($timekey, $key);
     /*
      * Bumping around loading up diffs can be pretty slow, so where
      * possible we want to cache the feed output so the next visitor
      * gets it quick too.
      */
     $cachedFeed = $this->loadFromCache($lastmod, $timekey, $key);
     if (is_string($cachedFeed)) {
         wfDebug("RC: Outputting cached feed\n");
         $feed->httpHeaders();
         echo $cachedFeed;
     } else {
         wfDebug("RC: rendering new feed and caching it\n");
         ob_start();
         self::generateFeed($rows, $feed);
         $cachedFeed = ob_get_contents();
         ob_end_flush();
         $this->saveToCache($cachedFeed, $timekey, $key);
     }
     return true;
 }