Ejemplo n.º 1
0
function checkUpdates()
{
    require_once txpath . '/lib/IXRClass.php';
    $client = new IXR_Client('http://rpc.textpattern.com');
    $uid = safe_field('val', 'txp_prefs', "name='blog_uid'");
    if (!$client->query('tups.getTXPVersion', $uid)) {
        return gTxt('problem_connecting_rpc_server');
    } else {
        $msg = array();
        $response = $client->getResponse();
        if (is_array($response)) {
            ksort($response);
            $version = safe_field('val', 'txp_prefs', "name='version'");
            $lversion = explode('.', $version);
            $branch = substr($version, 0, 3);
            foreach ($response as $key => $val) {
                $rversion = explode('.', $val);
                if ($key == 'txp_current_version_' . $branch) {
                    if (isset($lversion[2]) && isset($rversion[2]) && intval($rversion[2]) > intval($lversion[2])) {
                        $msg[] = gTxt('updated_branch_version_available');
                    } else {
                        $msg[] = gTxt('your_branch_is_updated');
                    }
                } else {
                    if (intval($rversion[0]) > intval($lversion[0]) || intval($rversion[1]) > intval($lversion[1])) {
                        $msg[] = gTxt('new_textpattern_version_available') . ': ' . $val;
                    }
                }
            }
            return $msg;
        }
    }
}
Ejemplo n.º 2
0
 /**
  * Envía mensajes a un array de destinatarios
  * 
  * El array de entrada debe ser:
  * 
  * $mensajes = array(
  *                array('637xxxxxx','texto del mensaje','texto que identifica al enviador'),
  *                //array(),
  *             );
  * 
  * @param array $mensajes
  * @return array
  */
 static function send(array $mensajes)
 {
     if (count($mensajes)) {
         $client = new IXR_Client(self::$url);
         $client->query('MensajeriaNegocios.enviarSMS', self::$user, self::$passw, $mensajes);
         return $client->getResponse();
     }
 }
 function login($username, $password)
 {
     $client = new IXR_Client($this->site . '/xmlrpc.php');
     if (!$client->query('wp.getCategories', '', $username, $password)) {
         return False;
     }
     return True;
 }
Ejemplo n.º 4
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());
         }
     }
 }
Ejemplo n.º 5
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;
     }
 }
Ejemplo n.º 6
0
function sms_to_wordpress($sms)
{
    $config = sms_to_wordpress_initialize();
    $message = $sms->TextDecoded;
    $number = $sms->SenderNumber;
    list($code) = explode(" ", $message);
    $wordpress_code = $config['wordpress_code'];
    $wordpress_post = trim(str_replace($config['wordpress_code'], '', $message));
    if (strtoupper($code) == strtoupper($wordpress_code)) {
        $CI =& get_instance();
        $CI->load->model('sms_to_wordpress/sms_to_wordpress_model', 'plugin_model');
        include_once 'libraries/IXR_Library.php';
        // if wp url exist
        $wp = $CI->plugin_model->get_wp_url_by_phone($number);
        if (is_array($wp)) {
            $client = new IXR_Client($wp['wp_url']);
            // Post parameter
            $post = array('title' => 'Post from SMS', 'description' => $wordpress_post, 'post_type' => 'post', 'post_status' => 'publish', 'mt_keywords' => 'sms,kalkun', 'publish' => 1);
            $CI->load->library('encrypt');
            $wp_pass = $CI->encrypt->decode($wp['wp_password']);
            // Debug ON. Now you know what's going on.
            //$client->debug = true;
            // Execute
            $res = $client->query('metaWeblog.newPost', '', $wp['wp_username'], $wp_pass, $post);
        }
    }
}
Ejemplo n.º 7
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;
}
 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();
 }
Ejemplo n.º 9
0
 /**
  * Purges remote files
  *
  * @param array $files
  * @param array $results
  * @return boolean
  */
 function purge($files, &$results)
 {
     if (empty($this->_config['apiid'])) {
         $results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, 'Empty API ID.');
         return false;
     }
     if (empty($this->_config['apikey'])) {
         $results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, 'Empty API key.');
         return false;
     }
     if ($this->_sha256('test') === false) {
         $results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, "hash() or mhash() function doesn't exists.");
         return false;
     }
     if (!class_exists('IXR_Client')) {
         require_once ABSPATH . WPINC . '/class-IXR.php';
     }
     if (function_exists('date_default_timezone_set')) {
         $timezone = date_default_timezone_get();
         date_default_timezone_set(W3TC_CDN_MIRROR_NETDNA_TZ);
     }
     $date = date('c');
     $auth_string = sprintf('%s:%s:purge', $date, $this->_config['apikey']);
     $auth_key = $this->_sha256($auth_string);
     $client = new IXR_Client(W3TC_CDN_MIRROR_NETDNA_URL);
     $client->timeout = 30;
     $results = array();
     foreach ($files as $local_path => $remote_path) {
         $url = $this->format_url($remote_path);
         $client->query('cache.purge', $this->_config['apiid'], $auth_key, $date, $url);
         if (!$client->isError()) {
             $val = $client->getResponse();
             if ($val) {
                 $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_OK, 'OK');
             } else {
                 $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, 'Unable to purge.');
             }
         } else {
             $results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_HALT, sprintf('Unable to purge (%s).', $client->getErrorMessage()));
         }
     }
     if (function_exists('date_default_timezone_set')) {
         date_default_timezone_set($timezone);
     }
     return !$this->_is_error($results);
 }
Ejemplo n.º 10
0
 private function getNamespace($server, $check_method)
 {
     if (empty($this->methods)) {
         $client = new \IXR_Client("http://{$server}:9001/RPC2/");
         //	$client->debug = true;
         if (!$client->query('system.listMethods')) {
             return false;
         } else {
             $methods = $client->getResponse();
             foreach ($methods as $method) {
                 $parts = explode('.', $method);
                 $this->methods[$parts[1]] = $parts[0];
             }
         }
     }
     return $this->methods[$check_method];
 }
Ejemplo n.º 11
0
function xmlRpcPing($url)
{
    global $myBlogName, $myBlogUrl, $myBlogUpdateUrl, $myBlogRSSFeedUrl;
    $client = new IXR_Client($url);
    $client->timeout = 3;
    $client->useragent .= ' -- PingTool/1.0.0';
    $client->debug = false;
    if ($client->query('weblogUpdates.extendedPing', $myBlogName, $myBlogUrl, $myBlogUpdateUrl, $myBlogRSSFeedUrl)) {
        return $client->getResponse();
    }
    // echo 'Failed extended XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
    if ($client->query('weblogUpdates.ping', $myBlogName, $myBlogUrl)) {
        return $client->getResponse();
    }
    // echo 'Failed basic XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
    return false;
}
 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;
 }
Ejemplo n.º 14
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;
}
Ejemplo n.º 15
0
 /**
  * Performs and action for the executed test case (i.e. sets the status of test case)
  *
  * @param string    $method
  * @param array     $args
  *
  * @return array
  */
 protected function action($method, $args)
 {
     $args["devKey"] = Mage_Testlink_Connector::$devKey;
     if (!$this->_client->query("tl.{$method}", $args)) {
         $response = null;
     } else {
         $response = $this->_client->getResponse();
     }
     return $response;
 }
Ejemplo n.º 16
0
 public static function rpc($url)
 {
     new Pinger();
     //require_once( GX_LIB.'/Vendor/IXR_Library.php' );
     $url = 'http://' . $url;
     $client = new IXR_Client($url);
     $client->timeout = 3;
     $client->useragent .= ' -- PingTool/1.0.0';
     $client->debug = false;
     if ($client->query('weblogUpdates.extendedPing', self::$myBlogName, self::$myBlogUrl, self::$myBlogUpdateUrl, self::$myBlogRSSFeedUrl)) {
         return $client->getResponse();
     }
     //echo 'Failed extended XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
     if ($client->query('weblogUpdates.ping', self::$myBlogName, self::$myBlogUrl)) {
         return $client->getResponse();
     }
     //echo 'Failed basic XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
     return false;
 }
Ejemplo n.º 17
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;
 }
 /**
  * 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;
 }
Ejemplo n.º 19
0
 public function get_current_info($version, $force = false, $plugin = false)
 {
     include_once ABSPATH . 'wp-includes/class-IXR.php';
     global $frm_update;
     $client = new IXR_Client($frm_update->pro_mothership_xmlrpc_url, false, 80, $frm_update->timeout);
     $force = $force ? 'true' : 'false';
     $plugin = $plugin ? $plugin : $this->plugin_nicename;
     if (!$client->query('proplug.get_current_info', $frm_update->pro_username, $frm_update->pro_password, $version, $force, get_option('siteurl'), $plugin)) {
         return false;
     }
     return $client->getResponse();
 }
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();
    }
}
Ejemplo n.º 21
0
 private function ping($pageURL, $feedURL)
 {
     $inConf = cmsConfig::getInstance();
     $inUser = cmsUser::getInstance();
     global $_LANG;
     require_once PATH . '/plugins/p_ping/IXR_Library.php';
     $siteName = $inConf->sitename;
     $siteURL = HOST . '/';
     $result = array();
     //
     // Яндекс.Блоги
     //
     if ($this->config['Yandex HOST']) {
         $pingClient = new IXR_Client($this->config['Yandex HOST'], $this->config['Yandex PATH']);
         // Посылаем запрос
         if ($pingClient->query('weblogUpdates.ping', $siteName, $siteURL, $pageURL, $feedURL)) {
             $result[] = $_LANG['P_PING_YANDEX'];
         }
         unset($pingClient);
     }
     //
     // Google
     //
     if ($this->config['Google HOST']) {
         $pingClient = new IXR_Client($this->config['Google HOST'], $this->config['Google PATH']);
         // Посылаем запрос
         if ($pingClient->query('weblogUpdates.extendedPing', $siteName, $siteURL, $pageURL, $feedURL)) {
             $result[] = $_LANG['P_PING_GOOGLE'];
         }
         unset($pingClient);
     }
     if ($inUser->is_admin && $result) {
         cmsCore::addSessionMessage(implode(', ', $result), 'info');
     }
     return;
 }
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();
    }
}
Ejemplo n.º 23
0
function deleteBadComment($badId)
{
    $ljClient = new IXR_Client(LJ_HOST, LJ_PATH);
    // Заполняем поля XML-запроса
    $ljArgs = array();
    $ljArgs['username'] = LJ_LOGIN;
    $ljArgs['password'] = LJ_PASSWD;
    $ljArgs['auth_method'] = 'clear';
    $ljArgs['ver'] = "1";
    $ljArgs['dtalkid'] = $badId;
    // судя по коду, можно делать еще recursive=1, чтобы удалить все ветку
    $ljMethod = 'LJ.XMLRPC.delcomments';
    if (!$ljClient->query($ljMethod, $ljArgs)) {
        echo 'Ошибка [' . $ljClient->getErrorCode() . '] ' . $ljClient->getErrorMessage();
    } else {
        // Получаем ответ
        $ljResponse = $ljClient->getResponse();
        echo "Deleted comment " . $badId . "\n";
    }
}
Ejemplo n.º 24
0
 /**
  * Private function for retrieving a users blogs for multisite setups
  *
  * @access protected
  *
  * @return array|IXR_Error
  */
 protected function _multisite_getUsersBlogs($args)
 {
     $current_blog = get_blog_details();
     $domain = $current_blog->domain;
     $path = $current_blog->path . 'xmlrpc.php';
     $rpc = new IXR_Client(set_url_scheme("http://{$domain}{$path}"));
     $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
     $blogs = $rpc->getResponse();
     if (isset($blogs['faultCode'])) {
         return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
     }
     if ($_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path) {
         return $blogs;
     } else {
         foreach ((array) $blogs as $blog) {
             if (strpos($blog['url'], $_SERVER['HTTP_HOST'])) {
                 return array($blog);
             }
         }
         return array();
     }
 }
Ejemplo n.º 25
0
$GLOBALS['txp_err_count'] = 0;
foreach ($create_sql as $query) {
    $result = mysql_query($query);
    if (!$result) {
        $GLOBALS['txp_err_count']++;
        echo "<b>" . $GLOBALS['txp_err_count'] . ".</b> " . mysql_error() . "<br />\n";
        echo "<!--\n {$query} \n-->\n";
        $GLOBALS['txp_install_successful'] = false;
    }
}
# Skip the RPC language fetch when testing
if (defined('TXP_TEST')) {
    return;
}
require_once txpath . '/lib/IXRClass.php';
$client = new IXR_Client('http://rpc.textpattern.com');
if (!$client->query('tups.getLanguage', $prefs['blog_uid'], LANG)) {
    # If cannot install from lang file, setup the english lang
    if (!install_language_from_file(LANG)) {
        $lang = 'en-gb';
        include_once txpath . '/setup/en-gb.php';
        if (!@$lastmod) {
            $lastmod = '0000-00-00 00:00:00';
        }
        foreach ($en_gb_lang as $evt_name => $evt_strings) {
            foreach ($evt_strings as $lang_key => $lang_val) {
                $lang_val = doSlash($lang_val);
                if (@$lang_val) {
                    mysql_query("INSERT DELAYED INTO `" . PFX . "txp_lang` SET lang='en-gb', name='" . $lang_key . "', event='" . $evt_name . "', data='" . $lang_val . "', lastmod='" . $lastmod . "'");
                }
            }
Ejemplo n.º 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;
}
Ejemplo n.º 27
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);
    }
}
Ejemplo n.º 28
0
function do_pings()
{
    global $txpcfg, $prefs, $production_status;
    # only ping for Live sites
    if ($production_status !== 'live') {
        return;
    }
    include_once txpath . '/lib/IXRClass.php';
    callback_event('ping');
    if ($prefs['ping_textpattern_com']) {
        $tx_client = new IXR_Client('http://textpattern.com/xmlrpc/');
        $tx_client->query('ping.Textpattern', $prefs['sitename'], hu);
    }
    if ($prefs['ping_weblogsdotcom'] == 1) {
        $wl_client = new IXR_Client('http://rpc.pingomatic.com/');
        $wl_client->query('weblogUpdates.ping', $prefs['sitename'], hu);
    }
}
Ejemplo n.º 29
0
 /**
  * Constructor
  * @param string $server URL of the Server to connect to
  * @since 0.1.0
  */
 function IXR_ClientSSL($server, $path = false, $port = 443, $timeout = false)
 {
     parent::IXR_Client($server, $path, $port, $timeout);
     $this->useragent = 'The Incutio XML-RPC PHP Library for SSL';
     // Set class fields
     $this->_certFile = false;
     $this->_caFile = false;
     $this->_keyFile = false;
     $this->_passphrase = '';
 }
Ejemplo n.º 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';
     }
 }