本文整理汇总了PHP中COM_isAnonUser函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_isAnonUser函数的具体用法?PHP COM_isAnonUser怎么用?PHP COM_isAnonUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_isAnonUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Here we do the work
*
* @param string $comment
* @return int
*/
public function execute($comment)
{
global $_TABLES, $_USER, $LANG_SX00, $LANG28;
$uid = COM_isAnonUser() ? 1 : $_USER['uid'];
// Get homepage URLs of all banned users
$result = DB_query("SELECT DISTINCT homepage FROM {$_TABLES['users']} WHERE status = 0 AND homepage IS NOT NULL AND homepage <> ''");
$numRows = DB_numRows($result);
// named entities
$comment = html_entity_decode($comment);
// decimal notation
$comment = preg_replace_callback('/&#(\\d+);/m', array($this, 'callbackDecimal'), $comment);
// hex notation
$comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment);
$ans = 0;
for ($i = 0; $i < $numRows; $i++) {
list($val) = DB_fetchArray($result);
$val = str_replace('#', '\\#', $val);
if (preg_match("#{$val}#i", $comment)) {
$ans = 1;
// quit on first positive match
SPAMX_log($LANG_SX00['foundspam'] . $val . ' (' . $LANG28[42] . ')' . $LANG_SX00['foundspam2'] . $uid . $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR']);
break;
}
}
$this->result = $ans;
return $ans;
}
示例2: parse
function parse($p1, $p2 = '', $fulltag)
{
global $_CONF, $LANG01, $LANG04;
$retval = '';
if (COM_isAnonUser()) {
$options = array('hide_forgotpw_link' => false, 'form_action' => $_CONF['site_url'] . '/users.php');
$options['title'] = $LANG04[65];
// log in to {site_name}
$options['message'] = $LANG04[66];
// please enter your user name and password below
$retval .= '<div class="uk-navbar-content uk-navbar-flip uk-hidden-small">';
$retval .= '<button class="uk-button uk-button-success" type="button" data-uk-modal="{target:\'#modalOpen\'}">' . $LANG01[58] . '</button></div>';
$retval .= '<div id="modalOpen" class="uk-modal">';
$retval .= '<div class="uk-modal-dialog uk-modal-dialog-medium"><a href="#" class="uk-modal-close uk-close"></a>';
$retval .= SEC_loginForm($options);
$retval .= '</div></div>';
} else {
$retval .= '<ul class="uk-navbar-nav tm-navbar-nav uk-navbar-flip">';
$retval .= '<li class="uk-parent uk-hidden-small" data-uk-dropdown>';
$retval .= '<a href="#">My Account <i class="uk-icon-caret-down"></i></a>';
$retval .= '<div class="uk-dropdown tm-dropdown uk-dropdown-navbar">';
$retval .= '<ul class="uk-nav uk-nav-navbar tm-nav-navbar">';
$userMenu = getUserMenu();
foreach ($userMenu as $option) {
$retval .= '<li><a href="' . $option['url'] . '">' . $option['label'] . '</a></li>';
}
$retval .= '</ul></div></li></ul>';
}
return $retval;
}
示例3: POLLS_pollList
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return string HTML for poll listing
*
*/
function POLLS_pollList()
{
global $_CONF, $_TABLES, $_USER, $_PO_CONF, $LANG25, $LANG_LOGIN, $LANG_POLLS;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
} else {
USES_lib_admin();
$header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true, 'align' => 'center'), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true, 'align' => 'center'), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true, 'align' => 'center'));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '');
$query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(date) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
$retval .= ADMIN_list('polls', 'POLLS_getListField', $header_arr, $text_arr, $query_arr, $defsort_arr, '', $token = 'dummy');
}
return $retval;
}
示例4: polllist
/**
* Shows all polls in system
*
* List all the polls on the system if no $pid is provided
*
* @return string HTML for poll listing
*
*/
function polllist()
{
global $_CONF, $_TABLES, $_PO_CONF, $LANG25, $LANG_POLLS;
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_PO_CONF['pollsloginrequired'] == 1)) {
$retval .= SEC_loginRequiredForm();
} else {
require_once $_CONF['path_system'] . 'lib-admin.php';
$header_arr = array(array('text' => $LANG25[9], 'field' => 'topic', 'sort' => true), array('text' => $LANG25[20], 'field' => 'voters', 'sort' => true), array('text' => $LANG25[3], 'field' => 'unixdate', 'sort' => true), array('text' => $LANG_POLLS['open_poll'], 'field' => 'is_open', 'sort' => true));
$defsort_arr = array('field' => 'unixdate', 'direction' => 'desc');
$text_arr = array('has_menu' => false, 'title' => $LANG_POLLS['pollstitle'], 'instructions' => "", 'icon' => '', 'form_url' => '', 'form_url' => $_CONF['site_url'] . '/polls/index.php');
$query_arr = array('table' => 'polltopics', 'sql' => $sql = "SELECT *,UNIX_TIMESTAMP(created) AS unixdate, display " . "FROM {$_TABLES['polltopics']} WHERE 1=1", 'query_fields' => array('topic'), 'default_filter' => COM_getPermSQL(), 'query' => '', 'query_limit' => 0);
$retval .= ADMIN_list('polls', 'plugin_getListField_polls', $header_arr, $text_arr, $query_arr, $defsort_arr);
}
return $retval;
}
示例5: handleSubscribe
function handleSubscribe($album_id)
{
global $_CONF, $_TABLES, $_USER, $MG_albums, $LANG_MG02;
$referer = isset($_SERVER['HTTP_REFERER']) ? COM_sanitizeUrl($_SERVER['HTTP_REFERER']) : $_CONF['site_url'];
if ($referer == '') {
$referer = $_CONF['site_url'];
}
$sLength = strlen($_CONF['site_url']);
if (substr($referer, 0, $sLength) != $_CONF['site_url']) {
$referer = $_CONF['site_url'];
}
$hasargs = strstr($referer, '?');
if ($hasargs) {
$sep = '&';
} else {
$sep = '?';
}
if (COM_isAnonUser()) {
echo COM_refresh($referer . $sep . 'msg=518');
exit;
}
$errorMessage = '';
if (!isset($MG_albums[$album_id]->id)) {
$errorMessage = $LANG_MG02['albumaccessdeny'];
} else {
if ($MG_albums[$album_id]->access == 0 || $MG_albums[$album_id]->hidden == 1 && $MG_albums[$album_id]->access != 3) {
$errorMessage = $LANG_MG02['albumaccessdeny'];
}
}
if (!empty($errorMessage)) {
echo MG_siteHeader();
echo $errorMessage;
echo MG_siteFooter();
exit;
}
$uid = $_USER['uid'];
$id_desc = $MG_albums[$album_id]->title;
$rc = PLG_subscribe('mediagallery', '', $album_id, $uid, '', $id_desc);
if ($rc === false) {
echo COM_refresh($referer . $sep . 'msg=519');
exit;
}
echo COM_refresh($referer . $sep . 'msg=520');
exit;
}
示例6: MG_ftpUpload
/**
* FTP Import
*
* @param int album_id album_id upload media
* @return string HTML
*
*/
function MG_ftpUpload($album_id)
{
global $MG_albums, $_USER, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03;
$retval = '';
$T = new Template(MG_getTemplatePath($album_id));
$T->set_file('mupload', 'ftpupload.thtml');
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('album_id', $album_id);
if ($MG_albums[$album_id]->access == 3 || SEC_hasRights('mediagallery.admin') || $MG_albums[$album_id]->member_uploads == 1 && !COM_isAnonUser()) {
$T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/admin.php', 'lang_upload_help' => $LANG_MG03['upload_help'], 'lang_media_ftp' => $LANG_MG01['upload_media'], 'lang_directory' => $LANG_MG01['directory'], 'lang_recurse' => $LANG_MG01['recurse'], 'lang_delete_files' => $LANG_MG01['delete_files'], 'lang_caption' => $LANG_MG01['caption'], 'lang_file' => $LANG_MG01['file'], 'lang_description' => $LANG_MG01['description'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 'lang_yes' => $LANG_MG01['yes'], 'lang_no' => $LANG_MG01['no'], 'lang_ftp_help' => $LANG_MG03['ftp_help'], 'album_id' => $album_id, 'ftp_path' => $_MG_CONF['ftp_path'], 'action' => 'ftp'));
$T->parse('output', 'mupload');
$retval .= $T->finish($T->get_var('output'));
return $retval;
} else {
COM_errorLog("MediaGallery: user attempted to upload to a restricted album.");
return MG_genericError($LANG_MG00['access_denied_msg']);
}
}
示例7: auth
/**
* Check if user is authorized
*
*
* @return boolean true if access granted, false if no access
*/
function auth()
{
global $_CONF, $REMOTE_ADDR;
$urlfor = 'advancededitor';
if (COM_isAnonUser()) {
$urlfor = 'advancededitor' . md5($REMOTE_ADDR);
}
$cookiename = $_CONF['cookie_name'] . 'adveditor';
if (isset($_COOKIE[$cookiename])) {
$token = $_COOKIE[$cookiename];
} else {
$token = '';
}
if (SEC_checkTokenGeneral($token, $urlfor)) {
return true;
} else {
return false;
}
return false;
}
示例8: _mg_displaycomment
/**
* Plugin function to display a specific comment thread
* $id Unique idenifier for item comment belongs to
* $cid Comment id to display (possibly including sub-comments)
* $title Page/comment title
* $order 'ASC' or 'DSC' or blank
* $format 'threaded', 'nested', or 'flat'
* $page Page number of comments to display
* $view True to view comment (by cid), false to display (by $pid)
*/
function _mg_displaycomment($id, $commentid, $title, $order, $format, $page, $view)
{
global $_CONF, $_USER, $_MG_CONF, $LANG_LOGIN;
if (COM_isAnonUser() && $_MG_CONF['loginrequired']) {
echo SEC_loginRequiredForm();
exit;
}
$retval = '';
require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-media.php';
list($ptitle, $retval, $themeCSS, $album_id) = MG_displayMediaImage($id, 0, 0, 0);
$retval = $themeCSS . $retval;
if (SEC_hasRights('mediagallery.admin')) {
$delete_option = true;
} else {
$delete_option = false;
}
$view = $view == 1 ? true : false;
$retval .= CMT_userComments($id, $title, 'mediagallery', $order, $format, $commentid, $page, $view, $delete_option);
return $retval;
}
示例9: MAPS_listUserMarkers
/**
* List all markers that the user has access to
*
* @retun string HTML for the list
*
*/
function MAPS_listUserMarkers()
{
global $_CONF, $_USER, $_MAPS_CONF, $_TABLES, $_IMAGE_TYPE, $LANG_ADMIN, $LANG_MAPS_1, $LANG_LOGIN;
require_once $_CONF['path_system'] . 'lib-admin.php';
$retval = '';
if (COM_isAnonUser()) {
$retval .= COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = COM_newTemplate($_CONF['path'] . 'plugins/maps/templates');
$login->set_file(array('login' => 'submitloginrequired.thtml'));
$login->set_var('xhtml', XHTML);
$login->set_var('login_message', $LANG_LOGIN[2]);
$login->set_var('site_url', $_CONF['site_url']);
$login->set_var('site_admin_url', $_CONF['site_admin_url']);
$login->set_var('layout_url', $_CONF['layout_url']);
$login->set_var('lang_login', $LANG_LOGIN[3]);
$login->set_var('lang_newuser', $LANG_LOGIN[4]);
$login->parse('output', 'login');
$retval .= $login->finish($login->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
return $retval;
}
$uid = $_USER['uid'];
if (DB_count($_TABLES['maps_markers'], 'owner_id', $uid) == 0) {
return $retval = $LANG_MAPS_1['no_marker'];
}
if ($_MAPS_CONF['monetize'] == 1) {
$header_arr = array(array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['address'], 'field' => 'address', 'sort' => false), array('text' => $LANG_MAPS_1['to_label'], 'field' => 'to', 'sort' => true), array('text' => $LANG_MAPS_1['id'], 'field' => 'mkid', 'sort' => true));
} else {
$header_arr = array(array('text' => $LANG_MAPS_1['name'], 'field' => 'name', 'sort' => true), array('text' => $LANG_MAPS_1['address'], 'field' => 'address', 'sort' => false), array('text' => $LANG_MAPS_1['id'], 'field' => 'mkid', 'sort' => true));
}
if ($_MAPS_CONF['marker_edition'] == 1 || SEC_hasRights('maps.admin')) {
$header_arr[] = array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false);
}
$defsort_arr = array('field' => 'mk.name', 'direction' => 'asc');
$text_arr = array('has_extras' => true, 'form_url' => $_MAPS_CONF['site_url'] . '/markers.php');
$sql = "SELECT\n\t mk.*, m.free_marker\n FROM {$_TABLES['maps_markers']} AS mk\n\t\t\tLEFT JOIN {$_TABLES['maps_maps']} AS m\n\t\t\t\t ON mk.mid = m.mid";
$query_arr = array('table' => 'maps_markers', 'sql' => $sql, 'query_fields' => array('mk.name'), 'default_filter' => 'WHERE mk.owner_id=' . $uid);
$retval .= ADMIN_list('markers', 'plugin_getListField_userMarkers', $header_arr, $text_arr, $query_arr, $defsort_arr);
return $retval;
}
示例10: submitstory
/**
* Shows the story submission form
*
*/
function submitstory()
{
global $_CONF, $_TABLES, $_USER, $LANG01, $LANG12, $LANG24, $_SCRIPTS;
// Add JavaScript
$_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
$retval = '';
$story = new Story();
if (isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) {
// preview
$story->loadSubmission();
$retval .= COM_startBlock($LANG12[32]) . STORY_renderArticle($story, 'p') . COM_endBlock();
} else {
$story->initSubmission();
}
$storyform = COM_newTemplate($_CONF['path_layout'] . 'submit');
if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
$storyform->set_file('storyform', 'submitstory_advanced.thtml');
$storyform->set_var('change_editormode', 'onchange="change_editmode(this);"');
$storyform->set_var('lang_expandhelp', $LANG24[67]);
$storyform->set_var('lang_reducehelp', $LANG24[68]);
$link_message = COM_isAnonUser() ? '' : $LANG01[138];
$storyform->set_var('noscript', COM_getNoScript(false, '', $link_message));
// Setup Advanced Editor
COM_setupAdvancedEditor('/javascript/submitstory_adveditor.js');
if ($story->EditElements('postmode') === 'html') {
$storyform->set_var('show_texteditor', 'none');
$storyform->set_var('show_htmleditor', '');
} else {
$storyform->set_var('show_texteditor', '');
$storyform->set_var('show_htmleditor', 'none');
}
} else {
$storyform->set_file('storyform', 'submitstory.thtml');
if ($story->EditElements('postmode') === 'html') {
$storyform->set_var('show_texteditor', 'none');
$storyform->set_var('show_htmleditor', '');
} else {
$storyform->set_var('show_texteditor', '');
$storyform->set_var('show_htmleditor', 'none');
}
}
$storyform->set_var('lang_username', $LANG12[27]);
if (!COM_isAnonUser()) {
$storyform->set_var('story_username', $_USER['username']);
$storyform->set_var('author', COM_getDisplayName());
$storyform->set_var('status_url', $_CONF['site_url'] . '/users.php?mode=logout');
$storyform->set_var('lang_loginout', $LANG12[34]);
} else {
$storyform->set_var('status_url', $_CONF['site_url'] . '/users.php');
$storyform->set_var('lang_loginout', $LANG12[2]);
if (!$_CONF['disable_new_user_registration']) {
$storyform->set_var('separator', ' | ');
$storyform->set_var('seperator', ' | ');
$storyform->set_var('create_account', COM_createLink($LANG12[53], $_CONF['site_url'] . '/users.php?mode=new', array('rel' => 'nofollow')));
}
}
$storyform->set_var('lang_title', $LANG12[10]);
$storyform->set_var('story_title', $story->EditElements('title'));
$storyform->set_var('lang_topic', $LANG12[28]);
$tlist = TOPIC_getTopicSelectionControl('article', '', false, false, false);
$storyform->set_var('topic_selection', $tlist);
if (empty($tlist)) {
$retval .= COM_showMessage(101);
return $retval;
}
$storyform->set_var('story_topic_options', $tlist);
$storyform->set_var('lang_story', $LANG12[29]);
$storyform->set_var('lang_introtext', $LANG12[54]);
$storyform->set_var('lang_bodytext', $LANG12[55]);
$storyform->set_var('story_introtext', $story->EditElements('introtext'));
$storyform->set_var('story_bodytext', $story->EditElements('bodytext'));
$storyform->set_var('lang_postmode', $LANG12[36]);
$postmode = $story->EditElements('postmode');
$storyform->set_var('story_postmode_options', COM_optionList($_TABLES['postmodes'], 'code,name', $postmode));
$allowed_html = '';
foreach (array('plaintext', 'html') as $pm) {
$allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
}
$allowed_html .= COM_allowedAutotags();
$storyform->set_var('allowed_html', $allowed_html);
$storyform->set_var('story_uid', $story->EditElements('uid'));
$storyform->set_var('story_sid', $story->EditElements('sid'));
$storyform->set_var('story_date', $story->EditElements('unixdate'));
$storyform->set_var('lang_preview', $LANG12[32]);
PLG_templateSetVars('story', $storyform);
if ($_CONF['skip_preview'] == 1 || isset($_POST['mode']) && $_POST['mode'] == $LANG12[32]) {
$storyform->set_var('save_button', '<input name="mode" type="submit" value="' . $LANG12[8] . '"' . XHTML . '>');
}
$retval .= COM_startBlock($LANG12[6], 'submitstory.html');
$storyform->parse('theform', 'storyform');
$retval .= $storyform->finish($storyform->get_var('theform'));
$retval .= COM_endBlock();
return $retval;
}
示例11: displayThumb
//.........这里部分代码省略.........
$smallheight = round($media_size[1] / $ratio);
} else {
$ratio = $media_size[1] / 50;
if ($ratio == 0) {
$smallheight = 50;
$smallwidth = 50;
} else {
$smallheight = 50;
$smallwidth = round($media_size[0] / $ratio);
}
}
if ($this->owner_id != "" && $this->owner_id > 1) {
$username = DB_getItem($_TABLES['users'], 'username', "uid=" . intval($this->owner_id));
} else {
$username = 'anonymous';
}
if (!isset($resolution_x)) {
$resolution_x = $newwidth;
}
if (!isset($resolution_y)) {
$resolution_y = $newheight;
}
if ($this->mime_type == 'audio/mpeg' && $MG_albums[$this->album_id]->mp3ribbon) {
$T->set_var(array('mp3_file' => $_MG_CONF['mediaobjects_url'] . '/orig/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext, 'site_url' => $_MG_CONF['site_url'], 'id' => $this->mime_ext . rand()));
$T->parse('mp3_podcast', 'mp3_podcast');
} else {
$T->set_var(array('mp3_podcast' => ''));
}
/*
* build the small rating bar
*
*/
if ($MG_albums[$this->album_id]->enable_rating > 0) {
$uid = COM_isAnonUser() ? 1 : $_USER['uid'];
$static = false;
// check to see if we are the owner, if so, no rating for us...
if (isset($_USER['uid']) && $_USER['uid'] == $this->owner_id) {
$static = true;
$voted = 0;
} else {
if (in_array($this->id, $ratedIds)) {
$static = true;
$voted = 1;
} else {
$static = 0;
$voted = 0;
}
}
if ($MG_albums[$this->album_id]->enable_rating == 1 && COM_isAnonUser()) {
$static = true;
}
if ($_MG_CONF['use_large_stars'] == 1) {
$starSize = '';
} else {
$starSize = 'sm';
}
$rating_box = RATING_ratingBar('mediagallery', $this->id, $this->votes, $this->rating, $voted, 5, $static, $starSize);
} else {
$rating_box = '';
}
$T->set_var('rating_box', '<center>' . $rating_box . '</center>');
$fs_bytes = @filesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext);
$fileSize = MG_get_size($fs_bytes);
$direct_url = 'disp/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext;
if (!file_exists($_MG_CONF['path_mediaobjects'] . $direct_url)) {
$direct_url = 'disp/' . $this->filename[0] . '/' . $this->filename . '.jpg';
示例12: EVLIST_getFeedLinks
/**
* Get the RSS feed links only
*
* @return array Array of links & titles
*/
function EVLIST_getFeedLinks()
{
global $_EV_CONF, $_TABLES;
$retval = array();
if (COM_isAnonUser() && $_EV_CONF['allow_anon_view'] != 1) {
return $retval;
}
// Get the feed info for configured feeds
$result = DB_query("SELECT title, filename \n FROM {$_TABLES['syndication']}\n WHERE type='" . DB_escapeString($_EV_CONF['pi_name']) . "'");
if (DB_numRows($result) > 0) {
$feed_url = SYND_getFeedUrl();
while ($A = DB_fetchArray($result, false)) {
$retval[] = array('feed_title' => $A['title'], 'feed_url' => $feed_url . $A['filename']);
}
}
return $retval;
}
示例13: MG_searchDisplayThumb
//.........这里部分代码省略.........
$newwidth = $tn_height;
$newheight = round($media_size[1] / $ratio);
} else {
$ratio = $media_size[1] / $tn_height;
$newheight = $tn_height;
$newwidth = round($media_size[0] / $ratio);
}
if ($media_size[0] > $media_size[1]) {
$ratio = $media_size[0] / 50;
$smallwidth = 50;
$smallheight = round($media_size[1] / $ratio);
} else {
$ratio = $media_size[1] / 50;
$smallheight = 50;
$smallwidth = round($media_size[0] / $ratio);
}
if ($M['media_user_id'] != "" && $M['media_user_id'] > 1) {
$username = DB_getItem($_TABLES['users'], 'username', "uid=" . $M['media_user_id']);
} else {
$username = 'anonymous';
}
if ($M['mime_type'] == 'audio/mpeg') {
$T->set_var(array('play_now' => '', 'download_now' => $_MG_CONF['site_url'] . '/download.php?mid=' . $M['media_id'], 'play_in_popup' => "javascript:showVideo('" . $_MG_CONF['site_url'] . '/video.php?n=' . $M['media_id'] . "'," . $resolution_y . ',' . $resolution_x . ')', 'mp3_file' => $_MG_CONF['mediaobjects_url'] . '/orig/' . $M['media_filename'][0] . '/' . $M['media_filename'] . '.' . $M['media_mime_ext'], 'site_url' => $_MG_CONF['site_url'], 'id' => $M['media_mime_ext'] . rand()));
$T->parse('mp3_podcast', 'mp3_podcast');
} else {
$T->set_var(array('mp3_podcast' => ''));
}
/*
* build the small rating bar
*
*/
if ($MG_albums[$M['album_id']]->enable_rating > 0) {
$ip = $_SERVER['REMOTE_ADDR'];
$uid = COM_isAnonUser() ? 1 : $_USER['uid'];
$static = false;
// check to see if we are the owner, if so, no rating for us...
if (isset($_USER['uid']) && $_USER['uid'] == $M['media_user_id']) {
$static = true;
} else {
if (in_array($M['media_id'], $ratedIds)) {
$static = true;
} else {
$static = '';
}
}
if ($MG_albums[$M['album_id']]->enable_rating == 1 && COM_isAnonUser()) {
$static = 'static';
}
$rating_box = RATING_ratingBar('mediagallery', $M['media_id'], $M['media_votes'], $M['media_rating'], $static, 5, '', 'sm');
} else {
$rating_box = '';
}
$T->set_var('rating_box', $rating_box);
if ($M['media_type'] == 0) {
$direct_url = 'disp/' . $M['media_filename'][0] . '/' . $M['media_filename'] . '.' . $M['media_mime_ext'];
if (!file_exists($_MG_CONF['path_mediaobjects'] . $direct_url)) {
$direct_url = $_MG_CONF['mediaobjects_url'] . '/' . 'disp/' . $M['media_filename'][0] . '/' . $M['media_filename'] . '.jpg';
} else {
$direct_url = $_MG_CONF['mediaobjects_url'] . '/' . $direct_url;
}
} else {
$direct_url = $media_thumbnail;
}
if ($MG_albums[$M['album_id']]->access == 3) {
$edit_item = '<a href="' . $_MG_CONF['site_url'] . '/admin.php?mode=mediaedit&s=1&album_id=' . $M['album_id'] . '&mid=' . $M['media_id'] . '">' . $LANG_MG01['edit'] . '</a>';
} else {
示例14: _isFormAllowed
/**
* Determines if user is allowed to use the search form
*
* Geeklog has a number of settings that may prevent
* the access anonymous users have to the search engine.
* This performs those checks
*
* @author Dirk Haun, dirk AT haun-online DOT de
* @return boolean True if form usage is allowed, otherwise false
*
*/
private function _isFormAllowed()
{
global $_CONF;
if (COM_isAnonUser() and ($_CONF['loginrequired'] == 1 or $_CONF['searchloginrequired'] >= 1)) {
return false;
}
return true;
}
示例15: mailstoryform
/**
* Display form to email a story to someone.
*
* @param string $sid ID of article to email
* @return string HTML for email story form
*
*/
function mailstoryform($sid, $to = '', $toemail = '', $from = '', $fromemail = '', $shortmsg = '', $msg = 0)
{
global $_CONF, $_TABLES, $_USER, $LANG08, $LANG_LOGIN;
require_once $_CONF['path_system'] . 'lib-story.php';
$retval = '';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_CONF['emailstoryloginrequired'] == 1)) {
$retval = COM_startBlock($LANG_LOGIN[1], '', COM_getBlockTemplate('_msg_block', 'header'));
$login = new Template($_CONF['path_layout'] . 'submit');
$login->set_file(array('login' => 'submitloginrequired.thtml'));
$login->set_var('xhtml', XHTML);
$login->set_var('site_url', $_CONF['site_url']);
$login->set_var('site_admin_url', $_CONF['site_admin_url']);
$login->set_var('layout_url', $_CONF['layout_url']);
$login->set_var('login_message', $LANG_LOGIN[2]);
$login->set_var('lang_login', $LANG_LOGIN[3]);
$login->set_var('lang_newuser', $LANG_LOGIN[4]);
$login->parse('output', 'login');
$retval .= $login->finish($login->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
return $retval;
}
$story = new Story();
$result = $story->loadFromDatabase($sid, 'view');
if ($result != STORY_LOADED_OK) {
return COM_refresh($_CONF['site_url'] . '/index.php');
}
if ($msg > 0) {
$retval .= COM_showMessage($msg);
}
if (empty($from) && empty($fromemail)) {
if (!COM_isAnonUser()) {
$from = COM_getDisplayName($_USER['uid'], $_USER['username'], $_USER['fullname']);
$fromemail = DB_getItem($_TABLES['users'], 'email', "uid = {$_USER['uid']}");
}
}
$mail_template = new Template($_CONF['path_layout'] . 'profiles');
$mail_template->set_file('form', 'contactauthorform.thtml');
$mail_template->set_var('xhtml', XHTML);
$mail_template->set_var('site_url', $_CONF['site_url']);
$mail_template->set_var('site_admin_url', $_CONF['site_admin_url']);
$mail_template->set_var('layout_url', $_CONF['layout_url']);
$mail_template->set_var('start_block_mailstory2friend', COM_startBlock($LANG08[17]));
$mail_template->set_var('lang_title', $LANG08[31]);
$mail_template->set_var('story_title', $story->displayElements('title'));
$url = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
$mail_template->set_var('story_url', $url);
$link = COM_createLink($story->displayElements('title'), $url);
$mail_template->set_var('story_link', $link);
$mail_template->set_var('lang_fromname', $LANG08[20]);
$mail_template->set_var('name', $from);
$mail_template->set_var('lang_fromemailaddress', $LANG08[21]);
$mail_template->set_var('email', $fromemail);
$mail_template->set_var('lang_toname', $LANG08[18]);
$mail_template->set_var('toname', $to);
$mail_template->set_var('lang_toemailaddress', $LANG08[19]);
$mail_template->set_var('toemail', $toemail);
$mail_template->set_var('lang_cc', $LANG08[36]);
$mail_template->set_var('lang_cc_description', $LANG08[37]);
$mail_template->set_var('lang_shortmessage', $LANG08[27]);
$mail_template->set_var('shortmsg', htmlspecialchars($shortmsg));
$mail_template->set_var('lang_warning', $LANG08[22]);
$mail_template->set_var('lang_sendmessage', $LANG08[16]);
$mail_template->set_var('story_id', $sid);
$mail_template->set_var('end_block', COM_endBlock());
PLG_templateSetVars('emailstory', $mail_template);
$mail_template->parse('output', 'form');
$retval .= $mail_template->finish($mail_template->get_var('output'));
return $retval;
}