Changeset 891 for trunk/includes/Global.php
- Timestamp:
- Jan 13, 2023, 12:40:34 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/Global.php
r888 r891 10 10 include_once(dirname(__FILE__).'/../Application/UpdateTrace.php'); 11 11 include_once(dirname(__FILE__).'/PageEdit.php'); 12 require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php');13 12 14 13 // Back compatibility, will be removed … … 134 133 $DbRow = $DbResult->fetch_assoc(); 135 134 $lang = $DbRow['Code']; 136 $url = 'http ://translate.google.cz/?sl=en&tl='.$lang.'&text='.$text;135 $url = 'https://translate.google.cz/?sl=en&tl='.$lang.'&text='.$text; 137 136 138 137 error_reporting(E_ALL ^ E_WARNING); … … 786 785 else return $_SERVER['PHP_SELF']; 787 786 } 787 788 function ShowBBcodes($text) 789 { 790 // NOTE : I had to update this sample code with below line to prevent obvious attacks as pointed out by many users. 791 // Always ensure that user inputs are scanned and filtered properly. 792 $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); 793 794 // BBcode array 795 $find = array( 796 '~\[b\](.*?)\[/b\]~s', 797 '~\[i\](.*?)\[/i\]~s', 798 '~\[u\](.*?)\[/u\]~s', 799 '~\[quote\](.*?)\[/quote\]~s', 800 '~\[size=(.*?)\](.*?)\[/size\]~s', 801 '~\[color=(.*?)\](.*?)\[/color\]~s', 802 '~\[url\]((?:ftp|https?)://.*?)\[/url\]~s', 803 '~\[img\](https?://.*?\.(?:jpg|jpeg|gif|png|bmp))\[/img\]~s' 804 ); 805 806 // HTML tags to replace BBcode 807 $replace = array( 808 '<b>$1</b>', 809 '<i>$1</i>', 810 '<span style="text-decoration:underline;">$1</span>', 811 '<pre>$1</'.'pre>', 812 '<span style="font-size:$1px;">$2</span>', 813 '<span style="color:$1;">$2</span>', 814 '<a href="$1">$1</a>', 815 '<img src="$1" alt="" />' 816 ); 817 818 // Replacing the BBcodes with corresponding HTML tags 819 return preg_replace($find, $replace, $text); 820 }
Note:
See TracChangeset
for help on using the changeset viewer.