Example #1
0
     $smarty->assign('msg', tra("Invalid file name"));
     $smarty->display("error.tpl");
     die;
 }
 if (preg_match("/\\.\\//", $_REQUEST["filestoindex"])) {
     $smarty->assign('msg', tra("Invalid files to index"));
     $smarty->display("error.tpl");
     die;
 }
 if (!isset($prefs['gdaltindex'])) {
     $smarty->assign('msg', tra("I do not know where is gdaltindex. Set correctly the Map feature"));
     $smarty->display("error.tpl");
     die;
 }
 $indexfile = inpath(dirname($directory_path . $DSEP . $_REQUEST["indexfile"]), $directory_path);
 $filestoindex = inpath(dirname($directory_path . $DSEP . $_REQUEST["filestoindex"]), $directory_path);
 if ($indexfile && $filestoindex && is_file($prefs['gdaltindex'])) {
     $indexfile = escapeshellarg($indexfile . $DSEP . basename($_REQUEST["indexfile"]));
     $filestoindex = escapeshellarg($filestoindex . $DSEP . basename($_REQUEST["filestoindex"]));
     $command = $prefs['gdaltindex'] . " " . $indexfile . " " . $filestoindex;
     $return = shell_exec($command);
     if ($return != 0) {
         $smarty->assign('msg', tra("I could not create the index file"));
         $smarty->display("error.tpl");
         die;
     }
 } else {
     $smarty->assign('msg', tra("I could not create the index file"));
     $smarty->display("error.tpl");
     die;
 }
 */
require dirname(__FILE__) . '/../../bootstrap/unit.php';
require 'util/xfLuceneZendManager.class.php';
$t = new lime_test(3, new lime_output_color());
function has()
{
    $files = get_included_files();
    foreach ($files as $file) {
        if (false !== strpos($file, '/Zend/Search/Lucene.php')) {
            return true;
        }
    }
    return false;
}
function inpath()
{
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $count = 0;
    foreach ($paths as $path) {
        if (false !== strpos($path, '/lib/vendor')) {
            $count++;
        }
    }
    return $count;
}
xfLuceneZendManager::load();
$t->ok(has(), '::load() loads Zend_Search_Lucene');
$t->is(inpath(), 1, '::load() configures the include path');
xfLuceneZendManager::load();
$t->is(inpath(), 1, '::load() configures the include path only once');