Ejemplo n.º 1
0
 /**
  * Starts the KeePassPHP application. Must be called before any other method
  * of KeePassPHP. If $debug is true, debug and error data will be added in
  * the static variable KeePassPHP::$errordump ; if $debug is false,
  * KeePass::$errordump will be non empty only if an error occurs.
  * Regardless of the value of $debug, the property KeePassPHP::$isError is
  * set to true if an error occurs. This way, a client application can check
  * if KeePassPHP detected an error, and retrieve some information from
  * KeePassPHP::$errordump (this information will probably not be useful
  * if $debug is false, though).
  * 
  * @param boolean $debug True to enable debug mode, false otherwise.
  */
 public static function init($debug = false)
 {
     if (self::$started) {
         return;
     }
     self::$isError = false;
     self::$debug = $debug;
     self::$errordump = "";
     HashHouse::setDefault(self::DEFAULT_HASH);
     self::$iconmanager = new IconManager(self::DIR_KEEPASSPHP . self::DIR_DATA . self::DIR_ICONS, self::PREFIX_ICON, false, false);
     self::$dbmanager = new FileManager(self::DIR_KEEPASSPHP . self::DIR_DATA . self::DIR_SECURE . self::DIR_KPHPDB, self::PREFIX_DATABASE, true, false);
     self::$kdbxmanager = new UploadManager(self::DIR_KEEPASSPHP . self::DIR_DATA . self::DIR_SECURE . self::DIR_KDBX, self::PREFEXT_KDBX);
     self::$keymanager = new UploadManager(self::DIR_KEEPASSPHP . self::DIR_DATA . self::DIR_SECURE . self::DIR_KEY, self::PREFEXT_KEY);
     self::$started = true;
     self::printDebug("KeePassPHP application started !");
 }