decir/common.php
author Dan
Wed, 17 Oct 2007 21:52:27 -0400
changeset 2 253118325c65
parent 1 6f8b7c6fac02
permissions -rw-r--r--
Pagination on topics and a whole crapload of other stuff.
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');
1
6f8b7c6fac02 Let's just say: major progress and still only 20% complete. So many changes I forgot to commit.
Dan
parents: 0
diff changeset
    24
require('functions.php');
0
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    25
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    26
$html = '    <!-- Decir\'s updated namespace extractor function -->
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    27
    <script type="text/javascript">
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    28
      function strToPageID(string)
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    29
      {
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    30
        var ret;
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    31
        for(var i in namespace_list)
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    32
          if(namespace_list[i] != \'\')
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    33
            if(namespace_list[i] == string.substr(0, namespace_list[i].length))
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    34
              ret = [string.substr(namespace_list[i].length), i];
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    35
        
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    36
        if ( ret )
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    37
          return ret;
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    38
        
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    39
        return [string, \'Article\'];
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    40
      }
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    41
    </script>
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    42
  ';
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    43
  
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    44
$template->add_header($html);
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    45
0417a5a0c7be Initial repository population
dan@fuhry
parents:
diff changeset
    46
?>