ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilWikiUtil.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
18 define ("IL_WIKI_MODE_REPLACE", "replace");
19 define ("IL_WIKI_MODE_COLLECT", "collect");
20 define ("IL_WIKI_MODE_EXT_COLLECT", "ext_collect");
21 
31 {
32 
42  static function replaceInternalLinks($s, $a_wiki_id, $a_offline = false)
43  {
44  return ilWikiUtil::processInternalLinks($s, $a_wiki_id,
45  IL_WIKI_MODE_REPLACE, false, $a_offline);
46  }
47 
54  static function collectInternalLinks($s, $a_wiki_id, $a_collect_non_ex = false)
55  {
57  $a_collect_non_ex);
58  }
59 
67  static function processInternalLinks($s, $a_wiki_id,
68  $a_mode = IL_WIKI_MODE_REPLACE, $a_collect_non_ex = false,
69  $a_offline = false)
70  {
71  $collect = array();
72  // both from mediawiki DefaulSettings.php
73  $wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";
74 
75  // Adapter for media wiki classes
76  include_once("./Modules/Wiki/classes/class.ilMediaWikiAdapter.php");
77  $GLOBALS["wgContLang"] = new ilMediaWikiAdapter();
78  $GLOBALS["wgInterWikiCache"] = false;
79 
80  # the % is needed to support urlencoded titles as well
81  //$tc = Title::legalChars().'#%';
82  $tc = $wgLegalTitleChars.'#%';
83 
84  //$sk = $this->mOptions->getSkin();
85 
86  #split the entire text string on occurences of [[
87  $a = explode( '[[', ' ' . $s );
88  #get the first element (all text up to first [[), and remove the space we added
89  $s = array_shift( $a );
90  $s = substr( $s, 1 );
91 
92  # Match a link having the form [[namespace:link|alternate]]trail
93  $e1 = "/^([{$tc}]+)(?:\\|(.+?))?]](.*)\$/sD";
94 
95  # Match cases where there is no "]]", which might still be images
96 // static $e1_img = FALSE;
97 // if ( !$e1_img ) { $e1_img = "/^([{$tc}]+)\\|(.*)\$/sD"; }
98 
99  # Match the end of a line for a word that's not followed by whitespace,
100  # e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched
101 // $e2 = wfMsgForContent( 'linkprefix' );
102 
103 /* $useLinkPrefixExtension = $wgContLang->linkPrefixExtension();
104  if( is_null( $this->mTitle ) ) {
105  throw new MWException( __METHOD__.": \$this->mTitle is null\n" );
106  }
107  $nottalk = !$this->mTitle->isTalkPage();*/
108  $nottalk = true;
109 
110 /* if ( $useLinkPrefixExtension ) {
111  $m = array();
112  if ( preg_match( $e2, $s, $m ) ) {
113  $first_prefix = $m[2];
114  } else {
115  $first_prefix = false;
116  }
117  } else {*/
118  $prefix = '';
119 // }
120 
121 /* if($wgContLang->hasVariants()) {
122  $selflink = $wgContLang->convertLinkToAllVariants($this->mTitle->getPrefixedText());
123  } else {
124  $selflink = array($this->mTitle->getPrefixedText());
125  }
126  $useSubpages = $this->areSubpagesAllowed();
127  wfProfileOut( $fname.'-setup' );
128 */
129  $useSubpages = false;
130 
131  # Loop for each link
132  for ($k = 0; isset( $a[$k] ); $k++)
133  {
134  $line = $a[$k];
135 
136 /* if ( $useLinkPrefixExtension ) {
137  wfProfileIn( $fname.'-prefixhandling' );
138  if ( preg_match( $e2, $s, $m ) ) {
139  $prefix = $m[2];
140  $s = $m[1];
141  } else {
142  $prefix='';
143  }
144  # first link
145  if($first_prefix) {
146  $prefix = $first_prefix;
147  $first_prefix = false;
148  }
149  wfProfileOut( $fname.'-prefixhandling' );
150  }*/
151 
152  $might_be_img = false;
153 
154  //wfProfileIn( "$fname-e1" );
155  if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
156  $text = $m[2];
157  # If we get a ] at the beginning of $m[3] that means we have a link that's something like:
158  # [[Image:Foo.jpg|[http://example.com desc]]] <- having three ] in a row fucks up,
159  # the real problem is with the $e1 regex
160  # See bug 1300.
161  #
162  # Still some problems for cases where the ] is meant to be outside punctuation,
163  # and no image is in sight. See bug 2095.
164  #
165  if( $text !== '' &&
166  substr( $m[3], 0, 1 ) === ']' &&
167  strpos($text, '[') !== false
168  )
169  {
170  $text .= ']'; # so that replaceExternalLinks($text) works later
171  $m[3] = substr( $m[3], 1 );
172  }
173  # fix up urlencoded title texts
174  if( strpos( $m[1], '%' ) !== false ) {
175  # Should anchors '#' also be rejected?
176  $m[1] = str_replace( array('<', '>'), array('&lt;', '&gt;'), urldecode($m[1]) );
177  }
178  $trail = $m[3];
179 /* } elseif( preg_match($e1_img, $line, $m) ) { # Invalid, but might be an image with a link in its caption
180  $might_be_img = true;
181  $text = $m[2];
182  if ( strpos( $m[1], '%' ) !== false ) {
183  $m[1] = urldecode($m[1]);
184  }
185  $trail = "";*/
186  } else { # Invalid form; output directly
187  $s .= $prefix . '[[' . $line ;
188  //wfProfileOut( "$fname-e1" );
189  continue;
190  }
191  //wfProfileOut( "$fname-e1" );
192  //wfProfileIn( "$fname-misc" );
193 
194  # Don't allow internal links to pages containing
195  # PROTO: where PROTO is a valid URL protocol; these
196  # should be external links.
197  if (preg_match('/^\b(?:' . ilWikiUtil::wfUrlProtocols() . ')/', $m[1])) {
198  $s .= $prefix . '[[' . $line ;
199  continue;
200  }
201 
202  # Make subpage if necessary
203 /* if( $useSubpages ) {
204  $link = $this->maybeDoSubpageLink( $m[1], $text );
205  } else {*/
206  $link = $m[1];
207 // }
208 
209  $noforce = (substr($m[1], 0, 1) != ':');
210  if (!$noforce) {
211  # Strip off leading ':'
212  $link = substr($link, 1);
213  }
214 
215 // wfProfileOut( "$fname-misc" );
216 // wfProfileIn( "$fname-title" );
217 
218  // todo
219  include_once("./Modules/Wiki/mediawiki/Title.php");
220  include_once("./Services/Utilities/classes/Sanitizer.php");
221  //$nt = Title::newFromText( $this->mStripState->unstripNoWiki($link) );
222 
223  // todo: check step by step
224 //echo "<br>".htmlentities($link)."---";
225  $nt = Title::newFromText($link);
226 
227  if( !$nt ) {
228  $s .= $prefix . '[[' . $line;
229  //wfProfileOut( "$fname-title" );
230  continue;
231  }
232 
233 /* $ns = $nt->getNamespace();
234  $iw = $nt->getInterWiki();
235  wfProfileOut( "$fname-title" );
236 
237 /* if ($might_be_img) { # if this is actually an invalid link
238  wfProfileIn( "$fname-might_be_img" );
239  if ($ns == NS_IMAGE && $noforce) { #but might be an image
240  $found = false;
241  while (isset ($a[$k+1]) ) {
242  #look at the next 'line' to see if we can close it there
243  $spliced = array_splice( $a, $k + 1, 1 );
244  $next_line = array_shift( $spliced );
245  $m = explode( ']]', $next_line, 3 );
246  if ( count( $m ) == 3 ) {
247  # the first ]] closes the inner link, the second the image
248  $found = true;
249  $text .= "[[{$m[0]}]]{$m[1]}";
250  $trail = $m[2];
251  break;
252  } elseif ( count( $m ) == 2 ) {
253  #if there's exactly one ]] that's fine, we'll keep looking
254  $text .= "[[{$m[0]}]]{$m[1]}";
255  } else {
256  #if $next_line is invalid too, we need look no further
257  $text .= '[[' . $next_line;
258  break;
259  }
260  }
261  if ( !$found ) {
262  # we couldn't find the end of this imageLink, so output it raw
263  #but don't ignore what might be perfectly normal links in the text we've examined
264  $text = $this->replaceInternalLinks($text);
265  $s .= "{$prefix}[[$link|$text";
266  # note: no $trail, because without an end, there *is* no trail
267  wfProfileOut( "$fname-might_be_img" );
268  continue;
269  }
270  } else { #it's not an image, so output it raw
271  $s .= "{$prefix}[[$link|$text";
272  # note: no $trail, because without an end, there *is* no trail
273  wfProfileOut( "$fname-might_be_img" );
274  continue;
275  }
276  wfProfileOut( "$fname-might_be_img" );
277  }
278 */
279 
280  $wasblank = ( '' == $text );
281  if( $wasblank ) $text = $link;
282 
283  # Link not escaped by : , create the various objects
284  if( $noforce ) {
285  # Interwikis
286  /*wfProfileIn( "$fname-interwiki" );
287  if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgContLang->getLanguageName( $iw ) ) {
288  $this->mOutput->addLanguageLink( $nt->getFullText() );
289  $s = rtrim($s . $prefix);
290  $s .= trim($trail, "\n") == '' ? '': $prefix . $trail;
291  wfProfileOut( "$fname-interwiki" );
292  continue;
293  }
294  wfProfileOut( "$fname-interwiki" );*/
295 
296 /* if ( $ns == NS_IMAGE ) {
297  wfProfileIn( "$fname-image" );
298  if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
299  # recursively parse links inside the image caption
300  # actually, this will parse them in any other parameters, too,
301  # but it might be hard to fix that, and it doesn't matter ATM
302  $text = $this->replaceExternalLinks($text);
303  $text = $this->replaceInternalLinks($text);
304 
305  # cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
306  $s .= $prefix . $this->armorLinks( $this->makeImage( $nt, $text ) ) . $trail;
307  $this->mOutput->addImage( $nt->getDBkey() );
308 
309  wfProfileOut( "$fname-image" );
310  continue;
311  } else {
312  # We still need to record the image's presence on the page
313  $this->mOutput->addImage( $nt->getDBkey() );
314  }
315  wfProfileOut( "$fname-image" );
316 
317  }
318 */
319 /* if ( $ns == NS_CATEGORY ) {
320  wfProfileIn( "$fname-category" );
321  $s = rtrim($s . "\n"); # bug 87
322 
323  if ( $wasblank ) {
324  $sortkey = $this->getDefaultSort();
325  } else {
326  $sortkey = $text;
327  }
328  $sortkey = Sanitizer::decodeCharReferences( $sortkey );
329  $sortkey = str_replace( "\n", '', $sortkey );
330  $sortkey = $wgContLang->convertCategoryKey( $sortkey );
331  $this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
332 */
337 // $s .= trim($prefix . $trail, "\n") == '' ? '': $prefix . $trail;
338 
339 // wfProfileOut( "$fname-category" );
340 // continue;
341 // }
342  }
343 
344  # Self-link checking
345 /* if( $nt->getFragment() === '' ) {
346  if( in_array( $nt->getPrefixedText(), $selflink, true ) ) {
347  $s .= $prefix . $sk->makeSelfLinkObj( $nt, $text, '', $trail );
348  continue;
349  }
350  }*/
351 
352  # Special and Media are pseudo-namespaces; no pages actually exist in them
353 /* if( $ns == NS_MEDIA ) {
354  $link = $sk->makeMediaLinkObj( $nt, $text );
355  # Cloak with NOPARSE to avoid replacement in replaceExternalLinks
356  $s .= $prefix . $this->armorLinks( $link ) . $trail;
357  $this->mOutput->addImage( $nt->getDBkey() );
358  continue;
359  } elseif( $ns == NS_SPECIAL ) {
360  $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix );
361  continue;
362  } elseif( $ns == NS_IMAGE ) {
363  $img = new Image( $nt );
364  if( $img->exists() ) {
365  // Force a blue link if the file exists; may be a remote
366  // upload on the shared repository, and we want to see its
367  // auto-generated page.
368  $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix );
369  $this->mOutput->addLink( $nt );
370  continue;
371  }
372  }*/
373 
374  // Media wiki performs an intermediate step here (Parser->makeLinkHolder)
375  if ($a_mode == IL_WIKI_MODE_REPLACE)
376  {
377  $s .= ilWikiUtil::makeLink($nt, $a_wiki_id, $text, '', $trail, $prefix,
378  $a_offline);
379 //echo "<br>-".htmlentities($s)."-";
380  }
381  if ($a_mode == IL_WIKI_MODE_EXT_COLLECT)
382  {
383  if (is_object($nt))
384  {
385  $url_title = ilWikiUtil::makeUrlTitle($nt->mTextform);
386  $db_title = ilWikiUtil::makeDbTitle($nt->mTextform);
387  list( $inside, $trail ) = ilWikiUtil::splitTrail( $trail );
388  $collect[] = array("nt" => $nt, "text" => $text,
389  "trail" => $trail, "db_title" => $db_title,
390  "url_title" => $url_title);
391  }
392  }
393  else
394  {
395  $url_title = ilWikiUtil::makeUrlTitle($nt->mTextform);
396  $db_title = ilWikiUtil::makeDbTitle($nt->mTextform);
397 
398  //$s .= ilWikiUtil::makeLink($nt, $a_wiki_id, $text, '', $trail, $prefix);
399  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
400  if ((ilWikiPage::_wikiPageExists($a_wiki_id, $db_title) ||
401  $a_collect_non_ex)
402  &&
403  !in_array($db_title, $collect))
404  {
405  $collect[] = $db_title;
406  }
407  }
408  }
409 
410  //wfProfileOut( $fname );
411 
412  if ($a_mode == IL_WIKI_MODE_COLLECT ||
413  $a_mode == IL_WIKI_MODE_EXT_COLLECT)
414  {
415  return $collect;
416  }
417  else
418  {
419  return $s;
420  }
421  }
422 
426  function removeUnsafeCharacters($a_str)
427  {
428  return str_replace(array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"), "", $a_str);
429  }
430 
440  static function makeLink( &$nt, $a_wiki_id, $text = '', $query = '', $trail = '', $prefix = '',
441  $a_offline = false)
442  {
443  global $ilCtrl;
444 
445  //wfProfileIn( __METHOD__ );
446  if ( ! is_object($nt) ) {
447  # Fail gracefully
448  $retVal = "<!-- ERROR -->{$prefix}{$text}{$trail}";
449  } else {
450 
451 //var_dump($trail);
452 //var_dump($nt);
453 
454  // remove anchor from text, define anchor
455  $anc = "";
456  if ($nt->mFragment != "")
457  {
458  if (substr($text, strlen($text) - strlen("#".$nt->mFragment))
459  == "#".$nt->mFragment)
460  {
461  $text = substr($text, 0, strlen($text) - strlen("#".$nt->mFragment));
462  $anc = "#".$nt->mFragment;
463  }
464  else
465  {
466  $anc = "#".$nt->mFragment;
467  }
468  }
469 
470  # Separate the link trail from the rest of the link
471  list( $inside, $trail ) = ilWikiUtil::splitTrail( $trail );
472 
473  //$retVal = '***'.$text."***".$trail;
474  $url_title = ilWikiUtil::makeUrlTitle($nt->mTextform);
475  $db_title = ilWikiUtil::makeDbTitle($nt->mTextform);
476  if ($db_title != "")
477  {
478  $pg_exists = ilWikiPage::_wikiPageExists($a_wiki_id, $db_title);
479  }
480  else
481  {
482  // links on same page (only anchor used)
483  $pg_exists = true;
484  }
485 
486 //var_dump($nt);
487 //var_dump($inside);
488 //var_dump($trail);
489  $wiki_link_class = (!$pg_exists)
490  ? ' class="ilWikiPageMissing" ' : "";
491 
492  if (!$a_offline)
493  {
494  if ($url_title != "")
495  {
496  $ilCtrl->setParameterByClass("ilobjwikigui", "page", $url_title);
497  $retVal = '<a '.$wiki_link_class.' href="'.
498  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoPage").$anc.
499  '">'.$text.'</a>'.$trail;
500  }
501  else
502  {
503  $retVal = '<a '.$wiki_link_class.' href="'.
504  $anc.
505  '">'.$text.'</a>'.$trail;
506  }
507  }
508  else
509  {
510  if ($pg_exists)
511  {
512  if ($db_title != "")
513  {
514  $pg_id = ilWikiPage::getIdForPageTitle($a_wiki_id, $db_title);
515  $retVal = '<a '.$wiki_link_class.' href="'.
516  "wpg_".$pg_id.".html".$anc.
517  '">'.$text.'</a>'.$trail;
518  }
519  else
520  {
521  $retVal = '<a '.$wiki_link_class.' href="'.
522  $anc.
523  '">'.$text.'</a>'.$trail;
524  }
525  }
526  else
527  {
528  $retVal = $text.$trail;
529  }
530  }
531 
532 //$ilCtrl->debug("ilWikiUtil::makeLink:-$inside-$trail-");
533 /* if ( $nt->isExternal() ) {
534  $nr = array_push( $this->mInterwikiLinkHolders['texts'], $prefix.$text.$inside );
535  $this->mInterwikiLinkHolders['titles'][] = $nt;
536  $retVal = '<!--IWLINK '. ($nr-1) ."-->{$trail}";
537  } else {
538  $nr = array_push( $this->mLinkHolders['namespaces'], $nt->getNamespace() );
539  $this->mLinkHolders['dbkeys'][] = $nt->getDBkey();
540  $this->mLinkHolders['queries'][] = $query;
541  $this->mLinkHolders['texts'][] = $prefix.$text.$inside;
542  $this->mLinkHolders['titles'][] = $nt;
543 
544  $retVal = '<!--LINK '. ($nr-1) ."-->{$trail}";
545  }
546 */
547  }
548  //wfProfileOut( __METHOD__ );
549  return $retVal;
550  }
551 
555  static function wfUrlProtocols()
556  {
557  $wgUrlProtocols = array(
558  'http://',
559  'https://',
560  'ftp://',
561  'irc://',
562  'gopher://',
563  'telnet://', // Well if we're going to support the above.. -ævar
564  'nntp://', // @bug 3808 RFC 1738
565  'worldwind://',
566  'mailto:',
567  'news:'
568  );
569 
570  // Support old-style $wgUrlProtocols strings, for backwards compatibility
571  // with LocalSettings files from 1.5
572  if ( is_array( $wgUrlProtocols ) ) {
573  $protocols = array();
574  foreach ($wgUrlProtocols as $protocol)
575  $protocols[] = preg_quote( $protocol, '/' );
576 
577  return implode( '|', $protocols );
578  } else {
579  return $wgUrlProtocols;
580  }
581  }
582 
586  public static function wfUrlencode ( $s )
587  {
588  $s = urlencode( $s );
589 // $s = preg_replace( '/%3[Aa]/', ':', $s );
590 // $s = preg_replace( '/%2[Ff]/', '/', $s );
591 
592  return $s;
593  }
594 
595 
599  static function makeDbTitle($a_par)
600  {
601  $a_par = ilWikiUtil::removeUnsafeCharacters($a_par);
602  return str_replace("_", " ", $a_par);
603  }
604 
608  static function makeUrlTitle($a_par)
609  {
610  $a_par = ilWikiUtil::removeUnsafeCharacters($a_par);
611  $a_par = str_replace(" ", "_", $a_par);
612  return ilWikiUtil::wfUrlencode($a_par);
613  }
614 
615  // from Linker.php
616  static function splitTrail( $trail )
617  {
618  /*static $regex = false;
619  if ( $regex === false ) {
620  global $wgContLang;
621  $regex = $wgContLang->linkTrail();
622  }*/
623  $regex = '/^([a-z]+)(.*)$/sD';
624 
625  $inside = '';
626  if ( '' != $trail ) {
627  $m = array();
628 
629  if ( preg_match( $regex, $trail, $m ) ) {
630  $inside = $m[1];
631  $trail = $m[2];
632  }
633  }
634 
635  return array( $inside, $trail );
636  }
637 
638  static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
639  {
640  global $ilUser, $ilObjDataCache, $ilAccess;
641 
642  include_once "./Services/Notification/classes/class.ilNotification.php";
643  include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
644  include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
645 
646  $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
647  $wiki = new ilObjWiki($a_wiki_ref_id, true);
648  $page = new ilWikiPage($a_page_id);
649 
650  // #11138
651  $ignore_threshold = ($a_action == "comment");
652 
653  if($a_type == ilNotification::TYPE_WIKI_PAGE)
654  {
655  $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
656  $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
657  $users = array_merge($users, $wiki_users);
658  if(!sizeof($users))
659  {
660  return;
661  }
662 
664  }
665  else
666  {
667  $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
668  if(!sizeof($users))
669  {
670  return;
671  }
672  }
673 
675 
676  // #15192 - should always be present
677  if($a_page_id)
678  {
679  include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
680  $link = ILIAS_HTTP_PATH."/".ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
681  }
682  else
683  {
684  include_once "./Services/Link/classes/class.ilLink.php";
685  $link = ilLink::_getLink($a_wiki_ref_id);
686  }
687 
688  include_once "./Services/Mail/classes/class.ilMail.php";
689  include_once "./Services/User/classes/class.ilObjUser.php";
690  include_once "./Services/Language/classes/class.ilLanguageFactory.php";
691  include_once("./Services/User/classes/class.ilUserUtil.php");
692 
693  foreach(array_unique($users) as $idx => $user_id)
694  {
695  if($user_id != $ilUser->getId() &&
696  $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id))
697  {
698  // use language of recipient to compose message
699  $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
700  $ulng->loadLanguageModule('wiki');
701 
702  $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle());
703  $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id))."\n\n";
704 
705  if($a_type == ilNotification::TYPE_WIKI_PAGE)
706  {
707  // update/delete
708  $message .= $ulng->txt('wiki_change_notification_page_body_'.$a_action).":\n\n";
709  $message .= $ulng->txt('wiki').": ".$wiki->getTitle()."\n";
710  $message .= $ulng->txt('page').": ".$page->getTitle()."\n";
711  $message .= $ulng->txt('wiki_changed_by').": ".ilUserUtil::getNamePresentation($ilUser->getId())."\n";
712 
713  // include comment/note text
714  if($a_comment)
715  {
716  $message .= "\n".$ulng->txt('comment').":\n\"".trim($a_comment)."\"\n";
717  }
718 
719  $message .= "\n".$ulng->txt('wiki_change_notification_page_link').": ".$link;
720  }
721  else
722  {
723  // new
724  $message .= $ulng->txt('wiki_change_notification_body_'.$a_action).":\n\n";
725  $message .= $ulng->txt('wiki').": ".$wiki->getTitle()."\n";
726  $message .= $ulng->txt('page').": ".$page->getTitle()."\n";
727  $message .= $ulng->txt('wiki_changed_by').": ".ilUserUtil::getNamePresentation($ilUser->getId())."\n\n";
728  $message .= $ulng->txt('wiki_change_notification_link').": ".$link;
729  }
730 
731  $mail_obj = new ilMail(ANONYMOUS_USER_ID);
732  $mail_obj->appendInstallationSignature(true);
733  $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id),
734  "", "", $subject, $message, array(), array("system"));
735  }
736  else
737  {
738  unset($users[$idx]);
739  }
740  }
741  }
742 }
743 
744 ?>