root/trunk/dotnode-xml.php

Revision 33, 3.3 KB (checked in by alexx, 5 years ago)
  • Auth: Remove MySQL PASSWORD hashing method to hash password, replace by MD5 hashing, add code to make a smooth transition between hashing method
  • XML engine: Fix a trivial recent bug in dotnode-xml.php
  • Robots: fix a bug in crontab script robots/launch_robots.sh (add cd dirname $0)
  • CSS: Add max_width to image in blog (work on Mozilla/*, Opera but not good on Safari (no proportional resizing), of course, that doesn't work on IE)
  • DB: changing DB structure !!!
    ALTER TABLE `user` ADD `passwd_md5` CHAR( 32 ) NOT NULL AFTER `passwd` ;
    ALTER TABLE `user` CHANGE `passwd` `passwd` VARCHAR( 42 ) NULL ;
    ALTER TABLE `dntp_translator` ADD `passwd_md5` CHAR( 32 ) NOT NULL AFTER `passwd` ;
    ALTER TABLE `dntp_translator` CHANGE `passwd` `passwd` VARCHAR( 42 ) NULL ;
    
Line 
1<?php
2/****************************************************** Open .node ***
3 * Description:   
4 * Status:        Stable.
5 * Author:        Alexandre Dath <alexandre@dotnode.com>
6 * $Id$
7 *
8 * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************** http://opensource.ikse.net/projects/dotnode ***/
24
25include('../includes/includes.inc.php');
26include('../includes/config/xml.inc.php');
27
28$_SERVER['HTTP_HOST'] = ereg_replace(":80$", '', $_SERVER['HTTP_HOST']);
29$requested_site = ereg_replace("^www\.", '', $_SERVER['HTTP_HOST']);
30ereg("(.*)\.${config['domain']}$", $requested_site, $regs);
31
32$login = $regs[1];
33
34$smarty = new Smarty_dotnode;
35$smarty->template_dir = SMARTYPATH.'/templates_xml/';
36$smarty->compile_id = 'xml';
37$smarty->caching = true;
38
39session_start();
40
41if( !$smarty->is_cached('index.tpl',$login.'.'.$_SERVER['PHP_SELF']) )
42{
43    $token = retreive_url_info($_SERVER['PHP_SELF']);
44    array_splice($token, 0, 1);
45
46    if(strlen($token[0]) == 32)
47        list($url_id) = array_splice($token, 0, 1);
48
49    for($idx=(count($token)-1); $idx>=0; $idx--)
50    {
51        $inc = "";
52        for($level=0; $level<=$idx; $level++)
53            $inc .= $token[$level].'/';
54        $inc = substr($inc,0,-1).'.inc.php';
55        error_log($_SERVER['HTTP_HOST'].' | Include:'.$inc);
56        if(file_exists(INCLUDEPATH.'/'.$inc))
57            break;
58    }
59
60    if(!file_exists(INCLUDEPATH.'/'.$inc) || !ereg("\.inc\.php$", $inc))
61        $inc = 'index.inc.php';
62
63    $db =& DB::connect($dsn);
64    if (DB::isError($db))
65        error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage());
66    $db->setFetchMode(DB_FETCHMODE_ASSOC);
67
68
69    $user['info'] =& get_cache_user_info($login);
70
71    if(!$user['info'])
72    {
73        header('Location: http://'.$config['domain'].'/pub/no-hp');
74        exit();
75    }
76
77    if(get_setting($user['info']['id'], 'publish') == 'no')
78        exit;
79
80    include (INCLUDEPATH.'/'.$inc);
81
82    $db->disconnect();
83
84    // Determination de la template a afficher
85    for($idx=(count($token)-1); $idx>=0; $idx--)
86    {       
87        $tpl = "";
88        for($level=0; $level<=$idx; $level++)
89            $tpl .= $token[$level].'/';
90        $tpl = substr($tpl,0,-1).'.tpl';
91        if($smarty->template_exists($tpl))
92            break;
93    }
94
95    if(!$smarty->template_exists($tpl))
96        $tpl='default.tpl';
97
98    $_SMARTY['tpl'] = $tpl;
99    $_SMARTY['token'] = $token;
100    $_SMARTY['url_id'] = $url_id;
101    $_SMARTY['profile'] = $user;
102    $smarty->assign($_SMARTY);
103}
104
105if(ereg('\.xul$', $_SERVER['PHP_SELF']))
106    header('Content-type: application/vnd.mozilla.xul+xml; charset=UTF-8');
107elseif(ereg('\.rdf$', $_SERVER['PHP_SELF']))
108    header('Content-type: text/rdf; charset=UTF-8');
109else
110    header('Content-type: application/rdf+xml; charset=UTF-8');
111$smarty->display('index.tpl', $login.'.'.$_SERVER['PHP_SELF']);
112
113?>
114
Note: See TracBrowser for help on using the browser.