Exemplo n.º 1
0
 /**
  * Initialize autoloading for Padl.
  *
  * This is designed to play nicely with other autoloaders.
  *
  * @return void
  */
 public static function init()
 {
     if (self::$library == null) {
         self::$library = new PadlLibrary();
     }
     return self::$library;
 }
Exemplo n.º 2
0
 /**
  * Load class
  * 
  * @param string $dir   The directory to load
  * @param string $class The class name
  * 
  * @return void
  */
 private static function loadClass($dir, $class)
 {
     $file = PadlLibrary::getPath() . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $class . '.php';
     if (file_exists($file) && is_file($file)) {
         require_once $file;
     }
 }
Exemplo n.º 3
0
 /**
  * Autoload class
  * 
  * @param string $class The class name
  * 
  * @return boolean 
  */
 function __autoload($class)
 {
     $dirs = array('Padl');
     foreach ($dirs as $d) {
         $file = PadlLibrary::getPath() . DIRECTORY_SEPARATOR . $d . DIRECTORY_SEPARATOR . $class . '.php';
         if (file_exists($file) && is_file($file)) {
             require_once $file;
             return true;
         }
     }
     return false;
 }
Exemplo n.º 4
0
    echo $_POST['dateLimitMonth'];
    ?>
 - <?php 
    echo $_POST['dateLimitDay'];
    ?>
 - <?php 
    echo $_POST['dateLimitYear'];
    ?>
</dd>
            
        </dl>
        
    <?php 
    // register autoload
    include_once '../src/PHP5.2/Padl/PadlLibrary.php';
    PadlLibrary::init();
    // gets the data and transform to boolean
    $domain = $_POST['domain'];
    $useMcrypt = $_POST['useMcrypt'] == 'true' ? true : false;
    $useTime = $_POST['useTime'] == 'true' ? true : false;
    $useServer = $_POST['useServer'] == 'true' ? true : false;
    $allowLocal = $_POST['allowLocal'] == 'true' ? true : false;
    // calculates the time offset (expire_in)
    $now = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'));
    $dateLimit = mktime(23, 59, 59, $_POST['dateLimitMonth'], $_POST['dateLimitDay'], $_POST['dateLimitYear']);
    $expireIn = $dateLimit - $now;
    // instatiate the class
    $padl = new PadlLicense($useMcrypt, $useTime, $useServer, $allowLocal);
    // copy the server vars (important for security, see note below)
    $server_array = $_SERVER;
    // set the server vars