Exemplo n.º 1
0
<?php

define("IN_MODULE", true);
require_once '../includes/FileScopeReplacer.php';
require_once '../includes/config.inc.php';
require_once '../includes/functions.inc.php';
$oldstatus = $c_status;
$newstatus = trim(strip_tags($_GET['newstatus']));
if (empty($newstatus) || $newstatus == "" || $newstatus == " ") {
    die($newstatus . "      -Incorrect params. Check them.");
}
$params = array();
//--------------- configuration --------------
// directory where files will be searched to replace
$params['dir'] = '../includes/';
// set to 1 if you want to proceed also nested directories
$params['include_nested'] = 0;
// this is string of what you are looking for
$params['search_what'] = $oldstatus;
$params['replace_to'] = $newstatus;
// setting for filtering, set '' if no filtering,
// otherwise thi is regexp expression like: '/your_regexp/flags',
// see http://www.php.net/manual/en/pcre.pattern.syntax.php
$params['file_name_match'] = '/^config.inc.php/';
// <-- this mean beginning from 'test'
//--------------- end configuration --------------
$replacer = new FileScopeReplacer($params);
$replacer->doWork();
//send to twitter
twit($newstatus);
echo "Weather station status was changed successfully.<br><br><a href='index.php'>Back</a>";
Exemplo n.º 2
0
    SORT_ASC,
    $files
);*/
/** Perform a GET request and echo the response **/
/** Note: Set the GET field BEFORE calling buildOauth(); **/
$page = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//file name
$cachefile = $cachedir . "cache.json";
if (file_exists($cachefile)) {
    $cachefile_created = filemtime($cachefile);
} else {
    $cachefile_created = 0;
}
if (time() - $cachetime < $cachefile_created) {
    $output = file_get_contents($cachefile);
    //echo "reading cache -- for debugging will be gone in launch";
} else {
    //echo "not reading cache -- for debugging will be gone in launch";
    clearstatcache();
    $output = twit();
    $fp = fopen($cachefile, 'w');
    // save the contents of output buffer to the file
    fwrite($fp, $output);
    fclose($fp);
}
$json = json_decode($output, true);
?>