Exemplo n.º 1
0
function week_menu($w)
{
    global $output;
    $output->nav['first'] = './?w=0';
    $output->nav['next'] = './?w=' . ($w + 1);
    $v = array();
    if ($w > 0) {
        $output->nav['prev'] = './?w=' . ($w - 1);
        $v[] = format_entry(output::mask('previous week'), $w - 1);
    } else {
        $v[] = format_entry(output::mask('week') . ':');
    }
    if ($w < 5) {
        $i0 = 0;
        $i1 = 10;
    } else {
        $i0 = $w - 4;
        $i1 = $w + 6;
        $v[] = format_entry('0', 0);
    }
    for ($i = $i0; $i < $i1; $i++) {
        if ($i != $w) {
            $v[] = format_entry($i, $i);
        } else {
            $v[] = format_entry($i);
        }
    }
    $v[] = format_entry(output::mask('next week'), $w + 1);
    return $v;
}
Exemplo n.º 2
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/incs/accesscontrol.php';
if (isset($_POST['submit'])) {
    if ($_POST['title'] != "" && $_POST['text'] != "") {
        $title = $_POST['title'];
        $text = $_POST['text'];
        $text_more = $_POST['text_more'];
        $aid = $_POST['aid'];
        $status = $_POST['status'];
        $comments = $_POST['comments'];
        $text = format_entry($text);
        if (!empty($text_more)) {
            $text_more = format_entry($text_more);
        }
        $titel = format_entry($titel);
        if ($_POST['month'] == 0) {
            $date = time() + $offset * 3600;
        } else {
            $date = mktime($_POST['hh'], $_POST['mm'], $_POST['ss'], $_POST['month'], $_POST['day'], $_POST['year']);
        }
        $sql = "\n\t\t\t\tINSERT INTO entries SET\n\t\t\t\ttitle = ('{$title}'),\n\t\t\t\ttext = ('{$text}'),\n\t\t\t\ttext_more = ('{$text_more}'),\n\t\t\t\taid = ('{$aid}'),\n\t\t\t\tdate = ('{$date}'),\n\t\t\t\tstatus = ('{$status}'),\n\t\t\t\tcomments = ('{$comments}')";
        $insert_result = mysql_query($sql) or print mysql_error();
        #		print '<h1 style="padding: 10px;">Indlægget er postet.</h1>';
        #		print '<p>'.stripslashes($sql).'</p>';
        #		}
    } else {
        print '<p style="padding-left: 10px;">Du skal udfylde alle felter.</p>';
    }
}
print_header(". {$blog_title} | Post et indlæg .", "edit", $domain_name, $description, $key_words);
Exemplo n.º 3
0
    print '<p>You searced for <span style="color: #693; font-weight: bold">\'' . urldecode($q) . '\'</span>, and <b>' . $numrows . '</b> posts matched your query.</p><p>The results are sorted by relevance. If your query appears within the first 200 characters of the post, it is highlighted <span style="background-color: olivedrab;color:white">like this</span>.</p>';
    $i = 1;
    while ($row = @mysql_fetch_array($result)) {
        extract($row);
        $linkdate = date('dmy', $date);
        $date = date("G:i || d.m || Y", $date);
        print "<h1>#{$i} <a href=\"{$install_path}/{$linkdate}/{$slug}\" style=\"margin-left: 3px\">{$title}</a></h1>\n";
        print "<p class=\"date\" style=\"margin-left: 17px;\">{$date} by {$name}</p>\n";
        $text = strip_tags($text);
        $text = stripslashes($text);
        $text = substr($text, 0, 200) . ' ...';
        $text = preg_replace("/({$q})/i", '<span style="background-color: olivedrab;color:white">\\1</span>', $text);
        ?>
            			<div style="padding-left: 17px;">
            			<?php 
        print format_entry($text);
        $i++;
        ?>
            			</div>
            			<?php 
    }
}
?>
         </div>
      </div>
		<div id="linkster">
		     <?php 
@(include 'incs/sidebars.inc.php');
?>
		</div>
    <div id="disclaimer">
Exemplo n.º 4
0
/**
 * Searches the index for words.
 *
 * @param array $str_a Contains the display text (index 0) and the search text (index 1).
 * @return string The search results as a list (in HTML code).
 */
function search_index($str_a)
{
    global $Current_weblog, $Weblogs, $index_file, $matches, $db, $allowed_chars;
    $str_a[1] = trim($str_a[1]);
    $words = explode(" ", $str_a[1]);
    $orig_words = explode(" ", trim($str_a[0]));
    // Ignoring empty strings and removing non-allowed chars from words
    foreach ($words as $key => $val) {
        if (trim($val) == "") {
            unset($words[$key]);
        } else {
            $words[$key] = preg_replace('/[^' . preg_quote($allowed_chars) . ']/i', '', trim($val));
        }
    }
    if (count($words) > 0) {
        foreach ($words as $word) {
            if (file_exists("db/search/" . $word[0] . ".php")) {
                $index_file[$word[0]] = load_serialize("db/search/" . $word[0] . ".php");
            }
        }
    }
    $n = count($words);
    for ($i = 0; $i < $n; $i++) {
        // getword sets $matches used below.
        $res = getword($words[$i]);
        if ($res) {
            $found_words[] = $orig_words[$i];
        }
    }
    // mix 'n match.. If the result set for 'AND' is empty, just lump
    // them together, so we have an 'OR'..
    if (count($matches) == 1) {
        $result = $matches[0];
    } else {
        if (count($matches) == 2) {
            list($word1, $word2) = $matches;
            $result = array_intersect($word1, $word2);
            if (count($result) == 0) {
                $result = array_merge($word1, $word2);
            }
        } else {
            if (count($matches) == 3) {
                list($word1, $word2, $word3) = $matches;
                $result = array_intersect($word1, $word2, $word3);
                if (count($result) == 0) {
                    $result = array_merge($word1, $word2, $word3);
                }
            } else {
                if (count($matches) > 3) {
                    list($word1, $word2, $word3, $word4) = $matches;
                    $result = array_intersect($word1, $word2, $word3, $word4);
                    if (count($result) == 0) {
                        $result = array_merge($word1, $word2, $word3, $word4);
                    }
                }
            }
        }
    }
    $title = lang('weblog_text', 'search_title');
    if (strlen($Weblogs[$Current_weblog]['search_format']) > 1) {
        list($format_top, $format_summary, $format_start, $format_entry, $format_end) = explode("----", $Weblogs[$Current_weblog]['search_format']);
    } else {
        $format_top = "<h2>%search_title%</h2>\n%search_form%\n";
        $format_summary = "<p>%search_summary%</p>\n";
        $format_start = "<ul>\n";
        $format_entry = "<li><!-- %code% --><a href='%link%'>%title%</a></li>\n";
        $format_end = "</ul>\n";
    }
    $output = $format_top . $format_summary;
    if (isset($found_words) && count($found_words) > 0) {
        rsort($result);
        $result = array_unique($result);
        $count = count($result);
        $name = implode(', ', $found_words);
        $summary = str_replace('%name%', $name, lang('weblog_text', 'matches'));
        $output .= $format_start;
        $db = new db();
        foreach ($result as $hit) {
            if ($db->entry_exists($hit)) {
                $entry = $db->read_entry($hit);
                $entry['link'] = make_filelink($entry['code'], "", "");
                $entry['categories'] = implode(', ', $entry['category']);
                $weblogs = find_weblogs_with_cat($entry['category']);
                foreach ($weblogs as $key => $value) {
                    $weblogs[$key] = $Weblogs[$value]['name'];
                }
                $entry['weblogs'] = implode(', ', $weblogs);
                if ($entry['title'] == "") {
                    $entry['title'] = substr(strip_tags($entry['introduction']), 0, 50);
                }
                $output .= format_entry($entry, $format_entry);
            }
        }
        $output .= "{$format_end}\n";
    } else {
        if ($str_a[1] != "") {
            $count = 0;
            $name = $str_a[0];
            $summary = str_replace('%name%', $name, lang('weblog_text', 'nomatches'));
        }
    }
    $output = str_replace("%search_term%", $name, $output);
    $output = str_replace("%search_count%", $count, $output);
    $output = str_replace("%search_summary%", $summary, $output);
    $output = str_replace("%search_title%", $title, $output);
    return $output;
}
Exemplo n.º 5
0
header("Content-type: application/xml");
# Here we create the query containing the RSS-version of the last 15 posts to the site.
$sql_xml = "SELECT (comments.date - ({$offset} * 3600)) as xml_date, (entries.date - ({$offset} * 3600)) as entrydate, slug, c_id, c_author, c_text, title, status from {$db_name}.entries, {$db_name}.comments WHERE comments.eid = entries.id and entries.status = '1' ORDER BY c_id DESC LIMIT 15";
# db-debugging
if (!($result_xml = @mysql_query($sql_xml))) {
    print "<p>Error executing XML-query." . mysql_error() . "</p>";
} else {
    # Set date for last build.
    putenv("TZ=CET");
    $last_build_date = date("r", time());
    # Initiate the content-string that will be added to
    $xml_string = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<rss version=\"2.0\" xmlns:icbm=\"http://postneo.com/icbm\">\n<channel>\n\t<title>. Comments from {$tagline} .</title>\n\t<description>Comments on {$tagline}</description>\n\t<link>http://{$domain_name}</link>\n\t<lastBuildDate>{$last_build_date}</lastBuildDate>\n\t<icbm:latitude>55.6773</icbm:latitude>\n\t<icbm:longitude>12.5749</icbm:longitude>\n";
    while ($row = @mysql_fetch_array($result_xml)) {
        extract($row);
        $text = htmlspecialchars($c_text);
        $text = format_entry($c_text);
        $pub_date = date("r", $xml_date);
        $date = date("dmy", $xml_date);
        $entry_date = date("dmy", $entrydate);
        $xml_string .= "<item>\n\t";
        $xml_string .= "<title>Comments from {$c_author} on '{$title}'</title>\n\t";
        $xml_string .= "<description>{$text}</description>\n\t";
        $xml_string .= "<link>http://{$domain_name}/" . $entry_date . "/" . $slug . "#c</link>\n\t";
        $xml_string .= "<pubDate>{$pub_date}</pubDate>\n\t";
        $xml_string .= "<guid>http://{$domain_name}/" . $entry_date . "/" . $slug . "</guid>\n\t";
        $xml_string .= "<author>{$email} ({$c_author})</author>\n\t";
        $xml_string .= "</item>\n";
    }
    $xml_string .= "</channel>\n</rss>";
}
print $xml_string;
Exemplo n.º 6
0
    $sql_del = "delete from comments where c_id = {$del_e}";
    if ($result_del = mysql_query($sql_del)) {
        print "<p style=\"margin: 0; padding: 0; color: #648C50; font-weight: bold;\">Kommentaren blev slettet fra databasen</p>";
        #	print "<p>$sql_del</p>";
    } else {
        print '<p style="margin: 0; padding: 0; color: #648C50;">Houston, we have a problem</p>';
    }
}
if (isset($_POST['submit']) && isset($_POST['entryid'])) {
    $aid = $_POST['aid'];
    $entryid = $_POST['entryid'];
    $title = $_POST['title'];
    $text_more = $_POST['text_more'];
    $text = format_entry($_POST['text']);
    if (!empty($text_more)) {
        $text_more = format_entry($text_more);
    }
    if ($_POST['month'] == 0) {
        $date = time() + $offset * 3600;
    } else {
        $date = mktime($_POST['hh'], $_POST['mm'], $_POST['ss'], $_POST['month'], $_POST['day'], $_POST['year']);
    }
    $status = $_POST['status'];
    $comments = $_POST['comments'];
    $sql_update = "UPDATE entries SET\n\t\ttitle = ('{$title}'),\n\t\ttext = ('{$text}'),\n\t\ttext_more = ('{$text_more}'),\n\t\tdate = ('{$date}'),\n\t\taid = ('{$aid}'),\n\t\tstatus = ('{$status}'),\n\t\tcomments = ('{$comments}')\n\t\tWHERE\n\t\tid = ('{$entryid}')";
    $update_result = @mysql_query($sql_update);
    /*	print $sql_update.'<br />';
    	print $entryid;
    	if(!$update_result) {
    		print mysql_error();
    	}
Exemplo n.º 7
0
function display_front_page($lastentries)
{
    global $install_path;
    $sql = "SELECT\n\tentries.title, \n\tentries.slug,\n\tentries.text, \n\tentries.text_more,\n\tauthors.uid, \n\tentries.date, \n\tentries.aid, \n\tentries.id, \n\tentries.comments,\n\tauthors.name \n\t\tFROM\n\tentries, \n\tauthors \n\t\tWHERE \n\tentries.aid = authors.uid\n\t \tAND\n\tentries.status = '1'\n\t \tORDER BY \n\tentries.date \n\t \tDESC LIMIT 0,{$lastentries}";
    $result = @mysql_query($sql);
    if (!$result) {
        print "<h4>Knas med databasen, prøv igen lidt senere.</h4><p>" . mysql_error() . "</p>";
        $no_success = 1;
    } else {
        while ($row = mysql_fetch_array($result)) {
            extract($row);
            $hour = date("G:i", $date);
            $day = date("d.m.Y", $date);
            # $title_d = dirify($title);
            $date = date('dmy', $date);
            if ($comments == 'on') {
                $sql2 = "SELECT c_text, c_author, date eid FROM comments WHERE comments.eid = '{$id}'";
                if (!($result2 = @mysql_query($sql2))) {
                    print "<p>Error performing query: " . mysql_error() . "</p>";
                    exit;
                } else {
                    #$count_comments = @mysql_num_rows($result2);
                    switch ($count_comments = mysql_num_rows($result2)) {
                        case 1:
                            $actual_comments = 'Comment';
                            break;
                        default:
                            $actual_comments = 'Comments';
                            break;
                    }
                }
            }
            print "<div class='entry'>\n";
            print "<h1><a title=\"Permanent link to '{$title}'\" href=\"{$install_path}/{$date}/{$slug}\">{$title}</a></h1>\n";
            print "<p class=\"byline\"><span style='color:\n#799dc6'>{$day}</span><br /> \n <a href=\"{$install_path}/{$date}/" . $slug . "#c\" title=\"{$count_comments} har tilføjet noget\">{$count_comments} {$actual_comments}</a></p>\n";
            print '<div class="ebody">' . stripslashes(format_entry($text));
            if (!empty($text_more)) {
                print "<p><a href=\"{$date}/{$slug}#mere\" style=\"font-weight: bold\" title=\"Click here to continue reading '{$title}'\">Continue reading '{$title}'...</a></p>";
            }
            #		print '<div class="splitter"></div>';
            print "</div></div>\n";
        }
    }
}
Exemplo n.º 8
0
}
$r = mysql_query($q);
if ($nsidebars = JOURNAL_SIDEBARS) {
    $sidebars = mysql_fetch_all(mysql_query("SELECT * FROM sidebars \n\t\t\t\tWHERE username = '******' \n\t\t\t\tORDER BY timestamp DESC\n\t\t\t\tLIMIT {$nsidebars}"));
    print "<div class='sidebars'>";
    foreach ($sidebars as $sidebar) {
        extract($sidebar);
        print "<div class='sidebar'><h2\n\t\t\tclass='title'>{$title}</h2><div class='content'>" . wiki_render($data) . "</div></div>";
    }
    print "</div>";
}
if ($r) {
    $r = mysql_fetch_all($r);
    if (count($r) > 1) {
        print format_rows($r, JOURNAL_DISPLAYLIMIT);
    } else {
        print format_entry(array_shift($r));
    }
    if ($date and !$time) {
        $q = "SELECT date_format(date, '%Y-%m-%d') AS date \n\t\t\t\tFROM journal \n\t\t\t\tWHERE username = '******' \n\t\t\t\t\tAND date_format(date, '%Y-%m-%d') > '{$date}' \n\t\t\t\tORDER BY date LIMIT 1";
        $r = mysql_query($q);
        $row = mysql_fetch_assoc($r);
        $nextdate = $row['date'];
        $q = "SELECT date_format(date, '%Y-%m-%d') AS date \n\t\t\t\tFROM journal \n\t\t\t\tWHERE username = '******' \n\t\t\t\t\tAND date_format(date, '%Y-%m-%d') < '{$date}' \n\t\t\t\tORDER BY date DESC LIMIT 1";
        $r = mysql_query($q);
        $row = mysql_fetch_assoc($r);
        $prevdate = $row['date'];
    }
} else {
    print "No journal entries, sadly";
}
Exemplo n.º 9
0
@(include 'incs/functions.inc.php');
header("Content-type: application/xml");
# Here we create the query containing the RSS-version of the last 15 posts to the site.
$sql_xml = "SELECT (date - ({$offset} * 3600)) as xml_date, title, slug, text, text_more, name, email from {$db_name}.entries, {$db_name}.authors where status = '1' AND entries.aid = authors.uid ORDER BY xml_date DESC LIMIT 0,15";
# db-debugging
if (!($result_xml = @mysql_query($sql_xml))) {
    print "<p>Error executing XML-query." . mysql_error() . "</p>";
} else {
    # Set date for last build.
    putenv("TZ=CET");
    $last_build_date = date("r", time());
    # Initiate the content-string that will be added to
    $xml_string = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<rss version=\"2.0\" xmlns:icbm=\"http://postneo.com/icbm\">\n<channel>\n\t<title>. {$blog_title} .</title>\n\t<description>{$description}</description>\n\t<link>http://{$domain_name}</link>\n\t<lastBuildDate>{$last_build_date}</lastBuildDate>\n\t<icbm:latitude>55.6773</icbm:latitude>\n\t<icbm:longitude>12.5749</icbm:longitude>\n";
    while ($row = @mysql_fetch_array($result_xml)) {
        extract($row);
        $text = format_entry($text) . format_entry($text_more);
        $text = htmlspecialchars($text);
        $pub_date = date("r", $xml_date);
        $date = date("dmy", $xml_date);
        $xml_string .= "<item>\n\t";
        $xml_string .= "<title>{$title}</title>\n\t";
        $xml_string .= "<description>{$text}</description>\n\t";
        $xml_string .= "<link>http://{$domain_name}/" . $date . "/" . $slug . "</link>\n\t";
        $xml_string .= "<pubDate>{$pub_date}</pubDate>\n\t";
        $xml_string .= "<guid>http://{$domain_name}/" . $date . "/" . $slug . "</guid>\n\t";
        $xml_string .= "<author>{$email} ({$name})</author>\n\t";
        $xml_string .= "<comments>http://{$domain_name}/" . $date . "/" . $slug . "#c</comments>\n\t";
        $xml_string .= "</item>\n";
    }
    $xml_string .= "</channel>\n</rss>";
}