includes/functions.php
changeset 685 17ebe24cdf85
parent 667 72818d2bf336
child 710 1fbce408813c
equal deleted inserted replaced
684:15dbbe7e7674 685:17ebe24cdf85
     1 <?php
     1 <?php
     2 
     2 
     3 /*
     3 /*
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     5  * Version 1.1.4 (Caoineag alpha 4)
     5  * Version 1.1.5 (Caoineag alpha 5)
     6  * Copyright (C) 2006-2008 Dan Fuhry
     6  * Copyright (C) 2006-2008 Dan Fuhry
     7  *
     7  *
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
    10  *
    10  *
  1369 }
  1369 }
  1370 
  1370 
  1371 /**
  1371 /**
  1372  * Tell which version of Enano we're running.
  1372  * Tell which version of Enano we're running.
  1373  * @param bool $long if true, uses English version names (e.g. alpha, beta, release candidate). If false (default) uses abbreviations (1.0a1, 1.0b3, 1.0RC2, etc.)
  1373  * @param bool $long if true, uses English version names (e.g. alpha, beta, release candidate). If false (default) uses abbreviations (1.0a1, 1.0b3, 1.0RC2, etc.)
       
  1374  * @param bool If true, prevents nightly build information from being appended, useful for upgrade/versioning checks.
  1374  * @return string
  1375  * @return string
  1375  */
  1376  */
  1376 
  1377 
  1377 function enano_version($long = false, $no_nightly = false)
  1378 function enano_version($long = false, $no_nightly = false)
  1378 {
  1379 {
  1411       '1.0.3'  => 'Dyrad',
  1412       '1.0.3'  => 'Dyrad',
  1412       '1.1.1'  => 'Caoineag alpha 1',
  1413       '1.1.1'  => 'Caoineag alpha 1',
  1413       '1.1.2'  => 'Caoineag alpha 2',
  1414       '1.1.2'  => 'Caoineag alpha 2',
  1414       '1.1.3'  => 'Caoineag alpha 3',
  1415       '1.1.3'  => 'Caoineag alpha 3',
  1415       '1.1.4'  => 'Caoineag alpha 4',
  1416       '1.1.4'  => 'Caoineag alpha 4',
       
  1417       '1.1.5'  => 'Caoineag alpha 5',
  1416     );
  1418     );
  1417   $version = enano_version();
  1419   $version = enano_version();
  1418   if ( isset($names[$version]) )
  1420   if ( isset($names[$version]) )
  1419   {
  1421   {
  1420     return $names[$version];
  1422     return $names[$version];
  2708         return $page_id;
  2710         return $page_id;
  2709       }
  2711       }
  2710     }
  2712     }
  2711   }
  2713   }
  2712   
  2714   
       
  2715   if ( empty($page_id) )
       
  2716     return '';
       
  2717   
  2713   // Remove character escapes
  2718   // Remove character escapes
  2714   $page_id = dirtify_page_id($page_id);
  2719   $page_id = dirtify_page_id($page_id);
  2715 
  2720 
  2716   $pid_clean = preg_replace('/[\w\.\/:;\(\)@\[\]_-]/', 'X', $page_id);
  2721   $pid_clean = preg_replace('/[\w\.\/:;\(\)@\[\]_-]/', 'X', $page_id);
  2717   $pid_dirty = enano_str_split($pid_clean, 1);
  2722   $pid_dirty = enano_str_split($pid_clean, 1);
  2718 
  2723   
  2719   foreach ( $pid_dirty as $id => $char )
  2724   foreach ( $pid_dirty as $id => $char )
  2720   {
  2725   {
  2721     if ( $char == 'X' )
  2726     if ( $char == 'X' )
  2722       continue;
  2727       continue;
  2723     $cid = ord($char);
  2728     $cid = ord($char);