Example #1
0
function unlinkRecursive($dir, $deleteRootToo)
{
    if (!($dh = @opendir($dir))) {
        return;
    }
    while (false !== ($obj = readdir($dh))) {
        if ($obj == '.' || $obj == '..') {
            continue;
        }
        $file = $dir . '/' . $obj;
        if (is_dir($file)) {
            $filelastmodified = filemtime($file . "/.");
            if (time() - $filelastmodified > 10 * 60) {
                unlinkRecursive($dir . '/' . $obj, true);
            }
        } else {
            $filelastmodified = filemtime($file);
            if (time() - $filelastmodified > 10 * 60) {
                @unlink($file);
            }
        }
    }
    closedir($dh);
    if ($deleteRootToo) {
        @rmdir($dir);
    }
    return;
}
Example #2
0
function purge()
{
    $source = "update/backup";
    if (unlinkRecursive($source, false)) {
        echo "Purge ancienne sauvegarde OK<br>";
        return true;
    } else {
        echo "Erreur purge ancienne sauvegarde : annulation de l'installation";
        return false;
    }
}
Example #3
0
function ADMINISTRACION_RESTABLECER_SISTEMA()
{
    if (isset($_POST['chk_confirmar_restablecer_sistema']) && isset($_POST['btn_restablecer_sistema'])) {
        $tablas = array('productos_categoria', 'producto_variedad', 'producto_contenedor', 'usuarios');
        foreach ($tablas as $tabla) {
            db_consultar(sprintf('TRUNCATE TABLE `%s`', db_prefijo . $tabla));
        }
        unlinkRecursive('IMG/i/', false);
        mkdir('IMG/i/m/');
    }
}
function unlinkRecursive($dir)
{
    if (!($dh = @opendir($dir))) {
        return "Warning: folder {$dir} couldn't be read by PHP";
    }
    while (false !== ($obj = readdir($dh))) {
        if ($obj == '.' || $obj == '..') {
            continue;
        }
        if (!@unlink($dir . '/' . $obj)) {
            unlinkRecursive($dir . '/' . $obj, true);
        }
    }
    closedir($dh);
    @rmdir($dir);
    return "Folder {$dir} deleted!";
}
Example #5
0
function unlinkRecursive($dir)
{
    if (!($dh = @opendir($dir))) {
        return;
    }
    while (false !== ($obj = readdir($dh))) {
        if ($obj == '.' || $obj == '..') {
            continue;
        }
        if (!@unlink($dir . '/' . $obj)) {
            unlinkRecursive($dir . '/' . $obj);
        }
    }
    closedir($dh);
    @rmdir($dir);
    return;
}
Example #6
0
function unlinkRecursive($dir)
{
    if (!($dh = @opendir($dir))) {
        return "error::This is not a directory!";
    }
    while (false !== ($obj = readdir($dh))) {
        if ($obj == '.' || $obj == '..') {
            continue;
        }
        if (!@unlink($dir . '/' . $obj)) {
            unlinkRecursive($dir . '/' . $obj);
        }
    }
    closedir($dh);
    @rmdir($dir);
    return true;
}
 function unlinkRecursive($dir, $deleteRootToo)
 {
     if (!($dh = @opendir($dir))) {
         return;
     }
     while (false !== ($obj = readdir($dh))) {
         if ($obj == '.' || $obj == '..') {
             continue;
         }
         if (!@unlink($dir . '/' . $obj)) {
             unlinkRecursive($dir . '/' . $obj, true);
         }
     }
     closedir($dh);
     if ($deleteRootToo) {
         @rmdir($dir);
     }
     return;
 }
Example #8
0
function clean($clean_tmp = false)
{
    $tmp = '_tmp/Pefi_COMRES/';
    $res = 'Cleaning commercials<br>';
    // remove commercial files
    $files = explode(';', tr('commercials.urls:admin'));
    foreach ($files as $fName) {
        $fName = '_pages/' . $fName;
        if (@unlink($fName)) {
            $res .= "Removed file: {$fName} <br>";
        } else {
            $res .= "Tried to remove file: {$fName} but no success <br>";
        }
    }
    if ($clean_tmp && is_dir($tmp)) {
        @unlinkRecursive($tmp);
        if (@rmdir($tmp)) {
            $res .= "Removed dir: {$tmp} <br>";
        } else {
            $res .= "Tried to remove dir: {$tmp} but no success <br>";
        }
    }
    return $res;
}
Example #9
0
<?php

require_once "PHP/vital.php";
ini_set('memory_limit', '128M');
set_time_limit(0);
unlinkRecursive('catalogo360/pages/', false);
$c = 'SELECT codigo_categoria, titulo FROM flores_categorias WHERE codigo_menu IN (1,2) ORDER BY titulo';
$r = db_consultar($c);
$XML = simplexml_load_file('catalogo360/marcadores-base.xml');
$XMLP = simplexml_load_file('catalogo360/config-base.xml');
$general = $XML->addChild('seccion');
$general->addAttribute("titulo", "Catalogo");
$general->addAttribute("pagina", "");
$pagina_actual = 1;
while ($f = mysql_fetch_assoc($r)) {
    $ref = $general->addChild('ref');
    //$ref->addAttribute("titulo",iconv('ISO-8859-1','UTF-8//TRANSLIT',$f['titulo']));
    $ref->addAttribute("titulo", $f['titulo']);
    $ref->addAttribute("pagina", $pagina_actual);
    $cp = 'SELECT foto, pc.titulo FROM flores_productos_categoria LEFT JOIN flores_producto_contenedor AS pc USING(codigo_producto) LEFT JOIN flores_producto_variedad USING(codigo_producto) WHERE codigo_categoria=' . $f['codigo_categoria'] . ' GROUP BY codigo_producto';
    $rp = db_consultar($cp);
    $pagina_actual += 1 + mysql_numrows($rp);
    while ($fp = mysql_fetch_assoc($rp)) {
        if (!file_exists('catalogo360/pages/' . $fp['foto'])) {
            $im = new Imagick('IMG/i/' . $fp['foto']);
            $im->setCompression(Imagick::COMPRESSION_JPEG);
            $im->setCompressionQuality(90);
            $im->setImageFormat('jpeg');
            $im->stripImage();
            $draw = new ImagickDraw();
            $pixel = new ImagickPixel('gray');
Example #10
0
         $returnError = "";
         $command2sudo = $command2Run->firstChild->nodeValue;
         exec("sudo {$command2sudo}", $outputCommand, $returnError);
         if ($returnError) {
             $messageOutput .= "[ERROR] Command run with errors: {$command2sudo}\n";
             $errorInCommand = true;
         } else {
             $messageOutput .= "[INFO] Command run successfully: {$command2sudo}\n";
         }
         $messageOutput .= implode("\n", $outputCommand) . "\n";
     }
 } else {
     $messageOutput .= "!!! Missing mandatory file. Please check package integrity.\n";
 }
 $messageOutput .= "Purging temporary folder /tmp/sexigraf-update/";
 unlinkRecursive("/tmp/sexigraf-update/");
 echo $messageOutput;
 echo "</pre>";
 $updateLog = fopen("update.log", "w");
 fwrite($updateLog, $messageOutput);
 fclose($updateLog);
 if ($errorInCommand) {
     echo ' <div class="alert alert-danger" role="danger">
     <h4><span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
     <span class="sr-only">Error:</span>
     There was some errors during the update process!</h4>
     Some errors occured during update of your SexiGraf appliance. This shouldn\'t happen, but don\'t worry, we are here to help you!<br />
     If you want, you can take a look above to the report that can point you to the right direction, or you can send it to us at plot &lt;at&gt; sexigraf.fr
     <p>You can fin update log <a href="update.log" target="_blank">here</a>, you can use the following button to send us an email with the details, we\'ll look into it and get back to you.</p>
     <form class="form" action="" method="post">
             <p><a class="btn btn-danger" href="mailto:plot@sexigraf.fr?subject=Error during upgrade&body=Please Find attached update error log."><i class="glyphicon glyphicon-remove-sign"></i> Send Support Mail</a></p>
Example #11
0
<?php

header('content-type: text/html; charset=utf-8');
require_once 'clean.php';
// create temporary directory name
$dir = $_POST['name'];
$prefix = $dir . "/TMP";
$name = $prefix . md5(time() . rand());
if (is_dir($dir) == false) {
    if (!mkdir($dir)) {
        die("Directory could not be created");
    }
} else {
    // remove old stuff
    unlinkRecursive($dir, false);
}
// create temporary directory, if not already existing
if (is_dir("{$name}") == false) {
    if (!mkdir("{$name}")) {
        die("Directory could not be created");
    }
}
echo "{$name}";
Example #12
0
  a downloaded page...
*/
echo "\n\n\nAn example of making a cached of page request" . " with the search API:\n";
$url = "http://www.ucanbuyart.com/";
$ui_flags = array();
$search_terms = "art classifieds";
// these words will be highlighted
$index_timestamp = "1317414322";
$data = $controller->cacheRequest($url, $ui_flags, $search_terms, $index_timestamp);
echo $data;
/*
  We now delete the example index to clean-up our test. In real-life
  you wouldn't want to delete your query index after making one query
*/
unlinkRecursive(CRAWL_DIR . "/cache/Archive1317414322");
unlinkRecursive(CRAWL_DIR . "/cache/IndexData1317414322");
// demo over, bye-bye for now!
exit;
/**
 * Short function to pretty-print the data gotten back from a Yioop! query
 * @param array $data  what we got back from doing a query
 */
function outputQueryData($data)
{
    // Now to print out info in the result
    foreach ($data['PAGES'] as $page) {
        echo "============\n";
        echo "TITLE: " . trim($page[CrawlConstants::TITLE]) . "\n";
        echo "URL: " . trim($page[CrawlConstants::URL]) . "\n";
        echo "DESCRIPTION:" . wordwrap(trim($page[CrawlConstants::DESCRIPTION])) . "\n";
        echo "Rank: " . $page[CrawlConstants::DOC_RANK] . "\n";
Example #13
0
File: util.php Project: sziszu/pefi
function cleanDir($dir)
{
    if ($dir != '') {
        @unlinkRecursive($dir);
        @rmdir($dir);
    }
}
Example #14
0
        // shouldn't end with ~
        if (!in_array(substr($fName, strlen($fName) - 1, 1), array('~')) && !in_array(substr($fName, 7, 1), array('_'))) {
            $content .= "<li><p>{$fName}</p><ul>";
            foreach ($_PEFI->route->langs as $lang) {
                $route = new Pefi_Router(createURL(basename($fName), $lang), $tr);
                $content .= '<li>' . $lang . ' - ' . cacheFile($route) . '</li>';
            }
            $content .= '</ul></li>';
        }
    }
    $content .= '</ol>';
    $_PEFI->view->content = $content;
    $tr->setEdit($edit);
    $tr->save($log);
} elseif ($todo == 'clearcache') {
    unlinkRecursive('_cache');
    $_PEFI->view->messages[] = '<p>Cache Cleaned</p>';
} elseif ($todo == 'editbfile') {
    $r = new Pefi_Router($_REQUEST['page'], $tr);
    $editedFile = $r->pageFile;
    $editedAction = createActionURL('site', 'savefile');
    $editedFileDir = dirname($editedFile);
    include 'codeedit.php';
} elseif ($todo == 'savefile' or $todo == 'viewfiles') {
    $excludedFiles = array('.');
    // figure out working dir
    if (array_key_exists('fileOrDir', $_REQUEST)) {
        $fileOrDir = $_REQUEST['fileOrDir'];
    } else {
        $fileOrDir = '.';
    }