Esempio n. 1
0
function display_entry_from_url()
{
    $expl = explode("/", $_SERVER['REQUEST_URI']);
    $entrydate = $expl[1];
    $e = undirify($expl[2]);
    $e = trim($e);
    $sql = "SELECT \n\t\tentries.title, \n\t\tentries.text,\n\t\tentries.text_more, \n\t\tauthors.uid, \n\t\tentries.date, \n\t\tentries.aid,\n\t\tentries.id, \n\t\tentries.comments,\n\t\tauthors.name \n\t\t\tFROM \n\t\tentries, \n\t\tauthors \n\t\t\tWHERE \n\t\tentries.aid = authors.uid \n\t\t\tAND \n\t\tentries.title LIKE ('{$e}%')\n\t\t\tAND\n\t\tentries.status = '1'\n\t\t\tAND\n\t\tFROM_UNIXTIME(entries.date, '%d%m%y') = '{$entrydate}'\n\t\t\tLIMIT 0,15";
    $result = @mysql_query($sql);
    if (!$result) {
        print "<p>Error executing query: " . mysql_error() . "</p>\n";
    }
    if (@mysql_num_rows($result) == 1) {
        while ($row = @mysql_fetch_array($result)) {
            extract($row);
            $hour = date("G:i", $date);
            $day = date("d.m.Y", $date);
            $date = date("G:i d. d.m || Y", $date);
            print "<div class='entry'>\n";
            print "<div class='head'>\n";
            print "<h1><img src='/img/permlink.gif' alt='' style=\"border: 0; vertical-align:middle; margin-right: 6px;\" />{$title}</h1>";
            print "</div>\n";
            print "<p class='date'>Kl. {$hour} d.{$day} af {$name}</p>\n";
            $text = stripslashes($text);
            print "{$text}\n";
            if (!empty($text_more)) {
                $text_more = stripslashes($text_more);
                print "<div id=\"mere\">{$text_more}</div>\n";
            }
            $sql_c = "SELECT * FROM comments WHERE eid = '{$id}' order by date";
            if (!($result_c = @mysql_query($sql_c))) {
                print "<p>error " . mysql_error() . "</p>";
            } else {
                if (@mysql_num_rows($result_c) > 0) {
                    print "<h2 id=\"c\" style=\"font-size: medium;\">Kommentarer</h2>\n";
                    while ($row_c = @mysql_fetch_array($result_c)) {
                        extract($row_c);
                        $data = "<div class=\"comment\">\n";
                        $data .= "<p>{$c_text}</p>\n";
                        $data .= "<p class=\"komm\">{$c_author}";
                        if (!empty($c_url)) {
                            $data .= " | <a title=\"Besøg {$c_author} på nettet\" href=\"{$c_url}\">web</a>";
                        }
                        if (!empty($c_email)) {
                            $data .= " | <a title=\"Skriv en email til {$c_author}\" href=\"mailto:" . spam_safe($c_email) . "\">@</a>";
                        }
                        $c_date = date("G:i / d.m / Y", $date);
                        $c_date = strtolower($c_date);
                        $data .= " / {$c_date}";
                        $data .= "</p>\n";
                        print $data;
                        print "</div>\n";
                    }
                }
            }
            if ($comments == 'on') {
                @(include 'incs/includes.inc.php');
                print $comments_form;
            }
            print "</div>\n";
        }
    } else {
        print "<p>Der findes ingen indlæg med den adresse.</p>";
        #	print "<p>{$sql}</p>";
    }
}
Esempio n. 2
0
function display_entry_from_url()
{
    $expl = array_reverse(explode("/", $_SERVER['REQUEST_URI']));
    $entrydate = $expl[1];
    $e = $expl[0];
    $e = trim($e);
    $sql = "SELECT \n\t\tentries.title, \n\t\tentries.slug,\n\t\tentries.text,\n\t\tentries.text_more, \n\t\tauthors.uid, \n\t\tentries.date, \n\t\tentries.aid,\n\t\tentries.id, \n\t\tentries.comments,\n\t\tauthors.name \n\t\t\tFROM \n\t\tentries, \n\t\tauthors \n\t\t\tWHERE \n\t\tentries.aid = authors.uid \n\t\t\tAND \n\t\tentries.slug LIKE ('{$e}%')\n\t\t\tAND\n\t\tentries.status = '1'\n\t\t\tAND\n\t\tFROM_UNIXTIME(entries.date, '%d%m%y') = '{$entrydate}'\n\t\t\tLIMIT 0,15";
    $result = @mysql_query($sql);
    if (!$result) {
        print "<h4>Problems with the database, please to try again later.</h4><p>" . mysql_error() . "</p>";
    }
    if (@mysql_num_rows($result) == 1) {
        while ($row = @mysql_fetch_array($result)) {
            extract($row);
            $hour = date("G:i", $date);
            $day = date("d.m.Y", $date);
            print '<div class="entry">';
            print "<h1>{$title} <span style='color: #799dc6'>{$day}</span></h1>\n";
            # print '<p class="byline">'.$hour.'</p>';
            $text = stripslashes(format_entry($text));
            print '<div class="ebody">';
            print "{$text}\n";
            if (!empty($text_more)) {
                $text_more = stripslashes(format_entry($text_more));
                print "<div id=\"mere\">{$text_more}</div>\n";
            }
            print '</div>';
            $sql_c = "SELECT * FROM comments WHERE eid = '{$id}' order by date";
            if (!($result_c = @mysql_query($sql_c))) {
                print "<p>error " . mysql_error() . "</p>";
            } else {
                if (@mysql_num_rows($result_c) > 0) {
                    $comment_count = 1;
                    print '<h2 id="c">Comments</h2>';
                    while ($row_c = @mysql_fetch_array($result_c)) {
                        extract($row_c);
                        #						$commentstyle = ($comment_count % 2) ? 'commentdark' : 'commentlight';
                        $data = '<div class="' . $commentstyle . '">';
                        #$commentnumber = ($comment_count % 2) ? 'commentnumberlight' : 'commentnumberdark';
                        #$data .= '<div class="'.$commentnumber.'">'.$comment_count.'</div>';
                        $data .= '<p class="komm">' . $c_author . '';
                        if (!empty($c_url)) {
                            $data .= " | <a title=\"Visit {$c_author} on the web\" href=\"{$c_url}\" rel=\"nofollow\">web</a>";
                        }
                        if (!empty($c_email)) {
                            $data .= " | <a title=\"Write an email to {$c_author}\" href=\"mailto:" . spam_safe($c_email) . "\">@</a>";
                        }
                        $c_date = date("G:i / jS \\o\f F / Y", $date);
                        $c_date = strtolower($c_date);
                        $data .= " / <a href=\"#c-" . $c_id . "\" id='c-{$c_id}' title=\"Permalink to this comment\">{$c_date}</a>";
                        $data .= "</p>\n";
                        $data .= "<div class='kommentry'>" . format_entry($c_text) . "</div>";
                        print $data;
                        # print '<hr />';
                        print "</div>\n";
                        $comment_count++;
                    }
                }
            }
            if ($comments == 'on') {
                @(include 'incs/includes.inc.php');
                print $comments_form;
            }
            /*			$sql_seek = "select * from entries;";
            			$result_seek = mysql_query($sql_seek);
            			mysql_data_seek($result_seek, 70);
            			while ($row = mysql_fetch_array($result_seek)) {
            				extract($row);
            				print $id."--".$title."<br />";
            				}
            */
        }
    } else {
        #print "<p>Der findes ingen indlæg med den adresse.</p>";
        #print "<p>{$sql}</p>";
    }
}