Пример #1
0
 public function __call($action, $arguments)
 {
     @(list($server, $option) = $arguments);
     if ($action == 'multicall') {
         $client = new \IXR_ClientMulticall("http://{$server}:9001/RPC2/");
         $client->debug = true;
         foreach ((array) $option as $method) {
             $client->addCall($this->getNamespace($server, $action) . '.' . $method);
         }
         if (!$client->query()) {
             return array('error' => array('code' => $client->getErrorCode(), 'msg' => $client->getErrorMessage()));
         }
     } else {
         $args = array($this->getNamespace($server, $action) . '.' . $action);
         if ($option) {
             $args[] = $option;
         }
         $client = new \IXR_Client("http://{$server}:9001/RPC2/");
         //$client->debug = true;
         if (!call_user_func_array(array($client, 'query'), $args)) {
             return array('error' => array('code' => $client->getErrorCode(), 'msg' => $client->getErrorMessage()));
         }
     }
     return $client->getResponse();
 }
 function capturePayment($transactionnumber)
 {
     if (!$this->client->query('payment.capture', $this->credentials, $transactionnumber)) {
         print $this->client->getErrorCode() . ' : ' . $this->client->getErrorMessage();
         return false;
     }
     return $this->client->getResponse();
 }
 function addOnlinePayment($order_id, $transaction_number, $transaction_status, $amount)
 {
     if (!$this->client->query('payment.addOnlinePayment', $this->credentials, $order_id, $transaction_number, $transaction_status, $amount)) {
         //if (!$client->query('products.test', $args)) {
         trigger_error('An error occurred - ' . $this->client->getErrorCode() . ":" . $this->client->getErrorMessage());
     }
     return 1;
 }
 function getConnectedKeywords($id)
 {
     if (!$this->client->query('contact.getConnectedKeywords', $this->credentials, $id)) {
         trigger_error($this->client->getErrorCode() . ' : ' . $this->client->getErrorMessage());
         return false;
     }
     return $this->client->getResponse();
 }
Пример #5
0
 /**
  * This method is similar to call_user_func() in that you can pass any number of arguments beyond the required two, which will then call the remote XMLRPC method.
  * @param string $url
  * @param string $method
  * @return array (bool success,mixed response)
  */
 function call($url, $method)
 {
     $client = new IXR_Client($url);
     if (defined('DEBUG_XMLRPC')) {
         $client->debug = true;
     }
     $args = func_get_args();
     return !call_user_func_array(array($client, 'query'), array($method) + array_slice($args, 1)) ? array(false, $client->getErrorCode() . ' : ' . $client->getErrorMessage()) : array(true, $client->getResponse());
 }
Пример #6
0
 public function sendpost($id)
 {
     if ($this->host == '' || $this->login == '') {
         return false;
     }
     $post = tpost::i($id);
     ttheme::$vars['post'] = $post;
     $theme = ttheme::i();
     $content = $theme->parse($this->template);
     $date = getdate($post->posted);
     if ($post->status != 'published') {
         return;
     }
     $meta = $post->meta;
     $client = new IXR_Client($this->host, '/interface/xmlrpc');
     //$client = new IXR_Client($this->host, '/rpc.xml');
     if (!$client->query('LJ.XMLRPC.getchallenge')) {
         if (litepublisher::$debug) {
             tfiler::log('live journal: error challenge');
         }
         return false;
     }
     $response = $client->getResponse();
     $challenge = $response['challenge'];
     $args = array('username' => $this->login, 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . md5($this->password)), 'ver' => "1", 'event' => $content, 'subject' => $post->title, 'year' => $date['year'], 'mon' => $date['mon'], 'day' => $date['mday'], 'hour' => $date['hours'], 'min' => $date['minutes'], 'props' => array('opt_nocomments' => !$post->commentsenabled, 'opt_preformatted' => true, 'taglist' => $post->tagnames));
     switch ($this->privacy) {
         case "public":
             $args['security'] = "public";
             break;
         case "private":
             $args['security'] = "private";
             break;
         case "friends":
             $args['security'] = "usemask";
             $args['allowmask'] = 1;
     }
     if ($this->community != '') {
         $args['usejournal'] = $this->community;
     }
     if (isset($meta->ljid)) {
         $method = 'LJ.XMLRPC.editevent';
         $args['itemid'] = $meta->ljid;
     } else {
         $method = 'LJ.XMLRPC.postevent';
     }
     if (!$client->query($method, $args)) {
         if (litepublisher::$debug) {
             tfiler::log('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
         }
         return false;
     }
     if (!isset($meta->ljid)) {
         $response = $client->getResponse();
         $meta->ljid = $response['itemid'];
     }
     return $meta->ljid;
 }
Пример #7
0
 public function send($post, $blogurl, $username, $password)
 {
     if ($post && $blogurl && $username && $password) {
         $title = $post['title'];
         $description = $post['body'];
         $selected_blog = $blogurl . "/xmlrpc.php";
         $client = new IXR_Client("{$selected_blog}");
         $content['title'] = $title;
         $content['description'] = $description;
         if (!$client->query('metaWeblog.newPost', '1', $username, $password, $content, 1)) {
             die('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
         }
     }
 }
Пример #8
0
 /**
  * sends targets from OutputThis.
  *
  * @param integer id of destination.
  */
 static function get_targets($username, $password)
 {
     Logger::log("Enter: function OutputThis::get_targets()");
     $client = new IXR_Client('http://outputthis.org/xmlrpc.php');
     if (!$client->query('outputthis.getPublishedTargets', $username, $password)) {
         $error[0] = 'error';
         $error[1] = 'Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage();
         Logger::log("Exit: function OutputThis::get_targets()-Error in getting information from output this");
         return $error;
     } else {
         $targets = $client->getResponse();
         Logger::log("Exit: function OutputThis::get_targets()-getting information from outputthis successful");
         return $targets;
     }
 }
Пример #9
0
function submitFlightToServer($serverURL, $username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider)
{
    require_once dirname(__FILE__) . "/lib/xml_rpc/IXR_Library.inc.php";
    $client = new IXR_Client($serverURL);
    // $client->debug=true;
    // echo "$username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider #<BR>";
    if (!$client->query('flights.submit', $username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider)) {
        //echo 'submitFlightToServer: Error '.$client->getErrorCode()." -> ".$client->getErrorMessage();
        return array(0, $client->getErrorCode(), $client->getErrorMessage());
    } else {
        $flightID = $client->getResponse();
        return array($flightID, '', '');
        // echo 'Flight was submited with id '.$flightID;
    }
    // return $flightID;
}
Пример #10
0
function get_palina($palina_id, $api_key)
{
    // mi autentico per ottenere il token
    $client = new IXR_Client("http://muovi.roma.it/ws/xml/autenticazione/1");
    if (!$client->query('autenticazione.Accedi', $api_key, '')) {
        echo '<br>An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage();
    }
    $token = $client->getResponse();
    // mostra il token
    //echo "<br><br>TOKEN-> ".$token;
    // richiamo il ws per la ricerca del percorso
    $client = new IXR_Client("http://muovi.roma.it/ws/xml/paline/7");
    if (!$client->query('paline.Previsioni', $token, (int) $palina_id, "it")) {
        echo '<br>An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage();
    }
    $response = $client->getResponse();
    return $response;
}
 /**
  * api_request
  * 
  * Handles any request made to the Syndication Toolkit Master wordpress install via cURL
  * 
  * @param	string	$method
  * @param	array	$params
  * @return	mixed	$results
  * @access 	public
  * @author	Ben Moody
  */
 public function api_request($method, $params)
 {
     //Init vars
     $client = NULL;
     $results = NULL;
     $request = NULL;
     $ch = NULL;
     $results = NULL;
     $response_code = NULL;
     $errorno = NULL;
     $error = NULL;
     //include Incutio XML-RPC Library from wordpress core
     require PRSOSYNDTOOLKITREADER__XMLRPC_LIB;
     $client = new IXR_Client($this->xml_rpc_url);
     if (!$client->query($method, $params, $this->username, $this->password)) {
         return array('errorCode' => $client->getErrorCode(), 'errorMsg' => $client->getErrorMessage());
     }
     $results = $client->getResponse();
     return $results;
 }
Пример #12
0
function get_language()
{
    global $prefs, $txpcfg, $textarray;
    require_once txpath . '/lib/IXRClass.php';
    $lang_code = gps('lang_code');
    $client = new IXR_Client(RPC_SERVER);
    //		$client->debug = true;
    @set_time_limit(90);
    if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) {
        if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) {
            if (defined('LANG')) {
                $textarray = load_lang(LANG);
            }
            return list_languages(gTxt($lang_code) . sp . gTxt('updated'));
        } else {
            $install_langfile = gTxt('install_langfile', array('{url}' => strong('<a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a>')));
            if ($install_langfile == 'install_langfile') {
                $install_langfile = 'To install new languages from file you can download them from <b><a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a></b> and place them inside your ./textpattern/lang/ directory.';
            }
            pagetop(gTxt('installing_language'));
            echo tag(gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", 'p', ' style="text-align:center;color:red;width:50%;margin: 2em auto"');
            echo tag($install_langfile, 'p', ' style="text-align:center;width:50%;margin: 2em auto"');
        }
    } else {
        $response = $client->getResponse();
        $lang_struct = unserialize($response);
        function install_lang_key(&$value, $key)
        {
            extract(gpsa(array('lang_code', 'updating')));
            $exists = safe_field('name', 'txp_lang', "name='" . doSlash($value['name']) . "' AND lang='" . doSlash($lang_code) . "'");
            $q = "name='" . doSlash($value['name']) . "', event='" . doSlash($value['event']) . "', data='" . doSlash($value['data']) . "', lastmod='" . doSlash(strftime('%Y%m%d%H%M%S', $value['uLastmod'])) . "'";
            if ($exists) {
                $value['ok'] = safe_update('txp_lang', $q, "lang='" . doSlash($lang_code) . "' AND name='" . doSlash($value['name']) . "'");
            } else {
                $value['ok'] = safe_insert('txp_lang', $q . ", lang='" . doSlash($lang_code) . "'");
            }
        }
        array_walk($lang_struct, 'install_lang_key');
        $size = count($lang_struct);
        $errors = 0;
        for ($i = 0; $i < $size; $i++) {
            $errors += !$lang_struct[$i]['ok'];
        }
        if (defined('LANG')) {
            $textarray = load_lang(LANG);
        }
        $msg = gTxt($lang_code) . sp . gTxt('updated');
        if ($errors > 0) {
            $msg .= sprintf(" (%s errors, %s ok)", $errors, $size - $errors);
        }
        return list_languages($msg);
    }
}
Пример #13
0
function stats_get_blog_id($api_key)
{
    $options = stats_get_options();
    require_once ABSPATH . WPINC . '/class-IXR.php';
    $client = new IXR_Client(STATS_XMLRPC_SERVER);
    extract(parse_url(get_option('home')));
    $path = rtrim($path, '/');
    if (empty($path)) {
        $path = '/';
    }
    $client->query('wpStats.get_blog_id', $api_key, stats_get_blog());
    if ($client->isError()) {
        if ($client->getErrorCode() == -32300) {
            $options['error'] = __('Your blog was unable to connect to WordPress.com. Please ask your host for help. (' . $client->getErrorMessage() . ')', 'stats');
        } else {
            $options['error'] = $client->getErrorMessage();
        }
        stats_set_options($options);
        return false;
    } else {
        $options['error'] = false;
    }
    $response = $client->getResponse();
    $blog_id = isset($response['blog_id']) ? (int) $response['blog_id'] : false;
    $options['host'] = $host;
    $options['path'] = $path;
    $options['blog_id'] = $blog_id;
    stats_set_options($options);
    stats_set_api_key($api_key);
    return $blog_id;
}
Пример #14
0
function get_cast_mdata_pull($ctx_age, $cast_mdata_ctx)
{
    $cast_name = $cast_mdata_ctx['name'];
    // sanity check - $cast_mdata_ctx['type'] MUST be "pull"
    assert($cast_mdata_ctx['type'] == "pull");
    do_log("slota");
    do_log("ctx_age=" . $ctx_age);
    do_log("cast_mdata_ctx=" . print_r($cast_mdata_ctx, true));
    // get the casti_srv_uri directly from $cast_mdata_ctx['arg'];
    $casti_srv_uri = $cast_mdata_ctx['arg'];
    // forward the xmlrpc to casti_srv_uri
    $client = new IXR_Client($casti_srv_uri);
    //	$client->debug	= true;
    if (!$client->query('get_cast_mdata', $cast_name)) {
        // delete the context file if it is now unreachable
        //		unlink(cast_name_to_filepath($cast_name));
        // forward the error to the caller
        return new IXR_Error($client->getErrorCode(), "slotaIXR" . $client->getErrorMessage());
    }
    // get the cast_mdata
    $cast_mdata = $client->getResponse();
    // return the $cast_mdata
    return $cast_mdata;
}
function reportResult($server_url, $tcaseid = null, $tcaseexternalid = null, $tplanid, $buildid = null, $buildname = null, $status, $notes = null, $bugid = null, $customfields = null, $platformname = null, $overwrite = false, $debug = false)
{
    $client = new IXR_Client($server_url);
    $client->debug = $debug;
    $data = array();
    $data["devKey"] = constant("DEV_KEY");
    $data["testplanid"] = $tplanid;
    if (!is_null($bugid)) {
        $data["bugid"] = $bugid;
    }
    if (!is_null($tcaseid)) {
        $data["testcaseid"] = $tcaseid;
    } else {
        if (!is_null($tcaseexternalid)) {
            $data["testcaseexternalid"] = $tcaseexternalid;
        }
    }
    if (!is_null($buildid)) {
        $data["buildid"] = $buildid;
    } else {
        if (!is_null($buildname)) {
            $data["buildname"] = $buildname;
        }
    }
    if (!is_null($notes)) {
        $data["notes"] = $notes;
    }
    $data["status"] = $status;
    if (!is_null($customfields)) {
        $data["customfields"] = $customfields;
    }
    if (!is_null($platformname)) {
        $data["platformname"] = $platformname;
    }
    if (!is_null($overwrite)) {
        $data["overwrite"] = $overwrite;
    }
    new dBug($data);
    if (!$client->query('tl.reportTCResult', $data)) {
        echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
    } else {
        return $client->getResponse();
    }
}
Пример #16
0
//wordpress post
require_once "IXR_Library.php.inc";
//$client->debug = false; //Set it to false in Production Environment
$title = '';
// $title variable will insert your blog title
$body = '';
// $body will insert your blog content (article content)
$category = ",";
// Comma seperated pre existing categories. Ensure that these categories exists in your blog.
$keywords = "";
$customfields = array('icon' => '123', 'developer' => 'Autor Bio Here');
// Insert your custom values like this in Key, Value format
//$customfields=array('icon'=>'123', 'developer'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format
//meta
$title = htmlentities($title, ENT_NOQUOTES, $encoding);
$keywords = htmlentities($keywords, ENT_NOQUOTES, $encoding);
$content = array('title' => $title, 'description' => $body, 'mt_allow_comments' => 0, 'mt_allow_pings' => 0, 'post_type' => 'post', 'mt_keywords' => $keywords, 'categories' => array($category), 'customfields' => array($customfields));
// Create the client object
$client = new IXR_Client('http://url/xmlrpc.php');
$username = "******";
$password = "******";
$params = array(0, $username, $password, $content, true);
// Last parameter is 'true' which means post immideately, to save as draft set it as 'false'
//print_r( $content );
// Run a query for PHP
if (!$client->query('metaWeblog.newPost', $params)) {
    die('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
} else {
    echo "<p>Article Posted Successfully {$title}</p>";
}
Пример #17
0
function get_language()
{
    global $prefs, $textarray;
    require_once txpath . '/lib/IXRClass.php';
    $lang_code = gps('lang_code');
    $client = new IXR_Client(RPC_SERVER);
    //		$client->debug = true;
    @set_time_limit(90);
    if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) {
        if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) {
            if (defined('LANG')) {
                $textarray = load_lang(LANG);
            }
            return list_languages(gTxt($lang_code) . sp . gTxt('updated'));
        } else {
            pagetop(gTxt('installing_language'));
            echo tag(gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", 'p', ' class="error lang-msg"');
        }
    } else {
        $response = $client->getResponse();
        $lang_struct = unserialize($response);
        if ($lang_struct === false) {
            $errors = $size = 1;
        } else {
            function install_lang_key(&$value, $key)
            {
                extract(gpsa(array('lang_code', 'updating')));
                $exists = safe_field('name', 'txp_lang', "name='" . doSlash($value['name']) . "' AND lang='" . doSlash($lang_code) . "'");
                $q = "name='" . doSlash($value['name']) . "', event='" . doSlash($value['event']) . "', data='" . doSlash($value['data']) . "', lastmod='" . doSlash(strftime('%Y%m%d%H%M%S', $value['uLastmod'])) . "'";
                if ($exists) {
                    $value['ok'] = safe_update('txp_lang', $q, "lang='" . doSlash($lang_code) . "' AND name='" . doSlash($value['name']) . "'");
                } else {
                    $value['ok'] = safe_insert('txp_lang', $q . ", lang='" . doSlash($lang_code) . "'");
                }
            }
            array_walk($lang_struct, 'install_lang_key');
            $size = count($lang_struct);
            $errors = 0;
            for ($i = 0; $i < $size; $i++) {
                $errors += !$lang_struct[$i]['ok'];
            }
            if (defined('LANG')) {
                $textarray = load_lang(LANG);
            }
        }
        $msg = gTxt($lang_code) . sp . gTxt('updated');
        if ($errors > 0) {
            $msg = array($msg . sprintf(" (%s errors, %s ok)", $errors, $size - $errors), E_ERROR);
        }
        return list_languages($msg);
    }
}
Пример #18
0
function pingback($content, $post_ID)
{
    global $wp_version, $wpdb;
    include_once ABSPATH . WPINC . '/class-IXR.php';
    // original code by Mort (http://mort.mine.nu:8080)
    $log = debug_fopen(ABSPATH . '/pingback.log', 'a');
    $post_links = array();
    debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n");
    $pung = get_pung($post_ID);
    // Variables
    $ltrs = '\\w';
    $gunk = '/#~:.?+=&%@!\\-';
    $punc = '.:?\\-';
    $any = $ltrs . $gunk . $punc;
    // Step 1
    // Parsing the post, external links (if any) are stored in the $post_links array
    // This regexp comes straight from phpfreaks.com
    // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php
    preg_match_all("{\\b http : [{$any}] +? (?= [{$punc}] * [^{$any}] | \$)}x", $content, $post_links_temp);
    // Debug
    debug_fwrite($log, 'Post contents:');
    debug_fwrite($log, $content . "\n");
    // Step 2.
    // Walking thru the links array
    // first we get rid of links pointing to sites, not to specific files
    // Example:
    // http://dummy-weblog.org
    // http://dummy-weblog.org/
    // http://dummy-weblog.org/post.php
    // We don't wanna ping first and second types, even if they have a valid <link/>
    foreach ($post_links_temp[0] as $link_test) {
        if (!in_array($link_test, $pung) && url_to_postid($link_test) != $post_ID && !is_local_attachment($link_test)) {
            // Also, let's never ping local attachments.
            $test = parse_url($link_test);
            if (isset($test['query'])) {
                $post_links[] = $link_test;
            } elseif ($test['path'] != '/' && $test['path'] != '') {
                $post_links[] = $link_test;
            }
            do_action('pre_ping', array(&$post_links, &$pung));
        }
    }
    foreach ($post_links as $pagelinkedto) {
        debug_fwrite($log, "Processing -- {$pagelinkedto}\n");
        $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
        if ($pingback_server_url) {
            @set_time_limit(60);
            // Now, the RPC call
            debug_fwrite($log, "Page Linked To: {$pagelinkedto} \n");
            debug_fwrite($log, 'Page Linked From: ');
            $pagelinkedfrom = get_permalink($post_ID);
            debug_fwrite($log, $pagelinkedfrom . "\n");
            // using a timeout of 3 seconds should be enough to cover slow servers
            $client = new IXR_Client($pingback_server_url);
            $client->timeout = 3;
            $client->useragent .= ' -- WordPress/' . $wp_version;
            // when set to true, this outputs debug messages by itself
            $client->debug = false;
            if ($client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto)) {
                add_ping($post_ID, $pagelinkedto);
            } else {
                debug_fwrite($log, "Error.\n Fault code: " . $client->getErrorCode() . " : " . $client->getErrorMessage() . "\n");
            }
        }
    }
    debug_fwrite($log, "\nEND: " . time() . "\n****************************\n");
    debug_fclose($log);
}
Пример #19
0
function mediacp_api($api)
{
    $client = new IXR_Client($api['path'] . "/system/rpc.php");
    if (isset($_GET['debug'])) {
        $client->debug = true;
        echo "Integration Version: " . date("d-m-Y.", filemtime(__FILE__)) . "<br />\n";
        print_r($api);
        echo "<br />\n";
    }
    if (!$client->query($api['rpc'], $api['args'])) {
        exit("An error occurred - " . $client->getErrorCode() . ":" . $client->getErrorMessage());
    }
    return $client->getResponse();
}
Пример #20
0
<?php

require "functions/xmlrpc.php";
$client = new IXR_Client('http://192.168.1.2/denial/rpc.php');
$client->debug = true;
if (!$client->query('blogger.getUsersBlogs', "943478217472357234234938249", "Kevin", "heh")) {
    die('<b>Error</b> ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
} else {
    $response = $client->getresponse();
}
Пример #21
0
 function send($link)
 {
     if (empty($this->url)) {
         return;
     }
     $this->title = clean_input_url($link->url);
     if (preg_match('/^ping:/', $this->url)) {
         // we got a pingback adress
         require_once mnminclude . 'IXR_Library.inc.php';
         $url = preg_replace('/^ping:/', '', $this->url);
         $client = new IXR_Client($url);
         $client->timeout = 3;
         $client->useragent .= ' -- Meneame/2';
         $client->debug = false;
         if ($client->query('pingback.ping', $link->get_permalink(), $this->link)) {
             $this->status = 'ok';
             $this->store();
             syslog(LOG_NOTICE, "Meneame, pingback sent: {$this->link}, {$this->url}");
             return true;
         } else {
             // Be quiet for pingbacks
             $this->status = 'error';
             $this->title = $client->getErrorMessage();
             $this->store();
             syslog(LOG_NOTICE, "Meneame, out pingback error: {$url} " . $link->get_permalink() . ': ' . $client->getErrorCode() . ' ' . $client->getErrorMessage());
             return false;
         }
     }
     // Send standard old trackback
     $title = urlencode($link->title);
     // Convert everything to HTML and the strip all html tags.
     $excerpt = urlencode(strip_tags(text_to_html($link->content)));
     $blog_name = urlencode(get_server_name());
     $tb_url = $this->url;
     $url = urlencode($link->get_permalink());
     $query_string = "charset=UTF-8&title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
     $trackback_url = parse_url($this->url);
     $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
     $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
     $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' . "\r\n";
     $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
     $http_request .= "User-Agent: MNM (http://meneame.net) ";
     $http_request .= "\r\n\r\n";
     $http_request .= $query_string;
     if ('' == $trackback_url['port']) {
         $trackback_url['port'] = 80;
     }
     $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 5);
     if ($fs && ($res = @fputs($fs, $http_request))) {
         /*********** DEBUG **********
                 $debug_file = '/tmp/trackback.log';
                 $fp = fopen($debug_file, 'a');
                 fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
                 while(!@feof($fs)) {
                         fwrite($fp, @fgets($fs, 4096));
                 }
                 fwrite($fp, "\n\n");
                 fclose($fp);
         		/*********** DEBUG ************/
         @fclose($fs);
         $this->status = 'ok';
         $this->store();
         syslog(LOG_NOTICE, "Meneame, trackback sent: {$this->link}, {$this->url}");
         return true;
     }
     $this->status = 'error';
     $this->store();
     return false;
 }
Пример #22
0
$client = new IXR_Client($server_url);
$client->debug = $debug;
new dBug($args);
if (!$client->query($client_query, $args)) {
    echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
    $response = null;
} else {
    $response = $client->getResponse();
}
echo "<br> Result was: ";
new dBug($response);
echo "<br>";
// -------------------------------------------------------------------------------------
$unitTestDescription = "Test - getTestSuitesForTestPlan";
$args = array();
$args["devKey"] = DEV_KEY;
$args["testplanid"] = 61579;
$debug = true;
echo $unitTestDescription;
$client = new IXR_Client($server_url);
$client->debug = $debug;
new dBug($args);
if (!$client->query('tl.getTestSuitesForTestPlan', $args)) {
    echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
    $response = null;
} else {
    $response = $client->getResponse();
}
echo "<br> Result was: ";
new dBug($response);
echo "<br>";
Пример #23
0
function bdn_check_for_placed()
{
    global $wpdb;
    if (!class_exists('IXR_Value')) {
        require_once ABSPATH . '/' . WPINC . '/class-IXR.php';
    }
    $client = new IXR_Client(PUBLISH_ENDPOINT);
    $params = array(1, PUBLISH_USER, PUBLISH_PASS, get_option('last_placed_meta_id'));
    if (!$client->query('bdn.getPlaced', $params)) {
        die('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
    }
    $keys = $client->getResponse();
    if (empty($keys)) {
        exit;
    }
    foreach ($keys as $k) {
        $p = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key = '_wpID' AND meta_value = %d", $k['post_id']));
        if ($p) {
            update_post_meta($p, '_placed', $k['meta_value']);
            wp_set_object_terms($p, array('published', 'final-published'), 'status');
        }
    }
    $last = reset($keys);
    update_option('last_placed_meta_id', $last['meta_id']);
    exit;
}
function executeTestCase($server_url, $context, $exec, $debug = false)
{
    new dBug($context);
    new dBug($exec);
    $client = new IXR_Client($server_url);
    $client->debug = $debug;
    $data = array();
    $data["devKey"] = 'admin';
    $data["status"] = $exec->status;
    if (property_exists($exec, 'user') && !is_null($exec->user)) {
        $data["user"] = $exec->user;
    }
    if (property_exists($exec, 'notes') && !is_null($exec->notes)) {
        $data["notes"] = $exec->notes;
    }
    if (property_exists($exec, 'bugid') && !is_null($exec->bugid)) {
        $data["bugid"] = $exec->bugid;
    }
    if (property_exists($exec, 'overwrite') && !is_null($exec->overwrite)) {
        $data["overwrite"] = $exec->overwrite;
    }
    if (property_exists($exec, 'customfields') && !is_null($exec->customfields)) {
        $data["customfields"] = $customfields;
    }
    if (property_exists($exec, 'timestamp') && !is_null($exec->timestamp)) {
        $data["timestamp"] = $exec->timestamp;
    }
    $data["testplanid"] = $context->testplanid;
    if (property_exists($context, 'testcaseid') && !is_null($context->testcaseid)) {
        $data["testcaseid"] = $context->testcaseid;
    } else {
        if (property_exists($context, 'testcaseexternalid') && !is_null($context->testcaseexternalid)) {
            $data["testcaseexternalid"] = $context->testcaseexternalid;
        }
    }
    if (property_exists($context, 'buildid') && !is_null($context->buildid)) {
        $data["buildid"] = $context->buildid;
    } else {
        if (property_exists($context, 'buildname') && !is_null($context->buildname)) {
            $data["buildname"] = $context->buildname;
        }
    }
    if (property_exists($context, 'platformname') && !is_null($context->platformname)) {
        $data["platformname"] = $context->platformname;
    }
    new dBug($data);
    if (!$client->query('tl.reportTCResult', $data)) {
        echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
    } else {
        return $client->getResponse();
    }
}
Пример #25
0
function ljxp_update_friendsgroups($username)
{
    $msgtype = 'error';
    if (empty($username)) {
        // Report what we did to the user
        $msg[] .= __('Cannot get friends groups unless username is set.', 'lj-xp');
        return $msg;
    }
    $options = get_option('ljxp');
    // And create our connection
    $client = new IXR_Client($options['host'], '/interface/xmlrpc');
    //$client->debug = true;
    // Get the challenge string
    // Using challenge for the most security. Allows pwd hash to be stored instead of pwd
    if (!$client->query('LJ.XMLRPC.getchallenge')) {
        $errors[$client->getErrorCode()] = $client->getErrorMessage();
    }
    // And retrieve the challenge string
    $response = $client->getResponse();
    $challenge = $response['challenge'];
    $args = array('username' => $options['username'], 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . $options['password']), 'ver' => '1');
    $method = 'LJ.XMLRPC.getfriendgroups';
    // And awaaaayyy we go!
    if (!$client->query($method, $args)) {
        $errors[$client->getErrorCode()] = $client->getErrorMessage();
    }
    $response = $client->getResponse();
    $groups = array();
    foreach ($response['friendgroups'] as $groupinfo) {
        $groupid = $groupinfo['id'];
        $groups[$groupid] = $groupinfo['name'];
    }
    $options['friendsgroups'] = $groups;
    // overwrite old values
    update_option('ljxp', $options);
    // Report our success
    $msg[] .= sprintf(__('Found %d friendsgroups.', 'lj-xp'), count($groups));
    $msgtype = 'updated';
    $msg = implode('<br />', $msg);
    return array('friendsgroups' => $groups, 'msg' => $msg, 'msgtype' => $msgtype);
}
Пример #26
0
function ljxp_delete($post_id)
{
    // Pull the post_id
    $ljxp_post_id = get_post_meta($post_id, 'ljID', true);
    $errors = array();
    // Ensures that there's actually a value. If the post was never
    // cross-posted, the value wouldn't be set, and there's no point in
    // deleting entries that don't exist
    if ($ljxp_post_id == 0) {
        return $post_id;
    }
    $options = ljxp_get_options();
    // And open the XMLRPC interface
    $client = new IXR_Client($options['host'], '/interface/xmlrpc');
    // Request the challenge for authentication
    if (!$client->query('LJ.XMLRPC.getchallenge')) {
        $errors[$client->getErrorCode()] = $client->getErrorMessage();
    }
    // And retrieve the challenge that LJ returns
    $response = $client->getResponse();
    $challenge = $response['challenge'];
    // Most of this is the same as before. The important difference is the
    // value of $args[event]. By setting it to a null value, LJ deletes the
    // entry. Really rather klunky way of doing things, but not my code!
    $args = array('username' => $options['username'], 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . $options['password']), 'itemid' => $ljxp_post_id, 'event' => "", 'subject' => "Delete this entry", 'year' => date('Y'), 'mon' => date('n'), 'day' => date('j'), 'hour' => date('G'), 'min' => date('i'), 'usejournal' => !empty($options['community']) ? $options['community'] : $options['username']);
    // And awaaaayyy we go!
    if (!$client->query('LJ.XMLRPC.editevent', $args)) {
        $errors[$client->getErrorCode()] = $client->getErrorMessage();
    }
    delete_post_meta($post_id, 'ljID');
    delete_post_meta($post_id, 'ljURL');
    update_option('ljxp_error_notice', $errors);
    return $post_id;
}
Пример #27
0
function cbrobot_queues()
{
    ?>
	<script type="text/javascript" src="<?php 
    bloginfo('wpurl');
    ?>
/wp-content/plugins/cbrobot/js/jquery.js"></script>
	<script type="text/javascript" src="<?php 
    bloginfo('wpurl');
    ?>
/wp-content/plugins/cbrobot/js/jquery.validate.js"></script>
<?php 
    global $wpdb;
    $options = unserialize(get_option("cbrobot_options"));
    if ($_POST['cbrobot_create_queue_save']) {
        $error = array();
        $blog_id = $_POST['cbrobot_bg_id'];
        $email = $_POST['cbrobot_bg_email'];
        $password = $_POST['cbrobot_bg_password'];
        $url = $_POST['cbrobot_bg_url'];
        $asin = $_POST['cbrobot_aa_asin'];
        if (!$blog_id) {
            echo '<div class="error"><p>***กรุณากรอก Blog Id***</p></div>';
            $error[] = "E_ID";
        }
        if (!$email) {
            echo '<div class="error"><p>***กรุณากรอก Email***</p></div>';
            $error[] = "E_EMAIL";
        }
        if (!$password) {
            echo '<div class="error"><p>***กรุณากรอก Password***</p></div>';
            $error[] = "E_PASSWORD";
        }
        if (!$url) {
            echo '<div class="error"><p>***กรุณากรอก URL***</p></div>';
            $error[] = "E_URL";
        }
        if (!$asin) {
            echo '<div class="error"><p>***กรุณากรอก Asin***</p></div>';
            $error[] = "E_ASIN";
        }
        if (count($error) == 0) {
            require_once "lib/content.php";
            require_once "lib/xmlrpc.php";
            $param = array();
            /* Load XML Template Config */
            $config = simplexml_load_file(ABSPATH . "/wp-content/plugins/cbrobot/template.xml");
            $title = base64_decode($config->title);
            $content = base64_decode($config->content);
            $client = new IXR_Client('http://www.channgamsim.com/xmlrpc.php');
            $params = array(0, $options['cbrobot_username'], $options['cbrobot_password'], $options['cbrobot_aa_affkey'], $options['cbrobot_aa_apikey'], $options['cbrobot_aa_secretkey'], $asin);
            if (!$client->query('demo.test', $params)) {
                echo '<div class="error">***' . $client->getErrorCode() . ' : ' . $client->getErrorMessage() . '***</div>';
            } else {
                $obj_content = new Content();
                $val = $client->message->params[0][Items][Item];
                $title = $obj_content->getXML($val, $title, $keyword);
                $content = $obj_content->getXML($val, $content, $keyword);
                $title = Content::spin_content($title);
                $content = Content::spin_content($content);
                $sql = "INSERT INTO " . $wpdb->prefix . "cbrobot_queues (blog_id, blog_email, blog_password, blog_url, asin, title, content, queue_time)\r\n\t\t\t            VALUES ('" . trim($blog_id) . "','" . trim($email) . "','" . trim($password) . "','" . trim($url) . "','" . trim($asin) . "',\r\n\t\t\t\t\t\t        '" . trim(base64_encode($title)) . "','" . trim(base64_encode($content)) . "','" . time() . "');";
                if ($result = $wpdb->query($sql)) {
                    echo '<div class="updated"><p>' . __('Insert Queue.', 'cbrobot') . '</p></div>';
                } else {
                    echo '<div class="error">***Not Insert Data' . $result . '***</div>';
                }
            }
        } else {
            ?>
			<script type="text/javascript" > 
				       $().ready(function() {
							$("#cbrobot_bg_id").val('<?php 
            echo $blog_id;
            ?>
');
							$("#cbrobot_bg_email").val('<?php 
            echo $email;
            ?>
');
							$("#cbrobot_bg_password").val('<?php 
            echo $password;
            ?>
');
							$("#cbrobot_bg_url").val('<?php 
            echo $url;
            ?>
');
							$("#cbrobot_aa_asin").val('<?php 
            echo $asin;
            ?>
');
			           });
			</script>
			<?php 
        }
    }
    if ($_GET['postdata']) {
        $id = $_GET['postdata'];
        post_data($id);
    }
    if ($_GET['delete']) {
        $id = $_GET['delete'];
        delete_data($id);
    }
    include_once "display-queues.php";
}
Пример #28
0
<?php

require './roots.php';
require_once $root_path . 'include/inc_environment_global.php';
require_once $root_path . 'classes/ixr_library.inc.php';
$client = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php');
$client->query('test.getTime');
print $client->getResponse();
// Prints the current time, according to our web server
$test = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php');
if (!$test->query('test.addArray', array(3, 5, 7))) {
    die('An error occurred - ' . $test->getErrorCode() . ":" . $test->getErrorMessage());
}
print $test->getResponse();
$client = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php');
if (!$client->query('test.add', 4, 5)) {
    die('An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage());
}
print $client->getResponse();
?>

Пример #29
0
/**
 * Installs a language from the RPC server or from a file.
 *
 * This function fetches language strings for the given language code from
 * either the RPC server or a file.
 *
 * Action is taken based on three HTTP POST parameters: 'lang_code', 'force' and
 * 'updating'. The 'lang_code' is the installed langauge, e.g. 'en-gb', 'fi-fi'.
 * The 'force' when set to 'file' can be used force an installation from a local
 * file. The 'updating' specifies whether only to install (0) or to update (1).
 */
function get_language()
{
    global $prefs, $textarray;
    require_once txpath . '/lib/IXRClass.php';
    $lang_code = gps('lang_code');
    $client = new IXR_Client(RPC_SERVER);
    //    $client->debug = true;
    @set_time_limit(90);
    // TODO: 90 seconds: seriously?
    if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) {
        if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) {
            if (defined('LANG')) {
                $textarray = load_lang(LANG);
            }
            callback_event('lang_installed', 'file', false, $lang_code);
            return list_languages(gTxt($lang_code) . sp . gTxt('updated'));
        } else {
            pagetop(gTxt('installing_language'));
            echo graf('<span class="ui-icon ui-icon-closethick"></span> ' . gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", array('class' => 'alert-block error'));
        }
    } else {
        $response = $client->getResponse();
        $lang_struct = unserialize($response);
        if ($lang_struct === false) {
            $errors = $size = 1;
        } else {
            array_walk($lang_struct, 'install_lang_key');
            $size = count($lang_struct);
            $errors = 0;
            for ($i = 0; $i < $size; $i++) {
                $errors += !$lang_struct[$i]['ok'];
            }
            if (defined('LANG')) {
                $textarray = load_lang(LANG);
            }
        }
        $msg = gTxt($lang_code) . sp . gTxt('updated');
        callback_event('lang_installed', 'remote', false, $lang_code);
        if ($errors > 0) {
            $msg = array($msg . sprintf(" (%s errors, %s ok)", $errors, $size - $errors), E_ERROR);
        }
        list_languages($msg);
    }
}
Пример #30
-1
 public function ping($siteName, $siteURL, $pageURL)
 {
     require_once 'IXR_Library.inc.php';
     // Что посылаем в пингах
     // Название сайта
     //		$siteName = 'WEB-технологии';
     //		// Адрес сайта
     //		$siteURL  = 'http://htmlweb.ru/';
     //		// Адрес страницы, которая изменилась (например)
     //		$pageURL  = 'http://htmlweb.ru/news/test.html';
     //		// Адрес страницы с фидом
     $feedURL = 'http://htmlweb.ru/news.rss';
     /**
      * Яндекс.Блоги
      */
     $pingClient = new IXR_Client('ping.blogs.yandex.ru', '/RPC2');
     // Посылаем challange-запрос
     if (!$pingClient->query('weblogUpdates.ping', $siteName, $siteURL, $pageURL)) {
         echo 'Ошибка ping-запроса [' . $pingClient->getErrorCode() . '] ' . $pingClient->getErrorMessage();
     } else {
         echo 'Послан ping Яндексу';
     }
     /**
      * Google
      */
     $pingClient = new IXR_Client('blogsearch.google.com', '/ping/RPC2');
     // Посылаем challange-запрос
     if (!$pingClient->query('weblogUpdates.extendedPing', $siteName, $siteURL, $pageURL, $feedURL)) {
         echo 'Ошибка ping-запроса [' . $pingClient->getErrorCode() . '] ' . $pingClient->getErrorMessage();
     } else {
         echo 'Послан ping Google';
     }
 }