本文整理汇总了PHP中COM_getCharset函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_getCharset函数的具体用法?PHP COM_getCharset怎么用?PHP COM_getCharset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_getCharset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor, initializes the output buffering.
*/
public function __construct()
{
global $_CONF;
ob_start();
// buffer any output
$this->_charset = COM_getCharset();
$this->pageTemplate = new Template($_CONF['path_layout']);
$this->_rewriteEnabled = $_CONF['url_rewrite'];
$this->_displayExtraBlocks = $_CONF['show_right_blocks'];
}
示例2: __construct
public function __construct()
{
global $_CONF, $LANG_CHARSET;
$version = preg_replace("/[^0-9.]/", '', VERSION);
$this->_gl150 = version_compare($version, '1.5.0', '>=');
$this->_gl200 = version_compare($version, '2.0.0', '>=');
if (is_callable('COM_getCharset')) {
$charset = COM_getCharset();
} else {
if (empty($LANG_CHARSET)) {
$charset = $_CONF['default_charset'];
if (empty($charset)) {
$charset = 'iso-8859-1';
}
} else {
$charset = $LANG_CHARSET;
}
}
$this->_charset = $charset;
}
示例3: setEncoding
/**
* Set the encoding of contents
*
* @access public
* @param string $encoding the encoding of contents
* @return void
*/
function setEncoding($encoding)
{
if ($encoding == '') {
$encoding = COM_getCharset();
}
if ($encoding == '') {
// This is very unlikely
$encoding = 'iso-8859-1';
}
$this->_encoding = $encoding;
}
示例4: COM_emailNotification
function COM_emailNotification($msgData = array())
{
global $_CONF;
// define the maximum number of emails allowed per bcc
$maxEmailsPerSend = 10;
// ensure we have something to send...
if (!isset($msgData['htmlmessage']) && !isset($msgData['textmessage'])) {
COM_errorLog("COM_emailNotification() - No message data provided");
return false;
// no message defined
}
if (empty($msgData['htmlmessage']) && empty($msgData['textmessage'])) {
COM_errorLog("COM_emailNotification() - Empty message data provided");
return false;
// no text in either...
}
if (!isset($msgData['subject']) || empty($msgData['subject'])) {
COM_errorLog("COM_emailNotification() - No subject provided");
return false;
// must have a subject
}
$queued = 0;
$subject = substr($msgData['subject'], 0, strcspn($msgData['subject'], "\r\n"));
$subject = COM_emailEscape($subject);
require_once $_CONF['path'] . 'lib/phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->SetLanguage('en', $_CONF['path'] . 'lib/phpmailer/language/');
$mail->CharSet = COM_getCharset();
if ($_CONF['mail_backend'] == 'smtp') {
$mail->IsSMTP();
$mail->Host = $_CONF['mail_smtp_host'];
$mail->Port = $_CONF['mail_smtp_port'];
if ($_CONF['mail_smtp_secure'] != 'none') {
$mail->SMTPSecure = $_CONF['mail_smtp_secure'];
}
if ($_CONF['mail_smtp_auth']) {
$mail->SMTPAuth = true;
$mail->Username = $_CONF['mail_smtp_username'];
$mail->Password = $_CONF['mail_smtp_password'];
}
$mail->Mailer = "smtp";
} elseif ($_CONF['mail_backend'] == 'sendmail') {
$mail->Mailer = "sendmail";
$mail->Sendmail = $_CONF['mail_sendmail_path'];
} else {
$mail->Mailer = "mail";
}
$mail->WordWrap = 76;
if (isset($msgData['htmlmessage']) && !empty($msgData['htmlmessage'])) {
$mail->IsHTML(true);
$mail->Body = $msgData['htmlmessage'];
if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
$mail->AltBody = $msgData['textmessage'];
}
} else {
$mail->IsHTML(false);
if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
$mail->Body = $msgData['textmessage'];
}
}
$mail->Subject = $subject;
if (isset($msgData['embeddedImage']) && is_array($msgData['embeddedImage'])) {
foreach ($msgData['embeddedImage'] as $embeddedImage) {
$mail->AddEmbeddedImage($embeddedImage['file'], $embeddedImage['name'], $embeddedImage['filename'], $embeddedImage['encoding'], $embeddedImage['mime']);
}
}
if (is_array($msgData['from'])) {
$mail->From = $msgData['from']['email'];
$mail->FromName = $msgData['from']['name'];
} else {
$mail->From = $msgData['from'];
$mail->FromName = $_CONF['site_name'];
}
$queued = 0;
if (is_array($msgData['to'])) {
foreach ($msgData['to'] as $to) {
if (is_array($to)) {
$mail->AddBCC($to['email'], $to['name']);
} else {
if (COM_isEmail($to)) {
$mail->AddBCC($to);
}
}
$queued++;
if ($queued >= $maxEmailsPerSend) {
if (!$mail->Send()) {
COM_errorLog("Email Error: " . $mail->ErrorInfo);
}
$queued = 0;
$mail->ClearBCCs();
}
}
}
if ($queued > 0) {
if (!@$mail->Send()) {
COM_errorLog("Email Error: " . $mail->ErrorInfo);
}
}
}
示例5: DB_fetchArray
}
$row = DB_fetchArray($result);
$aid = $row['album_id'];
$album_data = MG_getAlbumData($aid, array('skin', 'display_skin', 'album_id', 'playback_type', 'allow_download', 'full_display'), true);
if ($album_data['access'] == 0) {
$display = COM_startBlock($LANG_ACCESS['accessdenied'], '', COM_getBlockTemplate('_msg_block', 'header')) . '<br' . XHTML . '>' . $LANG_MG00['access_denied_msg'] . COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
$display = MG_createHTMLDocument($display);
COM_output($display);
exit;
}
$themeCSS = '';
if (!empty($album_data['skin'])) {
$skin = $album_data['skin'];
if (file_exists($_MG_CONF['path_html'] . 'themes/' . $skin . '/javascript.js')) {
$themeCSS .= '<script type="text/javascript" src="' . $_MG_CONF['site_url'] . '/themes/' . $skin . '/javascript.js"></script>' . LB;
}
if (file_exists($_MG_CONF['path_html'] . 'themes/' . $skin . '/style.css')) {
$themeCSS .= '<link rel="stylesheet" type="text/css" href="' . $_MG_CONF['site_url'] . '/themes/' . $skin . '/style.css"' . XHTML . '>' . LB;
}
}
$opt = array('playback_type' => 2, 'skin' => $album_data['skin'], 'display_skin' => $album_data['display_skin'], 'allow_download' => $album_data['allow_download'], 'full_display' => $album_data['full_display']);
$object = MG_buildContent($row, $opt);
$T = COM_newTemplate(MG_getTemplatePath($aid));
$T->set_file('video', 'view_window.thtml');
$T->set_var(array('site_url' => $_MG_CONF['site_url'], 'themeCSS' => $themeCSS, 'charset' => COM_getCharset(), 'object' => $object[0]));
if (!SEC_hasRights('mediagallery.admin')) {
$media_views = $row['media_views'] + 1;
DB_change($_TABLES['mg_media'], 'media_views', $media_views, 'media_id', addslashes($row['media_id']));
}
$display = $T->finish($T->parse('output', 'video'));
COM_output($display);
示例6: MG_mediaEdit
//.........这里部分代码省略.........
$poRow = DB_fetchArray($poResult);
$playback_options[$poRow['option_name']] = $poRow['option_value'];
}
$uimode_select = MG_optionlist(array('name' => 'uimode', 'current' => $playback_options['uimode'], 'values' => array('none' => $LANG_MG07['none'], 'mini' => $LANG_MG07['mini'], 'full' => $LANG_MG07['full'])));
$T->set_var(array('autostart_enabled' => $playback_options['autostart'] ? ' checked="checked"' : '', 'autostart_disabled' => $playback_options['autostart'] ? '' : ' checked="checked"', 'enablecontextmenu_enabled' => $playback_options['enablecontextmenu'] ? ' checked="checked"' : '', 'enablecontextmenu_disabled' => $playback_options['enablecontextmenu'] ? '' : ' checked="checked"', 'stretchtofit_enabled' => $playback_options['stretchtofit'] ? ' checked="checked"' : '', 'stretchtofit_disabled' => $playback_options['stretchtofit'] ? '' : ' checked="checked"', 'showstatusbar_enabled' => $playback_options['showstatusbar'] ? ' checked="checked"' : '', 'showstatusbar_disabled' => $playback_options['showstatusbar'] ? '' : ' checked="checked"', 'uimode_select' => $uimode_select, 'uimode' => $playback_options['uimode'], 'playcount' => $playback_options['playcount'], 'height' => $playback_options['height'], 'width' => $playback_options['width'], 'bgcolor' => $playback_options['bgcolor'], 'lang_resolution' => $lang_resolution, 'resolution' => $resolution));
$T->parse('playback_options', 'asf_options');
}
if ($row['mime_type'] == 'audio/mpeg') {
// pull defaults, then override...
$playback_options['autostart'] = $_MG_CONF['mp3_autostart'];
$playback_options['enablecontextmenu'] = $_MG_CONF['mp3_enablecontextmenu'];
$playback_options['uimode'] = $_MG_CONF['mp3_uimode'];
$playback_options['showstatusbar'] = $_MG_CONF['mp3_showstatusbar'];
$playback_options['loop'] = $_MG_CONF['mp3_loop'];
for ($i = 0; $i < $poNumRows; $i++) {
$poRow = DB_fetchArray($poResult);
$playback_options[$poRow['option_name']] = $poRow['option_value'];
}
$uimode_select = MG_optionlist(array('name' => 'uimode', 'current' => $playback_options['uimode'], 'values' => array('none' => $LANG_MG07['none'], 'mini' => $LANG_MG07['mini'], 'full' => $LANG_MG07['full'])));
$T->set_var(array('autostart_enabled' => $playback_options['autostart'] ? ' checked="checked"' : '', 'autostart_disabled' => $playback_options['autostart'] ? '' : ' checked="checked"', 'enablecontextmenu_enabled' => $playback_options['enablecontextmenu'] ? ' checked="checked"' : '', 'enablecontextmenu_disabled' => $playback_options['enablecontextmenu'] ? '' : ' checked="checked"', 'showstatusbar_enabled' => $playback_options['showstatusbar'] ? ' checked="checked"' : '', 'showstatusbar_disabled' => $playback_options['showstatusbar'] ? '' : ' checked="checked"', 'loop_enabled' => $playback_options['loop'] ? ' checked="checked"' : '', 'loop_disabled' => $playback_options['loop'] ? '' : ' checked="checked"', 'uimode_select' => $uimode_select, 'uimode' => $playback_options['uimode']));
$T->parse('playback_options', 'mp3_options');
}
if ($row['mime_type'] == 'application/x-shockwave-flash' || $row['mime_type'] == 'video/x-flv') {
// pull defaults, then override...
$playback_options['play'] = $_MG_CONF['swf_play'];
$playback_options['menu'] = $_MG_CONF['swf_menu'];
$playback_options['quality'] = $_MG_CONF['swf_quality'];
$playback_options['height'] = $_MG_CONF['swf_height'];
$playback_options['width'] = $_MG_CONF['swf_width'];
$playback_options['loop'] = $_MG_CONF['swf_loop'];
$playback_options['scale'] = $_MG_CONF['swf_scale'];
$playback_options['wmode'] = $_MG_CONF['swf_wmode'];
$playback_options['allowscriptaccess'] = $_MG_CONF['swf_allowscriptaccess'];
$playback_options['bgcolor'] = $_MG_CONF['swf_bgcolor'];
$playback_options['swf_version'] = $_MG_CONF['swf_version'];
for ($i = 0; $i < $poNumRows; $i++) {
$poRow = DB_fetchArray($poResult);
$playback_options[$poRow['option_name']] = $poRow['option_value'];
}
$quality_select = MG_optionlist(array('name' => 'quality', 'current' => $playback_options['quality'], 'values' => array('low' => $LANG_MG07['low'], 'high' => $LANG_MG07['high'])));
$scale_select = MG_optionlist(array('name' => 'scale', 'current' => $playback_options['scale'], 'values' => array('showall' => $LANG_MG07['showall'], 'noborder' => $LANG_MG07['noborder'], 'exactfit' => $LANG_MG07['exactfit'])));
$wmode_select = MG_optionlist(array('name' => 'wmode', 'current' => $playback_options['wmode'], 'values' => array('window' => $LANG_MG07['window'], 'opaque' => $LANG_MG07['opaque'], 'transparent' => $LANG_MG07['transparent'])));
$asa_select = MG_optionlist(array('name' => 'allowscriptaccess', 'current' => $playback_options['allowscriptaccess'], 'values' => array('always' => $LANG_MG07['always'], 'sameDomain' => $LANG_MG07['sameDomain'], 'never' => $LANG_MG07['never'])));
$T->set_var(array('play_enabled' => $playback_options['play'] ? ' checked="checked"' : '', 'play_disabled' => $playback_options['play'] ? '' : ' checked="checked"', 'menu_enabled' => $playback_options['menu'] ? ' checked="checked"' : '', 'menu_disabled' => $playback_options['menu'] ? '' : ' checked="checked"', 'loop_enabled' => $playback_options['loop'] ? ' checked="checked"' : '', 'loop_disabled' => $playback_options['loop'] ? '' : ' checked="checked"', 'quality_select' => $quality_select, 'scale_select' => $scale_select, 'wmode_select' => $wmode_select, 'asa_select' => $asa_select, 'flashvars' => isset($playback_options['flashvars']) ? $playback_options['flashvars'] : '', 'height' => $playback_options['height'], 'width' => $playback_options['width'], 'bgcolor' => $playback_options['bgcolor'], 'swf_version' => $playback_options['swf_version']));
if ($row['mime_type'] == 'application/x-shockwave-flash') {
$T->parse('playback_options', 'swf_options');
} else {
$T->parse('playback_options', 'flv_options');
}
}
if ($row['media_mime_ext'] == 'mov' || $row['media_mime_ext'] == 'mp4' || $row['mime_type'] == 'video/quicktime' || $row['mime_type'] == 'video/mpeg') {
// pull defaults, then override...
$playback_options['autoref'] = $_MG_CONF['mov_autoref'];
$playback_options['autoplay'] = $_MG_CONF['mov_autoplay'];
$playback_options['controller'] = $_MG_CONF['mov_controller'];
$playback_options['kioskmode'] = isset($_MG_CONF['mov_kioskmod']) ? $_MG_CONF['mov_kiokmode'] : '';
$playback_options['scale'] = $_MG_CONF['mov_scale'];
$playback_options['loop'] = $_MG_CONF['mov_loop'];
$playback_options['height'] = $_MG_CONF['mov_height'];
$playback_options['width'] = $_MG_CONF['mov_width'];
$playback_options['bgcolor'] = $_MG_CONF['mov_bgcolor'];
for ($i = 0; $i < $poNumRows; $i++) {
$poRow = DB_fetchArray($poResult);
$playback_options[$poRow['option_name']] = $poRow['option_value'];
}
$scale_select = MG_optionlist(array('name' => 'scale', 'current' => $playback_options['scale'], 'values' => array('tofit' => $LANG_MG07['to_fit'], 'aspect' => $LANG_MG07['aspect'], '1' => $LANG_MG07['normal_size'])));
$T->set_var(array('autoref_enabled' => $playback_options['autoref'] ? ' checked="checked"' : '', 'autoref_disabled' => $playback_options['autoref'] ? '' : ' checked="checked"', 'autoplay_enabled' => $playback_options['autoplay'] ? ' checked="checked"' : '', 'autoplay_disabled' => $playback_options['autoplay'] ? '' : ' checked="checked"', 'controller_enabled' => $playback_options['controller'] ? ' checked="checked"' : '', 'controller_disabled' => $playback_options['controller'] ? '' : ' checked="checked"', 'kioskmode_enabled' => $playback_options['kioskmode'] ? ' checked="checked"' : '', 'kioskmode_disabled' => $playback_options['kioskmode'] ? '' : ' checked="checked"', 'loop_enabled' => $playback_options['loop'] ? ' checked="checked"' : '', 'loop_disabled' => $playback_options['loop'] ? '' : ' checked="checked"', 'height' => $playback_options['height'], 'width' => $playback_options['width'], 'bgcolor' => $playback_options['bgcolor']));
$T->parse('playback_options', 'mov_options');
}
$remoteurl = $row['remote_url'];
$lang_remote_url = $row['remote_media'] == 1 ? $LANG_MG01['remote_url'] : $LANG_MG01['alternate_url'];
// user information
$username = '';
if (SEC_hasRights('mediagallery.admin')) {
$username = '<select name="owner_name"> ';
$sql = "SELECT * FROM {$_TABLES['users']} WHERE status=3 AND uid > 1 ORDER BY username ASC";
$result = DB_query($sql);
while ($userRow = DB_fetchArray($result)) {
$username .= '<option value="' . $userRow['uid'] . '"' . ($userRow['uid'] == $row['media_user_id'] ? ' selected="selected"' : '') . '>' . $userRow['username'] . '</option>' . LB;
}
$username .= '</select>';
} else {
if ($row['media_user_id'] != '') {
$displayname = $_CONF['show_fullname'] ? 'fullname' : 'username';
$username = DB_getItem($_TABLES['users'], $displayname, "uid={$row['media_user_id']}");
}
}
$cat_select = '<select name="cat_id" id="cat_id">';
$cat_select .= '<option value="">' . $LANG_MG01['no_category'] . '</option>';
$result = DB_query("SELECT * FROM {$_TABLES['mg_category']} ORDER BY cat_id ASC");
while ($catRow = DB_fetchArray($result)) {
$cat_select .= '<option value="' . $catRow['cat_id'] . '" ' . ($catRow['cat_id'] == $row['media_category'] ? ' selected="selected"' : '') . '>' . $catRow['cat_name'] . '</option>';
}
$cat_select .= '</select>';
$T->set_var(array('original_filename' => $row['media_original_filename'], 'attach_tn' => $row['media_tn_attached'], 'at_tn_checked' => $row['media_tn_attached'] == 1 ? ' checked="checked"' : '', 'attached_thumbnail' => $attached_thumbnail, 'album_id' => $album_id, 'media_thumbnail' => $thumbnail, 'media_id' => $row['media_id'], 'media_title' => $row['media_title'], 'media_desc' => $row['media_desc'], 'media_time' => $media_time[0], 'media_views' => $row['media_views'], 'media_comments' => $row['media_comments'], 'media_exif_info' => $exif_info, 'media_rating_max' => 5, 'height' => $size[1] + 50, 'width' => $size[0] + 40, 'queue' => $mqueue, 'month_select' => $month_select, 'day_select' => $day_select, 'year_select' => $year_select, 'hour_select' => $hour_select, 'minute_select' => $minute_select, 'user_ip' => $row['media_user_ip'], 'album_select' => $album_jumpbox, 'media_rating' => $row['media_rating'] / 2, 'media_votes' => $row['media_votes'], 's_mode' => 'edit', 's_title' => $LANG_MG01['edit_media'], 's_rotate_right' => $rotate_right, 's_rotate_left' => $rotate_left, 's_form_action' => $actionURL, 'allowed_html' => COM_allowedHTML(), 'site_url' => $_MG_CONF['site_url'], 'preview' => $preview, 'preview_end' => $preview_end, 'rpath' => htmlentities($back, ENT_QUOTES, COM_getCharset()), 'remoteurl' => $remoteurl, 'lang_remote_url' => $lang_remote_url, 'resolution' => $resolution, 'lang_resolution' => $lang_resolution, 'username' => $username, 'cat_select' => $cat_select, 'media_keywords' => $row['media_keywords'], 'artist' => $row['artist'], 'musicalbum' => $row['album'], 'genre' => $row['genre']));
// language items
$T->set_var(array('lang_playcount' => $LANG_MG07['playcount'], 'lang_playcount_help' => $LANG_MG07['playcount_help'], 'lang_playback_options' => $LANG_MG07['playback_options'], 'lang_option' => $LANG_MG07['option'], 'lang_description' => $LANG_MG07['description'], 'lang_on' => $LANG_MG07['on'], 'lang_off' => $LANG_MG07['off'], 'lang_auto_start' => $LANG_MG07['auto_start'], 'lang_auto_start_help' => $LANG_MG07['auto_start_help'], 'lang_height' => $LANG_MG07['height'], 'lang_width' => $LANG_MG07['width'], 'lang_height_help' => $LANG_MG07['height_help'], 'lang_width_help' => $LANG_MG07['width_help'], 'lang_enable_context_menu' => $LANG_MG07['enable_context_menu'], 'lang_enable_context_menu_help' => $LANG_MG07['enable_context_menu_help'], 'lang_stretch_to_fit' => $LANG_MG07['stretch_to_fit'], 'lang_stretch_to_fit_help' => $LANG_MG07['stretch_to_fit_help'], 'lang_status_bar' => $LANG_MG07['status_bar'], 'lang_status_bar_help' => $LANG_MG07['status_bar_help'], 'lang_ui_mode' => $LANG_MG07['ui_mode'], 'lang_ui_mode_help' => $LANG_MG07['ui_mode_help'], 'lang_bgcolor' => $LANG_MG07['bgcolor'], 'lang_bgcolor_help' => $LANG_MG07['bgcolor_help'], 'lang_loop' => $LANG_MG07['loop'], 'lang_loop_help' => $LANG_MG07['loop_help'], 'lang_menu' => $LANG_MG07['menu'], 'lang_menu_help' => $LANG_MG07['menu_help'], 'lang_scale' => $LANG_MG07['scale'], 'lang_swf_scale_help' => $LANG_MG07['swf_scale_help'], 'lang_wmode' => $LANG_MG07['wmode'], 'lang_wmode_help' => $LANG_MG07['wmode_help'], 'lang_quality' => $LANG_MG07['quality'], 'lang_quality_help' => $LANG_MG07['quality_help'], 'lang_flash_vars' => $LANG_MG07['flash_vars'], 'lang_asa' => $LANG_MG07['asa'], 'lang_asa_help' => $LANG_MG07['asa_help'], 'lang_swf_version_help' => $LANG_MG07['swf_version_help'], 'lang_auto_ref' => $LANG_MG07['auto_ref'], 'lang_auto_ref_help' => $LANG_MG07['auto_ref_help'], 'lang_controller' => $LANG_MG07['controller'], 'lang_controller_help' => $LANG_MG07['controller_help'], 'lang_kiosk_mode' => $LANG_MG07['kiosk_mode'], 'lang_kiosk_mode_help' => $LANG_MG07['kiosk_mode_help'], 'lang_original_filename' => $LANG_MG01['original_filename'], 'lang_media_item' => $LANG_MG00['media_col_header'], 'lang_media_attributes' => $LANG_MG01['media_attributes'], 'lang_mediaattributes' => $LANG_MG01['mediaattributes'], 'lang_attached_thumbnail' => $LANG_MG01['attached_thumbnail'], 'lang_category' => $LANG_MG01['category'], 'lang_keywords' => $LANG_MG01['keywords'], 'lang_rating' => $LANG_MG03['rating'], 'lang_comments' => $LANG_MG03['comments'], 'lang_votes' => $LANG_MG03['votes'], 'media_edit_title' => $LANG_MG01['media_edit'], 'media_edit_help' => $LANG_MG01['media_edit_help'], 'rotate_left' => $LANG_MG01['rotate_left'], 'rotate_right' => $LANG_MG01['rotate_right'], 'lang_title' => $LANG_MG01['title'], 'albums' => $LANG_MG01['albums'], 'description' => $LANG_MG01['description'], 'capture_time' => $LANG_MG01['capture_time'], 'views' => $LANG_MG03['views'], 'uploaded_by' => $LANG_MG01['uploaded_by'], 'submit' => $LANG_MG01['submit'], 'cancel' => $LANG_MG01['cancel'], 'reset' => $LANG_MG01['reset'], 'lang_save' => $LANG_MG01['save'], 'lang_reset' => $LANG_MG01['reset'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete' => $LANG_MG01['delete'], 'lang_delete_confirm' => $LANG_MG01['delete_item_confirm'], 'lang_reset_rating' => $LANG_MG01['reset_rating'], 'lang_reset_views' => $LANG_MG01['reset_views'], 'lang_replacefile' => $LANG_MG01['replace_file'], 'lang_artist' => $LANG_MG01['artist'], 'lang_genre' => $LANG_MG01['genre'], 'lang_music_album' => $LANG_MG01['music_album']));
$retval .= $T->finish($T->parse('output', 'admin'));
return $retval;
}
示例7: renderWikiText
/**
* Convert wiki-formatted text to (X)HTML
*
* @param string $wikitext wiki-formatted text
* @return string XHTML formatted text
*
*/
public static function renderWikiText($wikitext)
{
global $_CONF;
if (!$_CONF['wikitext_editor']) {
return $wikitext;
}
require_once 'Text/Wiki.php';
$wiki = new Text_Wiki();
$wiki->setFormatConf('Xhtml', 'translate', HTML_SPECIALCHARS);
$wiki->setRenderConf('Xhtml', 'charset', COM_getCharset());
$wiki->disableRule('wikilink');
$wiki->disableRule('freelink');
$wiki->disableRule('interwiki');
return $wiki->transform($wikitext, 'Xhtml');
}
示例8: SYND_fixCharset
/**
* Fix the character set of a default feed file which is hard-coded as 'iso-8859-1'.
*
* @param int $fid feed id
*/
function SYND_fixCharset($fid)
{
global $_CONF, $_TABLES, $_SYND_DEBUG;
$sql = "SELECT COUNT(filename) AS cnt " . "FROM {$_TABLES['syndication']} " . "WHERE (fid = {$fid}) AND (filename = 'geeklog.rss') " . "AND (charset = 'iso-8859-1')";
$result = DB_query($sql);
if ($result !== false) {
list($cnt) = DB_fetchArray($result);
if ($cnt == 1) {
$fileName = SYND_getFeedPath('geeklog.rss');
clearstatcache();
if (@filesize($fileName) === 0) {
$charset = DB_escapeString(COM_getCharset());
$sql = "UPDATE {$_TABLES['syndication']} " . "SET charset = '{$charset}' " . "WHERE (fid = {$fid})";
DB_query($sql);
}
}
}
}
示例9: PNB_handlePingback
//.........这里部分代码省略.........
$parts = parse_url($url);
if (empty($parts['host'])) {
TRB_logRejected('Pingback: No valid URL', $url);
return new XML_RPC_Response(0, 33, $PNB_ERROR['uri_invalid']);
} else {
$ip = gethostbyname($parts['host']);
if ($ip != $_SERVER['REMOTE_ADDR']) {
TRB_logRejected('Pingback: IP address mismatch', $url);
return new XML_RPC_Response(0, 49, $PNB_ERROR['spam']);
}
}
}
}
// See if we can read the page linking to us and extract at least
// the page's title out of it ...
$title = '';
$excerpt = '';
$http = new http_class();
$http->timeout = 0;
$http->data_timeout = 0;
$http->debug = 0;
$http->html_debug = 0;
$http->user_agent = 'glFusion/' . GVERSION;
$error = $http->GetRequestArguments($url, $arguments);
$error = $http->Open($arguments);
$error = $http->SendRequest($arguments);
if ($error == "") {
$http->ReadReplyHeaders($headers);
if ($http->response_status == 200) {
$error = $http->ReadWholeReplyBody($body);
if ($error == "" || strlen($body) > 0) {
if ($_CONF['check_trackback_link'] & 3) {
if (!TRB_containsBacklink($body, $oururl)) {
TRB_logRejected('Pingback: No link to us', $url);
$comment = TRB_formatComment($url);
PLG_spamAction($comment, $_CONF['spamx']);
return new XML_RPC_Response(0, 49, $PNB_ERROR['spam']);
}
}
preg_match(':<title>(.*)</title>:i', $body, $content);
if (empty($content[1])) {
$title = '';
// no title found
} else {
$title = trim(COM_undoSpecialChars($content[1]));
}
if ($_CONF['pingback_excerpt']) {
// Check which character set the site that sent the Pingback
// is using
$charset = 'ISO-8859-1';
// default, see RFC 2616, 3.7.1
$ctype = $headers['content-type'];
$c = explode(';', $ctype);
foreach ($c as $ct) {
$ch = explode('=', trim($ct));
if (count($ch) === 2) {
if (trim($ch[0]) === 'charset') {
$charset = trim($ch[1]);
break;
}
}
}
if (!empty($charset) && strcasecmp($charset, COM_getCharset()) !== 0) {
if (function_exists('mb_convert_encoding')) {
$body = @mb_convert_encoding($body, COM_getCharset(), $charset);
} elseif (function_exists('iconv')) {
$body = @iconv($charset, COM_getCharset(), $body);
}
}
$excerpt = PNB_makeExcerpt($body, $oururl);
}
// we could also run the rest of the other site's page
// through the spam filter here ...
} else {
COM_errorLog("Pingback verification: unable to retrieve response body");
return new XML_RPC_Response(0, 33, $PNB_ERROR['uri_invalid']);
}
} else {
COM_errorLog("Pingback verification: Got HTTP response code " . $http->response_status . " when requesting {$url}");
return new XML_RPC_Response(0, 33, $PNB_ERROR['uri_invalid']);
}
} else {
COM_errorLog("Pingback verification: " . $error . " when requesting " . $url);
return new XML_RPC_Response(0, 33, $PNB_ERROR['uri_invalid']);
}
// check for spam first
$saved = TRB_checkForSpam($url, $title, '', $excerpt);
if ($saved == TRB_SAVE_SPAM) {
return new XML_RPC_Response(0, 49, $PNB_ERROR['spam']);
}
// save as a trackback comment
$saved = TRB_saveTrackbackComment($id, $type, $url, $title, '', $excerpt);
if ($saved == TRB_SAVE_REJECT) {
return new XML_RPC_Response(0, 49, $PNB_ERROR['multiple']);
}
if (isset($_CONF['notification']) && in_array('pingback', $_CONF['notification'])) {
TRB_sendNotificationEmail($saved, 'pingback');
}
return new XML_RPC_Response(new XML_RPC_Value($PNB_ERROR['success']));
}
示例10: DLM_htmlspecialchars
/**
* Escape a string for displaying in HTML
*/
function DLM_htmlspecialchars($text)
{
$text = str_replace(array('<', '>', '&', '"', '''), array('<', '>', '&', '"', "'"), $text);
return htmlspecialchars($text, ENT_QUOTES, COM_getCharset());
}
示例11: TRB_sendTrackbackPing
/**
* Send a trackback ping
*
* Based on a code snippet by Jannis Hermanns,
* http://www.jannis.to/programming/trackback.html
*
* @param string $targeturl URL to ping
* @param string $url URL of our entry
* @param string $title title of our entry
* @param string $excerpt text excerpt from our entry
* @param string $blog name of our Geeklog site
* @return mixed true = success, otherwise: error message
*
*/
function TRB_sendTrackbackPing($targeturl, $url, $title, $excerpt, $blog = '')
{
global $_CONF, $LANG_TRB;
if (empty($blog)) {
$blog = $_CONF['site_name'];
}
$target = parse_url($targeturl);
if (!isset($target['query'])) {
$target['query'] = '';
} else {
if (!empty($target['query'])) {
$target['query'] = '?' . $target['query'];
}
}
if (!isset($target['port']) || !is_numeric($target['port'])) {
$target['port'] = 80;
}
$sock = fsockopen($target['host'], $target['port']);
if (!is_resource($sock)) {
COM_errorLog('Trackback: Could not connect to ' . $targeturl);
return $LANG_TRB['error_socket'];
}
$toSend = 'url=' . rawurlencode($url) . '&title=' . rawurlencode($title) . '&blog_name=' . rawurlencode($blog) . '&excerpt=' . rawurlencode($excerpt);
$charset = COM_getCharset();
fputs($sock, 'POST ' . $target['path'] . $target['query'] . " HTTP/1.0\r\n");
fputs($sock, 'Host: ' . $target['host'] . "\r\n");
fputs($sock, 'Content-type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n");
fputs($sock, 'Content-length: ' . MBYTE_strlen($toSend) . "\r\n");
fputs($sock, 'User-Agent: Geeklog/' . VERSION . "\r\n");
fputs($sock, "Connection: close\r\n\r\n");
fputs($sock, $toSend);
$res = '';
while (!feof($sock)) {
$res .= fgets($sock, 128);
}
fclose($sock);
// firing up the XML parser for this would be overkill ...
$r1 = strpos($res, '<error>');
$r2 = strpos($res, '</error>');
if ($r1 === false || $r2 === false) {
return $LANG_TRB['error_response'];
}
$r1 += strlen('<error>');
$e = trim(substr($res, $r1, $r2 - $r1));
if ($e != 0) {
$r1 = strpos($res, '<message>');
$r2 = strpos($res, '</message>');
$r1 += strlen('<message>');
if ($r1 === false || $r2 === false) {
return $LANG_TRB['error_unspecified'];
}
$m = trim(substr($res, $r1, $r2 - $r1));
return $m;
}
return true;
}
示例12: strip_tags
}
if (!$iframe) {
$pageTitle = strip_tags(COM_checkWords($subject));
$canonical = $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $showtopic;
if ($page > 1) {
$canonical .= '&page=' . $page;
}
$headercode = '<link rel="canonical" href="' . $canonical . '" />';
$display .= FF_siteHeader($pageTitle, $headercode);
$display .= FF_ForumHeader($forum, $showtopic);
} else {
list($cacheFile, $cacheURL) = COM_getStyleCacheLocation();
$csslink = $cacheURL;
$topicTemplate->set_var('csslink', $csslink);
$outputHandle = outputHandler::getInstance();
$topicTemplate->set_var(array('meta-header' => $outputHandle->renderHeader('meta'), 'css-header' => $outputHandle->renderHeader('style'), 'js-header' => $outputHandle->renderHeader('script'), 'raw-header' => $outputHandle->renderHeader('raw'), 'charset' => COM_getCharset()));
}
if (isset($_GET['lastpost']) && $_GET['lastpost']) {
if ($page == 0) {
$page = $numpages;
}
if (isset($_GET['onlytopic']) && $_GET['onlytopic'] == 1) {
$order = $_FF_CONF['showtopic_review_order'];
$page = 1;
} else {
$order = $FF_userprefs['topic_order'];
//'ASC';
}
if ($page > 1) {
$offset = ($page - 1) * $show;
} else {
示例13: MG_escape
/**
* Escapes a string for HTML output
*/
function MG_escape($str)
{
static $charset = NULL;
if ($charset == NULL) {
$charset = COM_getCharset();
}
$str = str_replace(array('<', '>', '&', '"', '''), array('<', '>', '&', '"', "'"), $str);
return htmlspecialchars($str, ENT_QUOTES, $charset);
}
示例14: COM_getEncodingt
/**
* Get a valid encoding for htmlspecialchars()
*
* @return string character set, e.g. 'utf-8'
*
*/
function COM_getEncodingt()
{
static $encoding;
if ($encoding === null) {
$encoding = strtolower(COM_getCharset());
$valid_charsets = array('iso-8859-1', 'iso-8859-15', 'utf-8', 'cp866', 'cp1251', 'cp1252', 'koi8-r', 'big5', 'gb2312', 'big5-hkscs', 'shift_jis', 'sjis', 'euc-jp');
if (!in_array($encoding, $valid_charsets)) {
$encoding = 'iso-8859-1';
}
}
return $encoding;
}
示例15: die
die('This file cannot be used on its own.');
}
// Prepares locale data
$locale = array();
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$locale['ja'] = array('locale' => 'C', 'date' => '%Y年%m月%d日 %H:%M', 'daytime' => '%m月%d日 %H:%M', 'shortdate' => '%d', 'dateonly' => '%m%d', 'timeonly' => '%H:%M');
} else {
$locale['ja'] = array('locale' => strtoupper(substr(PHP_OS, 0, 7)) === 'FREEBSD' ? 'ja_JP' : 'ja_JP.UTF-8', 'date' => '%Y年%B%e日(%a) %H:%M %Z', 'daytime' => '%m/%d %H:%M %Z', 'shortdate' => '%Y年%B%e日', 'dateonly' => '%B%e日', 'timeonly' => '%H:%M %Z');
}
$locale['en'] = array('locale' => 'en_GB', 'date' => '%A, %B %d %Y @ %I:%M %p %Z', 'daytime' => '%m/%d %I:%M%p', 'shortdate' => '%x', 'dateonly' => '%d-%b', 'timeonly' => '%I:%M %p %Z');
$htmlfilter = array();
$htmlfilter['ja'] = array('user' => array('a' => array('href' => 1, 'title' => 1, 'rel' => 1), 'b' => array(), 'blockquote' => array(), 'br' => array('clear' => 1), 'code' => array(), 'div' => array('class' => 1), 'em' => array(), 'font' => array('color' => 1), 'h' => array(), 'hr' => array(), 'i' => array(), 'li' => array(), 'ol' => array(), 'p' => array('lang' => 1), 'pre' => array(), 'strong' => array(), 'tt' => array(), 'ul' => array()), 'admin' => array('a' => array('href' => 1, 'title' => 1, 'id' => 1, 'lang' => 1, 'name' => 1, 'type' => 1, 'rel' => 1), 'br' => array('clear' => 1, 'style' => 1), 'caption' => array('style' => 1), 'div' => array('class' => 1, 'id' => 1, 'style' => 1), 'embed' => array('src' => 1, 'loop' => 1, 'quality' => 1, 'width' => 1, 'height' => 1, 'type' => 1, 'pluginspage' => 1, 'align' => 1), 'h1' => array('class' => 1, 'id' => 1, 'style' => 1), 'h2' => array('class' => 1, 'id' => 1, 'style' => 1), 'h3' => array('class' => 1, 'id' => 1, 'style' => 1), 'h4' => array('class' => 1, 'id' => 1, 'style' => 1), 'h5' => array('class' => 1, 'id' => 1, 'style' => 1), 'h6' => array('class' => 1, 'id' => 1, 'style' => 1), 'hr' => array('class' => 1, 'id' => 1, 'align' => 1), 'img' => array('src' => 1, 'width' => 1, 'height' => 1, 'vspace' => 1, 'hspace' => 1, 'dir' => 1, 'align' => 1, 'valign' => 1, 'border' => 1, 'lang' => 1, 'longdesc' => 1, 'title' => 1, 'id' => 1, 'alt' => 1, 'style' => 1), 'noscript' => array(), 'object' => array('type' => 1, 'data' => 1, 'classid' => 1, 'codebase' => 1, 'width' => 1, 'height' => 1, 'align' => 1), 'ol' => array('class' => 1, 'style' => 1), 'p' => array('class' => 1, 'id' => 1, 'align' => 1, 'lang' => 1), 'param' => array('name' => 1, 'value' => 1), 'script' => array('src' => 1, 'language' => 1, 'type' => 1), 'span' => array('class' => 1, 'id' => 1, 'lang' => 1), 'table' => array('class' => 1, 'id' => 1, 'width' => 1, 'border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), 'tbody' => array(), 'td' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'th' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'tr' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1), 'ul' => array('class' => 1, 'style' => 1)));
$htmlfilter['en'] = array('user' => array('p' => array(), 'b' => array(), 'strong' => array(), 'i' => array(), 'a' => array('href' => 1, 'title' => 1, 'rel' => 1), 'em' => array(), 'br' => array(), 'tt' => array(), 'hr' => array(), 'li' => array(), 'ol' => array(), 'ul' => array(), 'code' => array(), 'pre' => array()), 'admin' => array('p' => array('class' => 1, 'id' => 1, 'align' => 1), 'div' => array('class' => 1, 'id' => 1), 'span' => array('class' => 1, 'id' => 1), 'table' => array('class' => 1, 'id' => 1, 'width' => 1, 'border' => 1, 'cellspacing' => 1, 'cellpadding' => 1), 'tr' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1), 'th' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1), 'td' => array('class' => 1, 'id' => 1, 'align' => 1, 'valign' => 1, 'colspan' => 1, 'rowspan' => 1)));
$_JAPANIZE_DATA = array();
// 1. テーブル構造とデータを変更する
$_JAPANIZE_DATA[1] = array(array('ja' => "ALTER TABLE {$_TABLES['syndication']} " . "MODIFY language VARCHAR(20) NOT NULL DEFAULT 'ja' ", 'en' => "ALTER TABLE {$_TABLES['syndication']} " . "MODIFY language VARCHAR(20) NOT NULL DEFAULT 'en-gb' "), array('ja' => "UPDATE {$_TABLES['syndication']} " . "SET language = 'ja' ", 'en' => "UPDATE {$_TABLES['syndication']} " . "SET language = 'en-gb' "), array('ja' => "UPDATE {$_TABLES['syndication']} " . "SET charset = 'utf-8' ", 'en' => "UPDATE {$_TABLES['syndication']} " . "SET charset = '" . COM_getCharset() . "' "), array('ja' => "ALTER TABLE {$_TABLES['users']} " . "MODIFY username VARCHAR(108) NOT NULL DEFAULT '' ", 'en' => "ALTER TABLE {$_TABLES['users']} " . "MODIFY username VARCHAR(16) NOT NULL DEFAULT '' "), array('ja' => "UPDATE {$_TABLES['users']} " . "SET username = '" . DB_escapeString('ゲストユーザー') . "', " . " fullname = '" . DB_escapeString('ゲストユーザー') . "' " . "WHERE (uid = 1) ", 'en' => "UPDATE {$_TABLES['users']} " . "SET username = 'Anonymous', fullname = 'Anonymous' " . "WHERE (uid = 1) "), array('ja' => "UPDATE {$_TABLES['users']} " . "SET fullname= '" . DB_escapeString('サイト管理者') . "', homepage='" . DB_escapeString($_CONF['site_url']) . "' " . "WHERE (uid = 2) ", 'en' => "UPDATE {$_TABLES['users']} " . "SET fullname= 'Geeklog SuperUser', homepage='http://www.geeklog.net/' " . "WHERE (uid = 2) "), array('ja' => "UPDATE {$_TABLES['stories']} " . "SET title = '" . DB_escapeString('Geeklogへようこそ!') . "', " . "introtext = '" . DB_escapeString("<p>無事インストールが完了したようですね。おめでとうございます。できれば、<a href=\"docs/japanese/index.html\">docs ディレクトリ</a>のすべての文書に一通り目を通しておいてください。Geeklogはユーザーを中心としたセキュリティモデルを実装しています。Geeklogを管理・運用するにはこの仕組みを理解する必要があります。</p>\n<p>サイトにログインするには、次のアカウントを使用してください:</p>\n<p>ユーザー名: <strong>Admin</strong><br />\nパスワード: <strong>password</strong></p><p><strong>ログインしたら、忘れずに<a href=\"{$_CONF['site_url']}/usersettings.php?mode=edit\">パスワードを変更</a>してください。</strong></p><p>Geeklogのサポートは、<a href=\"http://www.geeklog.jp\">Geeklog Japanese</a>へ。追加ドキュメントは <a href=\"http://wiki.geeklog.jp\">Geeklog Wiki ドキュメント</a>をどうぞ。</p>") . "' " . "WHERE (sid = 'welcome') ", 'en' => "UPDATE {$_TABLES['stories']} " . "SET title = 'Welcome to Geeklog!', " . "introtext = '" . DB_escapeString("<p>Welcome and let me be the first to congratulate you on installing Geeklog. Please take the time to read everything in the <a href=\"docs/english/index.html\">docs directory</a>. Geeklog now has enhanced, user-based security. You should thoroughly understand how these work before you run a production Geeklog Site.</p>\n<p>To log into your new Geeklog site, please use this account:</p>\n<p>Username: <b>Admin</b><br />\nPassword: <b>password</b></p><p><b>And don't forget to <a href=\"{$_CONF['site_url']}/usersettings.php?mode=edit\">change your password</a> after logging in!</b></p>") . "' " . "WHERE (sid = 'welcome') "), array('ja' => "UPDATE {$_TABLES['storysubmission']} " . "SET title = '" . DB_escapeString('セキュリティを確認してください。') . "', " . "introtext = '" . DB_escapeString("<p>インストールが終了したら、次のことを実行してセキュリティを高めてください。</p><ol>\n<li>Adminアカウントのパスワードを変更する。</li>\n<li>installディレクトリを削除する(もう必要ありません)。</li>\n</ol>") . "' " . "WHERE (sid = 'security-reminder') ", 'en' => "UPDATE {$_TABLES['storysubmission']} " . "SET title = 'Are you secure?', " . "introtext = '" . DB_escapeString("<p>This is a reminder to secure your site once you have Geeklog up and running. What you should do:</p>\n\n<ol>\n<li>Change the default password for the Admin account.</li>\n<li>Remove the install directory (you won't need it any more).</li>\n</ol>") . "' " . "WHERE (sid = 'security-reminder') "), array('ja' => "UPDATE {$_TABLES['topics']} " . "SET topic = '" . DB_escapeString('おしらせ') . "' " . "WHERE (tid = 'General') ", 'en' => "UPDATE {$_TABLES['topics']} " . "SET topic = '" . DB_escapeString('General News') . "' " . "WHERE (tid = 'General') "));
if (DB_checkTableExists('events')) {
// イベントの郵便番号を16桁に
$_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['events']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
$_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['eventsubmission']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
$_JAPANIZE_DATA[1][] = array('ja' => "ALTER TABLE {$_TABLES['personal_events']} MODIFY zipcode VARCHAR(16)", 'en' => "SELECT 1");
}
if (DB_checkTableExists('linkcategories')) {
$_JAPANIZE_DATA[1][] = array('ja' => "UPDATE {$_TABLES['linkcategories']} " . "SET description = '" . DB_escapeString('Geeklog関係のサイト') . "' " . "WHERE (cid = '" . DB_escapeString('geeklog-sites') . "') ", 'en' => "UPDATE {$_TABLES['linkcategories']} " . "SET description = '" . DB_escapeString('Sites using or related to the Geeklog CMS') . "' " . "WHERE (cid = '" . DB_escapeString('geeklog-sites') . "') ");
}
if (DB_checkTableExists('links')) {
if (DB_count($_TABLES['links'], 'lid', 'geeklog.jp') == 0) {
$group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Links Admin'");
$_JAPANIZE_DATA[1][] = array('ja' => "INSERT INTO {$_TABLES['links']} " . "(lid, cid, url, description, title, hits, date, " . "owner_id, group_id, perm_owner, perm_group, " . "perm_members, perm_anon) " . "VALUES ('geeklog.jp', 'geeklog-sites', 'http://www.geeklog.jp/', " . "'" . DB_escapeString('Geeklog日本公式サイト') . "', '" . DB_escapeString('Geeklog Japanese') . "', 0, NOW(), 1, {$group_id}, " . "3, 3, 2, 2) ", 'en' => "DELETE FROM {$_TABLES['links']} " . "WHERE (lid = 'geeklog.jp')");
} else {
$_JAPANIZE_DATA[1][] = array('ja' => "SELECT 1", 'en' => "DELETE FROM {$_TABLES['links']} " . "WHERE (lid = 'geeklog.jp')");