function generate_last_trackbacks($temptrack) { global $entry, $Cfg; // if it exists, load it $lasttrack = load_serialize("db/ser_lasttrack.php", true, true); $lasttrack[] = array('title' => $temptrack['title'], 'excerpt' => trimtext($temptrack['excerpt'], 250), 'name' => $temptrack['name'], 'url' => $temptrack['url'], 'date' => $temptrack['date'], 'code' => $entry['code'], 'category' => $entry['category'], 'ip' => $temptrack['ip']); if (count($lasttrack) > $Cfg['lastcomm_amount_max']) { array_shift($lasttrack); } save_serialize("db/ser_lasttrack.php", $lasttrack); }
/** * Creates the file that holds the queue for comment moderation. * * @param array $tempcomm */ function generate_moderation_queue($tempcomm) { global $my_weblog, $db; // if it exists, load it if (file_exists("db/ser_modqueue.php")) { $lastcomm = load_serialize("db/ser_modqueue.php", true, true); } else { $lastcomm = array(); } $lastcomm[] = array('name' => $tempcomm['name'], 'email' => $tempcomm['email'], 'url' => $tempcomm['url'], 'date' => $tempcomm['date'], 'comment' => $tempcomm['comment'], 'code' => $db->entry['code'], 'title' => trimtext($db->entry['title'], 50), 'category' => $db->entry['category'], 'ip' => $tempcomm['ip']); save_serialize("db/ser_modqueue.php", $lastcomm); }
public function getSeriesData($url) { $data = array(); $contentUrl = getFileContent($url); if (!$contentUrl) { return false; } $htmlAll = str_get_html($contentUrl); if ($htmlAll) { $metaArr = getMetaFromHtml($contentUrl); $seriesThumb = $metaArr['og:image']; $seriesTitle = trimtext($htmlAll->find('div.title-detail-film', 0)->plaintext); $seriesDesc = trimtext(str_replace("Description", '', $htmlAll->find('div.desc-detail-film', 0)->plaintext)); $seriesCountry = trimtext(str_replace("Country:", '', $htmlAll->find('div.country-detail-film', 0)->plaintext)); $seriesStatus = trimtext(str_replace("Status:", '', $htmlAll->find('div.status-detail-film', 0)->plaintext)); $seriesRelease = trimtext(str_replace("Released:", '', $htmlAll->find('div.released-detail-film', 0)->plaintext)); $seriesGenre = trimtext(str_replace("Genre:", '', $htmlAll->find('div.genre-detail-film', 0)->plaintext)); $genre = array(); $genreDb = $this->Genre_model->getAll(); foreach ($genreDb as $gId => $gName) { if (strpos($seriesGenre, $gName) !== FALSE) { $genre[$gId] = $gName; } } $data['title'] = $seriesTitle; $data['description'] = $seriesDesc; $data['country'] = isset($this->_config['flip_countries'][$seriesCountry]) ? $this->_config['flip_countries'][$seriesCountry] : 0; $data['release_date'] = $seriesRelease; $data['is_complete'] = $seriesStatus == 'Completed' ? 1 : 0; $data['genre'] = $genre; $data['thumbnail'] = str_replace(' ', '%20', $seriesThumb); $data['original_url'] = $url; $episodeArr = array(); $episodeBlocks = $htmlAll->find('div.view-detail', 0)->find('div.row-9dr'); if ($episodeBlocks) { foreach ($episodeBlocks as $epBlock) { $videoData = array(); $tmpTitle = trimtext($epBlock->find('div.title_s_az', 0)->plaintext); $time = trimtext($epBlock->find('span.timeago', 0)->plaintext); $tmpTitle = trimtext(str_replace($time, '', $tmpTitle)); $subStatus = strtolower(trimtext($epBlock->find('div.country_s_az', 0)->plaintext)); $subStatus = $subStatus == 'sub' ? 1 : 0; $itemLink = $epBlock->find('a', 0)->href; $publishDate = format2DateTime($time); $videoData['publish_date'] = $publishDate; $videoData['has_sub'] = $subStatus; $videoData['original_url'] = $itemLink; $videoData['title'] = $tmpTitle; $videoData['status'] = STATUS_WAIT_FOR_APPROVE; $videoData['episode'] = $this->_getLastNumberInString($tmpTitle); $episodeArr[] = $videoData; } } $data['videos'] = $episodeArr; } return $data; }
$thumbArray = array_slice($thumbArray, $Pivot_Vars['slice'], $show); foreach ($fileArray as $file) { $ext = getextension($file['name']); if (strtolower($ext) == "jpg" || strtolower($ext) == "gif" || strtolower($ext) == "png") { $fullentry = urlencode($Paths['upload_url'] . $file['name']); //debug("full: $fullentry"); // get the image's witdh and height list($x, $y) = getimagesize(urldecode($Paths['upload_path'] . $file['name'])); $filesize = $file['size']; $disp_entry = trimtext(strtolower(urldecode($file['name'])), 30, TRUE); echo "<tr><td><a href=\"javascript:select('" . $file['name'] . "', {$x}, {$y});\">{$disp_entry}</a></td><td>( {$x} x {$y} px, {$filesize} kb. )\n"; echo "</td><td><a href=\"javascript:popup('{$fullentry}', {$x}, {$y});\">preview</a></td></tr>\n"; } else { if ($file['name'] != "." && $file['name'] != "..") { $fullentry = urlencode($Paths['upload_url'] . $file['name']); $filesize = $file['size']; $disp_entry = trimtext(strtolower(urldecode($file['name'])), 30, TRUE); echo "<tr><td><a href=\"javascript:select('" . $file['name'] . "', 0, 0);\">{$disp_entry}</a></td><td> ( {$filesize} kb. )</td><td> </td></tr>\n"; } } } ?> </table> <script type="text/javascript"> //<![CDATA[ self.focus(); //]]> </script> </body> </html>
$value = trim($value); } else { $value = trimtext(trim($value), $trimlen); } $itemformat = str_replace("%{$key}%", $value, $itemformat); } else { if (is_array($value)) { foreach ($value as $arrkey => $arrvalue) { if (is_string($arrvalue)) { $arrvalue = trimtext(trim($arrvalue), $trimlen); $itemformat = str_replace("%{$key}" . '->' . "{$arrkey}%", $arrvalue, $itemformat); } else { if (is_array($arrvalue)) { foreach ($arrvalue as $subarrkey => $subarrvalue) { if (is_string($subarrvalue)) { $subarrvalue = trimtext(trim($subarrvalue), $trimlen); $itemformat = str_replace("%{$key}" . '->' . "{$arrkey}" . '->' . "{$subarrkey}%", $subarrvalue, $itemformat); } } } } } } } } echo $itemformat; if ($count++ >= $rssmax) { break; } } error_reporting($old_errrep);
function make_archive_list($ye, $mo, $da, $title) { global $Weblogs, $Current_weblog, $db, $entry, $maxlength, $filtercat; $db = new db(); $current_cats = find_cats_in_weblog($Current_weblog); if ($da > 0 && $da < 32 && $mo > 0 && $mo < 13) { // get a list of the entries for the current day list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-%02d-00-00", $ye, $mo, $da), 'day'); } else { if ($mo > 0 && $mo < 13) { // get a list of the entries for the current month list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00", $ye, $mo), 'month'); } else { // get a list of the entries for the current year list($start_date, $stop_date) = getdaterange(sprintf("%02d-%02d-01-00-00", $ye, $mo), 'year'); } } $list_entries = $db->getlist_range($start_date, $stop_date, "", "", FALSE); if ($title != "") { // Normalizing requested title and title of possible entries (once). $title = str_replace("http://", "", $title); $title = str_replace("http", "", $title); $title = safe_string(strtolower($title), TRUE); foreach ($list_entries as $key => $value) { $entrytitle = $list_entries[$key]['title']; $entrytitle = str_replace("http://", "", $entrytitle); $entrytitle = str_replace("http", "", $entrytitle); $entrytitle = safe_string(strtolower($entrytitle), TRUE); $list_entries[$key]['title'] = $entrytitle; } // we try to see if we can match a given name to a title.. foreach ($list_entries as $entry) { if ($title == $entry['title']) { $_POST['id'] = $entry['code']; include 'entry.php'; die; } } // next, we see if the start is the same.. foreach ($list_entries as $entry) { if (substr($title, 0, 19) == substr($entry['title'], 0, 19)) { $_POST['id'] = $entry['code']; include 'entry.php'; die; } } // next, we see if the start is the same.. foreach ($list_entries as $entry) { if (substr($title, 0, 7) == substr($entry['title'], 0, 7)) { $_POST['id'] = $entry['code']; include 'entry.php'; die; } } } // We continue with the selected entries, and display the bunch $arc_list = ""; foreach ($list_entries as $list_entry) { // added by sam $valid_entry_cats = array_intersect($list_entry['category'], $current_cats); if ($valid_entry_cats && (!isset($filtercat) || @in_array($filtercat, $list_entry['category']))) { // if we don't filter, or we filter on the entry's category.. if ($list_entry['status'] == 'publish') { //if the entry is published $diffdate = format_date($list_entry['date'], $Weblogs[$Current_weblog]['diffdate_format']); $date = format_date($list_entry['date'], $Weblogs[$Current_weblog]['entrydate_format']); $link = make_filelink($list_entry['code'], "", ""); if ($diffdate != $lastdiffdate) { $arc_list .= "<br />" . $diffdate . "<br />\n"; $lastdiffdate = $diffdate; } $arc_list .= sprintf("%s <a href='%s' title=\"(%s, %s comments)\">%s</a><br />\n", $date, $link, implode(", ", $valid_entry_cats), $list_entry['commcount'], trimtext($list_entry['title'], $maxlength)); } } } // the search template for the current weblog if (isset($Weblogs[$Current_weblog]['extra_template']) && $Weblogs[$Current_weblog]['extra_template'] != "") { $template_html = load_template($Weblogs[$Current_weblog]['extra_template']); } else { $template_html = load_template($Weblogs[$Current_weblog]['archive_template']); } $template_html = replace_subweblogs_templates($template_html, $arc_list); $filename = $Weblogs[$Current_weblog]['archive_path'] . make_archive_name(); if (!$template_html) { ErrorOut("Could not load template file: <i>{$template}</i> [does not exist]"); } else { $output = $template_html; $output = parse_step4($output); } echo $output; flush(); }
/** * Store an edited comment, and then show the edit_comment screen * * @see edit_comment() * */ function submit_comment() { global $Cfg, $Pivot_Vars; // If magic_quotes_gpc is set, we need to strip slashes.. if (get_magic_quotes_gpc()) { $Pivot_Vars['name'] = stripslashes($Pivot_Vars['name']); $Pivot_Vars['comment'] = stripslashes($Pivot_Vars['comment']); } $mycomm = array('name' => entify($Pivot_Vars['name']), 'orig_name' => entify($Pivot_Vars['orig_name']), 'email' => $Pivot_Vars['email'], 'url' => $Pivot_Vars['url'], 'ip' => $Pivot_Vars['ip'], 'registered' => $Pivot_Vars['registered'], 'notify' => $Pivot_Vars['notify'], 'date' => $Pivot_Vars['date'], 'comment' => $Pivot_Vars['comment'], 'moderate' => 1 - $Pivot_Vars['moderate']); // Creating a copy for use in the last_comments update $mycomm_last = $mycomm; $mycomm_last['comment'] = trimtext($Pivot_Vars['comment'], 250); $mycomm_last['code'] = $Pivot_Vars['id']; unset($mycomm_last['registered']); unset($mycomm_last['notify']); //update last_comments if it's in there.. if (file_exists("db/ser_lastcomm.php")) { $last_comms = load_serialize("db/ser_lastcomm.php", true, true); } else { $last_comms = array(); } if ($last_comms !== false && count($last_comms) > 0) { foreach ($last_comms as $key => $last_comm) { if ($last_comm['code'] == $mycomm_last['code'] && $last_comm['name'] == $mycomm_last['orig_name'] && $last_comm['date'] == $mycomm_last['date']) { // Keeping old (entry) title and category $mycomm_last['title'] = $last_comm['title']; $mycomm_last['category'] = $last_comm['category']; // Updating the comment // $last_comms[$key] = ""; $last_comms[$key] = $mycomm_last; save_serialize("db/ser_lastcomm.php", $last_comms); break; } } } // Update the entry $db = new db(); $entry = $db->read_entry($Pivot_Vars['id']); $entry['comments'][$Pivot_Vars['count']] = $mycomm; $db->set_entry($entry); $db->save_entry(); // remove it from cache, to make sure the laters one is used. $db->unread_entry($entry['code']); $msg = lang('notice', 'comment_saved'); edit_comments($msg); }
function snippet_last_comments() { global $Cfg, $db, $Weblogs, $Current_weblog, $Paths; if (isset($Weblogs[$Current_weblog]['lastcomm_format']) && strlen($Weblogs[$Current_weblog]['lastcomm_format']) > 2) { $last_comments_format = $Weblogs[$Current_weblog]['lastcomm_format']; } else { $last_comments_format = "<a href='%url%' title='%date%' %popup%><b>%name%</b></a> (%title%): %comm%<br />"; } if (isset($Weblogs[$Current_weblog]['lastcomm_length']) && $Weblogs[$Current_weblog]['lastcomm_length'] > 0) { $last_comments_length = $Weblogs[$Current_weblog]['lastcomm_length']; } else { $last_comments_length = 100; } if (isset($Weblogs[$Current_weblog]['lastcomm_trim']) && $Weblogs[$Current_weblog]['lastcomm_trim'] > 0) { $last_comments_trim = $Weblogs[$Current_weblog]['lastcomm_trim']; } else { $last_comments_trim = 16; } if (isset($Weblogs[$Current_weblog]['lastcomm_amount']) && $Weblogs[$Current_weblog]['lastcomm_amount'] > 0) { $last_comments_count = $Weblogs[$Current_weblog]['lastcomm_amount']; } else { $last_comments_count = 10; } if (file_exists($Paths['pivot_path'] . "db/ser_lastcomm.php")) { $file = array_reverse(load_serialize($Paths['pivot_path'] . "db/ser_lastcomm.php", true, true)); } else { $file = array(); } $cats = find_cats_in_weblog($Current_weblog); $output = ""; $count = 0; if (count($file) > 0) { foreach ($file as $comment) { // if it's in a category that published n the frontpage, and the user is not blocked, we display it. if (count(array_intersect($comment['category'], $cats)) > 0 && !ip_check_block(trim($comment['ip'])) && $db->entry_exists($comment['code'])) { $id = safe_string($comment["name"], TRUE) . "-" . format_date($comment["date"], "%ye%%month%%day%%hour24%%minute%"); $url = make_filelink($comment['code'], "", $id); $comment['name'] = trimtext(stripslashes($comment['name']), $last_comments_trim); $comment['title'] = trimtext(stripslashes($comment['title']), $last_comments_trim); // Commenting out mywordwrap since it currently breaks textile commands (and maybe more). // $comment['comment'] = mywordwrap($comment['comment'], 18, " ", 1); $comment['comment'] = comment_format($comment["comment"]); // Remove the [name:1] part in the 'last comments.. $comment['comment'] = preg_replace("/\\[(.*):([0-9]+)\\]/iU", '', $comment['comment']); $comment['comment'] = trimtext(stripslashes($comment['comment']), $last_comments_length); // $comment['comment'] = unentify($comment['comment']); if ($Weblogs[$Current_weblog]['comment_pop'] == 1) { $popup = sprintf("onclick=\"window.open('%s', 'popuplink', 'width=%s,height=%s,directories=no,location=no,scrollbars=yes,menubar=no,status=yes,toolbar=no,resizable=yes'); return false\"", $url, $Weblogs[$Current_weblog]['comment_width'], $Weblogs[$Current_weblog]['comment_height']); } else { $popup = ""; } $thisline = $last_comments_format; $thisline = str_replace("%name%", $comment['name'], $thisline); $thisline = str_replace("%date%", $comment['date'], $thisline); $thisline = str_replace("%title%", $comment['title'], $thisline); $thisline = str_replace("%url%", $url, $thisline); $thisline = str_replace("%popup%", $popup, $thisline); $thisline = str_replace("%comm%", $comment['comment'], $thisline); $thisline = format_date($comment["date"], $thisline); $output .= "\n" . $thisline; $count++; if ($count >= $last_comments_count) { return $output; } } } } return $output; }
/** * Display all comment users */ function see_comm_users() { global $Pivot_Vars, $Users, $Paths; PageHeader(lang('adminbar', 'seecommusers_title'), 1); PageAnkeiler(lang('userbar', 'admin') . ' » ' . lang('adminbar', 'seecommusers_title')); StartTable('', 7); GenSetting('', lang('userinfo', 'commusers'), '', 8, '', 7); // In the comment user info table below, the keys pass, notify_entries, // notify_default and show_address are ignored. Activate the commented // out HTML code (in $table_body and $table_row) to display everything. $table_body = ' <tr class="tabular_header"> <td class="tabular">' . lang('userinfo', 'username') . ': </td> <td class="tabular">' . lang('userinfo', 'email') . ': </td> <td class="tabular">' . lang('userinfo', 'url') . ': </td> <td class="tabular">' . lang('userinfo', 'lastlogin') . ': </td> <!-- td class="tabular">' . lang('userinfo', 'show_address') . ': </td --> <!-- td class="tabular">' . lang('userinfo', 'notify_entries') . ': </td --> <!-- td class="tabular">' . lang('userinfo', 'notify_default') . ': </td --> <td class="tabular">' . lang('userinfo', 'verified') . ': </td> <td class="tabular">' . lang('userinfo', 'disabled') . ': </td> <td></td> </tr>'; $table_row = ' <tr> <td class="tabular">%name%</td> <td class="tabular">%email%</td> <td class="tabular">%url%</td> <td class="tabular">%last_login%</td> <!-- td class="tabular">%show_address%</td --> <!-- td class="tabular">%notify_entries%</td --> <!-- td class="tabular">%notify_default%</td --> <td class="tabular">%verified%</td> <td class="tabular">%disabled%</td> <td nowrap="nowrap">%editlink%</td> </tr>'; $comment_users = get_registered_visitors(); foreach ($comment_users as $name_md5 => $commuserdata) { $thisrow = $table_row; $commuserdata['verified'] = $commuserdata['verified'] == 1 ? "%Yes%" : "%No%"; if (!isset($commuserdata['disabled']) || $commuserdata['disabled'] == 0) { $commuserdata['disabled'] = "%No%"; } else { $commuserdata['disabled'] = "%Yes%"; } if (!isset($commuserdata['last_login'])) { $commuserdata['last_login'] = ""; } foreach ($commuserdata as $key => $value) { if (empty($value)) { $value = "-"; } $thisrow = str_replace("%{$key}%", trimtext($value, 30), $thisrow); } if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) { $thisrow = str_replace("%editlink%", MakeLink(array('func' => 'admin', 'do' => 'editcommuser', 'edituser' => $name_md5)) . lang('userinfo', 'editcommuser') . '</a>', $thisrow); } else { $thisrow = str_replace("%editlink%", "", $thisrow); } $table_body .= $thisrow; } $table_body = str_replace("%Yes%", lang('general', 'yes'), $table_body); $table_body = str_replace("%No%", lang('general', 'no'), $table_body); echo $table_body . '</table><br />'; PageFooter(); }
/** * Prints the last comments in the overview screen. * * @param int $num */ function last_comments_overview($num) { global $Pivot_Vars; // First check if there are any comments waiting to be moderated.. if (file_exists("db/ser_modqueue.php")) { $modqueue = array_reverse(load_serialize("db/ser_modqueue.php", true, true)); } else { $modqueue = array(); } if (count($modqueue) > 0) { printf("<table cellspacing='0' class='tabular_border' border='0' width='340'\r\n\t\t\t\tstyle='margin-top:6px;'>\n<tr class='tabular_nav'>\n<td colspan='2'>\n%s</td></tr>", lang("userbar", "moderate_comments")); $msg = lang("userbar", "moderate_comments_desc"); $msg = str_replace("%1", count($modqueue), $msg); printf("\n<tr>\n<td colspan='2' style='white-space:normal;'>\n<p><a href='index.php?menu=moderate_comments&session=%s'>", $Pivot_Vars['session']); printf("%s</a></p>\n</td>\n</tr>\n</table>\n<br>\n\n", $msg); } // Then display the last comments.. if (file_exists("db/ser_lastcomm.php")) { $lastcomments = array_reverse(load_serialize("db/ser_lastcomm.php", true, true)); } else { $lastcomments = array(); } if (count($lastcomments) > 0) { printf("<table cellspacing='0' class='tabular_border' border='0' width='340'\r\n\t\t\t\tstyle='margin-top:6px;'>\n<tr class='tabular_nav'>\n<td colspan='2'>\n<span style='float:right'>( "); // Only print the (more) links we've not currently selected. if ($num != 5) { $morelink = sprintf("index.php?session=%s&menu=main&morecomments=5", $Pivot_Vars['session']); printf('<a href="%s">5</a> ', $morelink); } if ($num != 20) { $morelink = sprintf("index.php?session=%s&menu=main&morecomments=20", $Pivot_Vars['session']); printf('<a href="%s">20</a> ', $morelink); } if ($num != 60) { $morelink = sprintf("index.php?session=%s&menu=main&morecomments=60", $Pivot_Vars['session']); printf('<a href="%s">60</a> ', $morelink); } printf(')</span>%s</td></tr>', lang("userbar", "recent_comments")); $linecount = 1; foreach ($lastcomments as $lastcomment) { if ($linecount % 2 == 0) { $bg_color = "tabular_line_even"; } else { $bg_color = "tabular_line_odd"; } $name = trimtext($lastcomment['name'], 22, FALSE); $date = format_date($lastcomment['date'], "%day%-%monname%-%ye% %hour24%:%minute%"); $comm = trimtext($lastcomment['comment'], 78, FALSE); $comm = mywordwrap($comm, 20, " ", 1); $link = sprintf("index.php?session=%s&menu=entries&func=editcomments&", $Pivot_Vars['session']); $editlink = sprintf("%sid=%s#a%s", $link, $lastcomment['code'], $lastcomment['date']); $dellink = sprintf("%sid=%s&del=%s", $link, $lastcomment['code'], urlencode($lastcomment['name'] . "@" . $lastcomment['date'])); $reportpopup = sprintf("openReportComment('%s', '%s','%s', '%s');", $Pivot_Vars['session'], $lastcomment['code'], urlencode($lastcomment['name'] . "@" . $lastcomment['date']), $dellink); printf("<tr class='%s'><td class='tabular-small'><a href='%s'>%s</a><br /><span class='date'>%s</span></td>", $bg_color, $editlink, $name, $date); printf("<td valign='top' class='tabular-small' style='white-space: normal;'>"); printf("<span style='float:right'><a href='%s' title='%s'>[D]</a>", $dellink, lang('entries', 'delete_comment')); printf("<a href='#' onclick=\"%s\" title='%s'>[R]</a></span>%s</td></tr>", $reportpopup, lang('entries', 'report_comment'), $comm); if ($linecount++ >= $num) { break; } } /* echo '<tr class="tabular_nav"><td colspan="2"><form id="oneclickdelete" name="oneclickdelete">'; printf('<input type="checkbox" value="1" %s /> %s', ($cfg['oneclickdelete']==1) ? 'checked="checked"' : '', lang('comment', 'oneclickreport') ); echo '</form></td></tr>'; */ echo '</table><br />'; } }