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; }
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; } } }
function login($username, $password) { $client = new IXR_Client($this->site . '/xmlrpc.php'); if (!$client->query('wp.getCategories', '', $username, $password)) { return False; } return True; }
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(); }
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(); }
/** * 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 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; }
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; }
/** * 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; }
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()); } } }
/** * 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; } }
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 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; }
/** * 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); }
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]; }
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; }
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 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; }
/** * 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); } }
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); } }
function query() { // Prepare multicall, then call the parent::query() method return parent::query('system.multicall', $this->calls); }
/** * Private function for retrieving a users blogs for multisite setups * * @access protected */ function _multisite_getUsersBlogs($args) { global $current_blog; $domain = $current_blog->domain; $path = $current_blog->path . 'xmlrpc.php'; $protocol = is_ssl() ? 'https' : 'http'; $rpc = new IXR_Client("{$protocol}://{$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(); } }
public function afterImport() { if (!function_exists('PHPMailerAutoload')) require __DIR__ . DIRECTORY_SEPARATOR . 'phpmailer' . DIRECTORY_SEPARATOR . 'PHPMailerAutoload.php'; $config = array(); foreach ($this->selectAll( 'SELECT `path`,`value` FROM `core_config_data` WHERE `scope` = "default" AND ( `path` LIKE "%/lesti_smtp/%" OR `path` LIKE "%/ident_general/%" OR `path` = "web/unsecure/base_url")') as $value) { $config [$value['path']] = $value['value']; } $secondPath = $this->selectone('SELECT `value` FROM `core_config_data` WHERE `scope_id` = 2 AND `path` = "web/unsecure/base_url"',null,'value'); $imageDir = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'catalog' . DIRECTORY_SEPARATOR . 'product' . DIRECTORY_SEPARATOR; $imageDir = realpath($imageDir); $name_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="name" AND `entity_type_id`= (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_type_code`="catalog_product" ) ',null,'attribute_id'); //$name = 71; $description_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="description" AND `entity_type_id`= (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_type_code`="catalog_product" ) ',null,'attribute_id'); //$description = 72; $url_key_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="url_key" AND `entity_type_id`= (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_type_code`="catalog_product" ) ',null,'attribute_id'); //$url_key = 97; $image_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="image" AND `entity_type_id`= (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_type_code`="catalog_product" ) ',null,'attribute_id'); //$image = 85; $catalog_category_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="name" AND `entity_type_id`= (SELECT `entity_type_id` FROM `eav_entity_type` WHERE `entity_type_code`="catalog_category" ) ',null,'attribute_id'); //$catalog_category = 41; $shared_on_social_networks_id = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="shared_on_social_networks" ',null,'attribute_id'); //$shared_on_social_networks = 143; $news_from_date = $this->selectone(' SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code`="news_from_date" ',null,'attribute_id'); //$shared_on_social_networks = 93; $product_stmt = $this->exec_stmt(' SELECT `catalog_product_entity`.`entity_id` , `catalog_product_entity`.`sku` FROM `catalog_product_entity` LEFT JOIN `catalog_product_entity_int` ON `catalog_product_entity_int`.`entity_id`=`catalog_product_entity`.`entity_id` AND `catalog_product_entity_int`.`attribute_id`= '.$shared_on_social_networks_id.' LEFT JOIN `catalog_product_entity_datetime` ON `catalog_product_entity_datetime`.`entity_id`=`catalog_product_entity`.`entity_id` AND `catalog_product_entity_datetime`.`attribute_id`= '.$news_from_date.' WHERE ( `catalog_product_entity_int`.`value` IS NULL OR `catalog_product_entity_int`.`value` != 1 ) AND ( `catalog_product_entity_datetime`.`value` IS NOT NULL OR `catalog_product_entity_datetime`.`value` != "" ) GROUP BY `catalog_product_entity`.`entity_id` ORDER BY `catalog_product_entity_datetime`.`value` DESC ',null,false); // Full path to twitterOAuth.php (change OAuth to your own path) // create new instance $tweet = new TwitterOAuth( $this->getParam("SOCIAL:twitterkey", ""), $this->getParam("SOCIAL:twittersecret", ""), $this->getParam("SOCIAL:twitterotoken", ""), $this->getParam("SOCIAL:twitterosecret", "") ); $productCount = 0; $facebookPages = explode(':',$this->getParam("SOCIAL:facebook", "")); $gogglePages = explode(':',$this->getParam("SOCIAL:gpage", "")); while ($productCount < $this->getParam("SOCIAL:topost", "10") && $product = $product_stmt->fetch(PDO::FETCH_ASSOC) ) { $product['image']= $this->selectone(' SELECT `value` FROM `catalog_product_entity_varchar` WHERE `catalog_product_entity_varchar`.`entity_id`='.$product['entity_id'].' AND `catalog_product_entity_varchar`.`attribute_id`= '.$image_id.' LIMIT 1 ',null,'value'); $product['url_path'] = $this->selectone(' SELECT `request_path` FROM `core_url_rewrite` WHERE `id_path` LIKE "product/%" AND `product_id` ='.$product['entity_id'].' ORDER BY `category_id` ASC LIMIT 1 ',null,'request_path'); if ( $product['url_path'] == '' || !is_file($imageDir . $product['image']) ) { continue; } $product['name']= $this->selectone(' SELECT `value` FROM `catalog_product_entity_varchar` WHERE `catalog_product_entity_varchar`.`entity_id`='.$product['entity_id'].' AND `catalog_product_entity_varchar`.`attribute_id`= '.$name_id.' LIMIT 1 ',null,'value'); $product['description']= $this->selectone(' SELECT `value` FROM `catalog_product_entity_text` WHERE `catalog_product_entity_text`.`entity_id`='.$product['entity_id'].' AND `catalog_product_entity_text`.`attribute_id`= '.$description_id.' LIMIT 1 ',null,'value'); $product['url_key']= $this->selectone(' SELECT `value` FROM `catalog_product_entity_varchar` WHERE `catalog_product_entity_varchar`.`entity_id`='.$product['entity_id'].' AND `catalog_product_entity_varchar`.`attribute_id`= '.$url_key_id.' LIMIT 1 ',null,'value'); $product['category_names'] = $this->selectone(' SELECT GROUP_CONCAT( DISTINCT `value` SEPARATOR ", ") as value FROM `catalog_category_entity_varchar` WHERE `entity_id` IN (SELECT `category_id` FROM `catalog_category_product` WHERE `product_id` = '.$product['entity_id'].') AND `catalog_category_entity_varchar`.`attribute_id`= '.$catalog_category_id.' ',null,'value'); $productCount ++; $tags = preg_replace('/^[^,]*, /', '', $product['category_names']); $tags = strtolower(', '.$tags); $tags = str_replace(' ','_',$tags); $tags = trim(str_replace(',_',' #',$tags)); if ( $this->getParam("SOCIAL:gemail", "") != '' && $this->getParam("SOCIAL:gpassword", "") != '' && $this->getParam("SOCIAL:gpage", "") != '' ) { foreach($gogglePages as $key=>$gogglePage) { $baseUrl = $config['web/unsecure/base_url']; if ($key>0 && $secondPath != '') $baseUrl = $secondPath; $nt = new nxsAPI_GP(); $loginError = $nt->connect($this->getParam("SOCIAL:gemail", ""), $this->getParam("SOCIAL:gpassword", "")); // Image URL $lnk = array('img'=>$baseUrl. '/media/catalog/product/' . $product['image']); $nt->postGP($product['name'] .' '. $tags . ' ' . $baseUrl . 'index.php/' . $product['url_path'], $lnk, $gogglePage); if ($loginError === false) $this->log($baseUrl . 'index.php/' . $product['url_path'] . " not sent succesfully " . $loginError, "info"); } } // Your Message $message = substr($product['name'], 0, 100) . ' ' . $config['web/unsecure/base_url'] . 'index.php/' . $product['url_path']. ' ' . $tags; if ( $this->getParam("SOCIAL:twitterkey", "") != '' && $this->getParam("SOCIAL:twittersecret", "") != '' && $this->getParam("SOCIAL:twitterotoken", "") != '' && $this->getParam("SOCIAL:twitterosecret", "") != '' ) { // Send tweet $tweet->post('statuses/update', array('status' => $message)); } if ( $this->getParam("SOCIAL:wpurl", "") != '' && $this->getParam("SOCIAL:wpusername") != '' && $this->getParam("SOCIAL:wppassword", "") != '' ) { $client = new IXR_Client($this->getParam("SOCIAL:wpurl", "")); $description = substr($product['description'],0,100); $description .= '<!--more-->'; $description .= substr($product['description'],100); $description .= '<br/><a href="' . $config['web/unsecure/base_url'] . 'index.php/' . $product['url_path'] . '">' . $product['name'] . '</a>'; $content = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_title' => $product['name'], 'post_content' => $description, 'terms' => array('category' => array($this->getParam("SOCIAL:wpcategory_id", ""))) ); $params = array(0, $this->getParam("SOCIAL:wpusername", ""), $this->getParam("SOCIAL:wppassword", ""), $content); $client->query('wp.newPost', $params); $post_id = $client->getResponse(); $command = 'convert "' .$imageDir . $product['image']. '" -resize 604x270\\> -resample 72 /tmp/storebaby.jpg 2>&1 '; exec($command); $content = array( 'name' => basename($product['image']), 'type' => mime_content_type(basename($product['image'])), 'bits' => new IXR_Base64(file_get_contents('/tmp/storebaby.jpg')), true ); $client->query('metaWeblog.newMediaObject', 1, $this->getParam("SOCIAL:wpusername"), $this->getParam("SOCIAL:wppassword"), $content); $media = $client->getResponse(); $content = array( 'post_status' => 'publish', 'mt_keywords' => preg_replace('/^[^,]*, /', '', $product['category_names']), 'wp_post_thumbnail' => $media['id'] ); $client->query('metaWeblog.editPost', $post_id, $this->getParam("SOCIAL:wpusername"), $this->getParam("SOCIAL:wppassword"), $content, true); } $fbConfigFile = __DIR__.'/fbConf.php'; if (is_file($fbConfigFile)) { require $fbConfigFile; $baseUrl = $config['web/unsecure/base_url']; $fb = new Facebook\Facebook(array( 'app_id' => $fbConfig['appId'], 'app_secret' => $fbConfig['appSecret'], 'default_graph_version' => 'v2.3' )); foreach($fbConfig['pages'] as $pageId=>$pageToken) { $fb->setDefaultAccessToken($pageToken); $linkData = [ 'link' => $baseUrl . 'index.php/' . $product['url_path'], 'name' => $product['name'] .' ' . $tags, 'message' => $product['name'] .' ' . $tags, 'picture' => $baseUrl. '/media/catalog/product/' . $product['image'] ]; try { // Returns a `Facebook\FacebookResponse` object $fb->post('/'. substr($pageId,1,99) .'/feed', $linkData,$pageToken); } catch(Facebook\Exceptions\FacebookResponseException $e) { echo 'Graph returned an error: ' . $e->getMessage(); } catch(Facebook\Exceptions\FacebookSDKException $e) { echo 'Facebook SDK returned an error: ' . $e->getMessage(); } } $this->exec_stmt('REPLACE INTO `catalog_product_entity_int` SET `value`=1 , `catalog_product_entity_int`.`attribute_id`= '.$shared_on_social_networks_id.', `catalog_product_entity_int`.`entity_id` = ' . $product['entity_id'] . ' '); } unlink('/tmp/storebaby.jpg'); } $product_stmt->closeCursor(); }
<?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(); ?>
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); }
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(); } }
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 . "'"); } } }
/** * 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(); } }
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'; } }