Changeset 877 for trunk/www/controllers/textblock.php
- Timestamp:
- 12/26/07 04:28:00 (4 years ago)
- File:
-
- 1 edited
-
trunk/www/controllers/textblock.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/controllers/textblock.php
r852 r877 4 4 require_once(IA_ROOT_DIR . "common/db/textblock.php"); 5 5 require_once(IA_ROOT_DIR . "common/textblock.php"); 6 require_once(IA_ROOT_DIR . "common/diff.php"); 6 7 7 // smart ass diff8 function string_diff($string1, $string2) {9 $name1 = tempnam(IA_ROOT_DIR.'attach/', "ia");10 $name2 = tempnam(IA_ROOT_DIR.'attach/', "ia");11 $fp1 = fopen($name1, "w");12 if (!$fp1) {13 flash_error("Eroare la comparare!");14 request(url_home());15 }16 $string1 .= "\n";17 fputs($fp1, $string1);18 fclose($fp1);19 20 $fp2 = fopen($name2, "w");21 if (!$fp2) {22 flash_error("Eroare la comparare!");23 request(url_home());24 }25 $string2 .= "\n";26 fputs($fp2, $string2);27 fclose($fp2);28 29 ob_start();30 system("diff -au ".$name1." ".$name2);31 $ret = ob_get_contents();32 ob_end_clean();33 if (!unlink($name1)) {34 flash_error("Eroare la comparare!");35 request(url_home());36 }37 if (!unlink($name2)) {38 flash_error("Eroare la comparare!");39 request(url_home());40 }41 return $ret;42 }43 8 44 9 // View a plain textblock. … … 126 91 log_assert_valid(textblock_validate($revto)); 127 92 128 $diff_title = string_diff( $revfrom['title'], $revto['title']);129 $diff_content = string_diff( $revfrom['text'], $revto['text']);93 $diff_title = string_diff(array($revfrom['title'], $revto['title'])); 94 $diff_content = string_diff(array($revfrom['text'], $revto['text'])); 130 95 131 96 $view = array(); … … 134 99 $view['revfrom_id'] = $revfrom_id; 135 100 $view['revto_id'] = $revto_id; 136 $view['diff_title'] = explode("\n", $diff_title);137 $view['diff_content'] = explode("\n", $diff_content);101 $view['diff_title'] = $diff_title; 102 $view['diff_content'] = $diff_content; 138 103 execute_view_die('views/textblock_diff.php', $view); 139 104 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)