[ Index ]
 

Code source de Pluxml 0.3.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> install.php (source)

   1  <?php
   2  # Copyright (c) 2006 Skyline-arts.com. All rights reserved.

   3  
   4  if(file_exists('pluxml/conf/config.xml')){
   5      header('Content-Type: text/plain');
   6      echo 'Pluxml est déjà configuré';
   7      exit;
   8  }
   9  include ('pluxml/lib/lib.util.php');
  10  $v = file('version');
  11  $v = $v['0'];
  12  
  13  function install($content){
  14              
  15      if(get_magic_quotes_gpc() == 1){
  16          if(is_array($content)){
  17              foreach($content as $key => $data) {
  18                  $new_content[$key] = stripslashes($data);
  19              }
  20          }else{
  21              $new_content = stripslashes($content);
  22          }
  23          $content = $new_content;
  24      }
  25      
  26      $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
  27  <document>
  28      <parametre name=\"version\">".$content['version']."</parametre>
  29      <parametre name=\"title\">".$content['titre']."</parametre>
  30      <parametre name=\"description\">".$content['sous-titre']."</parametre>
  31      <parametre name=\"racine\">".$content['racine']."</parametre>
  32      <parametre name=\"racine_xml\">".$content['racine_xml']."</parametre>
  33      <parametre name=\"delta\">".$content['delta']."</parametre>    
  34      <parametre name=\"bypage_rss\">".$content['bypage_rss']."</parametre>
  35      <parametre name=\"bypage\">".$content['bypage']."</parametre>
  36      <parametre name=\"style\">default</parametre>
  37  </document>";
  38  
  39      $file = 'pluxml/conf/config.xml';
  40      $f=fopen($file, 'w');
  41      fwrite($f, $xml);
  42      fclose($f);
  43      
  44      $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
  45  <document>
  46      <user login=\"".$content['redac_name']."\">".md5($content['redac_pwd'])."</user>
  47  </document>";
  48  
  49      $file = 'pluxml/conf/password.xml';
  50      $f=fopen($file, 'w');
  51      fwrite($f, $xml);
  52      fclose($f);
  53      
  54      $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>
  55  <document>
  56      <categorie number=\"001\" ordre=\"1\" url=\"Categorie\">Catégorie 1</categorie>
  57  </document>";
  58  
  59      $file = 'pluxml/conf/categorie.xml';
  60      $f=fopen($file, 'w');
  61      fwrite($f, $xml);
  62      fclose($f);
  63      
  64      $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
  65  <document>
  66  
  67      <infopost>
  68          <title>Premier article</title>
  69          <author>'.$content['redac_name'].'</author>
  70          <date>2006-01-01T00:00:00+00:00</date>
  71      </infopost>
  72      <chapo>
  73          <![CDATA[]]>
  74      </chapo>
  75      <content>
  76          <![CDATA[<p>Ceci est un article créé lors de l\'installation. Editez-le depuis la zone d\'administration.</p>]]>
  77      </content>
  78  
  79  </document>';
  80  
  81      $file = $content['racine_xml'].'/0001.001.premier-article.xml';
  82      $f=fopen($file, 'w');
  83      fwrite($f, $xml);
  84      fclose($f);
  85  }
  86  
  87  function racine(){
  88      $doc = str_replace('install.php', '', $_SERVER['REQUEST_URI']);
  89      return 'http://'.$_SERVER['HTTP_HOST'].$doc;
  90  }
  91      
  92  if (!empty($_POST['titre']) && !empty($_POST['sous-titre']) && !empty($_POST['racine']) && !empty($_POST['bypage']) && !empty($_POST['bypage_rss'])) {
  93      install($_POST);
  94      header('Location: '.$_POST['racine']);
  95  }
  96  
  97  for($i=-12;$i < -9; $i++){
  98      $delta['-'.abs($i).':00'] = '-'.abs($i).':00';
  99  }
 100  for($i=-9;$i < 0; $i++){
 101      $delta['-0'.abs($i).':00'] = '-0'.abs($i).':00';
 102  }
 103  for($i=0;$i < 10; $i++){
 104      $delta['+0'.$i.':00'] = '+0'.$i.':00';
 105  }
 106  for($i=10;$i <= 14; $i++){
 107      $delta['+'.$i.':00'] = '+'.$i.':00';
 108  }
 109  
 110  ?>
 111  
 112  
 113  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 114  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 115  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 116  <head>
 117  <title>Pluxml - Installation</title>
 118  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 119  <link rel="stylesheet" type="text/css" href="pluxml/admin/admin.css" media="screen" />
 120  </head>
 121  
 122  <body>
 123  <h2>Installation de Pluxml</h2>
 124  
 125  <ul>
 126      <li>Version : <?php echo $v; ?></li>
 127      <li><strong><?php test_write('pluxml/conf/'); ?></strong></li>
 128      <li><strong><?php test_write('pluxml/xml/'); ?></strong></li>
 129      <li>Version de php : <?php echo phpversion(); ?></li>
 130      <li>Etat des "magic quotes" : <?php echo get_magic_quotes_gpc(); ?></li>
 131  </ul>
 132  
 133  <form action="install.php" method="post" id="change-cf-file">
 134      <fieldset>
 135          <?php form::input('version', $v, 'hidden', 5, 3);?>
 136          <p class="field"><label>Titre du site&nbsp;:</label></p>
 137          <?php form::input('titre', '', 'text', 50, 255);?>
 138          <p class="field"><label>Sous-titre&nbsp;:</label></p>
 139          <?php form::input('sous-titre', '', 'text', 50, 255);?>
 140          <p class="field"><label>Racine du site&nbsp;:</label></p>
 141          <?php form::input('racine', racine(), 'text', 50, 255);?>
 142          <p class="field"><label>Emplacement des articles&nbsp;:</label></p>
 143          <?php form::input('racine_xml', 'pluxml/xml/', 'text', 50, 255);?>
 144          <p class="field"><label>Fuseau horaire&nbsp;:</label></p>
 145          <?php form::select('delta', $delta, '+00:00', 'text', 10, 255);?>
 146          <p class="field"><label>Nombre d'articles par page&nbsp;:</label></p>
 147          <?php form::input('bypage', '5', 'text', 5, 3);?>
 148          <p class="field"><label>Nombre d'articles sur le fil Rss&nbsp;:</label></p>
 149          <?php form::input('bypage_rss', '5', 'text', 5, 3);?>
 150      </fieldset>
 151      <fieldset>
 152          <p class="field"><label>Nom du rédacteur&nbsp;:</label></p>
 153          <?php form::input('redac_name', '', 'text', 50, 255);?>
 154          <p class="field"><label>Mot de passe du rédacteur&nbsp;:</label></p>
 155          <?php form::input('redac_pwd', '', 'password', 50, 255);?>
 156      </fieldset>
 157      
 158      <fieldset>
 159          <p><input type="submit" value="Installer" /></p>
 160      </fieldset>
 161  </form>
 162  </body>
 163  </html>


Généré le : Sun Apr 8 12:13:41 2007 par Balluche grâce à PHPXref 0.7