Beispiel #1
0
function ping($arr = array())
{
    //Ping XML内容
    $ping_body = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>weblogUpdates.extendedPing</methodName><params>' . "\r\n";
    $ping_body .= '<param><value>' . $GLOBALS['config']['blog_name'] . '</value></param>' . "\r\n";
    $ping_body .= '<param><value>' . $GLOBALS['config']['domain'] . '</value></param>' . "\r\n";
    $ping_body .= '<param><value>' . $arr['blog_url'] . '</value></param>."\\r\\n"';
    $ping_body .= '<param><value>' . $GLOBALS['config']['domain'] . '/feed.php' . '</value></param>' . "\r\n";
    $ping_body .= '</params></methodCall>';
    $ping_header = 'Content-Type: text/xml; charset=UTF-8' . "\r\n";
    $ping_header .= 'Content-Length: ' . strlen($ping_body) . "\r\n";
    $ping_header .= 'User-Agent: Simple-Log' . "\r\n";
    $ping_xml = $ping_header . $ping_body;
    //获取ping列表
    $ping_list = file(PBBLOG_ROOT . 'home/plugins/ping/ping.txt');
    $ping_res = array();
    foreach ($ping_list as $val) {
        $ping_res[] = array($ping_url, curl_ping($val, $ping_header, $ping_body));
    }
    $ping_log = "\r\n" . 'Ping at: ' . $GLOBALS['date'] . "\r\n";
    foreach ($ping_res as $val) {
        $ping_log .= $val[0] . ' 结果:' . $val[1] . "\r\n";
    }
    $fp = @fopen(PBBLOG_ROOT . 'home/plugins/ping/ping.log', "ab");
    flock($fp, LOCK_EX);
    fwrite($fp, $ping_log);
    fclose($fp);
}
Beispiel #2
0
    // try to authenticate using cookie
    if ($auth_cookie) {
        $authentication_success = $pony_db->autneticate_cookie($auth_cookie);
        if ($authentication_success) {
            $authentication_login = $pony_db->login;
        }
    }
}
// ajax ping code
// should be displayed before authorization form
if ($admin_routine == 'ping' && $admin_action == 'ping' && $authentication_success && $token === assign($_REQUEST['token']) && ($show_domains && ($pony_db->priv_is_admin() || $show_domains_to_users))) {
    $domain_id = trim(assign($_REQUEST['domain_id']));
    $find_domain_result = $pony_db->find_domain($domain_id);
    if (is_array($find_domain_result) && $find_domain_result && count($find_domain_result) == 3) {
        list($ping_url, $ping_time, $ping_status) = $find_domain_result;
        if (curl_ping($ping_url)) {
            $pony_db->update_domain($domain_id, 'OK');
            die("<span class=\"check\"></span>");
        }
    }
    $pony_db->update_domain($domain_id, 'FAIL');
    die("<span class=\"cross\"></span>");
}
if ($admin_action == 'chart' && strlen($admin_routine) && $authentication_success && $token === assign($_REQUEST['token'])) {
    require_once 'includes/chart.php';
    die;
}
// these variables available can be set after authentication only
$smarty->assign('priv_is_admin', $pony_db->priv_is_admin());
$smarty->assign('priv_can_delete', $pony_db->priv_can_delete());
$smarty->assign('authentication_success', $authentication_success);