svn: /web/doc-editor/trunk/php/ .htaccess AccountManager.php BugReader.php Conf.php CvsClient.php DBConnection.php File.php LockFile.php LogManager.php NewsReader.php ProjectManager.php RepositoryFetcher.php RepositoryManager.php SvnClient.php ToolsCheckEntities.php ToolsError.php VCSFactory.php conf/conf.ini conf/project.pear.ini conf/project.php.ini conf.inc.php conf.pear.inc.php conf.php.inc.php utility.php

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Mon, 01 Mar 2010 22:55:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=295700

Log:
Big change on project config file to allow a better management. We can easly enable/disable a specific project now, for example.

Changed paths:
    A   web/doc-editor/trunk/php/.htaccess
    U   web/doc-editor/trunk/php/AccountManager.php
    U   web/doc-editor/trunk/php/BugReader.php
    A + web/doc-editor/trunk/php/Conf.php
        (from web/doc-editor/trunk/php/conf.inc.php:r293091)
    U   web/doc-editor/trunk/php/CvsClient.php
    U   web/doc-editor/trunk/php/DBConnection.php
    U   web/doc-editor/trunk/php/File.php
    U   web/doc-editor/trunk/php/LockFile.php
    U   web/doc-editor/trunk/php/LogManager.php
    U   web/doc-editor/trunk/php/NewsReader.php
    U   web/doc-editor/trunk/php/ProjectManager.php
    U   web/doc-editor/trunk/php/RepositoryFetcher.php
    U   web/doc-editor/trunk/php/RepositoryManager.php
    U   web/doc-editor/trunk/php/SvnClient.php
    U   web/doc-editor/trunk/php/ToolsCheckEntities.php
    U   web/doc-editor/trunk/php/ToolsError.php
    U   web/doc-editor/trunk/php/VCSFactory.php
    A   web/doc-editor/trunk/php/conf/
    A   web/doc-editor/trunk/php/conf/conf.ini
    A   web/doc-editor/trunk/php/conf/project.pear.ini
    A   web/doc-editor/trunk/php/conf/project.php.ini
    D   web/doc-editor/trunk/php/conf.inc.php
    D   web/doc-editor/trunk/php/conf.pear.inc.php
    D   web/doc-editor/trunk/php/conf.php.inc.php
    U   web/doc-editor/trunk/php/utility.php
svn-diffs-295700.txt (text/x-diff, 51.9 KB)
Added: web/doc-editor/trunk/php/.htaccess
===================================================================
--- web/doc-editor/trunk/php/.htaccess	                        (rev 0)
+++ web/doc-editor/trunk/php/.htaccess	2010-03-01 22:55:43 UTC (rev 295700)
@@ -0,0 +1,4 @@
+<Files *.ini>
+Order deny,allow
+Deny from All
+</Files>
\ No newline at end of file

Modified: web/doc-editor/trunk/php/AccountManager.php
===================================================================
--- web/doc-editor/trunk/php/AccountManager.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/AccountManager.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -24,6 +24,7 @@
     public $vcsLang;
     public $userConf;
     public $defaultConf;
+    public $appConf;

     private function __construct()
     {
@@ -64,6 +65,9 @@

             "theme"                 => 'themes/empty.css'
         );
+
+        $this->appConf = Config::getInstance()->getConf();
+
     }

     public function switchLang($lang) {
@@ -131,7 +135,7 @@

         // We manage the project
         if( ProjectManager::getInstance()->setProject($project) ) {
-            $this->project = $project;
+            $this->project = strtoupper($project);
         } else {
             $return['state'] = false;
             $return['msg']   = 'Bad project';

Modified: web/doc-editor/trunk/php/BugReader.php
===================================================================
--- web/doc-editor/trunk/php/BugReader.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/BugReader.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -28,12 +28,15 @@
      *
      * @return An indexed array (id, title, description, link, pubDate) readable by ExtJs
      */
-    function getOpenBugs() {
+    function getOpenBugs()
+    {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         if( $this->lang == 'en' ) {
-            $url = $GLOBALS['DOC_EDITOR_BUGS_URL_EN'];
+            $url = $appConf[$project]['bugs.url.en'];
         } else {
-            $url = $GLOBALS['DOC_EDITOR_BUGS_URL_LANG'];
+            $url = $appConf[$project]['bugs.url.lang'];
         }

         $r = @file_get_contents($url);

Copied: web/doc-editor/trunk/php/Conf.php (from rev 293091, web/doc-editor/trunk/php/conf.inc.php)
===================================================================
--- web/doc-editor/trunk/php/Conf.php	                        (rev 0)
+++ web/doc-editor/trunk/php/Conf.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -0,0 +1,83 @@
+<?php
+
+class Config
+{
+    private static $instance;
+
+    public $conf = array();
+
+    public static function getInstance()
+    {
+        if (!isset(self::$instance)) {
+            $c = __CLASS__;
+            self::$instance = new $c;
+        }
+        return self::$instance;
+    }
+
+
+    private function __construct()
+    {
+        $this->buildConf();
+    }
+
+    public function buildConf()
+    {
+        $p = dirname(__FILE__).'/conf/';
+
+        // First, we load the global configuration file
+        $this->conf['GLOBAL_CONFIGURATION'] = parse_ini_file($p."conf.ini");
+          // We fix the data path here
+          $this->conf['GLOBAL_CONFIGURATION']['data.path'] = realpath(dirname(__FILE__).'/../'.$this->conf['GLOBAL_CONFIGURATION']['data.path']).'/';
+
+        // Second, we load all config project file
+        $d = dir($p);
+        while (false !== ($entry = $d->read())) {
+            if( is_file($p.$entry) && $entry != 'conf.ini' ) {
+
+               // Get the name of the project directly into the filename
+               $t = explode(".", $entry);
+
+               $this->conf[strtoupper($t[1])] = parse_ini_file($p.$entry);
+            }
+        }
+        $d->close();
+
+        // Third, we find all marks to be replace by a var from global_configuration array or current project
+        while( list($project, $value) = each($this->conf) ) {
+
+            if( $project == "GLOBAL_CONFIGURATION" ) { continue; }
+
+            while( list($keys, $v ) = each($value) ) {
+
+                $match = false;
+
+                if( preg_match_all("/\{(.[^}]*?)\['(.*?)'\]\}/", $v,$match) ) {
+
+                    $new_val = $v;
+                    for( $i=0; $i < count($match[0]); $i++ ) {
+
+                        $new_val = str_replace(  $match[0][$i],
+                                                 $this->conf[$match[1][$i]][$match[2][$i]],
+                                                 $new_val
+                        );
+
+                        $this->conf[$project][$keys]= $new_val;
+                    }
+                }
+            }
+        }
+
+        reset($this->conf);
+        return $this->conf;
+
+    }
+
+    public function getConf() {
+        return $this->conf;
+    }
+
+
+}
+
+?>

Modified: web/doc-editor/trunk/php/CvsClient.php
===================================================================
--- web/doc-editor/trunk/php/CvsClient.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/CvsClient.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,7 +1,5 @@
 <?php

-require_once dirname(__FILE__) . '/conf.inc.php';
-
 class CvsClient
 {
     private static $instance;
@@ -66,11 +64,14 @@
      */
     public function authenticate($cvsLogin, $cvsPasswd)
     {
-        $fp = fsockopen($GLOBALS['DOC_EDITOR_VCS_SERVER_HOST'], $GLOBALS['DOC_EDITOR_VCS_SERVER_PORT']);
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
+        $fp = fsockopen($appConf[$project]['vcs.server.host'], $appConf[$project]['vcs.server.port']);
         fwrite($fp,
             implode("\n", array(
                 'BEGIN AUTH REQUEST',
-                $GLOBALS['DOC_EDITOR_VCS_SERVER_PATH'],
+                $appConf[$project]['vcs.server.path'],
                 $cvsLogin,
                 $this->passwdEncode($cvsPasswd, 'A'),
                 'END AUTH REQUEST'."\n"
@@ -96,7 +97,9 @@
      */
     public function checkout()
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_DATA_PATH'].'; cvs -d :pserver:cvsread:[email protected]:/repository login;'
+        $appConf = AccountManager::getInstance()->appConf;
+
+        $cmd = 'cd '.$appConf['GLOBAL_CONFIGURATION']['data.path'].'; cvs -d :pserver:cvsread:[email protected]:/repository login;'
               .'cvs -d :pserver:cvsread:[email protected]:/repository checkout phpdoc-all;';
         exec($cmd);
     }
@@ -106,7 +109,10 @@
      */
     public function update()
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].'; cvs -f -q update -d -P .;';
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
+        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; cvs -f -q update -d -P .;';
         exec($cmd);
     }

@@ -119,8 +125,11 @@
      */
     public function log($path, $file)
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$path.'; cvs log '.$file;
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].$path.'; cvs log '.$file;
+
         $output = array();
         exec($cmd, $output);

@@ -183,8 +192,11 @@
      */
     public function diff($path, $file, $rev1, $rev2)
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$path.'; cvs diff -kk -u -r '.$rev2.' -r '.$rev1.' '.$file;
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].$path.'; cvs diff -kk -u -r '.$rev2.' -r '.$rev1.' '.$file;
+
         $output = array();
         exec($cmd, $output);

@@ -202,6 +214,9 @@
      */
     public function commit($log, $create=false, $update=false, $delete=false)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $create_stack = array();
         for ($i = 0; $create && $i < count($create); $i++) {
             $create_stack[] = $create[$i]->lang.'/'.$create[$i]->path.'/'.$create[$i]->name;
@@ -212,12 +227,8 @@
             $p = $update[$i]->lang.'/'.$update[$i]->path.'/'.$update[$i]->name;
             $update_stack[] = $p;

-            // Pre-commit : rename .new to actual file
-/*
-            @unlink(DOC_EDITOR_VCS_PATH.$p);
-*/
-            @copy(  $GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new', $GLOBALS['DOC_EDITOR_VCS_PATH'].$p);
-            @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new');
+            @copy(  $appConf[$project]['vcs.path'].$p.'.new', $appConf[$project]['vcs.path'].$p);
+            @unlink($appConf[$project]['vcs.path'].$p.'.new');
         }

         $delete_stack = array();
@@ -249,7 +260,7 @@
                "cvs -d :pserver:$cvsLogin:[email protected]:/repository -f commit -l -m '$log' $filesUpdate $filesDelete $filesCreate";

         // First, login into Cvs
-        $fullCmd = 'export CVS_PASSFILE='.realpath($GLOBALS['DOC_EDITOR_DATA_PATH']).'/.cvspass && cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].' && '
+        $fullCmd = 'export CVS_PASSFILE='.realpath($appConf['GLOBAL_CONFIGURATION']['data.path']).'/.cvspass && cd '.$appConf[$project]['vcs.path'].' && '
                   ."cvs -d :pserver:$cvsLogin:[email protected]:/repository login && $cmd";

         $output  = array();

Modified: web/doc-editor/trunk/php/DBConnection.php
===================================================================
--- web/doc-editor/trunk/php/DBConnection.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/DBConnection.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,6 +1,6 @@
 <?php

-require_once dirname(__FILE__) .'/conf.inc.php';
+require_once dirname(__FILE__) .'/Conf.php';
 require_once dirname(__FILE__) .'/utility.php';

 class DBConnection
@@ -20,12 +20,14 @@

     private function __construct()
     {
+        $appConf = Config::getInstance()->getConf();
+
         try {
             $this->conn = new mysqli(
-                $GLOBALS['DOC_EDITOR_SQL_HOST'],
-                $GLOBALS['DOC_EDITOR_SQL_USER'],
-                $GLOBALS['DOC_EDITOR_SQL_PASS'],
-                $GLOBALS['DOC_EDITOR_SQL_BASE']
+                $appConf['GLOBAL_CONFIGURATION']['sql.host'],
+                $appConf['GLOBAL_CONFIGURATION']['sql.user'],
+                $appConf['GLOBAL_CONFIGURATION']['sql.passwd'],
+                $appConf['GLOBAL_CONFIGURATION']['sql.database']
             );
             if (mysqli_connect_errno()) {
                 throw new Exception('connect databases failed!');

Modified: web/doc-editor/trunk/php/File.php
===================================================================
--- web/doc-editor/trunk/php/File.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/File.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,6 +1,5 @@
 <?php

-require_once dirname(__FILE__) . '/conf.inc.php';
 require_once dirname(__FILE__) . '/DBConnection.php';
 require_once dirname(__FILE__) . '/GTranslate.php';
 require_once dirname(__FILE__) . '/RepositoryManager.php';
@@ -24,6 +23,9 @@
      */
     public function __construct($lang='', $path='', $name='')
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         // Security
         $path = str_replace('..', '',  $path);
         $path = str_replace('//', '/', $path);
@@ -35,10 +37,10 @@
         if (substr($path, -1)   != '/') $path = $path.'/';
         $this->path = $path;

-        $this->full_path = $GLOBALS['DOC_EDITOR_VCS_PATH'].$lang.$path.$name;
+        $this->full_path = $appConf[$project]['vcs.path'].$lang.$path.$name;

         // The fallback file : if the file don't exist, we fallback to the EN file witch should always exist
-        $this->full_path_fallback = $GLOBALS['DOC_EDITOR_VCS_PATH'].'en'.$path.$name;
+        $this->full_path_fallback = $appConf[$project]['vcs.path'].'en'.$path.$name;
     }

     public function fileExist()
@@ -136,10 +138,13 @@
      * @param $path path to create
      * @return true
      */
-    private function createFolder($path) {
+    private function createFolder($path)
+    {
+       $appConf = AccountManager::getInstance()->appConf;
+       $project = AccountManager::getInstance()->project;

        // We create this folder localy
-       mkdir($GLOBALS['DOC_EDITOR_VCS_PATH'].$this->lang.$path);
+       mkdir($appConf[$project]['vcs.path'].$this->lang.$path);

        // We register this new folder to be committed
        $obj = (object) array('lang' => $this->lang, 'path' => $path, 'name' => '-');
@@ -152,7 +157,10 @@
      *
      * @return true
      */
-    public function folderExist() {
+    public function folderExist()
+    {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         $folders = array();
         $_folders = explode("/", $this->path);
@@ -170,7 +178,7 @@

            $herePath = $path.'/'.$folders[$i];

-           if( !is_dir($GLOBALS['DOC_EDITOR_VCS_PATH'].$this->lang.$herePath) ) {
+           if( !is_dir($appConf[$project]['vcs.path'].$this->lang.$herePath) ) {
               $this->createFolder($herePath);
            }

@@ -315,8 +323,11 @@
      */
     public function rawDiff($isPatch=false, $uniqID='')
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $ext = ($isPatch) ? '.' . $uniqID . '.patch' : '.new';
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$this->lang.$this->path.'; '
+        $cmd = 'cd '.$appConf[$project]['vcs.path'].$this->lang.$this->path.'; '
               .'diff -uN '.$this->name.' '.$this->name.$ext;

         $output = array();
@@ -334,6 +345,8 @@
      */
     public function Diff($type, $options)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         if( $type == 'vcs' ) {

@@ -345,7 +358,7 @@
         } elseif( $type == 'file' || $type == 'patch' ) {

             $ext = ( $options['type'] == 'patch' ) ? '.' . $options['uniqID'] . '.patch' : '.new';
-            $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$this->lang.$this->path.'; '
+            $cmd = 'cd '.$appConf[$project]['vcs.path'].$this->lang.$this->path.'; '
                   .'diff -uN '.$this->name.' '.$this->name.$ext;

             $output = array();

Modified: web/doc-editor/trunk/php/LockFile.php
===================================================================
--- web/doc-editor/trunk/php/LockFile.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/LockFile.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -3,7 +3,8 @@
  * A class for locking tasks
  *
  */
-class lockFile {
+class lockFile
+{

     /**
      * Lock file identifier
@@ -19,8 +20,11 @@
      */
     function __construct($id)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $this->id   = $id;
-        $this->path = $GLOBALS['DOC_EDITOR_DATA_PATH'] . '.' . preg_replace('![^0-9a-z.]!i', '', $this->id);
+        $this->path = $appConf[$project]['vcs.path'] . '.' . preg_replace('![^0-9a-z.]!i', '', $this->id);
     }

     /**

Modified: web/doc-editor/trunk/php/LogManager.php
===================================================================
--- web/doc-editor/trunk/php/LogManager.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/LogManager.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -105,7 +105,10 @@
      */
     public function saveOutputLog($file, $output)
     {
-        $fp = fopen($GLOBALS['DOC_EDITOR_VCS_PATH'] . '../.' . $file, 'w');
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
+        $fp = fopen($appConf[$project]['vcs.path'] . '../.' . $file, 'w');
         fwrite($fp, implode("<br>",$output));
         fclose($fp);
     }
@@ -118,8 +121,10 @@
      */
     public function readOutputLog($file)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

-        return $this->highlightBuildLog(file_get_contents($GLOBALS['DOC_EDITOR_VCS_PATH'] . '../.' . $file));
+        return $this->highlightBuildLog(file_get_contents($appConf[$project]['vcs.path'] . '../.' . $file));
     }

     /**

Modified: web/doc-editor/trunk/php/NewsReader.php
===================================================================
--- web/doc-editor/trunk/php/NewsReader.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/NewsReader.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -4,7 +4,8 @@
  * A class for read News form http://news.php.net
  *
  */
-class NewsReader {
+class NewsReader
+{

     /**
      * The lang
@@ -28,14 +29,17 @@
      *
      * @return An indexed array (id, title, description, link, pubDate) readable by ExtJs, or false if an error occurs
      */
-    function getLastNews() {
+    function getLastNews()
+    {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         $result = array();

         if( $this->lang == 'en' ) {
-            $url = $GLOBALS['DOC_EDITOR_NEWS_URL_EN'];
+            $url = $appConf[$project]['news.url.en'];
         } else {
-            $url = str_replace("{LANG}", strtolower(str_replace('_', '-', $this->lang)), $GLOBALS['DOC_EDITOR_NEWS_URL_LANG']);
+            $url = str_replace("{LANG}", strtolower(str_replace('_', '-', $this->lang)), $appConf[$project]['news.url.lang']);
         }

         $content = @file_get_contents($url);

Modified: web/doc-editor/trunk/php/ProjectManager.php
===================================================================
--- web/doc-editor/trunk/php/ProjectManager.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/ProjectManager.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -17,16 +17,24 @@
     }

     public $project;
+    public $appConf;

-    public $availableProject = array(
-         0 => Array('code' => 'php',  'iconCls' => 'project-php',  'name' => 'Php Documentation'),
-         1 => Array('code' => 'pear', 'iconCls' => 'project-pear', 'name' => 'Pear Documentation')
-    );
+    public $availableProject = array();

-
     private function __construct()
     {
+        $this->appConf = Config::getInstance()->getConf();

+        $i=0;
+        while( list($k, $v) = each($this->appConf) ) {
+            if( $k == "GLOBAL_CONFIGURATION" ) { continue; }
+
+            // Check if this project is enable
+            if( $this->appConf[$k]['project.enable'] ) {
+                $this->availableProject[$i] = array('code' => $this->appConf[$k]['project.code'],  'iconCls' => $this->appConf[$k]['project.iconCls'],  'name' => $this->appConf[$k]['project.name']);
+                ++$i;
+            }
+        }
     }

     public function getAvailableProject()
@@ -34,41 +42,19 @@
         return $this->availableProject;
     }

-    public function isDefinedProject($project)
-    {
-        $isDefined = false;
-
-        for( $i=0; $i < count($this->availableProject); $i++ ) {
-            if( $this->availableProject[$i]['code'] == $project ) {
-                $isDefined = true;
-            }
-        }
-
-        return $isDefined;
-
-    }
-
     public function setProject($project)
     {
+        $project = strtoupper($project);
+
         // This project must be defined in $availableProject constant
-        if( ! $this->isDefinedProject($project) ) {
+        if( !isset($this->appConf[$project]) || $this->appConf[$project]['project.enable'] == false ) {
             return false;
         }

-        // This project must have a conf file
-        if( is_file(dirname(__FILE__) . '/conf.'. $project .'.inc.php') ) {
-
-            include_once dirname(__FILE__) . '/conf.inc.php';
-            include_once dirname(__FILE__) . '/conf.'. $project .'.inc.php';
-
-            $this->project = $project;
-            AccountManager::getInstance()->project = $project;
-            $_SESSION['project'] = $project;
-
-            return true;
-        } else {
-            return false;
-        }
+        $this->project = $project;
+        AccountManager::getInstance()->project = $project;
+        $_SESSION['project'] = $project;
+        return true;
     }
 }
 ?>
\ No newline at end of file

Modified: web/doc-editor/trunk/php/RepositoryFetcher.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryFetcher.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/RepositoryFetcher.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -558,13 +558,16 @@
      */
     public function getFilesByDirectory($dir)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         // Security
         $dir = str_replace('..', '', $dir);
         if (substr($dir, -1) != '/') $dir .= '/';

         $m = $this->getModifies();

-        $d = dir($GLOBALS['DOC_EDITOR_VCS_PATH'].$dir);
+        $d = dir($appConf[$project]['vcs.path'].$dir);

         $files = array();
         while ($f = $d->read())
@@ -572,7 +575,7 @@
             // We display only 'en', 'LANG' tree
             if (   $dir == '/'
                 && $f != 'en'
-                && $f != $GLOBALS["DOC_EDITOR_ENTITIES_FOLDER"]
+                && $f != $appConf[$project]['entities.folder']
                 && $f != AccountManager::getInstance()->vcsLang
             ) {
                 continue; // skip non-en and non-user-lang
@@ -586,7 +589,7 @@
                 || $f == 'CVS'
             ) continue;

-            if (is_dir($GLOBALS['DOC_EDITOR_VCS_PATH'].$dir.$f)) {
+            if (is_dir($appConf[$project]['vcs.path'].$dir.$f)) {

                 $files[] = array(
                     'text' => $f,
@@ -628,7 +631,8 @@
      * @param $field The name of the field for this value
      * @return The value.
      */
-    public function getStaticValue($type, $field) {
+    public function getStaticValue($type, $field)
+    {

         // Save in DB
         $s = "SELECT id, value FROM staticValue WHERE

Modified: web/doc-editor/trunk/php/RepositoryManager.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryManager.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/RepositoryManager.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -69,10 +69,13 @@

     public function computeExistingLanguage()
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $this->existingLanguage = array();

         for( $i=0; $i < count($this->availableLang); $i++ ) {
-            if( is_dir($GLOBALS['DOC_EDITOR_VCS_PATH'].$this->availableLang[$i]['code'].'/') ) {
+            if( is_dir($appConf[$project]['vcs.path'].$this->availableLang[$i]['code'].'/') ) {
                 $this->existingLanguage[] = $this->availableLang[$i];
             }
         }
@@ -166,15 +169,17 @@
      */
     public function checkBuild($lang, $enable_xml_details="false")
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         $return = Array(
             "state"      => "ok",
             "logContent" => ""
         );

-        $cmd = 'cd '.realpath($GLOBALS['DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH']).';'
+        $cmd = 'cd '.realpath($appConf[$project]['vcs.configure.script.path']).';'
               .'/usr/bin/php configure.php '
-              .$GLOBALS['DOC_EDITOR_VCS_CONFIGURE_SCRIPT_OPTIONS'];
+              .$appConf[$project]['vcs.configure.script.options'];

         $cmd = str_replace("{LangCode}", $lang, $cmd).';';

@@ -333,6 +338,8 @@
      */
     public function beforeCommitChanges($files, $type)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         $stack = Array();

@@ -355,7 +362,7 @@
                         // We must update this file into the app, and suppress it from this commit process

                         // Delete this new file from the fileSystem
-                        @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name.'.new');
+                        @unlink($appConf[$project]['vcs.path'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name.'.new');
                         // Delete from pendingCommit table
                         $tmp = Array();
                         $tmp[0] = $files[$i];
@@ -379,7 +386,7 @@
                 for( $i=0; $i < count($files); $i++ ) {

                     // We get the filemtime for this file to compare with the filemtime after the update.
-                    $oldTime = filemtime($GLOBALS['DOC_EDITOR_VCS_PATH'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name);
+                    $oldTime = filemtime($appConf[$project]['vcs.path'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name);

                     $updateResponse = VCSFactory::getInstance()->updateSingleFile(
                         $files[$i]->lang,
@@ -390,7 +397,7 @@
                     if( $updateResponse ) {

                         // If this file haven't been deleted since last big update, $updateResponse should return true
-                        $newTime = filemtime($GLOBALS['DOC_EDITOR_VCS_PATH'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name);
+                        $newTime = filemtime($appConf[$project]['vcs.path'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name);


                         if( $newTime != $oldTime ) {
@@ -419,7 +426,7 @@
                         // We delete our .new, and remove all reference for it from the DB

                         // Delete this new file from the fileSystem
-                        @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name.'.new');
+                        @unlink($appConf[$project]['vcs.path'].$files[$i]->lang.'/'.$files[$i]->path.'/'.$files[$i]->name.'.new');

                         // Delete from pendingCommit table
                         $tmp = Array();
@@ -570,7 +577,9 @@
      */
     public function clearLocalChange($type, $file)
     {
+        $appConf = AccountManager::getInstance()->appConf;
         $project = AccountManager::getInstance()->project;
+
         $lang = $file->lang;
         $path = $file->path;
         $name = $file->name;
@@ -609,8 +618,8 @@
         }

         // We need check for error in this file
-        $en_content   = file_get_contents($GLOBALS['DOC_EDITOR_VCS_PATH'].'en' .$path.$name);
-        $lang_content = file_get_contents($GLOBALS['DOC_EDITOR_VCS_PATH'].$lang.$path.$name);
+        $en_content   = file_get_contents($appConf[$project]['vcs.path'].'en' .$path.$name);
+        $lang_content = file_get_contents($appConf[$project]['vcs.path'].$lang.$path.$name);

         $info = $file->getInfo($lang_content);
         $anode[0] = array(
@@ -673,14 +682,15 @@
      */
     public function postPatchAccept($uniqID)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $vcsLogin = AccountManager::getInstance()->vcsLogin;

         $s = "SELECT * FROM `pendingPatch` WHERE `uniqID` = '$uniqID'";
         $r = DBConnection::getInstance()->query($s);
         $a = $r->fetch_object();

-        $project = strtoupper(AccountManager::getInstance()->project);
-
         // We need to send an email ?
         if (trim($a->email) != '' ) {

@@ -708,7 +718,7 @@
             AccountManager::getInstance()->email($to, $subject, $msg);
         }

-        @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$a->lang.$a->path.$a->name.'.'.$a->uniqID.'.patch');
+        @unlink($appConf[$project]['vcs.path'].$a->lang.$a->path.$a->name.'.'.$a->uniqID.'.patch');
         $s = sprintf('DELETE FROM `pendingPatch` WHERE `id` = "%s"', $a->id);
         DBConnection::getInstance()->query($s);
     }
@@ -720,6 +730,9 @@
      */
     public function postPatchReject($uniqID)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $vcsLogin = AccountManager::getInstance()->vcsLogin;

         $s = "SELECT * FROM `pendingPatch` WHERE `uniqID` = '$uniqID'";
@@ -750,7 +763,7 @@
             AccountManager::getInstance()->email($to, $subject, $msg);
         }

-        @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$a->lang.$a->path.$a->name.'.'.$a->uniqID.'.patch');
+        @unlink($appConf[$project]['vcs.path'].$a->lang.$a->path.$a->name.'.'.$a->uniqID.'.patch');
         $s = sprintf('DELETE FROM `pendingPatch` WHERE `id` = "%s"', $a->id);
         DBConnection::getInstance()->query($s);
     }
@@ -1024,8 +1037,11 @@
      */
     private function doUpdateNotInEN($path, $lang)
     {
-        if ($dh = @opendir($GLOBALS['DOC_EDITOR_VCS_PATH'].$lang.$path)) {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        if ($dh = @opendir($appConf[$project]['vcs.path'].$lang.$path)) {
+
             $dirs  = array();
             $files = array();

@@ -1044,8 +1060,8 @@
             }

             foreach($files as $f) {
-                $en_file   = $GLOBALS['DOC_EDITOR_VCS_PATH'] .'en'  .$f->path .$f->name;
-                $lang_file = $GLOBALS['DOC_EDITOR_VCS_PATH'] .$lang .$f->path .$f->name;
+                $en_file   = $appConf[$project]['vcs.path'] .'en'  .$f->path .$f->name;
+                $lang_file = $appConf[$project]['vcs.path'] .$lang .$f->path .$f->name;

                 if (!@is_file($en_file)) {
                     $query = sprintf(
@@ -1073,8 +1089,11 @@
      */
     public function applyRevCheck($path = '/')
     {
-        if ($dh = @opendir($GLOBALS['DOC_EDITOR_VCS_PATH'].'en'.$path)) {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        if ($dh = @opendir($appConf[$project]['vcs.path'].'en'.$path)) {
+
             $dirs  = array();
             $files = array();

@@ -1239,7 +1258,8 @@
      * @param $value The value. Can be anything who can be store into a SQL TEXT field
      * @return Nothing.
      */
-    public function setStaticValue($type, $field, $value) {
+    public function setStaticValue($type, $field, $value)
+    {

         $project = AccountManager::getInstance()->project;


Modified: web/doc-editor/trunk/php/SvnClient.php
===================================================================
--- web/doc-editor/trunk/php/SvnClient.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/SvnClient.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,7 +1,5 @@
 <?php

-require_once dirname(__FILE__) . '/conf.inc.php';
-
 class SvnClient
 {
     private static $instance;
@@ -19,7 +17,8 @@
     {
     }

-    private function getKarmaList() {
+    private function getKarmaList()
+    {

         // If this data is older than 1 day, we update it
         $data = RepositoryFetcher::getStaticValue('karma_list', '');
@@ -31,9 +30,12 @@
         return $data["data"];
     }

-    private function updateKarmaList() {
+    private function updateKarmaList()
+    {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

-        $file = @file($GLOBALS['DOC_EDITOR_VCS_KARMA_FILE']);
+        $file = @file($appConf[$project]['vcs.karma.file']);

         $line_avail = array();
         $user = array();
@@ -102,7 +104,7 @@
                 array(
                         "token"    => getenv("TOKEN"),
                         "username" => $username,
-                        "password" => $password,
+                        "password" => $password
                 )
         );

@@ -139,6 +141,9 @@
      */
     public function svnAuthenticate($username, $password)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;
+
         $uuid = md5(uniqid(rand(), true));
         $uuid =   substr($uuid, 0, 8)  . '-'
                 . substr($uuid, 8, 4)  . '-'
@@ -146,9 +151,9 @@
                 . substr($uuid, 16, 4) . '-'
                 . substr($uuid, 20);

-        $host = $GLOBALS['DOC_EDITOR_VCS_SERVER_HOST'];
-        $port = $GLOBALS['DOC_EDITOR_VCS_SERVER_PORT'];
-        $uri  = '/' . $GLOBALS['DOC_EDITOR_VCS_SERVER_REPOS'] . '!svn/act/'.$uuid;
+        $host = $appConf[$project]['vcs.server.host'];
+        $port = $appConf[$project]['vcs.server.port'];
+        $uri  = '/' . $appConf[$project]['vcs.server.repos'] . '!svn/act/'.$uuid;

         $ping = sprintf('MKACTIVITY %s HTTP/1.1
 Host: %s
@@ -227,12 +232,15 @@
      */
     public function checkout()
     {
-        $host   = $GLOBALS['DOC_EDITOR_VCS_SERVER_HOST'];
-        $port   = $GLOBALS['DOC_EDITOR_VCS_SERVER_PORT'];
-        $uri    = $GLOBALS['DOC_EDITOR_VCS_SERVER_PATH'];
-        $module = $GLOBALS['DOC_EDITOR_VCS_MODULE'];
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_DATA_PATH'].'; '
+        $host   = $appConf[$project]['vcs.server.host'];
+        $port   = $appConf[$project]['vcs.server.port'];
+        $uri    = $appConf[$project]['vcs.server.path'];
+        $module = $appConf[$project]['vcs.module'];
+
+        $cmd = 'cd '.$appConf['GLOBAL_CONFIGURATION']['data.path'].'; '
               ."svn co http://$host:$port/$uri $module; ";

         $trial_threshold = 3;
@@ -253,8 +261,11 @@
      */
     public function updateSingleFile($lang, $path, $name)
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].'; svn up '.$lang.$path.$name;
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; svn up '.$lang.$path.$name;
+
         $trial_threshold = 3;
         while ($trial_threshold-- > 0) {
             $output = array();
@@ -262,7 +273,7 @@
             if (strlen(trim(implode('', $output))) != 0) break;
         }

-        if( is_file($GLOBALS['DOC_EDITOR_VCS_PATH'].$lang.$path.$name) ) {
+        if( is_file($appConf[$project]['vcs.path'].$lang.$path.$name) ) {
             return true;
         } else {
             return false;
@@ -276,8 +287,11 @@
      */
     public function update()
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].'; svn up .;';
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; svn up .;';
+
         $trial_threshold = 3;
         while ($trial_threshold-- > 0) {
             $output = array();
@@ -295,8 +309,11 @@
      */
     public function log($path, $file)
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$path.'; svn log '.$file;
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].$path.'; svn log '.$file;
+
         $trial_threshold = 3;
         while ($trial_threshold-- > 0) {
             $output = array();
@@ -342,8 +359,11 @@
      */
     public function diff($path, $file, $rev1, $rev2)
     {
-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].$path.'; svn diff -r '.$rev1.':'.$rev2.' '.$file;
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $cmd = 'cd '.$appConf[$project]['vcs.path'].$path.'; svn diff -r '.$rev1.':'.$rev2.' '.$file;
+
         $trial_threshold = 3;
         while ($trial_threshold-- > 0) {
             $output = array();
@@ -370,16 +390,20 @@
         @unlink($path);
     }

-    public function commitFolders($foldersPath) {
+    public function commitFolders($foldersPath)
+    {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $vcsLogin  = AccountManager::getInstance()->vcsLogin;
+        $vcsPasswd = AccountManager::getInstance()->vcsPasswd;
+
         $commitLogMessage = Array();

         for( $i=0; $i < count($foldersPath); $i++ ) {
             // We add this new folder into repository
-            $vcsLogin  = AccountManager::getInstance()->vcsLogin;
-            $vcsPasswd = AccountManager::getInstance()->vcsPasswd;

-            $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].'; svn add --non-recursive '.$foldersPath[$i]->lang.$foldersPath[$i]->path.'; svn ci --no-auth-cache --non-interactive -m "Add new folder from PhpDocumentation Online Editor" --username '.$vcsLogin.' --password '.$vcsPasswd.' '.$foldersPath[$i]->lang.$foldersPath[$i]->path;
+            $cmd = 'cd '.$appConf[$project]['vcs.path'].'; svn add --non-recursive '.$foldersPath[$i]->lang.$foldersPath[$i]->path.'; svn ci --no-auth-cache --non-interactive -m "Add new folder from PhpDocumentation Online Editor" --username '.$vcsLogin.' --password '.$vcsPasswd.' '.$foldersPath[$i]->lang.$foldersPath[$i]->path;

             $trial_threshold = 3;
             while ($trial_threshold-- > 0) {
@@ -403,7 +427,12 @@
      */
     public function commit($log, $create=false, $update=false, $delete=false)
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

+        $vcsLogin  = AccountManager::getInstance()->vcsLogin;
+        $vcsPasswd = AccountManager::getInstance()->vcsPasswd;
+
         $pathLogFile = $this->createCommitLogFile($log);

         $create_stack = array();
@@ -412,8 +441,8 @@
             $create_stack[] = $p;

             // Pre-commit : rename .new to actual file
-            @copy(  $GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new', $GLOBALS['DOC_EDITOR_VCS_PATH'].$p);
-            @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new');
+            @copy(  $appConf[$project]['vcs.path'].$p.'.new', $appConf[$project]['vcs.path'].$p);
+            @unlink($appConf[$project]['vcs.path'].$p.'.new');
         }

         $update_stack = array();
@@ -422,8 +451,8 @@
             $update_stack[] = $p;

             // Pre-commit : rename .new to actual file
-            @copy(  $GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new', $GLOBALS['DOC_EDITOR_VCS_PATH'].$p);
-            @unlink($GLOBALS['DOC_EDITOR_VCS_PATH'].$p.'.new');
+            @copy(  $appConf[$project]['vcs.path'].$p.'.new', $appConf[$project]['vcs.path'].$p);
+            @unlink($appConf[$project]['vcs.path'].$p.'.new');
         }

         $delete_stack = array();
@@ -437,8 +466,6 @@
         $filesDelete = implode($delete_stack, ' ');

         // Buil the command line
-        $vcsLogin  = AccountManager::getInstance()->vcsLogin;
-        $vcsPasswd = AccountManager::getInstance()->vcsPasswd;

         $cmdCreate = $cmdDelete = '';
         if (trim($filesCreate) != '') {
@@ -454,7 +481,7 @@
                $cmdCreate.
                "svn ci --no-auth-cache --non-interactive -F $pathLogFile --username $vcsLogin --password $vcsPasswd $filesUpdate $filesDelete $filesCreate";

-        $cmd = 'cd '.$GLOBALS['DOC_EDITOR_VCS_PATH'].'; ' .$cmd;
+        $cmd = 'cd '.$appConf[$project]['vcs.path'].'; ' .$cmd;

         $trial_threshold = 3;
         while ($trial_threshold-- > 0) {

Modified: web/doc-editor/trunk/php/ToolsCheckEntities.php
===================================================================
--- web/doc-editor/trunk/php/ToolsCheckEntities.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/ToolsCheckEntities.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -32,11 +32,13 @@
      */
     function __construct()
     {
+        $appConf = AccountManager::getInstance()->appConf;
+        $project = AccountManager::getInstance()->project;

         $this->urlConnectTimeout = 10;

         $this->userAgent = 'DocWeb Link Crawler (http://doc.php.net)';
-        $this->pathEntities = $GLOBALS['DOC_EDITOR_ENTITIES_URL'];
+        $this->pathEntities = $appConf[$project]['entities.url'];

         $this->forkUrlAllow   = ( function_exists('pcntl_fork') && isset($_ENV['NUMFORKS']) );
         $this->forkNumAllowed = ( $this->forkUrlAllow ) ? $_ENV['NUMFORKS'] : 0;

Modified: web/doc-editor/trunk/php/ToolsError.php
===================================================================
--- web/doc-editor/trunk/php/ToolsError.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/ToolsError.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -6,7 +6,8 @@
 require_once dirname(__FILE__) . '/DBConnection.php';
 require_once dirname(__FILE__) . '/AccountManager.php';

-class ToolsError {
+class ToolsError
+{

     /**
      * EN content of the file.

Modified: web/doc-editor/trunk/php/VCSFactory.php
===================================================================
--- web/doc-editor/trunk/php/VCSFactory.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/VCSFactory.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,15 +1,16 @@
 <?php

-require_once dirname(__FILE__) . '/conf.inc.php';
+class VCSFactory
+{

-class VCSFactory {
-
     private static $instance;

     public static function getInstance()
     {
+        $appConf = AccountManager::getInstance()->appConf;
+
         if (!isset(self::$instance)) {
-            switch ($GLOBALS['DOC_EDITOR_VCS']) {
+            switch ($appConf['GLOBAL_CONFIGURATION']['vcs.type']) {
                 case 'cvs':
                     require_once dirname(__FILE__) . '/CvsClient.php';
                     self::$instance = CvsClient::getInstance();

Added: web/doc-editor/trunk/php/conf/conf.ini
===================================================================
--- web/doc-editor/trunk/php/conf/conf.ini	                        (rev 0)
+++ web/doc-editor/trunk/php/conf/conf.ini	2010-03-01 22:55:43 UTC (rev 295700)
@@ -0,0 +1,13 @@
+[GLOBAL_CONFIGURATION]
+
+www.user = apache
+www.group = apache
+
+sql.host = localhost
+sql.user = nobody
+sql.passwd =
+sql.database = doc_editor
+
+vcs.type = svn
+
+data.path = "data/"

Added: web/doc-editor/trunk/php/conf/project.pear.ini
===================================================================
--- web/doc-editor/trunk/php/conf/project.pear.ini	                        (rev 0)
+++ web/doc-editor/trunk/php/conf/project.pear.ini	2010-03-01 22:55:43 UTC (rev 295700)
@@ -0,0 +1,30 @@
+[PEAR]
+
+project.enable = true
+project.code = pear
+project.iconCls = "project-pear"
+project.name = "Pear Documentation"
+
+vcs.server.host  = "svn.php.net"
+vcs.server.repos = "repository/"
+vcs.server.path  = "repository/pear/peardoc/trunk/"
+vcs.server.port  = 80
+
+vcs.anon.login  =
+vcs.anon.passwd =
+
+vcs.module = "peardoc"
+vcs.karma.file = "http://svn.php.net/viewvc/SVNROOT/global_avail?view=co"
+
+vcs.path = "{GLOBAL_CONFIGURATION['data.path']}{PEAR['vcs.module']}/"
+vcs.configure.script.path = "{PEAR['vcs.path']}"
+vcs.configure.script.options = "--lang={LangCode}"
+news.url.en = "http://news.php.net/group.php?format=rss&group=php.pear.doc";
+news.url.lang = "http://news.php.net/group.php?format=rss&group=php.pear.doc"
+
+bugs.url.en = "http://pear.php.net/feeds/latest.rss"
+
+bugs.url.lang =  "http://pear.php.net/feeds/latest.rss"
+
+entities.folder = "entities"
+entities.url = "{PEAR['vcs.path']}{PEAR['entities.folder']}/global.ent"

Added: web/doc-editor/trunk/php/conf/project.php.ini
===================================================================
--- web/doc-editor/trunk/php/conf/project.php.ini	                        (rev 0)
+++ web/doc-editor/trunk/php/conf/project.php.ini	2010-03-01 22:55:43 UTC (rev 295700)
@@ -0,0 +1,30 @@
+[PHP]
+
+project.enable = true
+project.code = php
+project.iconCls = "project-php"
+project.name = "Php Documentation"
+
+vcs.server.host  = "svn.php.net"
+vcs.server.repos = "repository/"
+vcs.server.path  = "repository/phpdoc/modules/doc-all/"
+vcs.server.port  = 80
+
+vcs.anon.login  =
+vcs.anon.passwd =
+
+vcs.module = "phpdoc-all"
+vcs.karma.file = "http://svn.php.net/viewvc/SVNROOT/global_avail?view=co"
+
+vcs.path = "{GLOBAL_CONFIGURATION['data.path']}{PHP['vcs.module']}/"
+vcs.configure.script.path = "{PHP['vcs.path']}doc-base/"
+vcs.configure.script.options = "--with-lang={LangCode} --disable-segfault-error --srcdir={PHP['vcs.configure.script.path']} {XmlDetails}"
+news.url.en = "http://news.php.net/group.php?format=rss&group=php.doc";
+news.url.lang = "http://news.php.net/group.php?format=rss&group=php.doc.{LANG}"
+
+bugs.url.en = "http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Documentation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=10&assign="
+
+bugs.url.lang =  "http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Translation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=All&assign=&format=rss"
+
+entities.folder = "doc-base"
+entities.url = "{PHP['vcs.path']}{PHP['entities.folder']}/entities/global.ent"

Deleted: web/doc-editor/trunk/php/conf.inc.php
===================================================================
--- web/doc-editor/trunk/php/conf.inc.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/conf.inc.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,46 +0,0 @@
-<?php
-
-if (file_exists(dirname(__FILE__) . '/local.conf.inc.php')) {
-
-    require_once dirname(__FILE__) . '/local.conf.inc.php';
-
-} else {
-
-    /**
-     * WWW user
-     */
-    $DOC_EDITOR_WWW_USER = 'apache';
-    /**
-     * WWW group
-     */
-    $DOC_EDITOR_WWW_GROUP = 'apache';
-    /**
-     * MySQL server
-     */
-    $DOC_EDITOR_SQL_HOST = 'localhost';
-    /**
-     * MySQL user
-     */
-    $DOC_EDITOR_SQL_USER = 'nobody';
-    /**
-     * MySQL password
-     */
-    $DOC_EDITOR_SQL_PASS = '';
-    /**
-     * MySQL database
-     */
-    $DOC_EDITOR_SQL_BASE = 'doc_editor';
-
-    /**
-     * Version Control System type (cvs/svn/...)
-     */
-    $DOC_EDITOR_VCS = 'svn';
-
-    /**
-     * Data path
-     */
-    $DOC_EDITOR_DATA_PATH = dirname(__FILE__).'/../' . 'data/';
-
-}
-
-?>

Deleted: web/doc-editor/trunk/php/conf.pear.inc.php
===================================================================
--- web/doc-editor/trunk/php/conf.pear.inc.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/conf.pear.inc.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,90 +0,0 @@
-<?php
-global $DOC_EDITOR_VCS_SERVER_HOST, $DOC_EDITOR_VCS_SERVER_REPOS, $DOC_EDITOR_VCS_SERVER_PATH, $DOC_EDITOR_VCS_SERVER_PORT, $DOC_EDITOR_VCS_ANON_LOGIN, $DOC_EDITOR_VCS_ANON_PASSWORD, $DOC_EDITOR_VCS_MODULE, $DOC_EDITOR_VCS_KARMA_FILE, $DOC_EDITOR_DATA_PATH, $DOC_EDITOR_VCS_PATH, $DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH, $DOC_EDITOR_NEWS_URL_EN, $DOC_EDITOR_NEWS_URL_LANG, $DOC_EDITOR_BUGS_URL_EN, $DOC_EDITOR_BUGS_URL_LANG, $DOC_EDITOR_ENTITIES_FOLDER, $DOC_EDITOR_ENTITIES_URL, $DOC_EDITOR_VCS_CONFIGURE_SCRIPT_OPTIONS;
-
-/**
- * VCS server
- */
-$DOC_EDITOR_VCS_SERVER_HOST = 'svn.php.net';
-
-/**
- * VCS repository
- */
-$DOC_EDITOR_VCS_SERVER_REPOS = 'repository/';
-
-/**
- * VCS project path
- *
- */
-$DOC_EDITOR_VCS_SERVER_PATH = $DOC_EDITOR_VCS_SERVER_REPOS . 'pear/peardoc/trunk/';
-
-/**
- * VCS server port
- */
-$DOC_EDITOR_VCS_SERVER_PORT = '80';
-
-/**
- * VCS Anonymous user
- */
-$DOC_EDITOR_VCS_ANON_LOGIN = '';
-
-/**
- * VCS Anonymous user password
- */
-$DOC_EDITOR_VCS_ANON_PASSWORD='';
-
-/**
- * VCS module
- */
-$DOC_EDITOR_VCS_MODULE = 'peardoc';
-
-/**
- * Karma File
- */
-$DOC_EDITOR_VCS_KARMA_FILE = 'http://svn.php.net/viewvc/SVNROOT/global_avail?view=co';
-
-/**
- * VCS path
- */
-$DOC_EDITOR_VCS_PATH = $DOC_EDITOR_DATA_PATH . $DOC_EDITOR_VCS_MODULE . '/';
-
-
-/**
- * VCS configure.php path
- */
-$DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH = $DOC_EDITOR_VCS_PATH;
-
-/**
- * VCS configure.php path
- */
-$DOC_EDITOR_VCS_CONFIGURE_SCRIPT_OPTIONS = '--lang={LangCode}';
-
-/**
- * News URL for EN
- */
-$DOC_EDITOR_NEWS_URL_EN = 'http://news.php.net/group.php?format=rss&group=php.pear.doc';
-
-/**
- * News URL for LANG
- */
-$DOC_EDITOR_NEWS_URL_LANG = 'http://news.php.net/group.php?format=rss&group=php.pear.doc';
-
-/**
- * Bugs URL for EN
- */
-$DOC_EDITOR_BUGS_URL_EN = 'http://pear.php.net/feeds/latest.rss';
-
-/**
- * Bugs URL for LANG
- */
-$DOC_EDITOR_BUGS_URL_LANG = 'http://pear.php.net/feeds/latest.rss';
-
-/**
- * Entities FOLDER
- */
-$DOC_EDITOR_ENTITIES_FOLDER = 'entities';
-
-/**
- * Entities URL
- */
-$DOC_EDITOR_ENTITIES_URL = $DOC_EDITOR_VCS_PATH . $DOC_EDITOR_ENTITIES_FOLDER . '/global.ent';
-?>
\ No newline at end of file

Deleted: web/doc-editor/trunk/php/conf.php.inc.php
===================================================================
--- web/doc-editor/trunk/php/conf.php.inc.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/conf.php.inc.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -1,90 +0,0 @@
-<?php
-global $DOC_EDITOR_VCS_SERVER_HOST, $DOC_EDITOR_VCS_SERVER_REPOS, $DOC_EDITOR_VCS_SERVER_PATH, $DOC_EDITOR_VCS_SERVER_PORT, $DOC_EDITOR_VCS_ANON_LOGIN, $DOC_EDITOR_VCS_ANON_PASSWORD, $DOC_EDITOR_VCS_MODULE, $DOC_EDITOR_VCS_KARMA_FILE, $DOC_EDITOR_DATA_PATH, $DOC_EDITOR_VCS_PATH, $DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH, $DOC_EDITOR_NEWS_URL_EN, $DOC_EDITOR_NEWS_URL_LANG, $DOC_EDITOR_BUGS_URL_EN, $DOC_EDITOR_BUGS_URL_LANG, $DOC_EDITOR_ENTITIES_FOLDER, $DOC_EDITOR_ENTITIES_URL, $DOC_EDITOR_VCS_CONFIGURE_SCRIPT_OPTIONS;
-
-/**
- * VCS server
- */
-$DOC_EDITOR_VCS_SERVER_HOST = 'svn.php.net';
-
-/**
- * VCS repository
- */
-$DOC_EDITOR_VCS_SERVER_REPOS = 'repository/';
-
-/**
- * VCS project path
- *
- */
-$DOC_EDITOR_VCS_SERVER_PATH = $DOC_EDITOR_VCS_SERVER_REPOS . 'phpdoc/modules/doc-all/';
-
-/**
- * VCS server port
- */
-$DOC_EDITOR_VCS_SERVER_PORT = '80';
-
-/**
- * VCS Anonymous user
- */
-$DOC_EDITOR_VCS_ANON_LOGIN = '';
-
-/**
- * VCS Anonymous user password
- */
-$DOC_EDITOR_VCS_ANON_PASSWORD = '';
-
-/**
- * VCS module
- */
-$DOC_EDITOR_VCS_MODULE = 'phpdoc-all';
-
-/**
- * Karma File
- */
-$DOC_EDITOR_VCS_KARMA_FILE = 'http://svn.php.net/viewvc/SVNROOT/global_avail?view=co';
-
-/**
- * VCS path
- */
-$DOC_EDITOR_VCS_PATH = $DOC_EDITOR_DATA_PATH . $DOC_EDITOR_VCS_MODULE . '/';
-
-/**
- * VCS configure.php path
- */
-$DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH = $DOC_EDITOR_VCS_PATH . 'doc-base/';
-
-/**
- * VCS configure.php path
- */
-$DOC_EDITOR_VCS_CONFIGURE_SCRIPT_OPTIONS = '--with-lang={LangCode} --disable-segfault-error --srcdir='.$DOC_EDITOR_VCS_CONFIGURE_SCRIPT_PATH.' {XmlDetails}';
-
-/**
- * News URL for EN
- */
-$DOC_EDITOR_NEWS_URL_EN = 'http://news.php.net/group.php?format=rss&group=php.doc';
-
-/**
- * News URL for LANG
- */
-$DOC_EDITOR_NEWS_URL_LANG = 'http://news.php.net/group.php?format=rss&group=php.doc.{LANG}';
-
-/**
- * Bugs URL for EN
- */
-$DOC_EDITOR_BUGS_URL_EN = 'http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Documentation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=10&assign=';
-
-/**
- * Bugs URL for LANG
- */
-$DOC_EDITOR_BUGS_URL_LANG = 'http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Translation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=All&assign=&format=rss';
-
-/**
- * Entities FOLDER
- */
-$DOC_EDITOR_ENTITIES_FOLDER = 'doc-base';
-
-/**
- * Entities URL
- */
-$DOC_EDITOR_ENTITIES_URL = $DOC_EDITOR_VCS_PATH.$DOC_EDITOR_ENTITIES_FOLDER.'/entities/global.ent';
-
-?>
\ No newline at end of file

Modified: web/doc-editor/trunk/php/utility.php
===================================================================
--- web/doc-editor/trunk/php/utility.php	2010-03-01 22:50:42 UTC (rev 295699)
+++ web/doc-editor/trunk/php/utility.php	2010-03-01 22:55:43 UTC (rev 295700)
@@ -9,10 +9,13 @@
  */
 function debug($mess)
 {
+    $appConf = AccountManager::getInstance()->appConf;
+    $project = AccountManager::getInstance()->project;
+
     $mess = '['.@date('d/m/Y H:i:s').'] by '
             .AccountManager::getInstance()->vcsLogin.' : '.str_replace("\r\n", " ", $mess)."\n";

-    $fp = fopen($GLOBALS['DOC_EDITOR_VCS_PATH'].'../.debug', 'a+');
+    $fp = fopen($appConf[$project]['vcs.path'].'../.debug', 'a+');
     fwrite($fp, $mess);
     fclose($fp);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.