removing trailing ?> from function scripts
[squirrelmail.git] / plugins / change_password / backend / ldap.php
index 7f4d4694ad5fbda452db10fcc8835817f4b60c81..fcfd30c9beae741dec0bb53e34ddd3c37b043c92 100644 (file)
@@ -1,24 +1,28 @@
 <?php
+
 /**
  * Change password LDAP backend
  *
+ * @copyright &copy; 2005-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
  * @subpackage change_password
  */
 
 /**
- * If SM_PATH isn't defined, define it.  Required to include files.
- * @ignore
+ * do not allow to call this file directly
  */
-if (!defined('SM_PATH')) define('SM_PATH','../../../');
+if ((isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) ||
+     (isset($HTTP_SERVER_SERVER['SCRIPT_FILENAME']) && $HTTP_SERVER_SERVER['SCRIPT_FILENAME'] == __FILE__) ) {
+    header("Location: ../../../src/login.php");
+    die();
+}
 
 /** load required functions */
 
-/** error_box() function */
-include_once(SM_PATH . 'functions/display_messages.php');
 /** sqimap_get_user_server() function */
-include_once(SM_PATH . 'functions/imap_general.php');
+include_once(SM_PATH . '../functions/imap_general.php');
 
 /** get imap server and username globals */
 global $imapServerAddress, $username;
@@ -154,27 +158,26 @@ $squirrelmail_plugin_hooks['change_password_init']['ldap'] =
  * Makes sure that required functions and configuration options are set.
  */
 function cpw_ldap_init() {
-    global $color;
-    global $cpw_ldap_basedn;
+    global $oTemplate, $cpw_ldap_basedn;
 
     // set initial value for error tracker
     $cpw_ldap_initerr=false;
 
     // check for ldap support in php
     if (! function_exists('ldap_connect')) {
-        error_box(_("Current configuration requires LDAP support in PHP."),$color);
+        error_box(_("Current configuration requires LDAP support in PHP."));
         $cpw_ldap_initerr=true;
     }
 
     // chech required configuration settings.
     if ($cpw_ldap_basedn=='') {
-        error_box(_("Plugin is not configured correctly."),$color);
+        error_box(_("Plugin is not configured correctly."));
         $cpw_ldap_initerr=true;
     }
 
     // if error var is positive, close html and stop execution
     if ($cpw_ldap_initerr) {
-        echo '</body></html>';
+        $oTemplate->display('footer.tpl');
         exit;
     }
 }
@@ -782,4 +785,3 @@ function cpw_ldap_compare_pass($pass_hash,$pass_clear,&$msgs) {
     }
     return $ret;
 }
-?>
\ No newline at end of file