Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
slackbuilds:repository [2015/03/30 12:19]
Giuseppe Di Terlizzi
slackbuilds:repository [2015/03/30 12:43]
Giuseppe Di Terlizzi
Line 1: Line 1:
 ====== Lotar's SlackBuilds Repository ====== ====== Lotar's SlackBuilds Repository ======
  
-<PHP>+<php>
  
 date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
Line 8: Line 8:
  
 $work_dir      = '/membri/lotar/slackbuilds'; $work_dir      = '/membri/lotar/slackbuilds';
-$current_dir   = ltrim(str_replace($work_dir, '', ((isset($_GET['dir'])) ? $_GET['dir'] : '')), '/');+$current_dir   = ltrim(str_replace($work_dir, '', ((isset($_GET['_dir'])) ? $_GET['_dir'] : '')), '/');
 $parent_dir    = dirname("/$current_dir"); $parent_dir    = dirname("/$current_dir");
 $excluded_file = array(basename($_SERVER['PHP_SELF']), '.htaccess', 'index.php'); $excluded_file = array(basename($_SERVER['PHP_SELF']), '.htaccess', 'index.php');
-$url_path      = 'http://lotar.altervista.org/slackbuils';+$url_path      = 'http://lotar.altervista.org/slackbuilds'; //rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
  
 $page_title    = ""; $page_title    = "";
Line 27: Line 27:
 } }
  
-$readme = null;+$readme  = null
 +list($package) = explode('/', $current_dir);
  
-if (file_exists("$work_dir/$current_dir/README")) {+if (file_exists("$work_dir/$current_dir/README") && ! empty($current_dir)) {
   $readme = file_get_contents("$work_dir/$current_dir/README");   $readme = file_get_contents("$work_dir/$current_dir/README");
 } elseif (file_exists("$work_dir/$current_dir/../README")) { } elseif (file_exists("$work_dir/$current_dir/../README")) {
Line 36: Line 37:
  
 if ($readme) { if ($readme) {
-   echo '<pre class="readme">'; +   echo '<p style="white-space:pre; font-family:monospace">'; 
-   //$readme = file_get_contents("$work_dir/$current_dir/README"); +   echo preg_replace("/^($package:)/m", '', $readme); 
-   //echo preg_replace("/^($current_dir:)/m", '', $readme); +   //echo $readme; 
-   echo $readme; +   echo '</p>';
-   echo '</pre>';+
 } }
  
 echo '<table>'; echo '<table>';
 +echo "<caption>$page_title</caption>";
 echo '<thead> echo '<thead>
   <tr>   <tr>
Line 59: Line 60:
   echo "   echo "
   <tr>   <tr>
-    <td><a href=\"?dir=$parent_dir\"><i class=\"fa fa-arrow-left fa-lg\"></i></a></td> +    <td><a href=\"?_dir=$parent_dir\"><i class=\"fa fa-arrow-left fa-lg\"></i></a></td> 
-    <td><a href=\"?dir=$parent_dir\">Parent Directory</a></td>+    <td><a href=\"?_dir=$parent_dir\">Parent Directory</a></td>
     <td>&nbsp;</td>     <td>&nbsp;</td>
     <td> - </td>     <td> - </td>
Line 75: Line 76:
     $size = "-";     $size = "-";
     $icon = 'fa-folder';     $icon = 'fa-folder';
-    $href = ($current_dir) ? "?dir=/$current_dir/$file" : "?dir=/$file";+    $href = ($current_dir) ? "?_dir=/$current_dir/$file" : "?_dir=/$file";
  
   } else {   } else {
Line 117: Line 118:
  
   if (! in_array($file, $excluded_file)) {   if (! in_array($file, $excluded_file)) {
- 
-    $odd = (++$i % 2) ? '' : 'pure-table-odd'; 
  
     echo "     echo "
-    <tr class=\"$odd\">+    <tr>
       <td><a href=\"$href\"><i class=\"fa $icon fa-lg\"></i></a></td>       <td><a href=\"$href\"><i class=\"fa $icon fa-lg\"></i></a></td>
       <td><a href=\"$href\">$file</a></td>       <td><a href=\"$href\">$file</a></td>
Line 135: Line 134:
   </tbody>   </tbody>
 </table>'; </table>';
-</PHP>+ 
 +</php>
  
 ~~NOCACHE~~ ~~NOCACHE~~
  • slackbuilds/repository.txt
  • Last modified: 7 years ago
  • by Giuseppe Di Terlizzi