Don't directly alter $conf array; use $chora_conf instead
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Jan 2011 19:56:02 +0000 (12:56 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Jan 2011 20:18:02 +0000 (13:18 -0700)
$conf can be overwritten at any time by an application push, so there is
no guarantee the data will remain in there.

chora/browsedir.php
chora/lib/Application.php
chora/lib/Chora.php
chora/templates/headerbar.inc

index dae1f92..d6483e7 100644 (file)
@@ -35,7 +35,7 @@ try {
 
 /* Decide what title to display. */
 $title = ($where == '')
-    ? $conf['options']['introTitle']
+    ? $chora_conf['introTitle']
     : "/$where";
 
 $extraLink = $VC->hasFeature('deleted')
index e3d7d28..2a3574f 100644 (file)
@@ -44,12 +44,12 @@ class Chora_Application extends Horde_Registry_Application
      * Initialization function.
      *
      * Global variables defined:
+     *   $chora_conf
      *   $sourceroots
      */
     protected function _init()
     {
-        global $conf;
-        global $acts, $defaultActs, $where, $atdir, $fullname, $sourceroot;
+        global $acts, $conf, $defaultActs, $where, $atdir, $fullname, $sourceroot;
 
         try {
             $GLOBALS['sourceroots'] = Horde::loadConfiguration('backends.php', 'sourceroots');
@@ -119,20 +119,21 @@ class Chora_Application extends Horde_Registry_Application
             ? null
             : $GLOBALS['injector']->getInstance('Horde_Cache');
 
-        $conf['paths']['temp'] = Horde::getTempDir();
-
-        $GLOBALS['VC'] = Horde_Vcs::factory(Horde_String::ucfirst($sourcerootopts['type']),
-            array('cache' => $cache,
-                  'sourceroot' => $sourcerootopts['location'],
-                  'paths' => $conf['paths'],
-                  'username' => isset($sourcerootopts['username']) ? $sourcerootopts['username'] : '',
-                  'password' => isset($sourcerootopts['password']) ? $sourcerootopts['password'] : ''));
-
-        $conf['paths']['sourceroot'] = $sourcerootopts['location'];
-        $conf['paths']['cvsusers'] = $sourcerootopts['location'] . '/' . (isset($sourcerootopts['cvsusers']) ? $sourcerootopts['cvsusers'] : '');
-        $conf['paths']['introText'] = CHORA_BASE . '/config/' . (isset($sourcerootopts['intro']) ? $sourcerootopts['intro'] : '');
-        $conf['options']['introTitle'] = isset($sourcerootopts['title']) ? $sourcerootopts['title'] : '';
-        $conf['options']['sourceRootName'] = $sourcerootopts['name'];
+        $GLOBALS['chora_conf'] = array(
+            'cvsusers' => $sourcerootopts['location'] . '/' . (isset($sourcerootopts['cvsusers']) ? $sourcerootopts['cvsusers'] : ''),
+            'introText' => CHORA_BASE . '/config/' . (isset($sourcerootopts['intro']) ? $sourcerootopts['intro'] : ''),
+            'introTitle' => (isset($sourcerootopts['title']) ? $sourcerootopts['title'] : ''),
+            'sourceRootName' => $sourcerootopts['name']
+        );
+        $chora_conf = &$GLOBALS['chora_conf'];
+
+        $GLOBALS['VC'] = Horde_Vcs::factory(Horde_String::ucfirst($sourcerootopts['type']), array(
+            'cache' => $cache,
+            'sourceroot' => $sourcerootopts['location'],
+            'paths' => array_merge($conf['paths'], array('temp' => Horde::getTempDir())),
+            'username' => isset($sourcerootopts['username']) ? $sourcerootopts['username'] : '',
+            'password' => isset($sourcerootopts['password']) ? $sourcerootopts['password'] : ''
+        ));
 
         $where = Horde_Util::getFormData('f', '/');
 
index 3ebcb6d..99aa01d 100644 (file)
@@ -433,7 +433,7 @@ class Chora
     static public function showAuthorName($name, $fullname = false)
     {
         try {
-            $users = $GLOBALS['VC']->getUsers($GLOBALS['conf']['paths']['cvsusers']);
+            $users = $GLOBALS['VC']->getUsers($GLOBALS['chora_conf']['cvsusers']);
             if (isset($users[$name])) {
                 return '<a href="mailto:' . htmlspecialchars($users[$name]['mail']) . '">' .
                     htmlspecialchars($fullname ? $users[$name]['name'] : $name) .
@@ -447,7 +447,7 @@ class Chora
     static public function getAuthorEmail($name)
     {
         try {
-            $users = $GLOBALS['VC']->getUsers($GLOBALS['conf']['paths']['cvsusers']);
+            $users = $GLOBALS['VC']->getUsers($GLOBALS['chora_conf']['cvsusers']);
             if (isset($users[$name])) {
                 return $users[$name]['mail'];
             }
index 08d7bb1..d57f1c4 100644 (file)
@@ -3,7 +3,7 @@
  <tr>
   <td class="browseLocation">
    <?php echo _("Location:") ?>
-   <strong>[ <a href="<?php echo Chora::url('browsedir') ?>"><?php echo $conf['options']['sourceRootName'] ?></a> ]
+   <strong>[ <a href="<?php echo Chora::url('browsedir') ?>"><?php echo $chora_conf['sourceRootName'] ?></a> ]
    <?php echo Chora::whereMenu($where, isset($onb) ? $onb : null) ?></strong>
 <?php if (!empty($onb)): ?>
     <em><?php echo _("Tracking Branch") ?>: <strong><?php echo $onb ?></strong></em>
@@ -14,9 +14,9 @@
 <?php endif; ?>
  </tr>
 
-<?php if (!$where && @is_file($conf['paths']['introText'])): ?>
+<?php if (!$where && @is_file($chora_conf['introText'])): ?>
  <tr>
-  <td class="text" colspan="2"><?php @readfile($conf['paths']['introText']) ?></td>
+  <td class="text" colspan="2"><?php @readfile($chora_conf['introText']) ?></td>
  </tr>
 <?php endif; ?>