Exemplo n.º 1
0
 /**
  * Creates a new file logger.
  *
  * @param   string  $directory log directory
  * @param   string  $filename log filename
  * @return  void
  */
 public function __construct($directory, $filename = NULL)
 {
     if (!is_dir($directory)) {
         if (!mkdir($directory, 0700, TRUE) || !is_writable($directory)) {
             throw new KoException('Directory :dir must be writable', array(':dir' => Ko::debug_path($directory)));
         }
     }
     // Determine the directory path && filename.
     $this->_directory = realpath($directory) . '/';
     if (!is_null($filename) && !empty($filename)) {
         $this->_filename = $filename;
     }
 }
Exemplo n.º 2
0
?>
')">Loaded extensions</a> (<?php 
echo count($included);
?>
)</h3>
		<div id="<?php 
echo $env_id;
?>
" class="collapsed">
			<table cellspacing="0">
				<?php 
foreach ($included as $file) {
    ?>
				<tr>
					<td><code><?php 
    echo Ko::debug_path($file);
    ?>
</code></td>
				</tr>
				<?php 
}
?>
			</table>
		</div>
		<?php 
foreach (array('_SESSION', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER') as $var) {
    ?>
		<?php 
    if (empty($GLOBALS[$var]) or !is_array($GLOBALS[$var])) {
        continue;
    }
Exemplo n.º 3
0
 /**
  * Save the image. If the filename is omitted, the original image will
  * be overwritten.
  *
  * @param   string   new image path
  * @param   integer  quality of image: 1-100
  * @return  boolean
  */
 public function save($file = NULL, $quality = 100)
 {
     if ($file === NULL) {
         // Overwrite the file
         $file = $this->file;
     }
     if (is_file($file)) {
         if (!is_writable($file)) {
             throw new KoException('File must be writable: :file', array(':file' => Ko::debug_path($file)));
         }
     } else {
         // Get the directory of the file
         $directory = realpath(pathinfo($file, PATHINFO_DIRNAME));
         if (!is_dir($directory) or !is_writable($directory)) {
             throw new KoException('Directory must be writable: :directory', array(':directory' => Ko::debug_path($directory)));
         }
     }
     return $this->_do_save($file, $quality);
 }