+/**
+ * If magic_quotes_runtime is on, SquirrelMail breaks in new and creative ways.
+ * Force magic_quotes_runtime off.
+ * tassium@squirrelmail.org - I put it here in the hopes that all SM code includes this.
+ * If there's a better place, please let me know.
+ */
+ini_set('magic_quotes_runtime','0');
+
+/* Since we decided all IMAP servers must implement the UID command as defined in
+ * the IMAP RFC, we force $uid_support to be on.
+ */
+
+global $uid_support;
+$uid_support = true;
+
+sqsession_is_active();
+
+/* if running with magic_quotes_gpc then strip the slashes
+ from POST and GET global arrays */
+
+if (get_magic_quotes_gpc()) {
+ sqstripslashes($_GET);
+ sqstripslashes($_POST);
+}
+
+/* strip any tags added to the url from PHP_SELF.
+ This fixes hand crafted url XXS expoits for any
+ page that uses PHP_SELF as the FORM action */
+
+$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
+
+/**
+ * returns true if current php version is at mimimum a.b.c
+ *
+ * Called: check_php_version(4,1)
+ * @param int a major version number
+ * @param int b minor version number
+ * @param int c release number
+ * @return bool
+ */
+function check_php_version ($a = '0', $b = '0', $c = '0')
+{
+ return version_compare ( PHP_VERSION, "$a.$b.$c", 'ge' );
+}
+
+/**
+ * returns true if the current internal SM version is at minimum a.b.c
+ * These are plain integer comparisons, as our internal version is
+ * constructed by us, as an array of 3 ints.
+ *
+ * Called: check_sm_version(1,3,3)
+ * @param int a major version number
+ * @param int b minor version number
+ * @param int c release number
+ * @return bool
+ */
+function check_sm_version($a = 0, $b = 0, $c = 0)
+{
+ global $SQM_INTERNAL_VERSION;
+ if ( !isset($SQM_INTERNAL_VERSION) ||
+ $SQM_INTERNAL_VERSION[0] < $a ||
+ ( $SQM_INTERNAL_VERSION[0] == $a &&
+ $SQM_INTERNAL_VERSION[1] < $b) ||
+ ( $SQM_INTERNAL_VERSION[0] == $a &&
+ $SQM_INTERNAL_VERSION[1] == $b &&
+ $SQM_INTERNAL_VERSION[2] < $c ) ) {
+ return FALSE;