Your IP : 216.73.216.186


Current Path : /home/pressec/www/presselib/coup-de-pouce/
Upload File :
Current File : /home/pressec/www/presselib/coup-de-pouce/cli.php

<?php

  if(!isset($argv) || !$argv){
    echo "variable argv non disponible\n";
    return;
  }

  $path_file = "pathes.php";
  $FIRST = false;
  foreach($argv as $cmd_arg){
    if(!$FIRST){
      $FIRST = true;
      continue;
    }
    if(strlen($cmd_arg)){
      if(($k = strpos($cmd_arg, "=")) && (substr($cmd_arg, 0, $k) == "path_file")){
        $path_file = substr($cmd_arg, $k + 1);
      }
    }
  }  
  if(!$path_file || !file_exists($path_file)){
    echo "fichier des chemins introuvable\n";
    return;
  }

  require $path_file;
  $PATHES["mw_dir"] .= $PATHES["mw_dir"] && substr($PATHES["mw_dir"], -1) != "/" ? "/" : "";
  require $PATHES["mw_dir"]."mw_app.php";

  $app = new mw_app($path_file);

  if(($res = $app->init()) !== true){
    echo $res."\n";
    return;
  }

  $env = $app->env();

  if(($res = $env->run_cli($argv)) !== true){
    echo $res."\n";
    return;
  }

  debug($env->get_out());