/** * Tumbler Dashboard API Read * * @param string $email tumblr account email address * @param string $password tumblr account password * @return void */ function fetch_tumblr_dashboard_xml($email, $password) { global $config; $config['DEBUG'] && error_log('[DEBUG] REQUESTING API READ!'); // Prepare POST request $request_data = http_build_query(array('email' => $email, 'password' => $password, 'generator' => 'tumblr Dashboard Feed 1.1', 'num' => '50')); // Send the POST request (with cURL) $ch = curl_init('http://www.tumblr.com/api/dashboard'); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, 'tumblr-dashboard-rss 1.1'); curl_setopt($ch, CURLOPT_POSTFIELDS, $request_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Check for success if ($status == 200) { // echo "Success! The output is $result.\n"; // do process/output $posts = read_xml($result); output_rss($posts); // cache xml file $config['cache']['request'] && cache_xml($result); } else { if ($status == 403) { echo 'Bad email or password'; } else { if ($status == 503) { echo 'Rate Limit Exceded or Service Down'; } else { echo "Error: {$result}\n"; } } } }
function output_rss($pattern, $rss_data, $count_latest) { $temp = null; for ($i = 0; $i < $count_latest; $i++) { $temp .= sprintf($pattern, $rss_data['link'][$i], html_entity_decode($rss_data['title'][$i]), html_entity_decode($rss_data['desc'][$i])); } return $temp; } $url = 'http://censor.net.ua/includes/news_ru.xml'; $reg_exp = '#<item>.*?<title>(.*?)<\\/title>.*?'; $reg_exp .= '<link>(.*?)<\\/link>.*?<description>'; $reg_exp .= '(.*?)<\\/description>.*?<\\/item>#si'; $pattern = '<a href="%s">%s</a><br>%s<hr>'; if ($xml_data = file_get_contents($url)) { $rss_data = parse_rss($reg_exp, $xml_data); echo output_rss($pattern, $rss_data, 20); } ?> </div> <?php echo $content; ?> </div> <footer class="footer"> <div class="container"> <p class="pull-left">© My Company <?php
if ($total <= $artcnt) { $start = 1; $artcnt = $total; } else { $start = $total - $artcnt + 1; } $articles = bbs_getarticles($board, $start, $artcnt, $ftype) or die; $cc = count($articles); for ($i = $cc - 1; $i >= 0; $i--) { $origin = $articles[$i]; $item = array(); $item["title"] = htmlspecialchars($origin['TITLE'], ENT_QUOTES) . " "; $conurl = "bbscon.php?bid=" . $brdnum . "&id=" . $origin['ID']; //you want the link to always work, so you don't want to add num //if ($ftype == $dir_modes["DIGEST"]) $conurl .= "&ftype=".$ftype."&num=".($start+$i); $item["link"] = SiteURL . $conurl; $item["author"] = $origin['OWNER']; $item["pubDate"] = gmt_date_format($origin['POSTTIME']); $item["guid"] = $item["link"]; //TODO //$item["comments"] = ?? //TODO $filename = bbs_get_board_filename($board, $origin["FILENAME"]); $contents = bbs2_readfile_text($filename, DESC_CHAR_PER_RSS_ITEM, 0); if (is_string($contents)) { $item["description"] = "<![CDATA[" . $contents . "]]>"; } $items[] = $item; } } output_rss($channel, $items);
/** * The standard log function for Open-AudIT. Writes logs to a text file in the desired format (json or syslog). * * @access public * * @category Function * * @author Mark Unwin <*****@*****.**> * * @param Object log_details An object containing details you wish to log * * @return NULL [logs the provided string to the log file] */ function output() { error_reporting(E_ALL); $CI =& get_instance(); if ($CI->response->meta->id == 888888888888.0) { $CI->response->meta->id = NULL; unset($CI->response->data); $CI->response->data = array(); } if (!empty($CI->response->data) and count($CI->response->data) > 0) { $CI->response->data = output_convert($CI->response->data); } if (!empty($CI->response->included) and $CI->response->meta->collection != 'scripts') { $CI->response->included = output_convert($CI->response->included); } create_links(); // if we have errors set, make sure we remove the data object / array if (count($CI->response->errors) > 0) { unset($CI->response->data); } else { unset($CI->response->errors); } switch ($CI->response->meta->format) { case 'screen': output_screen($CI->response); break; case 'json_data': output_json_data(); break; case 'datatables': output_datatables(); break; case 'excel': output_excel($CI->response); break; case 'csv': output_csv($CI->response); break; case 'html': output_html($CI->response); break; case 'table': output_report($CI->response); break; case 'html_formatted': output_html_formatted($CI->response); break; case 'table_formatted': output_table_formatted($CI->response); break; case 'xml': output_xml($CI->response); break; case 'json': output_json($CI->response); break; case 'rss': output_rss($CI->response); break; case 'pdf': // TODO: need to insert the PDF function here output_screen($CI->response); break; case 'doc': // TODO: need to insert the doc / docx function here output_screen($CI->response); break; default: output_screen($CI->response); break; } }
{ return strcmp($args[1][$col], $args[0][$col]); } } /********************************************************** * Settings * **********************************************************/ $url = 'http://forum.gladiators.ru/index.php?act=rssout&id=1'; $reg_exp = '#<item>.*?.*?'; $reg_exp .= '<title>(.*?)<\\/title>.*?'; $reg_exp .= '<link>(.*?)<\\/link>.*?'; $reg_exp .= '<pubDate>(.*?)<\\/pubDate>.*?'; //$reg_exp .='.*?'; $reg_exp .= '<\\/item>#si'; $pattern = ' <tr> <td width="20" align="left" valign="top"><img src=/images/marker3.gif width=11px height=11px> </td> <td align="left" valign="top"><a href="%s" target=_blank><b>%s</b></a><br><br></td></tr>'; //ereg_replace("+0400", "df", $pattern); /********************************************************** * Main script * **********************************************************/ if ($xml_data = file_get_contents($url)) { $rss_data = parse_rss($reg_exp, $xml_data); $file = fopen("/var/www/gladiators.ru/php/informer1.html", "w"); fputs($file, $str = output_rss($pattern, $rss_data)); fclose($file); echo $str; } /********************************************************** * The END * **********************************************************/