Projet

Général

Profil

« Précédent | Suivant » 

Révision afe20e9f

IDafe20e9f14694e029fae3009bcef1eeb98b90c7b
Parent 2858c9fe
Enfant d4e538ff

Ajouté par Jocelyn Delande il y a plus de 10 ans

Moved error handling and autoloading outside of the utils::init() (__autoload was not working actuallly)

Fichiers

  • ajouté
  • modifié
  • copié
  • renommé
  • supprimé

Voir les différences

Révisions

class/site_point.class.php
1 1
<?php
2 2
require_once(dirname(__FILE__).'/../constants.inc.php');
3 3
require_once(dirname(__FILE__).'/utils.class.php');
4
utils::init();
5 4
//
6 5
class PanoramaFormatException extends Exception {
7 6
	/** If the files organization is not correct for a panorama, we can't let it go...
class/utils.class.php
1 1
<?php
2 2

  
3
abstract class utils {
4
  static public function init() {
5
    function __autoload($class) {
6
      $class_loc = 'class/'.$class.'.class.php';
7
      if (is_readable($class_loc)) {
8
	require_once($class_loc);
9
      }
10
    }
11

  
12
    function errorToException($code, $msg, $file, $line) {
13
      throw new Exception($msg);
14
    }
15
    set_error_handler('errorToException');
3
function __autoload($class) {
4
  $class_loc = 'class/'.$class.'.class.php';
5
  if (is_readable($class_loc)) {
6
	  require_once($class_loc);
16 7
  }
8
}
17 9

  
10
function errorToException($code, $msg, $file, $line) {
11
  throw new Exception($msg);
12
}
13
set_error_handler('errorToException');
14

  
15

  
16
abstract class utils {
18 17
  static public function list_available_panos($base_dir) {
19 18
	  /** Lists all that can be turned into a panorama
20 19
	   */
creerPano.php
13 13
      <h2>Liste des images transformables en panoramas</h2>
14 14
      <?php
15 15
require 'class/utils.class.php';
16
utils::init();
17 16

  
18 17
if(isset($_GET['dir']) && is_dir($_GET['dir'])) {
19 18
  $base_dir = $_GET['dir'];
index.php
15 15
require_once 'class/utils.class.php';
16 16
require_once 'constants.inc.php';
17 17
require_once('class/site_point.class.php');
18
utils::init();
19 18

  
20 19
if(isset($_GET['dir']) && is_dir($_GET['dir'])) {
21 20
  $base_dir = $_GET['dir'];
panorama.php
4 4
  <?php
5 5
   require 'class/utils.class.php';
6 6
   require_once 'constants.inc.php';
7
   utils::init();
8 7

  
9 8
   $form_extpoint = file_get_contents('html/form_extpoint.html');
10 9