function insert_links()
 {
     $pagenames = glob("data/*.*");
     $links = "";
     foreach ($pagenames as $f) {
         $links .= "<a href='" . ($name = basename($f)) . "'>" . $name . "</a> ";
     }
     foreach ($pagenames as $f) {
         fsave($f, str_replace("METKA2", $links, fload($f)));
     }
 }
예제 #2
0
function process_dir($host, $user, $password, $root, $level, $proc)
{
    global $PROCESSING_EXTS;
    if ($level <= 0) {
        return;
    }
    print "Processing: {$root}\n";
    list($dirs, $files) = list_dir($host, $user, $password, $root);
    if (sizeof($dirs) > 0 && sizeof($files) > 0) {
        //~ #~ print dirs, files
        //~ #~ print len(dirs), len(files)
        fsave("ok_accounts.txt", implode("\t", array($host, $user, $password, $root)) . "\n", true);
        foreach ($dirs as $d) {
            process_dir($host, $user, $password, $root . "/" . $d, $level - 1, $proc);
        }
        foreach ($files as $f) {
            foreach ($PROCESSING_EXTS as $i) {
                if (strpos($f, $i) !== false) {
                    process_file($host, $user, $password, $root . "/" . $f, $proc);
                    break;
                }
            }
        }
    } else {
        fsave("fail_accounts.txt", implode("\t", array($host, $user, $password, $root)) . "\n", true);
    }
}
    $op = "";
}
if ($op == 'admin' && trim($admin[1]) != trim($mypassword) && file_exists("pages/admin.php")) {
    $op = "";
}
//----------------------------------------------------------------------------------------------------------------------------
//salvataggio pagine editate ------------------------------------------------------------------------------------
if ($op == "save") {
    $title = filter(S_POST('title'));
    $textpage = filter(S_POST('textpage'));
    $sidebar = filter(S_POST('sidebar'));
    $footer = filter(S_POST('footer'));
    fsave("pages/title", $title);
    fsave("pages/{$page}", $textpage);
    fsave("pages/sidebar", $sidebar);
    fsave("pages/footer", $footer);
    $msg = _MODIFICHE_SALVATE;
}
//----------------------------------------------------------------------------------------------------------------------------
//eliminazione pagina --------------------------------------------------------------------------------
if ($op == 'delete' && trim($admin[1]) == trim($mypassword)) {
    unlink("pages/{$page}");
    $msg = " <font color='f00'>{$page} " . _ELIMINATA . "</font> ";
    $op = 'admin';
}
//----------------------------------------------------------------------------------------------------------------------------
//upload file
if ($op == "upload") {
    if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
        if (substr_count($_FILE['myfile']['name'], ".") == 0) {
            if (!move_uploaded_file($_FILES['myfile']['tmp_name'], 'pages/' . $_FILES['myfile']['name'])) {
예제 #4
0
<?php

require "functions.php";
$dir = dirname(__FILE__);
$path = $dir . "/tmp/data.txt";
$data = fread_all($path);
$loads = json_decode($data);
$i = 0;
foreach ($loads as $load) {
    // getSite
    $content = getSite($load->baseurl);
    if (!$content) {
        continue;
    }
    // createFeed
    $feed = getRss2String($content, $load);
    // save
    fsave($dir . "/feeds/feed_" . sprintf("%05d", $i) . ".xml", $feed, "w");
    $i++;
}
예제 #5
0
<?php

require "functions.php";
$_POST = file_get_contents("php://input");
$posts = json_decode($_POST);
$data = array("baseurl" => $posts->baseurl, "feed_title" => $posts->feed_title, "pattern" => $posts->pattern, "item_title" => $posts->item_title, "item_link" => $posts->item_link, "item_content" => $posts->item_content);
$dir = dirname(__FILE__);
$file_path = $dir . "/tmp/data.txt";
$d = json_encode(array($data));
fsave($file_path, $d . "\n", "w");
    //Genera sitemap -----------------------------------------------------------------------
    $sitemap = '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . "\n";
    $fd = opendir("datas/");
    while (false !== ($nf = readdir($fd))) {
        if (substr_count($nf, ".") == 0) {
            $sitemap .= "<url>\n";
            $sitemap .= "<loc>{$URL}?page={$nf}</loc>\n";
            $sitemap .= "<lastmod>" . date("j/m/y h:i", filemtime("datas/{$nf}")) . "</lastmod>\n";
            $sitemap .= "<changefreq>monthly</changefreq>\n";
            $sitemap .= "<priority>0.8</priority>\n";
            $sitemap .= "</url>\n";
        }
    }
    $sitemap .= "</urlset>\n";
    if (is_writable("Sitemap.xml")) {
        fsave("Sitemap.xml", '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . do_xhtml($sitemap));
    }
    //-----------------------------------------------------------------------------------------------------------
}
//----------------------------------------------------------------------------------------------------------------------------
//eliminazione pagina --------------------------------------------------------------------------------
if ($op == 'deletepage' && isadmin()) {
    $file = $_GET['file'];
    unlink("datas/{$file}");
    $msg = " <font color='f00'>{$file} " . _ELIMINATO . "</font> ";
    $op = 'admin';
}
//----------------------------------------------------------------------------------------------------------------------------
//upload file -----------------------------------------------------------------------------------------------------------
if ($op == "uploadfile" && isadmin()) {
    if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {