[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 // $Id: category.php 20295 2006-02-15 12:31:25Z $ 3 4 if (!function_exists('parseText')) 5 { 6 include('parse/main.php'); 7 } 8 // Add a page to a list of categories. 9 function add_to_category($page, $catlist) 10 { 11 global $pagestore, $Entity, $UserName, $REMOTE_ADDR, $FlgChr; 12 13 // Parse the category list for category names. 14 $parsed = parseText($catlist, array('parse_wikiname', 'parse_freelink'), ''); 15 $pagenames = array(); 16 preg_replace('/' . $FlgChr . '(\\d+)' . $FlgChr . '/e', 17 '$pagenames[]=$Entity[\\1][1]', $parsed); 18 19 if(validate_page($page) == 2) 20 { $page = '((' . $page . '))'; } 21 22 // Add it to each category. 23 foreach($pagenames as $category) 24 { 25 $pg = $pagestore->page($category); 26 27 $pg->read(); 28 if($pg->exists) 29 { 30 if(preg_match('/\\[\\[!.*\\]\\]/', $pg->text)) 31 { 32 if(!preg_match("/\\[\\[!.*$page.*\\]\\]/", $pg->text)) 33 { 34 $pg->text = preg_replace('/(\\[\\[!.*)\\]\\]/', 35 "\\1 $page]]", $pg->text); 36 } 37 else 38 { continue; } 39 } 40 else 41 { $pg->text = $pg->text . "\n[[! $page]]\n"; } 42 43 $pg->text = str_replace("\\", "\\\\", $pg->text); 44 $pg->text = str_replace("'", "\\'", $pg->text); 45 46 $pg->version++; 47 $pg->comment = ''; 48 $pg->hostname = gethostbyaddr($REMOTE_ADDR); 49 $pg->username = $UserName; 50 51 $pg->write(); 52 } 53 } 54 } 55 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |