decir/common.php
author dan@fuhry
Wed, 13 Jun 2007 22:33:54 -0400
changeset 0 0417a5a0c7be
child 1 6f8b7c6fac02
permissions -rw-r--r--
Initial repository population
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     1
<?php
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     2
/*
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     3
 * Decir
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     4
 * Version 0.1
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     5
 * Copyright (C) 2007 Dan Fuhry
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     6
 * common.php - Loader and common basic functions
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     7
 *
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    10
 *
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    13
 */
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    14
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    15
if(!defined('DECIR_ROOT'))
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    16
{
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    17
  $_GET['title'] = 'null';
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    18
  header('HTTP/1.1 403 Forbidden');
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    19
  require('../includes/common.php');
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    20
  die_friendly('Access denied', '<p>This script cannot be run outside of Enano.</p>');
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    21
}
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    22
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    23
require('constants.php');
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    24
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    25
$html = '    <!-- Decir\'s updated namespace extractor function -->
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    26
    <script type="text/javascript">
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    27
      function strToPageID(string)
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    28
      {
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    29
        var ret;
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    30
        for(var i in namespace_list)
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    31
          if(namespace_list[i] != \'\')
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    32
            if(namespace_list[i] == string.substr(0, namespace_list[i].length))
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    33
              ret = [string.substr(namespace_list[i].length), i];
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    34
        
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    35
        if ( ret )
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    36
          return ret;
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    37
        
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    38
        return [string, \'Article\'];
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    39
      }
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    40
    </script>
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    41
  ';
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    42
  
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    43
$template->add_header($html);
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    44
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    45
?>