[Vtigercrm-commits] [vtiger-commits] r6222 - in /vtigercrm/trunk/include: database/PearDatabase.php utils/utils.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat May 20 04:25:58 EDT 2006


Author: don
Date: Sat May 20 02:25:53 2006
New Revision: 6222

Log:
function added to remove the script tag

Modified:
    vtigercrm/trunk/include/database/PearDatabase.php
    vtigercrm/trunk/include/utils/utils.php

Modified: vtigercrm/trunk/include/database/PearDatabase.php
==============================================================================
--- vtigercrm/trunk/include/database/PearDatabase.php (original)
+++ vtigercrm/trunk/include/database/PearDatabase.php Sat May 20 02:25:53 2006
@@ -439,7 +439,7 @@
 		$result->Move($row);
 		$rowdata = $this->change_key_case($result->FetchRow());
 		//$this->println($rowdata);
-		$coldata = to_html($rowdata[$col]);
+		$coldata = strip_selected_tags($rowdata[$col],'script');
 		//$this->println("ADODB query_result ". $coldata);
 		return $coldata;
 	}

Modified: vtigercrm/trunk/include/utils/utils.php
==============================================================================
--- vtigercrm/trunk/include/utils/utils.php (original)
+++ vtigercrm/trunk/include/utils/utils.php Sat May 20 02:25:53 2006
@@ -2228,5 +2228,24 @@
 	}
 }
 
+/**   Function to remove the script tag in the contents
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________..
+ */
+function strip_selected_tags($text, $tags = array())
+{
+    $args = func_get_args();
+    $text = array_shift($args);
+    $tags = func_num_args() > 2 ? array_diff($args,array($text))  : (array)$tags;
+    foreach ($tags as $tag){
+        if(preg_match_all('/<'.$tag.'[^>]*>(.*)<\/'.$tag.'>/iU', $text, $found)){
+            $text = str_replace($found[0],$found[1],$text);
+        }
+    }
+
+    return $text;
+}
+
 
 ?>





More information about the vtigercrm-commits mailing list