Пример #1
0
 /**
  * Returns server writable temporary directory, preferring to Joomla tmp if possible.
  *
  * @return  string  Path to temporary directory.
  */
 public static function tmpdir()
 {
     if (!self::$tmpdir) {
         // Find Apache writable temporary directory defaulting to Joomla.
         $temp = @tempnam(JFactory::getConfig()->get('tmp_path'), 'jj');
         // If the previous call fails, let's try system default instead.
         if ($temp === false) {
             $temp = @tempnam(sys_get_temp_dir(), 'jj');
         }
         // Set the temporary directory and remove created file.
         if ($temp !== false) {
             self::$apache = fileowner($temp);
             self::$tmpdir = dirname($temp);
             unlink($temp);
         }
     }
     return realpath(self::$tmpdir);
 }