soucis avec les url relatives
authorx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 09:23:48 +0000 (09:23 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 09:23:48 +0000 (09:23 +0000)
include/auto.prepend.inc.php
plugins/insert.mkStats.php

index c2e0852..7e32a0d 100644 (file)
@@ -20,7 +20,7 @@ function _new_page($type, $tpl_name, $tpl_head, $min_auth, $popup=false, $admin=
 
     $page->template_dir = $globals->spoolroot . "/templates/";
     $page->compile_dir  = $globals->spoolroot . "/templates_c/";
-    $page->plugins_dir  = $globals->spoolroot . "/plugins/";
+    $page->plugins_dir[]= $globals->spoolroot . "/plugins/";
     $page->cache_dir    = $globals->spoolroot . "/cache/";
 
     $page->assign('xorg_head', $tpl_head);
index 8202c49..2e5f7f8 100644 (file)
@@ -7,6 +7,15 @@ function nb_trk($pri,$tr) {
     return ($res?$res:"-");
 }
 
+function url()
+{
+  $chemins = Array('.', '..', '../..');
+  foreach ($chemins as $ch) {
+    if (file_exists("$ch/login.php"))
+      return "$ch";
+  }
+  return "";
+}
 /*
  * Smarty plugin
  * ------------------------------------------------------------- 
@@ -24,6 +33,8 @@ function smarty_insert_mkStats($params, &$smarty)
     $stats_req = ($stats_req ? $stats_req : "-");
 
     $nbtrk = array(nb_trk(5,2), nb_trk(4,2), nb_trk(5,1), nb_trk(4,1));
+
+    $rel = url();
     return <<<EOF
         <table class="bicol"
           style="font-weight:normal;text-align:center; border-left:0px; border-right:0px; margin-top:0.5em; width:100%; margin-left: 0;">
@@ -33,14 +44,14 @@ function smarty_insert_mkStats($params, &$smarty)
           <th width="33%">Todo</th>
         </tr>
         <tr class="impair">
-          <td><a href="admin/valider.php">$stats_req</a></td>
+          <td><a href="$rel/admin/valider.php">$stats_req</a></td>
           <td>
-            <a href="trackers/tracker_show.php?tr_id=2">
+            <a href="$rel/trackers/tracker_show.php?tr_id=2">
             <strong>{$nbtrk[0]}</strong> / {$nbtrk[1]}
             </a>
           </td>
           <td>
-            <a href="trackers/tracker_show.php?tr_id=1">
+            <a href="$rel/trackers/tracker_show.php?tr_id=1">
             <strong>{$nbtrk[2]}</strong> / {$nbtrk[3]}
             </a>
           </td>