function run_talk($snt, $n, $t, $id) { $talk_data = get_talk_data($t, $id); if (get_member_lab($id) === "ropas") { $who = "<r:who member=\"" . $id . "\"/>"; } else { $who = "<r:who>" . get_member_name($id) . "</r:who>"; } $src = array("TITLE" => htmlspecialchars($talk_data["title"]), "WHO" => $who, "WHEN" => date(DATE_ATOM, $t), "WHERE" => $snt["where"], "ABSTRACT" => htmlspecialchars($talk_data["abstract"]), "SLIDES_FILENAME" => date('md', $t) . "_" . $n . ".pdf", "MEMO_FILENAME" => date('ymd', $t) . "_" . $id . ".pdf", "ID" => $id, "DATE" => date('Y-m-d', $t)); $temp_filename = __ROOT__ . "/template/xml.temp"; $msg = replace($temp_filename, $src); $filename = __ROOT__ . "/talk_root/" . date('Y', $t) . "/" . date('md', $t) . "_" . $n . ".xml"; if (!my_file_put_contents($filename, $msg)) { exit(1); } }
function json_put_contents($filename, $arr) { return my_file_put_contents($filename, json_encode($arr)); }
function AddURL($url, $rs = false, $pause = false) { $url = trim($url); $download_url = $url; // $sid = md5($url); //@A use the file name as id list($file, $rest) = explode("?r=", $url, 2); //@A get rid of redirection data $url = $file; $sid = basename($url); $urlfile = "{$this->tmpdir}/{$sid}.url"; $statfile = "{$this->tmpdir}/{$sid}.stat"; $pidfile = "{$this->tmpdir}/{$sid}.pid"; if ($rs) { $this->wgetoptions = "{$this->wgetoptions} {$this->rsoptions}"; $rsfile = "{$this->tmpdir}/{$sid}.rs"; my_file_put_contents($rsfile, $rs, false); } my_file_put_contents($urlfile, $download_url); my_file_put_contents($this->logfile, $url, true); $safe_urlfile = escapeshellarg($urlfile); $safe_url = escapeshellarg($url); $safe_destdir = escapeshellarg($this->destdir); $safe_statfile = escapeshellarg($statfile); $safe_ratelimit = escapeshellarg($this->ratelimit); //@A set download filename explicit with -O option -> must include also the download directory name! exec("{$this->wget} {$this->wgetoptions} --limit-rate={$safe_ratelimit} --referer={$safe_url} --background --input-file={$safe_urlfile} --progress=dot --append-output={$safe_statfile} -O {$safe_destdir}/{$sid}", $output); preg_match('/[0-9]+/', $output[0], $output); my_file_put_contents($pidfile, $output[0]); if ($pause) { $this->PauseJob($sid); } else { if ($this->ratelimit != 0) { $this->StopAll(); } } return true; }
function write_queue($filename, $queue) { if (!my_file_put_contents($filename, implode("\n", $queue))) { exit(1); } }
function create_sitemap_pages() { global $db, $my_base_url, $my_pligg_base, $URLMethod; if (XmlSitemaps_use_cache) { $icf = "cache/sitemap-pages.xml"; if (file_exists($icf) && ($s = stat($icf)) && time() - $s['mtime'] < XmlSitemaps_cache_ttl) { echo my_file_get_contents($icf); return true; } ob_start(); } echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"; $sql = "SELECT link_modified FROM " . table_links . " WHERE link_status!='discard' ORDER BY link_modified DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { $path = "{$my_base_url}{$my_pligg_base}"; create_entry(strtotime($res[0]), $path); } ///////////////// Upcoming............. $sql = "SELECT UNIX_TIMESTAMP(link_date) FROM " . table_links . " WHERE link_status='queued' ORDER BY link_date DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { if ($URLMethod == 1) { $path = "{$my_base_url}{$my_pligg_base}/upcoming.php"; } else { if ($URLMethod == 2) { $path = "{$my_base_url}{$my_pligg_base}/upcoming"; } } create_entry($res[0], $path); } //////////////////////...........categories................. $sql = "SELECT category_id,category_name,category_safe_name FROM " . table_categories . " WHERE category_enabled=1 AND category_name!='new category'"; $cat = $db->get_results($sql); foreach ($cat as $i) { $sql = "SELECT UNIX_TIMESTAMP(link_published_date),link_id FROM " . table_links . " WHERE link_category=" . $i->category_id . " AND link_status='published' ORDER BY link_published_date DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { $path = getmyFullurl('maincategory', urlencode($i->category_safe_name)); create_entry($res[0], $path); } } ////////////////////.............upcoming categories.......... foreach ($cat as $i) { $sql = "SELECT UNIX_TIMESTAMP(link_date) FROM " . table_links . " WHERE link_category=" . $i->category_id . " AND link_status='queued' ORDER BY link_date DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { $path = getmyFullurl('queuedcategory', urlencode($i->category_safe_name)); create_entry($res[0], $path); } } if (check_for_enabled_module('extra_pages', 0.1)) { //.............Tips page............... $sql = "SELECT UNIX_TIMESTAMP(modified_date) FROM " . table_prefix . "extra_pages WHERE type='Tip' ORDER BY modified_date DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { if ($URLMethod == 1) { $path = "{$my_base_url}{$my_pligg_base}/module.php?module=extra_pages&action=show_tips"; } else { if ($URLMethod == 2) { $path = "{$my_base_url}{$my_pligg_base}/tips"; } } create_entry($res[0], $path); } //.............FAQ page................ $sql = "SELECT UNIX_TIMESTAMP(modified_date) FROM " . table_prefix . "extra_pages WHERE type='FAQ' ORDER BY modified_date DESC LIMIT 1"; $res = $db->get_col($sql); if (isset($res[0])) { if ($URLMethod == 1) { $path = "{$my_base_url}{$my_pligg_base}/module.php?module=extra_pages&action=show_faq"; } else { if ($URLMethod == 2) { $path = "{$my_base_url}{$my_pligg_base}/faq"; } } create_entry($res[0], $path); } } //close xml echo '</urlset>'; if (XmlSitemaps_use_cache) { $ret = ob_get_contents(); ob_end_flush(); my_file_put_contents($icf, $ret); } return true; }