Beispiel #1
0
 public function pingUrl()
 {
     if (!utils::keysOk($this->data, ['url', 'title'])) {
         return $this->response('ERROR', 'required keys not set');
     }
     $url = $this->data['url'];
     if (!utils::validUrl($url)) {
         return $this->response('ERROR', 'invalid url');
     }
     $title = $this->data['title'];
     main::loadLibs(['httpRequest/httpRequest.class.php']);
     $pingomaticUrl = 'http://pingomatic.com/ping/' . '?title=' . urlencode($title) . '&blogurl=' . urlencode($url) . '&rssurl=' . '&chk_weblogscom=on' . '&chk_blogs=on' . '&chk_feedburner=on' . '&chk_newsgator=on' . '&chk_myyahoo=on' . '&chk_pubsubcom=on' . '&chk_blogdigger=on' . '&chk_weblogalot=on' . '&chk_newsisfree=on' . '&chk_topicexchange=on' . '&chk_google=on' . '&chk_tailrank=on' . '&chk_skygrid=on' . '&chk_collecta=on' . '&chk_superfeedr=on' . '&chk_audioweblogs=on' . '&chk_rubhub=on' . '&chk_a2b=on' . '&chk_blogshares=on';
     $request = new httpRequest($pingomaticUrl);
     $request->setRandUserAgent();
     if (array_key_exists('proxy', $this->data)) {
         try {
             $request->setProxy($this->data['proxy']);
         } catch (Exception $e) {
             return $this->response('ERROR', $e->getMessage());
         }
     }
     $request = $request->exec();
     if (!$request['status'] == 'OK') {
         return $this->response('ERROR', $request['message']);
     }
     if (strrpos($request['data'], 'Pinging complete!') === false) {
         return $this->response('ERROR', 'pingomatic failed to ping ' . $url);
     }
     return $this->response('OK', 'successfully pinged ' . $url);
 }
Beispiel #2
0
header('Content Type: text/plain');
define('wm_absolute_path', dirname(__FILE__) . '/');
define('wm_lib_path', wm_absolute_path . 'lib/');
define('wm_acts_path', wm_absolute_path . 'acts/');
define('wm_templates_path', wm_absolute_path . 'templates/');
define('wm_log_path', wm_absolute_path . 'log/');
define('wm_db_file', wm_absolute_path . 'db.sqlite');
require wm_absolute_path . 'main.php';
require wm_absolute_path . 'template.php';
require wm_absolute_path . 'utils.php';
$inputData = trim(file_get_contents('php://input'));
if (!$inputData) {
    main::log('ERROR', sprintf('[%s] no input data provided', $_SERVER['REMOTE_ADDR']), true);
}
$inputData = json_decode($inputData, true);
if (!($inputData && is_array($inputData))) {
    main::log('ERROR', sprintf('[%s] invalid input data', $_SERVER['REMOTE_ADDR']), true);
}
if (!utils::keysOk($inputData, ['act', 'data'])) {
    main::log('ERROR', sprintf('[%s] required keys not set', $_SERVER['REMOTE_ADDR']), true);
}
$act = $inputData['act'];
$data = $inputData['data'];
main::loadLibs(['sqliteDB/sqliteDB.class.php']);
main::initDB();
list($laBool, $laMsg) = main::loadAct($act);
if (!$laBool) {
    main::log('ERROR', $lsMsg, true);
}
$actOb = new $act($data);
print_r($actOb->exec());