PHP ini_set Examples

PHP ini_set - 30 examples found. These are the top rated real world PHP examples of ini_set extracted from open source projects. You can rate examples to help us improve the quality of examples.
 /**
  * Filters an asset after it has been loaded.
  *
  * @param  \Assetic\Asset\AssetInterface  $asset
  * @return void
  */
 public function filterLoad(AssetInterface $asset)
 {
     $max_nesting_level = ini_get('xdebug.max_nesting_level');
     $memory_limit = ini_get('memory_limit');
     if ($max_nesting_level && $max_nesting_level < 200) {
         ini_set('xdebug.max_nesting_level', 200);
     }
     if ($memory_limit && $memory_limit < 256) {
         ini_set('memory_limit', '256M');
     }
     $root = $asset->getSourceRoot();
     $path = $asset->getSourcePath();
     $dirs = array();
     $lc = new \Less_Parser(array('compress' => true));
     if ($root && $path) {
         $dirs[] = dirname($root . '/' . $path);
     }
     foreach ($this->loadPaths as $loadPath) {
         $dirs[] = $loadPath;
     }
     $lc->SetImportDirs($dirs);
     $url = parse_url($this->getRequest()->getUriForPath(''));
     $absolutePath = str_replace(public_path(), '', $root);
     if (isset($url['path'])) {
         $absolutePath = $url['path'] . $absolutePath;
     }
     $lc->parseFile($root . '/' . $path, $absolutePath);
     $asset->setContent($lc->getCss());
 }
 function connect($server, $db, $user, $password, $socketPath, $charset = null, $port = false)
 {
     $connection = false;
     if ($socketPath !== false) {
         ini_set("mysqli.default_socket", $socketPath);
     }
     if ($this->UsePersistentConnection == true) {
         // Only supported on PHP 5.3 (mysqlnd)
         if (version_compare(PHP_VERSION, '5.3') > 0) {
             $this->Server = 'p:' . $this->Server;
         } else {
             eZDebug::writeWarning('mysqli only supports persistent connections when using php 5.3 and higher', 'eZMySQLiDB::connect');
         }
     }
     eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
     $connection = mysqli_connect($server, $user, $password, null, (int) $port, $socketPath);
     $dbErrorText = mysqli_connect_error();
     eZPerfLogger::accumulatorStop('mysqli_connection');
     $maxAttempts = $this->connectRetryCount();
     $waitTime = $this->connectRetryWaitTime();
     $numAttempts = 1;
     while (!$connection && $numAttempts <= $maxAttempts) {
         sleep($waitTime);
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $connection = mysqli_connect($this->Server, $this->User, $this->Password, null, (int) $this->Port, $this->SocketPath);
         eZPerfLogger::accumulatorStop('mysqli_connection');
         $numAttempts++;
     }
     $this->setError();
     $this->IsConnected = true;
     if (!$connection) {
         eZDebug::writeError("Connection error: Couldn't connect to database. Please try again later or inform the system administrator.\n{$dbErrorText}", __CLASS__);
         $this->IsConnected = false;
         throw new eZDBNoConnectionException($server);
     }
     if ($this->IsConnected && $db != null) {
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $ret = mysqli_select_db($connection, $db);
         eZPerfLogger::accumulatorStop('mysqli_connection');
         if (!$ret) {
             //$this->setError();
             eZDebug::writeError("Connection error: " . mysqli_errno($connection) . ": " . mysqli_error($connection), "eZMySQLiDB");
             $this->IsConnected = false;
         }
     }
     if ($charset !== null) {
         $originalCharset = $charset;
         $charset = eZCharsetInfo::realCharsetCode($charset);
     }
     if ($this->IsConnected and $charset !== null) {
         eZPerfLogger::accumulatorStart('mysqli_connection', 'mysqli_total', 'Database connection');
         $status = mysqli_set_charset($connection, eZMySQLCharset::mapTo($charset));
         eZPerfLogger::accumulatorStop('mysqli_connection');
         if (!$status) {
             $this->setError();
             eZDebug::writeWarning("Connection warning: " . mysqli_errno($connection) . ": " . mysqli_error($connection), "eZMySQLiDB");
         }
     }
     return $connection;
 }
Example #3
0
/**
 * Initialize session.
 * @param boolean $keepopen keep session open? The default is
 * 			to close the session after $_SESSION has been populated.
 * @uses $_SESSION
 */
function session_init($keepopen = false)
{
    $settings = new phpVBoxConfigClass();
    // Sessions provided by auth module?
    if (@$settings->auth->capabilities['sessionStart']) {
        call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
        return;
    }
    // No session support? No login...
    if (@$settings->noAuth || !function_exists('session_start')) {
        global $_SESSION;
        $_SESSION['valid'] = true;
        $_SESSION['authCheckHeartbeat'] = time();
        $_SESSION['admin'] = true;
        return;
    }
    // start session
    session_start();
    // Session is auto-started by PHP?
    if (!ini_get('session.auto_start')) {
        ini_set('session.use_trans_sid', 0);
        ini_set('session.use_only_cookies', 1);
        // Session path
        if (isset($settings->sessionSavePath)) {
            session_save_path($settings->sessionSavePath);
        }
        session_name(isset($settings->session_name) ? $settings->session_name : md5('phpvbx' . $_SERVER['DOCUMENT_ROOT'] . $_SERVER['HTTP_USER_AGENT']));
        session_start();
    }
    if (!$keepopen) {
        session_write_close();
    }
}
Example #4
0
/**
 * Function used to auto load the framework classes
 * 
 * It imlements PSR-0 and PSR-4 autoloading standards
 * The required class name should be prefixed with a namespace
 * This lowercaser of the namespace should match the folder name of the class 
 * 
 * @since 1.0.0
 * @param string $class_name name of the class that needs to be included
 */
function autoload_framework_classes($class_name)
{
    error_reporting(E_ALL);
    ini_set('display_errors', true);
    ini_set('display_startup_errors', true);
    /** If the required class is in the global namespace then no need to autoload the class */
    if (strpos($class_name, "\\") === false) {
        return false;
    }
    /** The namespace seperator is replaced with directory seperator */
    $class_name = str_replace("\\", DIRECTORY_SEPARATOR, $class_name);
    /** The class name is split into namespace and short class name */
    $path_info = explode(DIRECTORY_SEPARATOR, $class_name);
    /** The namepsace is extracted */
    $namespace = implode(DIRECTORY_SEPARATOR, array_slice($path_info, 0, count($path_info) - 1));
    /** The class name is extracted */
    $class_name = $path_info[count($path_info) - 1];
    /** The namespace is converted to lower case */
    $namespace_folder = trim(strtolower($namespace), DIRECTORY_SEPARATOR);
    /** .php is added to class name */
    $class_name = $class_name . ".php";
    /** The applications folder name */
    $framework_folder_path = realpath(dirname(__FILE__));
    /** The application folder is checked for file name */
    $file_name = $framework_folder_path . DIRECTORY_SEPARATOR . $namespace_folder . DIRECTORY_SEPARATOR . $class_name;
    if (is_file($file_name)) {
        include_once $file_name;
    }
}
 /**
  * Constructor
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @param	array 		Configuration info for this method
  * @param	array 		Custom configuration info for this method
  * @return	void
  */
 public function __construct(ipsRegistry $registry, $method, $conf = array())
 {
     $this->method_config = $method;
     $this->openid_config = $conf;
     parent::__construct($registry);
     //-----------------------------------------
     // Fix include path for OpenID libs
     //-----------------------------------------
     $path_extra = dirname(__FILE__);
     $path = ini_get('include_path');
     $path = $path_extra . PATH_SEPARATOR . $path;
     ini_set('include_path', $path);
     define('Auth_OpenID_RAND_SOURCE', null);
     //-----------------------------------------
     // OpenID libraries are not STRICT compliant
     //-----------------------------------------
     ob_start();
     /**
      * Turn off strict error reporting for openid
      */
     if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_RECOVERABLE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     } else {
         error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
     }
     //-----------------------------------------
     // And grab libs
     //-----------------------------------------
     require_once "Auth/OpenID/Consumer.php";
     require_once "Auth/OpenID/FileStore.php";
     require_once "Auth/OpenID/SReg.php";
     require_once "Auth/OpenID/PAPE.php";
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $this->validateNumber = "09xxxxxxxx";
     $this->has_key = true;
     ini_set("soap.wsdl_cache_enabled", "0");
 }
Example #7
0
    function forgot()
    {
        // Create an instance of the client model
        $this->load->model('client');
        // Grab the email from form post
        $email = $this->input->post('email');
        if ($email && $this->client->email_exists($email)) {
            // send the reset email and then redirect to password_sent page
            $slug = md5($this->client->id . $this->client->email . date('Ymd') . 'yeoman');
            $this->load->library('email');
            ini_set('SMTP', 'smtp.menara.ma.');
            $this->email->from('noreply@reputation.com', 'Reputation App');
            $this->email->to($email);
            $this->email->subject('Please reset your password');
            $this->email->message('To reset your password please click the link below and follow the instructions:
' . '<a href="' . site_url('Login/reset/' . $this->client->id . '/' . $slug) . '">link</a>' . '

If you did not request to reset your password then please just ignore this email and no changes will occur.

Note: This reset code will expire after ' . date('j M Y') . '.');
            $b = $this->email->send();
            echo 'sent: ' . $b . ', link: ' . '<a href="' . site_url('Login/reset/' . $this->client->id . '/' . $slug) . '">link</a>';
            //redirect('Login/password_sent');
        } else {
            $this->show_forgot(true);
        }
    }
Example #8
0
 public static function start($lifetime = 0, $path = '/', $domain = NULL)
 {
     if (!self::$_initialized) {
         if (!is_object(Symphony::Database()) || !Symphony::Database()->connected()) {
             return false;
         }
         $cache = Cache::instance()->read('_session_config');
         if (is_null($cache) || $cache === false) {
             self::create();
             Cache::instance()->write('_session_config', true);
         }
         if (!session_id()) {
             ini_set('session.save_handler', 'user');
             ini_set('session.gc_maxlifetime', $lifetime);
             ini_set('session.gc_probability', '1');
             ini_set('session.gc_divisor', '3');
         }
         session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
         session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
         if (strlen(session_id()) == 0) {
             if (headers_sent()) {
                 throw new Exception('Headers already sent. Cannot start session.');
             }
             session_start();
         }
         self::$_initialized = true;
     }
     return session_id();
 }
Example #9
0
 /**
  * @ignore
  * @param array $options
  */
 public function prepareEnvironment($options = array())
 {
     if (empty($options['skipErrorHandler'])) {
         set_error_handler(array('Ip\\Internal\\ErrorHandler', 'ipErrorHandler'));
     }
     if (empty($options['skipError'])) {
         if (ipConfig()->showErrors()) {
             error_reporting(E_ALL | E_STRICT);
             ini_set('display_errors', '1');
         } else {
             ini_set('display_errors', '0');
         }
     }
     if (empty($options['skipSession'])) {
         if (session_id() == '' && !headers_sent()) {
             //if session hasn't been started yet
             session_name(ipConfig()->get('sessionName'));
             if (!ipConfig()->get('disableHttpOnlySetting')) {
                 ini_set('session.cookie_httponly', 1);
             }
             session_start();
         }
     }
     if (empty($options['skipEncoding'])) {
         mb_internal_encoding(ipConfig()->get('charset'));
     }
     if (empty($options['skipTimezone'])) {
         date_default_timezone_set(ipConfig()->get('timezone'));
         //PHP 5 requires timezone to be set.
     }
 }
 protected function restoreDefaultTimezone()
 {
     if (null !== $this->defaultTimezone) {
         ini_set('date.timezone', $this->defaultTimezone);
         $this->defaultTimezone = null;
     }
 }
Example #11
0
 /**
  * Run the command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     // Allow PHP to use a lot of memory
     ini_set('memory_limit', '-1');
     // Create a new search
     $search = new Search($input->getOption('dimension'));
     // Set the search as randomized
     if ($input->getOption('randomized')) {
         $search->setRandomized(true);
     }
     // Set number of iterations
     if ($input->getOption('iterations')) {
         $search->setIterations($input->getOption('iterations'));
     }
     // Set number of learning iterations
     if ($input->getOption('learn')) {
         $search->setLearningIterations($input->getOption('learn'));
     }
     if ($input->getOption('penalize')) {
         $search->setPenalize(true);
     }
     if ($input->getOption('remember')) {
         $search->setForget(false);
     }
     // Execute the search
     $result = $search->run($output);
     // Print out output (if specified)
     if ($input->getOption('print')) {
         $output->write(print_r($result, true));
     }
     // Print out the length of the path found
     $output->writeln("\n" . 'Largest path found was: ' . count($result));
 }
Example #12
0
 /**
  * Downloads a package
  *
  * @param string $url    URL of file to download
  * @param string $target Download target filename [optional]
  *
  * @return mixed Path to downloaded package or boolean false on failure
  *
  * @since   11.1
  */
 public static function downloadPackage($url, $target = false)
 {
     $config = JFactory::getConfig();
     // Capture PHP errors
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     // Set user agent
     $version = new JVersion();
     ini_set('user_agent', $version->getUserAgent('Installer'));
     $http = JHttpFactory::getHttp();
     $response = $http->get($url);
     if (200 != $response->code) {
         JLog::add(JText::_('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_CONNECT'), JLog::WARNING, 'jerror');
         return false;
     }
     if ($response->headers['wrapper_data']['Content-Disposition']) {
         $contentfilename = explode("\"", $response->headers['wrapper_data']['Content-Disposition']);
         $target = $contentfilename[1];
     }
     // Set the target path if not given
     if (!$target) {
         $target = $config->get('tmp_path') . '/' . self::getFilenameFromURL($url);
     } else {
         $target = $config->get('tmp_path') . '/' . basename($target);
     }
     // Write buffer to file
     JFile::write($target, $response->body);
     // Restore error tracking to what it was before
     ini_set('track_errors', $track_errors);
     // Bump the max execution time because not using built in php zip libs are slow
     @set_time_limit(ini_get('max_execution_time'));
     // Return the name of the downloaded package
     return basename($target);
 }
Example #13
0
function compress()
{
    ini_set("pcre.recursion_limit", "16777");
    $CI =& get_instance();
    $buffer = $CI->output->get_output();
    $re = '%# Collapse whitespace everywhere but in blacklisted elements.
        (?>             # Match all whitespans other than single space.
          [^\\S ]\\s*     # Either one [\\t\\r\\n\\f\\v] and zero or more ws,
        | \\s{2,}        # or two or more consecutive-any-whitespace.
        ) # Note: The remaining regex consumes no text at all...
        (?=             # Ensure we are not in a blacklist tag.
          [^<]*+        # Either zero or more non-"<" {normal*}
          (?:           # Begin {(special normal*)*} construct
            <           # or a < starting a non-blacklist tag.
            (?!/?(?:textarea|pre|script)\\b)
            [^<]*+      # more non-"<" {normal*}
          )*+           # Finish "unrolling-the-loop"
          (?:           # Begin alternation group.
            <           # Either a blacklist start tag.
            (?>textarea|pre|script)\\b
          | \\z          # or end of file.
          )             # End alternation group.
        )  # If we made it here, we are not in a blacklist tag.
        %Six';
    $new_buffer = preg_replace($re, " ", $buffer);
    // We are going to check if processing has working
    if ($new_buffer === null) {
        $new_buffer = $buffer;
    }
    $CI->output->set_output($new_buffer);
    $CI->output->_display();
}
Example #14
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>';

	}
Example #15
0
 public function _initError()
 {
     if ($this->config->application->showErrors) {
         error_reporting(-1);
         ini_set('display_errors', 'On');
     }
 }
Example #16
0
 public function auto()
 {
     ini_set('memory_limit', '-1M');
     set_time_limit(0);
     $url = "http://www.moksos.com";
     self::Get_Index_All_Update($url);
 }
Example #17
0
 public static function toXml($data, $rootNodeName = 'data', $xml = null)
 {
     // turn off compatibility mode as simple xml throws a wobbly if you don't.
     if (ini_get('zend.ze1_compatibility_mode') == 1) {
         ini_set('zend.ze1_compatibility_mode', 0);
     }
     if ($xml == null) {
         $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><{$rootNodeName} />");
     }
     // loop through the data passed in.
     foreach ($data as $key => $value) {
         // no numeric keys in our xml please!
         if (is_numeric($key)) {
             // make string key...
             $key = "child_" . (string) $key;
         }
         // replace anything not alpha numeric
         $key = preg_replace('/[^a-z]/i', '', $key);
         // if there is another array found recrusively call this function
         if (is_array($value)) {
             $node = $xml->addChild($key);
             // recrusive call.
             ArrayToXML::toXml($value, $rootNodeName, $node);
         } else {
             // add single node.
             $value = htmlentities($value);
             $xml->addChild($key, $value);
         }
     }
     // pass back as string. or simple xml object if you want!
     return $xml->asXML();
 }
Example #18
0
 function proxy_pdf()
 {
     // pre($_POST);
     // exit();
     ini_set("memory_limit", -1);
     $serverUrl = $this->config->item("pdf_server");
     $serverUrl = $serverUrl ? $serverUrl : "";
     //if server is local just runt the method pdf;
     if (empty($serverUrl) || $serverUrl == 'local') {
         //print "local";
         $this->pdf();
         exit;
     }
     //print "remote";
     //$req=get_post();
     $req = $_POST;
     //$req["tbl"]=rawurldecode($req["tbl"]);
     $postdata = http_build_query($_POST);
     // pre($postdata);
     // exit();
     $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
     $context = stream_context_create($opts);
     $filename = isset($req["filename"]) && !empty($req["filename"]) ? preg_replace("/(\\s+)|(\\.html\$)/", "", $req["filename"]) : date("Y_m_d");
     //chose one
     //$serverUrl="http://localhost:90/import_ikan/";
     //$serverUrl="http://gis.bkipm.kkp.go.id/budidaya_new/";
     $result = file_get_contents($serverUrl . 'export/pdf', false, $context);
     header('Content-disposition: inline; filename=' . $filename . '.pdf');
     //header('Content-disposition: attachment; filename='.$filename.'.pdf');
     header('Content-type: application/pdf');
     print $result;
 }
 public static function register()
 {
     ini_set('unserialize_callback_func', 'spl_autoload_call');
     if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
         throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
     }
 }
Example #20
0
 function index($syear = 2014, $eyear = 2015)
 {
     ini_set('display_errors', 'On');
     if ($this->aauth->isCustomer()) {
         redirect('customer/dashboard');
     }
     $this->session->set_userdata('syear', $syear);
     $this->session->set_userdata('eyear', $eyear);
     $this->load->library('pagination');
     $this->load->helper('text');
     $this->load->library('form_validation');
     $this->load->helper('form');
     $notification = $this->load->model('usermodel');
     $notification = $this->load->model('calender/event');
     $inner = array();
     $page = array();
     //$page['content'] = "Welcome to landlord Masters";
     //$inner['row'] = "Test";
     // $inner['dasbBoardData'] = $this->usermodel->dasbBoardData($syear, $eyear, $this->ids);
     //        e($inner['dasbBoardData']);
     $inner['franchises'] = $this->usermodel->getAllFranchise();
     $inner['regions'] = $this->db->get('franchise_region')->result_array();
     // $inner['magentoDashboardData'] = self::loadmagentodata();
     // self::setUserSession($inner['regions'], $inner['franchises']);
     $page['content'] = $this->load->view('user/dashboard', $inner, TRUE);
     // e($this->dashboard);
     $this->load->view($this->dashboard, $page);
 }
Example #21
0
/**
 * Check if compression handler (ob_gzhandler) should be enabled. Note: this should not be used
 * as an indicator of whether output received by a client will be compressed, only whether an
 * output handler is used to compress output.
 * @return bool
 * @access public
 */
function compress_handler_is_enabled() {
	global $g_compress_html;

	// indicates compression should be disabled for a page. Note: php.ini may still enable zlib.output_compression.
	// it may be possible to turn this off through the use of ini_set within that specific page.
	if( defined( 'COMPRESSION_DISABLED' ) ) {
		return false;
	}

	// Dont use config_get here so only dependency is on consant.inc.php in this module
	// We only actively compress html if global configuration compress_html is set.
	if( ON == $g_compress_html ) {
		// both compression handlers require zlib module to be loaded
		if( !extension_loaded( 'zlib' ) ) {
			return false;
		}

		if ( ini_get( 'zlib.output_compression' ) ) {
			/* zlib output compression is already enabled - we can't load the gzip output handler */
			return false;
		}

		// Since php 5.2.10, it's possible to set zlib.output_compression via ini_set.
		// This method is preferred over ob_gzhandler
		if( php_version_at_least( '5.2.10' ) && ini_get( 'output_handler' ) == '' && function_exists( 'ini_set' ) ) {
			ini_set( 'zlib.output_compression', true );
			// do it transparently
			return false;
		}

		// if php.ini does not already use ob_gzhandler by default, return true.
		return ( 'ob_gzhandler' != ini_get( 'output_handler' ) );
	}
}
Example #22
0
function espresso_ical()
{
    $name = $_REQUEST['event_summary'] . ".ics";
    $output = "BEGIN:VCALENDAR\n" . "PRODID:-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN\n" . "VERSION:2.0\n" . "BEGIN:VEVENT\n" . "DTSTAMP:" . $_REQUEST['currentyear'] . $_REQUEST['currentmonth'] . $_REQUEST['currentday'] . "T" . $_REQUEST['currenttime'] . "\n" . "UID:" . $_REQUEST['attendee_id'] . "@" . $_REQUEST['event_id'] . "\n" . "ORGANIZER:MAILTO:" . $_REQUEST['contact'] . "\n" . "DTSTART:" . $_REQUEST['startyear'] . $_REQUEST['startmonth'] . $_REQUEST['startday'] . "T" . $_REQUEST['starttime'] . "\n" . "DTEND:" . $_REQUEST['endyear'] . $_REQUEST['endmonth'] . $_REQUEST['endday'] . "T" . $_REQUEST['endtime'] . "\n" . "STATUS:CONFIRMED\n" . "CATEGORIES:" . $_REQUEST['event_categories'] . "\n" . "SUMMARY:" . $_REQUEST['event_summary'] . "\n" . "DESCRIPTION:" . $_REQUEST['event_description'] . "\n" . "END:VEVENT\n" . "END:VCALENDAR";
    if (ob_get_length()) {
        echo 'Some data has already been output, can\'t send iCal file';
    }
    header('Content-Type: application/x-download');
    if (headers_sent()) {
        echo 'Some data has already been output, can\'t send iCal file';
    }
    header('Content-Length: ' . strlen($output));
    header('Content-Disposition: attachment; filename="' . $name . '"');
    header('Cache-Control: private, max-age=0, must-revalidate');
    header('Pragma: public');
    header('Content-Type: application/octet-stream');
    header('Content-Type: application/force-download');
    header('Content-type: application/pdf');
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Content-Transfer-Encoding: binary");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    ini_set('zlib.output_compression', '0');
    echo $output;
    die;
}
 /**
  * Method for parsing ini files
  *
  * @param		string	$filename Path and name of the ini file to parse
  *
  * @return	array		Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned
  *
  * @since		2.5
  */
 public static function parseFile($filename)
 {
     jimport('joomla.filesystem.file');
     if (!JFile::exists($filename)) {
         return array();
     }
     // Capture hidden PHP errors from the parsing
     $version = phpversion();
     $php_errormsg = null;
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     if ($version >= '5.3.1') {
         $contents = file_get_contents($filename);
         $contents = str_replace('_QQ_', '"\\""', $contents);
         $strings = @parse_ini_string($contents);
         if ($strings === false) {
             return array();
         }
     } else {
         $strings = @parse_ini_file($filename);
         if ($strings === false) {
             return array();
         }
         if ($version == '5.3.0' && is_array($strings)) {
             foreach ($strings as $key => $string) {
                 $strings[$key] = str_replace('_QQ_', '"', $string);
             }
         }
     }
     return $strings;
 }
 /**
  * testDocRef method
  *
  * @return void
  */
 public function testDocRef()
 {
     ini_set('docref_root', '');
     $this->assertEquals(ini_get('docref_root'), '');
     $debugger = new Debugger();
     $this->assertEquals(ini_get('docref_root'), 'http://php.net/');
 }
function disable_ob()
{
    // Turn off output buffering
    ini_set('output_buffering', 'off');
    // Turn off PHP output compression
    ini_set('zlib.output_compression', false);
    // Implicitly flush the buffer(s)
    ini_set('implicit_flush', true);
    ob_implicit_flush(true);
    // Clear, and turn off output buffering
    while (ob_get_level() > 0) {
        // Get the curent level
        $level = ob_get_level();
        // End the buffering
        ob_end_clean();
        // If the current level has not changed, abort
        if (ob_get_level() == $level) {
            break;
        }
    }
    // Disable apache output buffering/compression
    if (function_exists('apache_setenv')) {
        apache_setenv('no-gzip', '1');
        apache_setenv('dont-vary', '1');
    }
}
Example #26
0
 /**
  * Sets the time against which the session is measured. This function also
  * sets the cash_session_id internally as a mechanism for tracking analytics
  * against a consistent id, regardless of PHP session id.
  *
  * @return boolean
  */
 protected function startSession()
 {
     // begin PHP session
     if (!defined('STDIN')) {
         // no session for CLI, suckers
         @session_cache_limiter('nocache');
         $session_length = 3600;
         @ini_set("session.gc_maxlifetime", $session_length);
         @session_start();
     }
     $this->cash_session_timeout = ini_get("session.gc_maxlifetime");
     if (!isset($_SESSION['cash_session_id'])) {
         $modifier_array = array('deedee', 'johnny', 'joey', 'tommy', 'marky');
         $_SESSION['cash_session_id'] = $modifier_array[array_rand($modifier_array)] . '_' . rand(1000, 9999) . substr((string) time(), 4);
     }
     if (isset($_SESSION['cash_last_request_time'])) {
         if ($_SESSION['cash_last_request_time'] + $this->cash_session_timeout < time()) {
             $this->resetSession();
         }
     }
     $_SESSION['cash_last_request_time'] = time();
     if (!isset($GLOBALS['cash_script_store'])) {
         $GLOBALS['cash_script_store'] = array();
     }
     return true;
 }
Example #27
0
 /**
  * เรียกใช้งาน Class แบบสามารถเรียกได้ครั้งเดียวเท่านั้น
  *
  * @param array $config ค่ากำหนดของ แอพพลิเคชั่น
  * @return Singleton
  */
 public function __construct()
 {
     /* display error */
     if (defined('DEBUG') && DEBUG === true) {
         /* ขณะออกแบบ แสดง error และ warning ของ PHP */
         ini_set('display_errors', 1);
         ini_set('display_startup_errors', 1);
         error_reporting(-1);
     } else {
         /* ขณะใช้งานจริง */
         error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
     }
     /* config */
     self::$cfg = \Config::create();
     /* charset default UTF-8 */
     ini_set('default_charset', self::$char_set);
     if (extension_loaded('mbstring')) {
         mb_internal_encoding(self::$char_set);
     }
     /* inint Input */
     Input::normalizeRequest();
     // template ที่กำลังใช้งานอยู่
     Template::inint(Input::get($_GET, 'skin', self::$cfg->skin));
     /* time zone default Thailand */
     @date_default_timezone_set(self::$cfg->timezone);
 }
Example #28
0
 function iniciarSesion($session_name, $secure)
 {
     // Make sure the session cookie is not accessable via javascript.
     $httpunico = true;
     // Hash algorithm to use for the sessionid. (use hash_algos() to get a list of available hashes.)
     $sesion_hash = 'sha512';
     // Check if hash is available
     if (in_array($sesion_hash, hash_algos())) {
         // Set the has function.
         ini_set('session.hash_function', $sesion_hash);
     }
     // How many bits per character of the hash.
     // The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ",").
     ini_set('session.hash_bits_per_character', 5);
     // Force the session to only use cookies, not URL variables.
     ini_set('session.use_only_cookies', 1);
     // Get session cookie parameters
     $cookieParams = session_get_cookie_params();
     // Set the parameters
     session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httpunico);
     // Change the session name
     session_name($session_name);
     // Now we cat start the session
     session_start();
     // This line regenerates the session and delete the old one.
     // It also generates a new encryption key in the database.
 }
Example #29
0
 /**
  * Constructor. Starts PHP session handling in our own private store
  *
  * Side-effect: might set a cookie, so must be called before any other output.
  */
 public function __construct()
 {
     $this->typo3tempPath = PATH_site . 'typo3temp/';
     // Start our PHP session early so that hasSession() works
     $sessionSavePath = $this->getSessionSavePath();
     // Register our "save" session handler
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
     session_save_path($sessionSavePath);
     session_name($this->cookieName);
     ini_set('session.cookie_path', GeneralUtility::getIndpEnv('TYPO3_SITE_PATH'));
     // Always call the garbage collector to clean up stale session files
     ini_set('session.gc_probability', 100);
     ini_set('session.gc_divisor', 100);
     ini_set('session.gc_maxlifetime', $this->expireTimeInMinutes * 2 * 60);
     if (\TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSessionAutoStartEnabled()) {
         $sessionCreationError = 'Error: session.auto-start is enabled.<br />';
         $sessionCreationError .= 'The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:<br />';
         $sessionCreationError .= '<pre>php_value session.auto_start Off</pre>';
         throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587485);
     } elseif (defined('SID')) {
         $sessionCreationError = 'Session already started by session_start().<br />';
         $sessionCreationError .= 'Make sure no installed extension is starting a session in its ext_localconf.php or ext_tables.php.';
         throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587486);
     }
     session_start();
 }
 /**
  * 処理の読み込みを行う
  *
  * @return void
  */
 public static function load()
 {
     // E_DEPRECATED 定数 (for PHP < 5.3)
     // TODO バージョン互換処理に統合したい。
     if (!defined('E_DEPRECATED')) {
         define('E_DEPRECATED', 8192);
     }
     // エラーレベル設定 (PHPのログに対する指定であり、以降のエラーハンドリングには影響しない模様)
     // 開発時は -1 (全て) を推奨
     error_reporting(E_ALL & ~E_NOTICE & ~E_USER_NOTICE & ~E_DEPRECATED & ~E_STRICT);
     if (!(defined('SAFE') && SAFE === true) && !(defined('INSTALL_FUNCTION') && INSTALL_FUNCTION === true)) {
         // E_USER_ERROR または警告を捕捉した場合のエラーハンドラ
         set_error_handler(array(__CLASS__, 'handle_warning'), E_USER_ERROR | E_WARNING | E_USER_WARNING | E_CORE_WARNING | E_COMPILE_WARNING);
         // 実質的に PHP 5.2 以降かで処理が分かれる
         if (function_exists('error_get_last')) {
             // E_USER_ERROR 以外のエラーを捕捉した場合の処理用
             register_shutdown_function(array(__CLASS__, 'handle_error'));
             // 以降の処理では画面へのエラー表示は行なわない
             ini_set('display_errors', 0);
         } else {
             // エラー捕捉用の出力バッファリング
             ob_start(array(__CLASS__, '_fatal_error_handler'));
             ini_set('display_errors', 1);
         }
     }
 }