コード例 #1
0
ファイル: language.inc.php プロジェクト: rhertzog/lcs
function utf8_strftime($format, $time)
{
  $result = strftime($format,$time);
  return utf8_convert($result);
}
コード例 #2
0
ファイル: search.php プロジェクト: kaz6120/P_BLOG
 $count_sql .= $binary_flag . "`name` LIKE '%" . $keys[0] . "%' OR ";
 $count_sql .= $binary_flag . "`comment` LIKE '%" . $keys[0] . "%')";
 for ($i = 1; $i < sizeof($keys); $i++) {
     $count_sql .= $and_or . ' (';
     $count_sql .= $binary_flag . "`name` LIKE '%" . $keys[$i] . "%' OR ";
     $count_sql .= $binary_flag . "`comment` LIKE '%" . $keys[$i] . "%')";
 }
 if ($date != "all") {
     $count_sql .= " AND (`date` LIKE '" . $date . "%')";
 }
 $hit_res = mysql_query($count_sql);
 $hit_row = mysql_num_rows($hit_res);
 ///////////////////////////////////////////////////////////////////////////////////
 // Switch the search result messages and titles.
 $rows = mysql_num_rows($res);
 $keyword = utf8_convert($keyword);
 // If "date" query string matches "yyyy-mm-dd", return empty value.
 if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $date)) {
     $contents = '';
     $hit_result = '';
 } else {
     if ($keyword == '' && preg_match('/^[0-9]{4}-[0-9]{2}/', $date) || $keyword == '' && $date == 'all') {
         if (preg_match('/^[0-9]{4}-[0-9]{2}/', $date)) {
             $yyyy = substr($date, 0, 4);
             $mm = substr($date, 5, 2);
             $date_array = getdate(mktime(0, 0, 0, $mm, 1, $yyyy));
             $month = $date_array['month'];
             $mday = $date_array['mday'];
             $year = $date_array['year'];
             switch ($cfg['date_style']) {
                 case '1':
コード例 #3
0
ファイル: fnc_logs.inc.php プロジェクト: kaz6120/P_BLOG
/**
 * Post comment link
 */
function post_comment()
{
    global $cd, $cfg, $lang, $id, $row, $session_status, $row, $trows, $comment_class, $forum_table, $block_spam;
    $tsql = "SELECT `id`, `tid`, `user_name`, `user_uri`, `title`, `comment`, `date`, `color`, `trash` FROM `{$forum_table}`" . " WHERE (`refer_id` = '{$row['id']}') AND (`trash` = '0') ORDER BY `date` ASC";
    $tres = mysql_query($tsql);
    if (!$tres) {
        return ' Comment : Off';
        exit;
    }
    $trow = mysql_num_rows($tres);
    if ($trow == '0') {
        $cstr = 'Comment';
    } elseif ($trow == '1') {
        $cstr = $trow . ' Comment';
    } else {
        $cstr = $trow . ' Comments';
    }
    // comment field name
    $comment_field_name = md5($block_spam['comment_field_name']);
    if ($trow != 0) {
        // When there are some comments...
        $comments = '';
        while ($trows = mysql_fetch_array($tres)) {
            $trows['title'] = htmlspecialchars(utf8_convert($trows['title']));
            $trows['comment'] = nl2p(htmlspecialchars(utf8_convert($trows['comment'])));
            $trows['user_name'] = htmlspecialchars(utf8_convert($trows['user_name']));
            $class_order = array_keys($comment_class);
            $color_class = $class_order[$trows['color']];
            // If user's website URI was posted, wrap the user name with anchor.
            if (isset($trows['user_uri']) && preg_match('/([^=^\\"]|^)(http\\:[\\w\\.\\~\\-\\/\\?\\&\\+\\=\\:\\@\\%\\;\\#\\%]+)/', $trows['user_uri'])) {
                $user_name = '<a href="' . $trows['user_uri'] . '" rel="nofollow">' . $trows['user_name'] . '</a>';
            } else {
                $user_name = $trows['user_name'];
            }
            // Smiley!
            $trows = smiley($trows);
            $comments .= '<h5 id="c' . $trows['id'] . '">' . $trows['title'] . "</h5>\n" . '<div class="' . $color_class . '">' . "\n" . $trows['comment'] . '<p class="author">From : ' . $user_name . ' @ ' . $trows['date'] . ' ' . '<span class="edit"><a href="./forum/comment_edit.php?id=' . $trows['id'] . '">' . $lang['edit'] . '</a></span>' . "</p>\n" . "</div>\n";
            // Admin button
            if ($session_status == 'on') {
                $comments .= '<form action="./forum/admin/comment_edit.php" method="post">' . "\n" . '<div class="submit-button">' . "\n" . '<input type="hidden" name="edit" value="1" />' . "\n" . '<input type="hidden" name="id" value="' . $trows['id'] . '" />' . "\n" . '<input type="submit" value="' . $lang['mod_del'] . '" />' . "\n" . '</div>' . "\n" . '</form>' . "\n";
            }
            $tid = $trows['tid'];
        }
        // Cookies
        if (isset($_COOKIE['p_blog_forum_user'])) {
            $user_name = $_COOKIE['p_blog_forum_user'];
            $checked = ' checked="checked"';
        } else {
            $user_name = '';
            $checked = '';
        }
        if (isset($_COOKIE['p_blog_forum_email'])) {
            $user_email = $_COOKIE['p_blog_forum_email'];
        } else {
            $user_email = '';
        }
        if (isset($_COOKIE['p_blog_forum_uri'])) {
            $user_uri = $_COOKIE['p_blog_forum_uri'];
        } else {
            $user_uri = '';
        }
        // Settings for "Comment Form Template"
        $post_title = '';
        $title = 'Re: ' . $row['name'];
        $comment = $lang['no_tags_allowed'];
        $action = './forum/comment_reply.php';
        $refer_id = $row['id'];
        // Set parent key = 0 since parent comment is already posted,
        // and specify the topic id.
        $parent_key = '<input type="hidden" name="parent_key" value="0" />' . "\n" . '<input type="hidden" name="tid" value="' . $tid . '" />';
        $comment_title = $lang['view_com_title_1'] . htmlspecialchars(strip_tags($row['name'])) . $lang['view_com_title_2'];
        $comment_link = '<a href="./article.php?id=' . $row['id'] . '#comments" title="' . $comment_title . '" class="status-on">' . $cstr . '</a> ';
    } else {
        // When No Comment...
        // Settings for "Comment Form Template"
        $post_title = '';
        $action = './forum/comment_reply.php';
        $refer_id = $row['id'];
        // Initialize user info because it's the first time post
        $user_name = '';
        $user_email = '';
        $user_uri = '';
        $title = 'Re: ' . $row['name'];
        $comment = $lang['no_tags_allowed'];
        $checked = '';
        // Set parent key = 1
        $parent_key = '<input type="hidden" name="parent_key" value="1" />';
        $comments = '<p class="gray-out">No Comments</p>';
        $comment_title = $lang['post_com_title_1'] . htmlspecialchars(strip_tags($row['name'])) . $lang['post_com_title_2'];
        $comment_link = '<a href="./article.php?id=' . $row['id'] . '#comments" title="' . $comment_title . '">' . 'Post Comment</a> ';
        $tid = '';
    }
    // Load the presentation template of "Comment Form"
    $comment_form = '';
    // Initialize comment form
    require_once $cd . '/forum/contents/comment_form.tpl.php';
    $comment_list = <<<EOD
<!-- Begin #comment-list -->
<div id="comment-list">
<h4 id="comments">{$cstr}</h4>
{$comments}
{$comment_form}
</div>
<!-- End #comment-list -->
EOD;
    if (!empty($id)) {
        // When Permalink
        $comment = $comment_list;
    } else {
        $comment = $comment_link;
    }
    return $comment;
}
コード例 #4
0
ファイル: index2.php プロジェクト: kaz6120/P_BLOG
    $contents = <<<EOD
<div class="section">
<h2 id="archive-title">{$cfg['file_index_title']}</h2>
{$category_sort}
EOD;
    while ($row = mysql_fetch_array($cate_res)) {
        $sql = 'SELECT ' . "`id`, `bin_title`, `bintype`, `binname`, `binsize`, `bindate`, DATE_FORMAT(`bin_mod`,'%Y-%m-%d %T') as `bin_mod`, `bin_category`, `bincomment`, `bin_count`" . ' FROM ' . $info_table . " WHERE (`draft` = '0') AND (`bin_category` = '" . $row['bin_category'] . "') ORDER BY `bindate` DESC LIMIT " . ($cfg['max_listup'] + 1);
        $res = mysql_query($sql);
        if (!$res) {
            die(mysql_error());
        }
        $row = convert_to_utf8($row);
        $contents .= '<div class="section">' . "\n" . '<h3>' . $row['bin_category'] . "</h3>\n<ul>\n";
        $i = 0;
        while ($row = mysql_fetch_array($res)) {
            if ($i >= $cfg['max_listup']) {
                $bin_category = utf8_convert($row['bin_category']);
                $contents .= "</ul>\n" . '<ul>' . '<li>' . '<a href="./category.php?k=' . urlencode($bin_category) . '&amp;d=&amp;p=0&amp;pn=1&amp;c=" title="' . $bin_category . '">' . $lang['more'] . '</a>' . '</li>';
            } else {
                $row = convert_to_utf8($row);
                $contents .= display_binary_box2($row, $data_table);
                $i++;
            }
        }
        $contents .= "</ul>\n</div>\n";
    }
    $contents .= "</div><!-- End .section -->\n";
} else {
    $contents .= "\n" . '<div class="section">' . "\n" . '<h2>Welcome to ' . $cfg['blog_title'] . " !</h2>\n" . '<p>' . $lang['no_files'] . "</p>\n" . "</div>\n";
}
xhtml_output('file');