private function _init() { $path = CORE_BASE . 'classes/email/' . $this->_method . '.php'; // If it doesn't exist, fall back to standard email if (!file_exists($path)) { $this->_method = 'standard'; return $this->_init(); } // Grab the file grab($path); $class = ucfirst($this->_method); $this->_class = new $class(); }
function upload_post_main_image($data) { try { $cover_sizes = array(array(150, 150, false), array(400, 400, true)); $content = $data['text']; $urls = array(); preg_match_all("/(<img )(.+?)( \\/)?(>)/", $content, $images); foreach ($images[2] as $val) { if (preg_match("/(src=)('|\")(.+?)('|\")/", $val, $matches) == 1) { $urls[$matches[3]] = $matches[3]; } } if (count($urls)) { foreach ($urls as $url) { $imgdata = grab($url); $tmp_name = '/tmp/image.jpg'; file_put_contents($tmp_name, $imgdata); $size = getimagesize($tmp_name); if ($size) { if ($size[0] >= 150) { if ($size[1] >= 150) { $folder = Config::need('static_path') . 'upload/post_images/' . $data['id']; $filename = $folder . '/' . $data['id'] . '_' . $data['id_author'] . '.jpg'; $filename_o = $folder . '/' . $data['id'] . '_' . $data['id_author'] . '_big.jpg'; mkdir($folder); $thumb = new Thumb(); try { $thumb->createThumbnails($tmp_name, array($filename, $filename_o), $cover_sizes); } catch (Exception $e) { return false; } unlink($tmp_name); return true; } } } else { unlink($tmp_name); } } } return false; } catch (Exception $e) { return false; } }
<?xml version="1.0" encoding="utf-8"?> <module> <name>Day View</name> <author>Dana C. Hutchins</author> <url>http://supercali.inforest.com/</url> <version>1.0.0</version> <link_name>Day</link_name> <description>Shows a day on one screen.</description> <image></image> <install_script></install_script> </module> */ include "modules/day_week_functions.php"; include "includes/header.php"; ?> <?php $thisday = $y . "-" . $m . "-" . $a; $nextday = $next["day"]["y"] . "-" . $next["day"]["m"] . "-" . $next["day"]["a"]; grab($thisday, $nextday, $c); echo "<div class=\"frame\">\n"; echo '<div class="cal_top"><a href="', $PHP_SELF, '?o=', $o, '&w=', $w, '&c=', $c, '&m=', $prev["day"]["m"], '&a=', $prev["day"]["a"], '&y=', $prev["day"]["y"], '"><</a> ', date('l, F j, Y', mktime(0, 0, 0, $m, $a, $y)), ' <a href="', $PHP_SELF, '?o=', $o, '&w=', $w, '&c=', $c, '&m=', $next["day"]["m"], '&a=', $next["day"]["a"], '&y=', $next["day"]["y"], '">></a></div>' . "\n"; echo "<table class=\"day\"><tr>"; showHours(); echo "<td><table class=\"day\"><tr>"; echo "<td width=\"100%\" class=\"single_day\">\n"; showDay($y, $m, $a, "Events"); echo "</td>"; echo "</tr></table></td></tr></table>"; echo "</div>\n"; include "includes/footer.php";
$ids = Database::sql2array($query); if (count($ids) > 0) { $posts_processed = true; } $aids = array(); foreach ($ids as $data) { $aids[$data['id_author']] = $data['id_author']; } $query = 'SELECT * FROM `authors` WHERE id IN(' . implode(',', $aids) . ')'; $authors = Database::sql2array($query, 'id'); foreach ($ids as $data) { $url = 'http://'; $url .= $authors[$data['id_author']]['username']; $url .= '.livejournal.com'; $url .= '/data/rss'; $raw = grab($url); $rss = new DOMDocument(); $rss->loadXML($raw); $posts = array(); $found = false; $fulltext = ''; foreach ($rss->getElementsByTagName('item') as $item) { foreach ($item->getElementsByTagName('*') as $field) { if ($field->nodeName == 'link') { if (strpos($field->nodeValue, '/' . $data['id'] . '.html') !== false) { $found = true; foreach ($item->getElementsByTagName('description') as $f) { $fulltext = $f->nodeValue; } } else { // not our post
foreach ($item->getElementsByTagName('*') as $field) { if ($field->nodeName == 'foaf:knows') { break; } if (!isset($bio[$field->nodeName])) { $bio[$field->nodeName] = $field->nodeValue; } if ($field->nodeName == 'foaf:img') { $bio[$field->nodeName] = $field->attributes->item(0)->value; } } break; } if ($bio['foaf:img']) { $pic = 0; $imgdata = grab($bio['foaf:img']); $tmp_name = '/tmp/aimage.jpg'; file_put_contents($tmp_name, $imgdata); $size = getimagesize($tmp_name); if ($size) { if ($size[0] >= 10) { if ($size[1] >= 10) { $folder = Config::need('static_path') . 'upload/author_images/' . ceil($author['id'] / 500); $filename = $folder . '/' . $author['id'] . '.jpg'; $filename1 = $folder . '/' . $author['id'] . '_small.jpg'; mkdir($folder); $thumb = new Thumb(); try { $thumb->createThumbnails($tmp_name, array($filename, $filename1), $cover_sizes); $pic = 1; } catch (Exception $e) {
function upload() { // Uploading frontend function global $curdir; style(); echo "<form name='files' enctype='multipart/form-data' method='POST'>\n<b>Output Directory</b><br>\n<input type='text' name='loc' size='65' value='" . $curdir . "'><br><br>\n<b>Remote Upload</b><br>\n<input type='text' name='rem' size='65'>\n<input type='submit' value='Grab'><br><br>\n<b>Local File Upload</b><br>\n<input name='up' type='file' size='65'>\n<input type='submit' value='Upload'>\n</form><br>"; if ($_POST['rem']) { grab($_POST['rem']); } if ($_FILES['up']) { up($_FILES['up']); } }
<?php header("Content-type: text/html; charset=gb2312"); include "Course.class.php"; switch ($_GET['action']) { case 'login': login(); break; case 'choose': choose(); break; case 'grab': grab(); break; } function login() { //登录 $grab = new Course($_POST['username']); $username = $_POST['username']; $password = $_POST['password']; $url = "http://jw.gdufs.edu.cn/pkmslogin.form"; $field = array('username' => $username, 'password' => $password, 'login-form-type' => 'pwd'); if ($grab->login($url, $field)) { $res = my_iconv($grab->loginResult()); echo json_encode($res); } else { echo 0; } } function choose()
echo "</td>"; $offset++; /* if we're on the last day of the week, wrap to the other side */ if ($offset > 6) { $offset = 0; echo '</tr>'; if ($day < $totaldays) { echo '<tr>'; } } } /* fill in the remaining spaces for the end of the month, just to make it look pretty */ if ($offset > 0) { $offset = 7 - $offset; } for ($t = 0; $t < $offset; $t++) { echo "<td> </td>"; } /* end the table */ echo '</tr></table>'; echo '</td>'; } echo "</tr>"; } echo "</table>"; } include "includes/header.php"; grab($y . "-01-01", $y . "-12-31", $c); showYear($y); include "includes/footer.php";
/**/ header('Content-Type: application/json'); $return = array(); // We need the id always set, so enforce that here if (!isset($_REQUEST['id'])) { die(json_encode(array('error' => array(t('Video: Error: Missing ID'))))); } if (is_null(setting('web_video_imdb_path', hostname))) { die(json_encode(array('error' => array(t('Video: Error: IMDB: Not Found'))))); } switch ($_REQUEST['action']) { case 'lookup': lookup($_REQUEST['id'], $_REQUEST['title']); break; case 'grab': grab($_REQUEST['id'], $_REQUEST['number']); break; case 'metadata': metadata($_REQUEST['id']); break; } echo json_encode($return); function lookup($id, $title) { global $return; $return['id'] = $id; $return['action'] = 'lookup'; $imdb = setting('web_video_imdb_path', hostname); $imdbwebtype = setting('web_video_imdb_type', hostname); // Escape any extra " in the title string $title = str_replace('"', '\\"', $title);
/* correct date format */ $coredate = date("Ymd", mktime(0, 0, 0, $calmonth, $d, $calyear)); showGrid($coredate); echo "</td>"; $offset++; /* if we're on the last day of the week, wrap to the other side */ if ($offset > 6) { $offset = 0; echo '</tr>'; if ($day < $totaldays) { echo '<tr>'; } } } /* fill in the remaining spaces for the end of the month, just to make it look pretty */ if ($offset > 0) { $offset = 7 - $offset; } for ($t = 0; $t < $offset; $t++) { echo "<td> </td>"; } /* end the table */ echo '</tr></table>'; } include "includes/header.php"; $thismonth = $y . "-" . $m; $nextmonth = $next["month"]["y"] . "-" . $next["month"]["m"]; grab($thismonth . "-01", $nextmonth . "-01", $c); showMonth($m, $y); include "includes/footer.php";
} echo "</ul>\n"; } } } function showUpcoming() { global $start_time; if ($start_time) { ksort($start_time); while (list($k) = each($start_time)) { showGrid($k); } } } echo "hide:" . $hideheader; if (!$plusmonths) { $plusmonths = 1; } if (!$plusdays) { $plusdays = 0; } if (!$hideheader) { include "includes/header.php"; } $listend = date("Y-m-d", mktime(0, 0, 0, $m + $plusmonths, $a + $plusdays, $y)); grab($y . "-" . $m . "-" . $a, $listend, $c); showUpcoming($m, $y); if (!$hideheader) { include "includes/footer.php"; }
public function parse($template) { $vars = self::$vars; $vars['_alnum'] = 'a-zA-Z0-9_'; // Replace {{variables}} $template = preg_replace_callback('/{{([' . $vars['_alnum'] . ']+)(\\/[' . $vars['_alnum'] . ' \\.,+\\-\\/!\\?]+)?}}/', function ($matches) use($vars) { if (count($matches) === 3) { $matches[1] = $matches[1] . '/' . $matches[2]; unset($matches[2]); } // Discard the first match, and check for fallbacks $matches = explode('/', last($matches)); // There will always be a first key $match = first($matches); // Set the fallback value, if it exists $fallback = isset($matches[1]) ? $matches[1] : ''; // Return matching variables, if they exist // AND are not null or empty-ish if (isset($vars[$match])) { return $vars[$match]; } // Try a fallback return $fallback; }, $template); // [conditionals][/conditionals] $template = preg_replace_callback('/(\\[[\\!?' . $vars['_alnum'] . ']+\\])(.*?\\[\\/[' . $vars['_alnum'] . ']+\\])/s', function ($matches) use($vars) { $match = str_replace(array('[', ']'), '', $matches[1]); $cond = isset($vars[$match]) and !empty($vars[$match]); // [!inverse][/inverse] if (strpos($match, '!') !== false) { $match = str_replace('!', '', $match); $cond = !isset($vars[$match]) or empty($vars[$match]); } if ($cond !== false) { return trim(preg_replace('/\\[[\\/!]?' . $match . '\\]/', '', $matches[0])); } return ''; }, $template); // Include partials (~partial~) $template = preg_replace_callback('/~([' . $vars['_alnum'] . ']+)~/', function ($matches) use($vars) { return grab(APP_BASE . 'partials/' . preg_replace('/[^' . $vars['_alnum'] . ']+/', '', $matches[0]) . '.php', $vars); }, $template); return $template; }
} // get current quarter $thisquarter = intval((intval($m) - 1) / 3 + 1); $thisyear = $y; //create date range $startmonth = ($thisquarter - 1) * 3 + 1; $endmonth = $thisquarter * 3 + 1; $startmonth = "{$y}-{$startmonth}"; $endmonth = "{$y}-{$endmonth}"; if ($thisquarter == 4) { $nextquarter = 1; $nextmonth = 1; $nextyear = $next["year"]["y"]; } else { $nextquarter = $thisquarter + 1; $nextyear = $y; $nextmonth = $thisquarter * 3 + 1; } if ($thisquarter == 1) { $prevquarter = 4; $prevyear = $prev["year"]["y"]; $prevmonth = 10; } else { $prevquarter = $thisquarter - 1; $prevyear = $y; $prevmonth = $prevquarter * 3 - 2; } include "includes/header.php"; grab($startmonth . "-01", $endmonth . "-01", $c); showQuarter($thisquarter, $thisyear); include "includes/footer.php";
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19 "); return curl_exec($ch); } function grab($link) { $link = code($link); $link = explode('<source src="', $link); $link = explode('"', $link[1]); $link = $link[0]; return $link; } $link = $_GET["link"]; $link = grab($link); //header ("Location: $link"); echo $link; function get_link_total($url) { //http://movie.zing.vn/Movie/a34682bc.aspx if (preg_match('#xvideos.com/video([^/]+)\\/([^/]+)#', $url, $id_sr)) { $id = $id_sr[1]; $name = $id_sr[2]; //$url = "http://thugianviet.net/sex-".$id."/".$name.".mp4"; $url = "xvideos.php?link=http://www.xvideos.com/video" . $id . "/" . $name; } return $url; } function get_link_total2($url) {
} for ($i = 0; $i < 2 * 15; $i += 15) { grab4("http://www.allproxysites.com/category.php?id=46&start={$i}"); } for ($i = 0; $i < 4 * 15; $i += 15) { grab4("http://www.allproxysites.com/category.php?id=47&start={$i}"); } grab4("http://www.allproxysites.com/category.php?id=48"); for ($i = 0; $i < 3 * 15; $i += 15) { grab4("http://www.allproxysites.com/category.php?id=49&start={$i}"); } for ($i = 0; $i < 6 * 15; $i += 15) { grab4("http://www.allproxysites.com/category.php?id=50&start={$i}"); } for ($i = 0; $i < 53 * 15; $i += 15) { grab4("http://www.allproxysites.com/category.php?id=51&start={$i}"); } grab3("http://multiproxy.org/txt_anon/proxy.txt"); grab2("http://www.cybersyndrome.net/pla5.html"); for ($i = 0; $i < 12 * 25; $i += 25) { grab("http://www.megaproxylist.com/?start={$i}"); } for ($i = 0; $i < 97 * 15; $i += 15) { grab("http://www.workingproxies.info/proxies.shtml?start={$i}"); } for ($i = 0; $i < 4 * 50; $i += 50) { grab("http://proxyliberty.com/recent-proxies.php?start={$i}"); } for ($i = 0; $i < 4 * 50; $i += 50) { grab("http://proxyliberty.com/top-proxies.php?start={$i}"); }
<name>Week View</name> <author>Dana C. Hutchins</author> <url>http://supercali.inforest.com/</url> <version>1.0.0</version> <link_name>Week</link_name> <description>Shows a week on one screen.</description> <image></image> <install_script></install_script> </module> */ include "modules/day_week_functions.php"; include "includes/header.php"; ?> <?php $thisweek = $now["week"]["y"][0] . "-" . $now["week"]["m"][0] . "-" . $now["week"]["a"][0]; $nextweek = $next["week"]["y"] . "-" . $next["week"]["m"] . "-" . $next["week"]["a"]; grab($thisweek, $nextweek, $c); echo "<div class=\"frame\">\n"; echo '<div class="cal_top"><a href="', $PHP_SELF, '?o=', $o, '&w=', $w, '&c=', $c, '&m=', $prev["week"]["m"], '&a=', $prev["week"]["a"], '&y=', $prev["week"]["y"], '"><</a> ', $lang["week_of"], date('F j, Y', mktime(0, 0, 0, $now["week"]["m"][0], $now["week"]["a"][0], $now["week"]["y"][0])), ' <a href="', $PHP_SELF, '?o=', $o, '&w=', $w, '&c=', $c, '&m=', $next["week"]["m"], '&a=', $next["week"]["a"], '&y=', $next["week"]["y"], '">></a></div>' . "\n"; echo "<table class=\"day\"><tr>"; showHours(); echo "<td><table class=\"day\"><tr>"; for ($we = 0; $we < 7; $we++) { echo "<td width=\"14%\" class=\"single_day\">\n"; showDay($now["week"]["y"][$we], $now["week"]["m"][$we], $now["week"]["a"][$we]); echo "</td>"; } echo "</tr></table></td></tr></table>"; echo "</div>\n"; include "includes/footer.php";
function import($url, $path) { $binarys = grab($url); if (!file_put_contents($path, $binarys)) { @unlink($path); return false; } return true; }
require_once 'include.php'; $update_time = floor(time() / 60 / 60) * 60 * 60; // округляем время до получаса $fetched_count = 0; $tables = Database::sql2array('SHOW TABLES LIKE \'posts_data%\''); $exists_table = array(); foreach ($tables as $trash => $name) { $exists_table[$name] = $name; } if (!is_running_process(basename(__FILE__))) { $page = 0; $posts_processed = true; while ($posts_processed) { $page++; $url = 'http://blogs.yandex.ru/entriesapi/?p=' . $page; $data = grab($url); $rss = new DOMDocument(); $rss->loadXML($data); $i = 0; $posts = array(); foreach ($rss->getElementsByTagName('item') as $item) { $i++; foreach ($item->getElementsByTagName('*') as $field) { $nn = str_replace('yablogs:', '', $field->nodeName); $posts[$i][$nn] = $field->nodeValue; } } $posts_processed = count($posts) > 0; $aids = array(); $anames = array(); foreach ($posts as $post) {
} } grab("http://www.proxynova.com/proxy-server-list/country-us/"); grab("http://www.proxynova.com/proxy-server-list/country-cn/"); grab("http://www.proxynova.com/proxy-server-list/country-br/"); grab("http://www.proxynova.com/proxy-server-list/country-id/"); grab("http://www.proxynova.com/proxy-server-list/country-ve/"); grab("http://www.proxynova.com/proxy-server-list/country-th/"); grab("http://www.proxynova.com/proxy-server-list/country-ae/"); grab("http://www.proxynova.com/proxy-server-list/country-eg/"); grab("http://www.proxynova.com/proxy-server-list/country-pe/"); grab("http://www.proxynova.com/proxy-server-list/country-ru/"); grab("http://www.proxynova.com/proxy-server-list/country-in/"); grab("http://www.proxynova.com/proxy-server-list/country-tw/"); grab("http://www.proxynova.com/proxy-server-list/country-de/"); grab("http://www.proxynova.com/proxy-server-list/country-ua/"); grab("http://www.proxynova.com/proxy-server-list/country-ar/"); grab("http://www.proxynova.com/proxy-server-list/country-za/"); grab("http://www.proxynova.com/proxy-server-list/country-co/"); grab("http://www.proxynova.com/proxy-server-list/country-fr/"); grab("http://www.proxynova.com/proxy-server-list/country-gb/"); grab("http://www.proxynova.com/proxy-server-list/country-ir/"); grab("http://www.proxynova.com/proxy-server-list/country-ca/"); grab("http://www.proxynova.com/proxy-server-list/country-sy/"); grab("http://www.proxynova.com/proxy-server-list/country-pl/"); grab("http://www.proxynova.com/proxy-server-list/country-hk/"); grab("http://www.proxynova.com/proxy-server-list/country-nl/"); grab("http://www.proxynova.com/proxy-server-list/country-cz/"); grab("http://www.proxynova.com/proxy-server-list/country-it/"); grab("http://www.proxynova.com/proxy-server-list/country-jp/");
} echo "</div>\n"; echo "<div class=\"title\"><a href=\"show_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\" onClick=\"openPic('show_event.php?id=" . $id . "&size=small','pop','600','400'); window.newWindow.focus(); return false\""; if ($color[$id]) { echo " style=\"color: " . $color[$id] . "; background: " . $background[$id] . ";\""; } echo ">" . $title[$id] . "</a></div>\n"; if ($venue[$id]) { echo "<div class=\"venue\">" . $venue[$id] . "</div>\n"; if ($city[$id]) { echo "<div class=\"location\">" . $city[$id]; if ($state[$id]) { echo ", " . $state[$id]; } echo "</div>\n"; } } echo "</div>"; if ($ed[$id] == true) { echo "<div class=\"edit\">[<a href=\"edit_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\" onClick=\"openPic('edit_event.php?id=" . $id . "&size=small','pop','600','500'); window.newWindow.focus(); return false\">" . $lang["edit"] . "</a>] [<a href=\"delete_event.php?id=" . $id . "&o=" . $o . "&c=" . $c . "&m=" . $m . "&a=" . $a . "&y=" . $y . "&w=" . $w . "\">" . $lang["delete"] . "</a>]</div>\n"; } echo "</li>\n"; } } echo "</ul>\n"; } } $thisday = $y . "-" . $m . "-" . $a; $nextseven = $next["seven"]["y"] . "-" . $next["seven"]["m"] . "-" . $next["seven"]["a"]; grab($thisday, $nextseven, $c); showWeek();