当前位置: 首页>>代码示例>>PHP>>正文


PHP localised_date函数代码示例

本文整理汇总了PHP中localised_date函数的典型用法代码示例。如果您正苦于以下问题:PHP localised_date函数的具体用法?PHP localised_date怎么用?PHP localised_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了localised_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_log_list

function display_log_list()
{
    global $lang_viewlog_php, $folder_icon, $delete_all_icon, $delete_this_icon, $view_icon, $lang_date;
    $log_list = getloglist('logs/');
    if (count($log_list) > 0) {
        foreach ($log_list as $log) {
            $mtime = localised_date($log['mtime'], $lang_date['log']);
            $filesize = cpg_format_bytes($log['filesize']);
            echo <<<EOT
                            <tr>
                                    <td class="tableb">
                                            {$folder_icon}&nbsp;<a href= "viewlog.php?log={$log['logname']}">{$log['logname']}</a>
                                            &nbsp;&nbsp;&nbsp; ( <em>{$filesize}</em>, {$lang_viewlog_php['last_updated']}: <em>{$mtime}</em>)
                                    </td>
                            </tr>
EOT;
        }
        echo <<<EOT
                                <tr>
                                        <td class="tableb" align="center">
                                                <button type="button" class="button" name="dall" value="{$lang_viewlog_php['delete_all']}" id="dall" onclick="window.location='viewlog.php?action=dall';">{$delete_all_icon}{$lang_viewlog_php['delete_all']}</button>
                                        </td>
                                </tr>
EOT;
    } else {
        cpg_die(INFORMATION, $lang_viewlog_php['no_logs'], __FILE__, __LINE__);
    }
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:28,代码来源:viewlog.php

示例2: dst_start

function dst_start()
{
    global $CONFIG, $CPG_PHP_SELF, $lang_admin_php, $lang_date, $lang_plugin_dst;
    require_once "./plugins/dst/lang/english.php";
    if ($CONFIG['lang'] != 'english' && file_exists("./plugins/dst/lang/{$CONFIG['lang']}.php")) {
        require_once "./plugins/dst/lang/{$CONFIG['lang']}.php";
    }
    if ($CONFIG['plugin_dst_on'] == '1') {
        if ($CPG_PHP_SELF != 'admin.php') {
            $CONFIG['time_offset']++;
        } else {
            $lang_admin_php['time_offset_detail'] = str_replace('%s', localised_date(time() + 3600, $lang_date['comment']), $lang_admin_php['time_offset_detail']);
        }
    }
    if ($CONFIG['plugin_dst_country'] != '') {
        $lang_admin_php['time_offset_detail'] .= '<br />' . sprintf($lang_plugin_dst['plugin_is_installed_and_interferes'], '<a href="pluginmgr.php">' . $lang_plugin_dst['dst'] . '</a>') . ' ';
        $lang_admin_php['time_offset_detail'] .= sprintf($lang_plugin_dst['you_have_selected_x_as_country'], '<em>' . $CONFIG['plugin_dst_country'] . '</em>') . ' ';
        $lang_admin_php['time_offset_detail'] .= sprintf($CONFIG['plugin_dst_on'] == '1' ? $lang_plugin_dst['dst_will_end_on'] : $lang_plugin_dst['dst_will_start_on'], $CONFIG['plugin_dst_datetime']) . ' ' . $lang_plugin_dst['time_will_auto_adjust'];
    }
    if ($CONFIG['plugin_dst_datetime'] != '' && date('Y-m-d H:i:s') > $CONFIG['plugin_dst_datetime']) {
        // We have reached the trigger date: DST plugin is on and the trigger date has passed, so let's toggle the DST and set the new trigger date
        include_once './plugins/dst/functions.inc.php';
        $dst_array = plugin_dst_xml_read();
        plugin_dst_datetime_update($dst_array);
    }
}
开发者ID:phill104,项目名称:branches,代码行数:26,代码来源:codebase.php

示例3: create_banlist

/**
 * create_banlist()
 *
 * @return
 **/
function create_banlist()
{
    global $CONFIG, $lang_banning_php, $album_date_fmt;
    //$PHP_SELF,
    $result = cpg_db_query("SELECT *, UNIX_TIMESTAMP(expiry) AS expiry FROM {$CONFIG['TABLE_BANNED']} WHERE brute_force=0");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        echo <<<EOHEAD
                <tr>
                <th align="center" class="tableh2">{$lang_banning_php['user_name']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['ip_address']}</th>
                <th align="center" class="tableh2">{$lang_banning_php['expiry']}</th>
                <th align="center" class="tableh2"></th>
                </tr>
EOHEAD;
        $row_counter = 0;
        while ($row = mysql_fetch_array($result)) {
            if ($row['user_id']) {
                $username = get_username($row['user_id']);
            } else {
                $username = '';
            }
            if ($row['expiry']) {
                $expiry = localised_date($row['expiry'], '%Y-%m-%d');
            } else {
                $expiry = '';
            }
            echo <<<EOROW
                                        <tr>
                                               <form action="{$_SERVER['PHP_SELF']}" method="post" name="banlist{$row_counter}">
                                                     <td width="20%" class="tableb" valign="middle">
                                                             <input type="hidden" name="ban_id" value="{$row['ban_id']}" />
                                                <input type="text" class="textinput" style="width: 100%" name="edit_ban_user_name" value="{$username}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="textinput" size="15" name="edit_ban_ip_addr" value="{$row['ip_addr']}" />
                                        </td>
                                                <td class="tableb" valign="middle">
                                                <input type="text" class="listbox_lang" size="20" name="edit_ban_expires" value="{$expiry}" readonly="readonly" title="{$lang_banning_php['select_date']}" />
                                                <a href="javascript:;"  onclick="return getCalendar(document.banlist{$row_counter}.edit_ban_expires);" title="{$lang_banning_php['select_date']}"><img src="images/calendar.gif" width="16" height="16" border="0" alt="" /></a>
                                        </td>
                                        <td class="tableb" valign="middle">
                                                                <input type="submit" class="button" name="edit_ban" value="{$lang_banning_php['edit_ban']}" />
                                        &nbsp;&nbsp;
                                                                <input type="submit" class="button" name="delete_ban" value="{$lang_banning_php['delete_ban']}" />
                                        </td>
                                </form>
                                </tr>
EOROW;
            $row_counter++;
        }
    }
    mysql_free_result($result);
}
开发者ID:alencarmo,项目名称:OCF,代码行数:59,代码来源:banning.php

示例4: decode

 function decode($time, $code = null)
 {
     global $CONFIG;
     if ($CONFIG['lang'] == "german") {
         $last_msg_date_fmt = '%d.%m.%Y %H:%M';
     } else {
         $last_msg_date_fmt = '%b %d, %Y, %H:%M:%S %p';
     }
     $registed_date_fmt = "%b %d, %Y";
     if ($code !== null) {
         return localised_date($time, $code);
     } else {
         return localised_date($time, $last_msg_date_fmt);
     }
 }
开发者ID:phill104,项目名称:branches,代码行数:15,代码来源:time_helper.php

示例5: log_write

function log_write($text, $log = null)
{
    global $LINEBREAK, $lang_date;
    if (isset($CONFIG['log_mode']) && $CONFIG['log_mode'] == CPG_NO_LOGGING) {
        return false;
    }
    if (is_null($log)) {
        $log = CPG_GLOBAL_LOG;
    }
    $log = 'logs/' . $log . '.log.php';
    if (!file_exists($log)) {
        $log_header = implode('', file('include/log_header.inc.php'));
    } else {
        $log_header = '';
    }
    if (!isset($lang_date['log'])) {
        $lang_date['log'] = '%Y-%m-%d %H:%M:%S';
    }
    $fp = fopen($log, 'a');
    fwrite($fp, $log_header);
    fwrite($fp, localised_date(-1, $lang_date['log']) . ' - ' . $text . $LINEBREAK . '---' . $LINEBREAK);
    fclose($fp);
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:23,代码来源:logger.inc.php

示例6: enlargeit_html_comments

function enlargeit_html_comments($pid)
{
    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST;
    global $enlargeit_image_comments, $enlargeit_add_your_comment, $lang_display_comments;
    $html = '';
    // report to moderator buttons
    $tmpl_comment_edit_box = template_extract_block($enlargeit_image_comments, 'edit_box_smilies', '{EDIT}');
    template_extract_block($enlargeit_image_comments, 'edit_box_no_smilies');
    template_extract_block($enlargeit_add_your_comment, 'input_box_no_smilies');
    $tmpl_comments_buttons = template_extract_block($enlargeit_image_comments, 'buttons', '{BUTTONS}');
    $tmpl_comments_ipinfo = template_extract_block($enlargeit_image_comments, 'ipinfo', '{IPINFO}');
    if ($CONFIG['comments_sort_descending'] == 1) {
        $comment_sort_order = 'DESC';
    } else {
        $comment_sort_order = 'ASC';
    }
    $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id {$comment_sort_order}");
    while ($row = mysql_fetch_array($result)) {
        $user_can_edit = GALLERY_ADMIN_MODE || USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || !USER_ID && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
        $comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';
        $comment_edit_box = '';
        $comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
        $comment_body = make_clickable($row['msg_body']);
        $smilies = '';
        $ip = $row['msg_hdr_ip'];
        if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
            $ip .= ' [' . $row['msg_raw_ip'] . ']';
        }
        $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo);
        $template = template_eval($enlargeit_image_comments, $params);
        $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']), '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => '', '{IP}' => $ip, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
        $html .= template_eval($template, $params);
    }
    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
        if (USER_ID) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="" /></td>';
            template_extract_block($enlargeit_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
        } else {
            if (isset($USER['name'])) {
                $user_name = strtr($USER['name'], $HTML_SUBST);
            } else {
                $user_name = $lang_display_comments['your_name'];
            }
        }
        $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => $lang_display_comments['comment'], '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width']);
        template_extract_block($enlargeit_add_your_comment, 'smilies');
        $html .= template_eval($enlargeit_add_your_comment, $params);
    }
    return $html;
}
开发者ID:phill104,项目名称:branches,代码行数:51,代码来源:enl_comment.php

示例7: cpg_die

        }
    }
}
global $db;
if (!USER_ID) {
    cpg_die(_ERROR, ACCESS_DENIED);
}
//, __FILE__, __LINE__
$sql = "SELECT username, user_email, user_regdate as user_regdate_cp, group_name, " . "user_from, user_interests, user_website, user_occ, " . "COUNT(pid) as pic_count, ROUND(SUM(total_filesize)/1024) as disk_usage, group_quota " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_USERGROUPS']} AS g ON user_group_cp = group_id " . "LEFT JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON category = " . FIRST_USER_CAT . " + user_id " . "LEFT JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid " . "WHERE user_id ='" . USER_ID . "' " . "GROUP BY user_id, username, user_email, user_regdate, group_name, user_from, user_interests, user_website, user_occ, group_quota";
$result = $db->sql_query($sql);
if (!$db->sql_numrows($result)) {
    cpg_die(_ERROR, $lang_register_php['err_unk_user'], __FILE__, __LINE__);
}
$user_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$form_data = array('username' => $user_data['username'], 'reg_date' => localised_date($user_data['user_regdate_cp'], REGISTER_DATE_FMT), 'group' => $user_data['group_name'], 'email' => $user_data['user_email'], 'disk_usage' => $user_data['disk_usage'] ? $user_data['disk_usage'] : 0 . ($user_data['group_quota'] ? '/' . $user_data['group_quota'] : '') . ' ' . $lang_byte_units[1], 'location' => $user_data['user_from'], 'interests' => $user_data['user_interests'], 'website' => $user_data['user_website'], 'occupation' => $user_data['user_occ']);
$title = sprintf(X_S_PROFILE, CPG_USERNAME);
pageheader($title);
starttable(-1, $title, 2);
$chset = _CHARSET;
echo '<form method="post" action="' . URL::index("") . '" enctype="multipart/form-data" accept-charset="$chset">';
make_form($edit_profile_form_param, $form_data);
echo <<<EOT
        
        </form>

EOT;
endtable();
if (defined('CPG_NUKE')) {
    get_lang("Your_Account");
    require_once 'modules/Your_Account/functions.php';
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:profile.php

示例8: cpgRedirectPage

    $CPG_REFERER = "index.php";
}
$login_failed = '';
$cookie_warning = '';
if ($superCage->post->keyExists('submitted')) {
    if ($USER_DATA = $cpg_udb->login($superCage->post->getEscaped('username'), $superCage->post->getEscaped('password'), $superCage->post->getInt('remember_me'))) {
        //$referer=preg_replace("'&amp;'","&",$referer);
        cpgRedirectPage($CPG_REFERER, $lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']), 3);
        exit;
    } else {
        if ($superCage->server->testip('REMOTE_ADDR')) {
            $ip = $superCage->server->getRaw('REMOTE_ADDR');
        } else {
            $ip = 'Unknown';
        }
        log_write("Failed login attempt with Username: " . $superCage->post->getEscaped('username') . " from IP {$ip} on " . localised_date(-1, $log_date_fmt), CPG_SECURITY_LOG);
        $login_failed = <<<EOT
                  <tr>
                          <td colspan="2" align="center" class="tableh2">
                        <span style="color:red"><b>{$lang_login_php['err_login']}<b></span>
                        </td>
                  </tr>
EOT;
        // get IP address of the person who tried to log in, look it up on the banning table and increase the brute force counter. If the brute force counter has reached a critical limit, set a regular banning record
        $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_BANNED']} WHERE ip_addr='{$raw_ip}' OR ip_addr='{$hdr_ip}'");
        $failed_logon_counter = mysql_fetch_array($result);
        mysql_free_result($result);
        $expiry_date = date("Y-m-d H:i:s", mktime(date('H'), date('i') + $CONFIG['login_expiry'], date('s'), date('m'), date('d'), date('Y')));
        if ($failed_logon_counter['brute_force']) {
            $failed_logon_counter['brute_force'] = $failed_logon_counter['brute_force'] - 1;
            $query_string = "UPDATE {$CONFIG['TABLE_BANNED']} SET brute_force='" . $failed_logon_counter['brute_force'] . "',  expiry='" . $expiry_date . "' WHERE ban_id=" . $failed_logon_counter['ban_id'];
开发者ID:phill104,项目名称:branches,代码行数:31,代码来源:login.php

示例9: theme_html_comments


//.........这里部分代码省略.........
                            $hide_comment = 1;
                        } else {
                            $row['msg_author'] = $lang_display_comments['unapproved_comment'];
                            $row['msg_body'] = $lang_display_comments['pending_approval_message'];
                            $row['author_id'] = 0;
                        }
                    }
                }
                // the comment is not approved - end
            }
            // user or guest is logged in - end
            if ($CONFIG['enable_smilies']) {
                $comment_body = process_smilies(make_clickable($row['msg_body']));
                $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
            } else {
                $comment_body = make_clickable($row['msg_body']);
                $smilies = '';
            }
            // wrap the comment into italics if it isn't approved
            if ($row['approval'] == 'NO') {
                $comment_body = '<em>' . $comment_body . '</em>';
                $row['msg_author'] = $row['msg_author'];
            }
            list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_hdr_ip']));
            $ip = $row['msg_hdr_ip'] . $row['ip_detail'];
            if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
                list($row['ip_detail']) = CPGPluginAPI::filter('ip_information', array('', $row['msg_raw_ip']));
                $ip .= ' [' . $row['msg_raw_ip'] . $row['ip_detail'] . ']';
            }
            list($timestamp, $form_token) = getFormToken();
            $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo, '{PENDING_APPROVAL}' => &$pending_approval, '{FORM_TOKEN}' => $form_token, '{TIMESTAMP}' => $timestamp);
            $template = template_eval($template_image_comments, $params);
            if ($row['author_id'] == 0) {
                $profile_lnk = stripslashes($row['msg_author']);
            } else {
                $profile_lnk = '<a href="profile.php?uid=' . $row['author_id'] . '">' . stripslashes($row['msg_author']) . '</a>';
            }
            $params = array('{MSG_AUTHOR_LNK}' => $profile_lnk, '{MSG_AUTHOR}' => $row['msg_author'], '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{DELETE_TITLE}' => &$lang_display_comments['delete_title'], '{DELETE_ICON}' => '<img src="' . $location . 'images/icons/delete.png" border="0" alt="" width="16" height="16" class="icon" />', '{EDIT_ICON}' => '<img src="' . $location . 'images/icons/edit.png" border="0" alt="" width="16" height="16" class="icon" />', '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $lang_date['comment']), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_common['ok'], '{SMILIES}' => $smilies, '{IP}' => $ip, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{REPORT_COMMENT_ICON}' => '<img src="' . $location . 'images/icons/report.png" border="0" alt="" width="16" height="16" class="icon" />', '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'], '{FORM_TOKEN}' => $form_token, '{TIMESTAMP}' => $timestamp);
            if ($hide_comment != 1) {
                $html .= template_eval($template, $params);
            }
        }
        // while-loop end
        $html .= $tabs;
    }
    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
        if (USER_ID) {
            $user_name_input = '<tr><td colspan="2"><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
            template_extract_block($template_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
        } else {
            if (isset($USER['name'])) {
                $user_name = strtr($USER['name'], $HTML_SUBST);
            } else {
                $user_name = $lang_display_comments['your_name'];
            }
        }
        if ($CONFIG['comment_captcha'] == 0 || $CONFIG['comment_captcha'] == 2 && USER_ID) {
            template_extract_block($template_add_your_comment, 'comment_captcha');
        } else {
            $template_add_your_comment = CPGPluginAPI::filter('captcha_comment_print', $template_add_your_comment);
        }
        if ($CONFIG['show_bbcode_help']) {
            $captionLabel = '&nbsp;' . cpg_display_help('f=empty.htm&amp;h=lang_bbcode_help_title&amp;t=lang_bbcode_help', 470, 245);
        }
        list($timestamp, $form_token) = getFormToken();
        $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => $lang_display_comments['comment'], '{CONFIRM}' => $lang_common['confirm'] . '&nbsp;' . cpg_display_help('f=empty.htm&amp;h=lang_common[captcha_help_title]&amp;t=lang_common[captcha_help]', 470, 245), '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_common['ok'], '{OK_ICON}' => cpg_fetch_icon('ok', 1), '{DEFAULT_USERNAME}' => $lang_display_comments['your_name'], '{DEFAULT_USERNAME_MESSAGE}' => $lang_display_comments['default_username_message'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'], '{HELP_ICON}' => $captionLabel, '{FORM_TOKEN}' => $form_token, '{TIMESTAMP}' => $timestamp);
        if ($CONFIG['enable_smilies']) {
            $params['{SMILIES}'] = generate_smilies();
        } else {
            template_extract_block($template_add_your_comment, 'smilies');
        }
        template_extract_block($template_add_your_comment, 'login_to_comment');
        if ($CONFIG['comments_sort_descending'] == 1) {
            $html = '<br />' . template_eval($template_add_your_comment, $params) . $html;
        } else {
            $html .= template_eval($template_add_your_comment, $params);
        }
    } else {
        // user can not post comments
        if ($CONFIG['comment_promote_registration'] == 1 && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
            template_extract_block($template_add_your_comment, 'user_name_input');
            if ($CONFIG['enable_smilies'] == 1) {
                template_extract_block($template_add_your_comment, 'input_box_smilies');
            } else {
                template_extract_block($template_add_your_comment, 'input_box_no_smilies');
            }
            template_extract_block($template_add_your_comment, 'comment_captcha');
            template_extract_block($template_add_your_comment, 'smilies');
            template_extract_block($template_add_your_comment, 'submit');
            $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{WIDTH}' => $CONFIG['picture_table_width'] == "100%" ? $CONFIG['main_table_width'] : $CONFIG['picture_table_width'], '{LOGIN_TO_COMMENT}' => sprintf($lang_display_comments['log_in_to_comment'], '<a href="login.php?referer=' . $REFERER . '">', '</a>'), '{HELP_ICON}' => '');
            if ($CONFIG['comments_sort_descending'] == 1) {
                $html = '<br />' . template_eval($template_add_your_comment, $params) . $html;
            } else {
                $html .= template_eval($template_add_your_comment, $params);
            }
        }
    }
    return $html;
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine_1.6.x,代码行数:101,代码来源:theme.php

示例10: update_history

function update_history($html)
{
    $superCage = Inspekt::makeSuperCage();
    global $CONFIG, $matches, $cat, $USER_DATA, $FORBIDDEN_SET;
    global $lang_plugin_update_history, $lastup_date_fmt;
    require 'plugins/update_history/include/init.inc.php';
    $CONFIG['TABLE_UPDATE_HISTORY_CONFIG'] = $CONFIG['TABLE_PREFIX'] . 'update_history_config';
    $Group_Id = $USER_DATA['groups'][0];
    $result = cpg_db_query("select * FROM {$CONFIG['TABLE_UPDATE_HISTORY_CONFIG']} WHERE Group_Id={$Group_Id}");
    $param = mysql_fetch_array($result);
    //settings
    $GID = $param['Group_Id'];
    $bloc = $param['bloc'];
    $archive = $param['archive'];
    $uploader_name = $param['uploader_name'];
    $days = $param['days'];
    if ($superCage->get->keyExists('cat')) {
        $cat = $superCage->get->getInt('cat');
    } else {
        $cat = '';
    }
    $nb = intval($param['number']);
    $end = time();
    $counter = array();
    $info = array();
    $FORBIDDEN_SET_UPD = $FORBIDDEN_SET ? "AND {$FORBIDDEN_SET}" : '';
    $CAT_FILTER = $cat ? "AND a.category = {$cat}" : '';
    //if $bloc set to 1 display the block
    if ($matches[1] != 'updatehistory' || !$bloc == "1") {
        return $matches;
    }
    //if GALLERY_ADMIN_MODE, display button to plugin admin page
    if (GALLERY_ADMIN_MODE) {
        //if $archive set to 1, button displayed to acces to the plugin archive page
        if ($archive == "1") {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_archive\">{$lang_plugin_update_history[archive]}</a>&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_admin\">{$lang_plugin_update_history[admin]}</a>";
        } else {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_admin\">{$lang_plugin_update_history[admin]}</a>";
        }
    } else {
        if ($archive == "1") {
            $bloc_title = $lang_plugin_update_history['update'] . "&nbsp;&nbsp;&nbsp;<a class=\"admin_menu\" href=\"index.php?file=update_history/history_archive\">{$lang_plugin_update_history[archive]}</a>";
        } else {
            $bloc_title = $lang_plugin_update_history['update'];
        }
    }
    //display update history bloc
    starttable("100%", $bloc_title);
    //If $days set to 1 show the last uploads since the $nb last days (default setting)
    if ($days == "1") {
        echo '<tr><td class="tableh2"><b>' . $lang_plugin_update_history['history'] . $nb . $lang_plugin_update_history['last_days'] . '</b></td></tr>';
        for ($d = 0; $d < $nb; $d++) {
            $start = strtotime(date("Ymd")) - $d * 60 * 60 * 24;
            $result = cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid)  AND (ctime BETWEEN {$start} AND {$end}) {$FORBIDDEN_SET_UPD} {$CAT_FILTER} ORDER BY ctime DESC");
            while ($row = mysql_fetch_assoc($result)) {
                $day = localised_date($row['ctime'], $plugin_update_history_date_fmt);
                //$day = ($day, $lastup_date_fmt);
                $counter[$day][$row[album_title]] += 1;
                $info[$day][$row[album_title]] = $row;
                $users[$day][$row[album_title]][] = $row['owner'];
            }
            $end = $start;
        }
        $i = 0;
        $test = array_keys($counter);
        foreach ($counter as $day) {
            foreach ($day as $album => $number) {
                $date = $test[$i];
                $album_info = $info[$date][$album];
                if ($number == 1) {
                    echo '<tr><td class="tableb">' . $date . ": {$number}" . $lang_plugin_update_history['new'] . "<a href=\"thumbnails.php?album={$album_info['aid']}\">{$album}</a>";
                } else {
                    echo '<tr><td class="tableb">' . $date . ": {$number}" . $lang_plugin_update_history['news'] . "<a href=\"thumbnails.php?album={$album_info['aid']}\">{$album}</a>";
                }
                $links = array();
                foreach ($users[$date][$album] as $u) {
                    if ($uploader_name == 1) {
                        //show the uploader name if $uploader_name set to 1
                        if ($u > 0) {
                            $links[] = $lang_plugin_update_history['by'] . "<a href=\"profile.php?uid={$u}\">" . get_username($u) . "</a>";
                        }
                    }
                }
                $out = array_unique($links);
                echo implode(', ', $out);
                echo "</td></tr>";
            }
            $i++;
        }
    } else {
        //otheerway Show n last uploaded files according settings
        $limit = $nb;
        echo '<tr><td class="tableh2"><b>' . $lang_plugin_update_history['history'] . $nb . $lang_plugin_update_history_admin['uploaded_files'] . '</b></td></tr>';
        $result = cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid) {$FORBIDDEN_SET_UPD} {$CAT_FILTER}  ORDER BY ctime DESC LIMIT {$nb}");
        for ($d = 0; $d < $nb; $d++) {
            while ($row = mysql_fetch_assoc($result)) {
                $day = localised_date($row['ctime'], $plugin_update_history_date_fmt);
                $album = $row['album_title'];
                $thumb = $CONFIG['fullpath'] . "/" . $row['filepath'] . "/" . $CONFIG['thumb_pfx'] . $row['filename'];
                echo '<tr><td class="tableb">' . $day . ": <a href=\"displayimage.php?pos=-{$row['pid']}\"><img border=\"1\" width=\"{$CONFIG['alb_list_thumb_size']}\" src=\"{$thumb}\" alt=\"{$row['filename']}\" title=\"{$row['filename']}\"/></a>" . $lang_plugin_update_history['add'] . "<a href=\"thumbnails.php?album={$row['aid']}\">{$album}</a>";
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:codebase.php

示例11: list_cat_albums


//.........这里部分代码省略.........
        if ($CONFIG['link_pic_count'] == 1 || $album['pic_count'] == 0) {
            if (!empty($album['keyword'])) {
                $keyword = $album['keyword'] ? "AND (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : '';
                $query = "SELECT count(pid) AS link_pic_count, max(pid) AS link_last_pid, max(ctime) AS link_last_upload " . " FROM {$CONFIG['TABLE_PICTURES']} " . " WHERE ((aid != '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved}";
                $result = cpg_db_query($query);
                $link_stat = $result->fetchAssoc(true);
                $catdata['subalbums'][$aid]['link_pic_count'] = $link_stat['link_pic_count'];
                $catdata['subalbums'][$aid]['last_pid'] = !empty($album['last_pid']) && $album['last_pid'] > $link_stat['link_last_pid'] ? $album['last_pid'] : $link_stat['link_last_pid'];
                if ($CONFIG['link_last_upload'] && $link_stat['link_pic_count'] > 0) {
                    $catdata['subalbums'][$aid]['last_upload'] = $album['last_upload'] > $link_stat['link_last_upload'] ? $album['last_upload'] : $link_stat['link_last_upload'];
                }
            }
        }
        if ($catdata['subalbums'][$aid]['last_pid']) {
            $last_pids[] = $catdata['subalbums'][$aid]['last_pid'];
        }
        if ($album['thumb'] > 0) {
            $last_pids[] = $album['thumb'];
        }
    }
    if (count($last_pids)) {
        $result = cpg_db_query("SELECT pid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} WHERE pid IN (" . implode(',', $last_pids) . ")");
        while ($row = $result->fetchAssoc()) {
            $last_pid_data[$row['pid']] = $row;
            unset($last_pid_data[$row['pid']]['pid']);
        }
        $result->free();
    }
    unset($last_pids);
    foreach ($catdata['subalbums'] as $aid => $album) {
        // Inserts a thumbnail if the album contains 1 or more images
        //unused code {SaWey}
        //$visibility = $album['visibility'];
        $keyword = $album['keyword'] ? "OR (keywords like '%" . addslashes($album['keyword']) . "%' {$forbidden_set_string})" : '';
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
            //test for visibility
            if ($album['pic_count'] > 0 || !empty($album['link_pic_count'])) {
                if (!empty($last_pid_data[$album['thumb']]['filename'])) {
                    $picture = $last_pid_data[$album['thumb']];
                } elseif ($album['thumb'] < 0) {
                    $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} WHERE ((aid = '{$aid}' {$forbidden_set_string}) {$keyword}) {$approved} " . "ORDER BY RAND() LIMIT 0,1";
                    $result = cpg_db_query($sql);
                    $picture = $result->fetchAssoc(true);
                } else {
                    $picture = $last_pid_data[$album['last_pid']];
                }
                $pic_url = get_pic_url($picture, 'thumb');
                if (!is_image($picture['filename'])) {
                    $image_info = cpg_getimagesize(urldecode($pic_url));
                    $picture['pwidth'] = $image_info[0];
                    $picture['pheight'] = $image_info[1];
                }
                //thumb cropping
                if (array_key_exists('system_icon', $picture) && $picture['system_icon'] == true) {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
                } else {
                    $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size'], false, 'cat_thumb');
                }
                $alb_list[$aid]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image thumbnail\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />";
            } else {
                // Inserts an empty thumbnail if the album contains 0 images
                // $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
                $alb_list[$aid]['thumb_pic'] = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image thumbnail" border="0" alt="" />';
            }
        } elseif ($CONFIG['show_private']) {
            // $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
            $alb_list[$aid]['thumb_pic'] = '<img src="' . $cpg_privatepic_data['thumb'] . '" ' . $cpg_privatepic_data['whole'] . ' class="image thumbnail" border="0" alt="" />';
        }
        // Prepare everything
        if (!in_array($aid, $FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
            $link_pic_count = !empty($album['link_pic_count']) ? $album['link_pic_count'] : 0;
            $last_upload_date = $album['pic_count'] || $CONFIG['link_pic_count'] && $link_pic_count > 0 ? localised_date($album['last_upload'], $lang_date['lastup']) : '';
            $alb_list[$aid]['aid'] = $aid;
            $alb_list[$aid]['album_title'] = $album['title'];
            $alb_list[$aid]['album_desc'] = bb_decode($album['description']);
            $alb_list[$aid]['pic_count'] = $album['pic_count'];
            $alb_list[$aid]['last_upl'] = $last_upload_date;
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']);
            $alb_list[$aid]['album_info'] = theme_album_info($album['pic_count'], $link_pic_count, $last_upload_date);
            $alb_list[$aid]['album_adm_menu'] = album_adm_menu($aid, $cat, $album['owner']);
        } elseif ($CONFIG['show_private']) {
            // show private album description
            $link_pic_count = !empty($album['link_pic_count']) ? $album['link_pic_count'] : 0;
            $last_upload_date = $album['pic_count'] || $CONFIG['link_pic_count'] && $link_pic_count > 0 ? localised_date($album['last_upload'], $lang_date['lastup']) : '';
            $alb_list[$aid]['aid'] = $aid;
            $alb_list[$aid]['album_title'] = $album['title'];
            $alb_list[$aid]['album_desc'] = bb_decode($album['description']);
            $alb_list[$aid]['pic_count'] = $album['pic_count'];
            $alb_list[$aid]['last_upl'] = $last_upload_date;
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']);
            $alb_list[$aid]['album_info'] = theme_album_info($album['pic_count'], $link_pic_count, $last_upload_date);
            $alb_list[$aid]['album_adm_menu'] = album_adm_menu($aid, $cat, $album['owner']);
        }
    }
    ob_start();
    theme_display_album_list_cat($alb_list, $nbAlb, $cat, $PAGE, $totalPages);
    $cat_albums = ob_get_contents();
    ob_end_clean();
    return $cat_albums;
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:101,代码来源:index.php

示例12: html_comments

function html_comments($pid)
{
    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $username, $FAVPICS, $CURRENT_PIC_DATA, $THEME_DIR;
    global $template_image_comments, $template_add_your_comment, $db;
    $html = '';
    if (!$CONFIG['enable_smilies']) {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_smilies');
        template_extract_block($template_add_your_comment, 'input_box_smilies');
    } else {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_no_smilies');
        template_extract_block($template_add_your_comment, 'input_box_no_smilies');
    }
    $tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
    $tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');
    $result = $db->sql_query("SELECT msg_id, msg_author, msg_body, msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id ASC", false, __FILE__, __LINE__);
    while ($row = $db->sql_fetchrow($result)) {
        $user_can_edit = GALLERY_ADMIN_MODE || USER_ID > 1 && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || USER_ID < 2 && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
        $comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';
        $comment_edit_box = $user_can_edit ? $tmpl_comment_edit_box : '';
        $comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
        if ($CONFIG['enable_smilies']) {
            $comment_body = set_smilies(make_clickable($row['msg_body']));
            $smilies = smilies_table('onerow', 'msg_body', "f{$row['msg_id']}");
        } else {
            $comment_body = make_clickable($row['msg_body']);
            $smilies = '';
        }
        $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo);
        $template = template_eval($template_image_comments, $params);
        $info = '';
        if (!in_array($pid, $FAVPICS)) {
            $info = '<a href="' . URL::index('&amp;file=addfav&amp;pid=' . $CURRENT_PIC_DATA['pid']) . '" >' . ADDFAV . '</a>';
        } else {
            $info = '<a href="' . URL::index('&amp;file=addfav&amp;pid=' . $CURRENT_PIC_DATA['pid']) . '" >' . REMFAV . '</a>';
        }
        $params = array('{MSG_AUTHOR}' => $row['msg_author'], '{MSG_ID}' => $row['msg_id'], '{MSG_TYPE}' => GALLERY_ADMIN_MODE ? 'text' : 'hidden', '{EDIT_TITLE}' => COM_EDIT_TITLE, '{CONFIRM_DELETE}' => CONFIRM_DELETE_COM, '{DELETE_LINK}' => URL::index("&amp;file=delete"), '{DELETE_TEXT}' => DELETE . ' ' . COMMENT, '{MSG_DATE}' => localised_date($row['msg_date'], COMMENT_DATE_FMT), '{MSG_BODY}' => &$comment_body, '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => OK, '{SMILIES}' => $smilies, '{HDR_IP}' => NET::decode_ip($row['msg_hdr_ip']), '{RAW_IP}' => NET::decode_ip($row['msg_raw_ip']), '{ACTION}' => 'action="' . URL::index('&amp;file=db_input') . '" enctype="multipart/form-data" accept-charset="utf-8"', '{ADDFAVLINK}' => URL::index("&amp;file=addfav&amp;pid={$pid}"), '{ADDFAVTEXT}' => $info, '{THEMEDIR}' => $THEME_DIR);
        $html .= template_eval($template, $params);
    }
    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments']) {
        if (USER_ID > 1) {
            $username_input = '<input type="hidden" name="msg_author" value="' . CPG_USERNAME . '" />';
            template_extract_block($template_add_your_comment, 'username_input', $username_input);
            // $username = '';
        } else {
            $username = isset($USER['name']) ? '"' . htmlprepare($USER['name']) . '"' : '"' . YOUR_NAME . '" onclick="javascript:this.value=\'\';"';
        }
        if (!in_array($pid, $FAVPICS)) {
            $info = '<a href="' . URL::index('&amp;file=addfav&amp;pid=' . $CURRENT_PIC_DATA['pid']) . '" >' . ADDFAV . '</a>';
        } else {
            $info = '<a href="' . URL::index('&amp;file=addfav&amp;pid=' . $CURRENT_PIC_DATA['pid']) . '" >' . REMFAV . '</a>';
        }
        $params = array('{ADD_YOUR_COMMENT}' => ADD_YOUR_COMMENT, '{NAME}' => COM_NAME, '{COMMENT}' => COMMENT, '{PIC_ID}' => $pid, '{username}' => $username, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => OK, '{SMILIES}' => '', '{ACTION}' => 'action="' . URL::index("&amp;file=db_input") . '" enctype="multipart/form-data" accept-charset="utf-8"', '{ADDFAVLINK}' => URL::index("&amp;file=addfav&amp;pid={$pid}"), '{ADDFAVTEXT}' => $info);
        if ($CONFIG['enable_smilies']) {
            $params['{SMILIES}'] = smilies_table('onerow', 'message', 'post');
        }
        //		if ($CONFIG['enable_smilies']) $params['{SMILIES}'] = generate_smilies();
        $html .= template_eval($template_add_your_comment, $params);
    }
    if (USER_ID > 1 or $CONFIG['allow_anon_fullsize'] or USER_IS_ADMIN) {
        return $html;
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:64,代码来源:displayimage.php

示例13: sprintf

            $userMessage .= '<li style="list-style-image:url(images/icons/ok.png)">' . sprintf($lang_admin_php['config_setting_ok'], $lang_admin_php[$adminDataKey]) . '</li>' . $LINEBREAK;
        }
    }
    // inner foreach loop -- end
}
// Loop through the config fields to check posted values for validity -- end
if ($userMessage != '') {
    $userMessage = '<ul>' . $LINEBREAK . $userMessage . '</ul>' . $LINEBREAK;
}
//print_r($evaluation_array);
if ($superCage->post->keyExists('update_config') > 0 && $userMessage == '') {
    $userMessage = $lang_admin_php['upd_not_needed'];
}
// put the current date into the lang string
$tzinfo =& $config_data['general_settings']['time_offset']['end_description'];
$tzinfo = sprintf($tzinfo, localised_date(-1, $lang_date['comment']));
//pageheader($lang_admin_php['title']);
/*
// section to test new regex stuff - uncomment temporarily if needed
$string = 'http://localhost/foo/';
$regex = '^'
                  .'(http://){1,1}' // leading 'http://' is mandatory - no support for https yet
                  .'(([0-9a-z_!~*\'().&=+$%-]+: ){0,1}' //password, separated with a colon
                  .'[0-9a-z_!~*\'().&=+$%-]+@){0,1}' //username, separated with an @
                  .'(([0-9]{1,3}\.){3}[0-9]{1,3}' // IP- 199.194.52.184
                  .'|' // allows either IP or domain or localhost
                  .'('
                  .'([0-9a-z_!~*\'()-]+\.)*' // tertiary domain(s)- www.
                  .'([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.' // second level domain
                  .'[a-z]{2,6}' // first level domain- .com or .museum
                  .')'
开发者ID:stephenjschaefer,项目名称:APlusPhotography,代码行数:31,代码来源:admin.php

示例14: fix_displayimage


//.........这里部分代码省略.........
                    if (strpos($match, $v) !== FALSE) {
                        $matches[3][$key] = " style=\"border:1pix;border-color:grey;\"";
                        break;
                    }
                }
                $film_strip = ereg_replace(preg_quote($match), $matches[1][$key] . $matches[2][$key] . $matches[3][$key] . $matches[4][$key] . $matches[5][$key], $film_strip);
            }
            $film_strip = ereg_replace("class=\"image\"", "", $film_strip);
        }
        //removes alt and title from film_strip
        $pattern = "#(alt=\")(.*?)(\")#s";
        if (preg_match_all($pattern, $film_strip, $matches)) {
            foreach ($matches[0] as $key => $match) {
                $film_strip = ereg_replace(preg_quote($match), "", $film_strip);
            }
        }
        $pattern = "#(title=\")(.*?)(\")#s";
        if (preg_match_all($pattern, $film_strip, $matches)) {
            foreach ($matches[0] as $key => $match) {
                $film_strip = ereg_replace(preg_quote($match), "", $film_strip);
            }
        }
        //and try to set a border on current vote
        $result = cpg_db_query("SELECT rating FROM `{$CONFIG['TABLE_PREFIX']}user_votes` WHERE pid = {$CURRENT_PIC_DATA['pid']} AND user_id  = " . USER_ID);
        if ($row = mysql_fetch_row($result)) {
            $pattern = "#(<img.*?rating{$row[0]}.*?)(border=\"0\")(.*?/>)#s";
            if (preg_match($pattern, $votes, $matches)) {
                $votes = ereg_replace(preg_quote($matches[0]), $matches[1] . "border=\"2\"" . $matches[3], $votes);
            }
        }
        // find if user can vote (not own image) and if can vote verifies that the voting block is not hidden
        if ($CURRENT_PIC_DATA['owner_id'] == USER_ID || !USER_CAN_RATE_PICTURES) {
            //<a href="javascript:location.href='./ratepic.php?pic=22&amp;rate=1'" title="Beurk"><img src="themes/alphadxd/images/rating1.gif" border="0" alt="Beurk" /></a>
            $pattern = "#(<a href.*?ratepic.*?\\>)(.*?)(</a>)#s";
            if (preg_match_all($pattern, $votes, $matches)) {
                foreach ($matches[0] as $key => $match) {
                    $votes = ereg_replace(preg_quote($match), $matches[2][$key], $votes);
                }
            }
        } else {
            $votes = ereg_replace(preg_quote("display: none;"), "", $votes);
        }
        // only display current user's comments in a contest
        if ($CURRENT_ALBUM_DATA['comments'] != 'YES') {
            return;
        }
        $comments = '';
        $pid = $CURRENT_PIC_DATA['pid'];
        if (!$CONFIG['enable_smilies']) {
            $tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_no_smilies', '{EDIT}');
            template_extract_block($saved_template_image_comments, 'edit_box_smilies');
            template_extract_block($saved_template_add_your_comment, 'input_box_smilies');
        } else {
            $tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_smilies', '{EDIT}');
            template_extract_block($saved_template_image_comments, 'edit_box_no_smilies');
            template_extract_block($saved_template_add_your_comment, 'input_box_no_smilies');
        }
        $tmpl_comments_buttons = template_extract_block($saved_template_image_comments, 'buttons', '{BUTTONS}');
        template_extract_block($saved_template_image_comments, 'ipinfo', '');
        //suppressed by PL
        template_extract_block($saved_template_image_comments, 'report_comment_button');
        // won't report on own comment, would we?
        $newpostok = true;
        $query = "SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' AND msg_author='" . USER_NAME . "' ORDER BY msg_id DESC LIMIT 1";
        $result = cpg_db_query($query);
        if ($row = mysql_fetch_array($result)) {
            $user_can_edit = true;
            $comment_buttons = $tmpl_comments_buttons;
            $comment_edit_box = $tmpl_comment_edit_box;
            if ($CONFIG['enable_smilies']) {
                $comment_body = process_smilies(make_clickable($row['msg_body']));
                $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
            } else {
                $comment_body = make_clickable($row['msg_body']);
                $smilies = '';
            }
            $params = array('{EDIT}' => &$tmpl_comment_edit_box, '{BUTTONS}' => &$tmpl_comments_buttons);
            $template = template_eval($saved_template_image_comments, $params);
            $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']), '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], '%d %B %Y'), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
            $comments .= template_eval($template, $params);
            $newpostok = false;
            // only 1 comment per author
        }
        if (USER_ID == $CURRENT_PIC_DATA['owner_id'] || USER_ID == 0) {
            $newpostok = false;
        }
        if ($newpostok) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
            template_extract_block($saved_template_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
            $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => "", '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width']);
            if ($CONFIG['enable_smilies']) {
                $params['{SMILIES}'] = generate_smilies();
            } else {
                template_extract_block($saved_template_add_your_comment, 'smilies');
            }
            $comments .= template_eval($saved_template_add_your_comment, $params);
        }
    }
}
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:codebase.php

示例15: theme_html_comments

function theme_html_comments($pid)
{
    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST;
    global $template_image_comments, $template_add_your_comment, $lang_display_comments, $lang_common, $REFERER;
    $html = '';
    //report to moderator buttons
    if (!($CONFIG['report_post'] == 1 && USER_CAN_SEND_ECARDS)) {
        template_extract_block($template_image_comments, 'report_comment_button');
    }
    if (!$CONFIG['enable_smilies']) {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_smilies');
        template_extract_block($template_add_your_comment, 'input_box_smilies');
    } else {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_no_smilies');
        template_extract_block($template_add_your_comment, 'input_box_no_smilies');
    }
    $tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
    $tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');
    if ($CONFIG['comments_sort_descending'] == 1) {
        $comment_sort_order = 'DESC';
    } else {
        $comment_sort_order = 'ASC';
    }
    $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid, approval FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id {$comment_sort_order}");
    while ($row = mysql_fetch_array($result)) {
        // while-loop start
        $user_can_edit = GALLERY_ADMIN_MODE || USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || !USER_ID && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
        if ($user_can_edit != '' && $CONFIG['comment_user_edit'] != 0 || GALLERY_ADMIN_MODE) {
            $comment_buttons = $tmpl_comments_buttons;
            $comment_edit_box = $tmpl_comment_edit_box;
        } else {
            $comment_buttons = '';
            $comment_edit_box = '';
        }
        $comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
        $hide_comment = 0;
        // comment approval
        $pending_approval = '';
        if (USER_IS_ADMIN) {
            //display the selector approve/disapprove
            if ($row['approval'] == 'NO') {
                $pending_approval = '<a href="reviewcom.php?pos=-{PID}&amp;msg_id={MSG_ID}&amp;what=approve" title="' . $lang_display_comments['approve'] . '"><img src="images/approve.gif" border="0" alt="" align="middle" /></a>';
            } else {
                $pending_approval = '<a href="reviewcom.php?pos=-{PID}&amp;msg_id={MSG_ID}&amp;what=disapprove" title="' . $lang_display_comments['disapprove'] . '"><img src="images/disapprove.gif" border="0" alt="" align="middle" /></a>';
            }
        } else {
            // user or guest is logged in - start
            if ($row['approval'] == 'NO') {
                // the comment is not approved - start
                if ($user_can_edit) {
                    // the comment comes from the current visitor, display it with a warning that it needs admin approval
                    $pending_approval = '<img src="images/approve.gif" border="0" alt="" title="' . $lang_display_comments['pending_approval'] . '" align="middle" />';
                } else {
                    // the comment comes from someone else - don't display it at all
                    if ($CONFIG['comment_placeholder'] == 0) {
                        $hide_comment = 1;
                    } else {
                        $row['msg_author'] = $lang_display_comments['unapproved_comment'];
                        $row['msg_body'] = $lang_display_comments['pending_approval_message'];
                        $row['author_id'] = 0;
                    }
                }
            }
            // the comment is not approved - end
        }
        // user or guest is logged in - end
        if ($CONFIG['enable_smilies']) {
            $comment_body = process_smilies(make_clickable($row['msg_body']));
            $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
        } else {
            $comment_body = make_clickable($row['msg_body']);
            $smilies = '';
        }
        // wrap the comment into italics if it isn't approved
        if ($row['approval'] == 'NO') {
            $comment_body = '<em>' . $comment_body . '</em>';
            $row['msg_author'] = $row['msg_author'];
        }
        $ip = $row['msg_hdr_ip'];
        if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
            $ip .= ' [' . $row['msg_raw_ip'] . ']';
        }
        $params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo, '{PENDING_APPROVAL}' => &$pending_approval);
        $template = template_eval($template_image_comments, $params);
        if ($row['author_id'] == 0) {
            $profile_lnk = stripslashes($row['msg_author']);
        } else {
            $profile_lnk = '<a href="profile.php?uid=' . $row['author_id'] . '">' . stripslashes($row['msg_author']) . '</a>';
        }
        $params = array('{MSG_AUTHOR_LNK}' => $profile_lnk, '{MSG_AUTHOR}' => $row['msg_author'], '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{DELETE_TITLE}' => &$lang_display_comments['delete_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{IP}' => $ip, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
        if ($hide_comment != 1) {
            $html .= template_eval($template, $params);
        }
    }
    // while-loop end
    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
        if (USER_ID) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:theme.php


注:本文中的localised_date函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。