summaryrefslogtreecommitdiffstats
path: root/code/links.inc.php
blob: 54d1dd98a5f30bc59c5cfb36f30e5b8110aee51f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?PHP
  Uses('user', 'pages');
  
  class Links {
    function GetNeonLink($page, $extra = '', $html = true) {
      if($GLOBALS['pages']->HasReadAccess($page)) {
        if($GLOBALS['user']->login_type == 'url')
          $ret = 'index.php?page=' . $page . '&login=' . $GLOBALS['user']->login_key
               . ($extra ? '&' . $extra : '');
        
        else
          $ret = 'index.php?page=' . $page . ($extra ? '&' . $extra : '');
        
        if($html) return htmlspecialchars($ret);
        
        return 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\'). '/' . $ret;
      }
      	
      return '';
    }
    
    function GetExternalLink($link) {
      return $link;
    }
    
    function GetMailtoLink($address) {
      return 'mailto:' . $address;
    }
  }
    
  $GLOBALS['links'] = new Links;
?>