本文整理匯總了PHP中MG_getTemplatePath函數的典型用法代碼示例。如果您正苦於以下問題:PHP MG_getTemplatePath函數的具體用法?PHP MG_getTemplatePath怎麽用?PHP MG_getTemplatePath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MG_getTemplatePath函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: MG_enroll
function MG_enroll()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;
// let's make sure this user does not already have a member album
if ($_MG_CONF['member_albums'] != 1) {
echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
exit;
}
$sql = "SELECT album_id FROM {$_TABLES['mg_albums']} WHERE owner_id=" . (int) $_USER['uid'] . " AND album_parent=" . $_MG_CONF['member_album_root'];
$result = DB_query($sql);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$display = MG_siteHeader();
$display .= COM_showMessageText($LANG_MG03['existing_member_album'], '', true);
$display .= MG_siteFooter();
echo $display;
exit;
}
$T = new Template(MG_getTemplatePath(0));
$T->set_file('enroll', 'enroll.thtml');
$T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/enroll.php', 'lang_title' => $LANG_MG03['enroll_title'], 'lang_overview' => $LANG_MG03['overview'], 'lang_terms' => $LANG_MG03['terms'], 'lang_member_album_overview' => $LANG_MG03['member_album_overview'], 'lang_member_album_terms' => $LANG_MG03['member_album_terms'], 'lang_agree' => $LANG_MG03['agree'], 'lang_cancel' => $LANG_MG03['cancel']));
$T->parse('output', 'enroll');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例2: MG_enroll
function MG_enroll()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03;
// let's make sure this user does not already have a member album
if ($_MG_CONF['member_albums'] != 1) {
echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
exit;
}
$sql = "SELECT album_id FROM {$_TABLES['mg_albums']} " . "WHERE owner_id=" . intval($_USER['uid']) . " AND album_parent=" . intval($_MG_CONF['member_album_root']);
$result = DB_query($sql);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$display = COM_startBlock('', '', COM_getBlockTemplate('_msg_block', 'header'));
$display .= $LANG_MG03['existing_member_album'];
$display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
$display = MG_createHTMLDocument($display);
COM_output($display);
exit;
}
$T = COM_newTemplate(MG_getTemplatePath(0));
$T->set_file('enroll', 'enroll.thtml');
$T->set_var(array('s_form_action' => $_MG_CONF['site_url'] . '/enroll.php', 'lang_title' => $LANG_MG03['enroll_title'], 'lang_overview' => $LANG_MG03['overview'], 'lang_terms' => $LANG_MG03['terms'], 'lang_member_album_overview' => $LANG_MG03['member_album_overview'], 'lang_member_album_terms' => $LANG_MG03['member_album_terms'], 'lang_agree' => $LANG_MG03['agree'], 'lang_cancel' => $LANG_MG03['cancel']));
$retval .= $T->finish($T->parse('output', 'enroll'));
return $retval;
}
示例3: MG_navbar
function MG_navbar($selected = '', $album_id)
{
global $_CONF, $_MG_CONF, $LANG_MG01, $LANG_MG03, $glversion;
USES_class_navbar();
$T = new Template(MG_getTemplatePath($album_id));
$T->set_file(array('upload' => 'upload.thtml'));
$T->set_var(array('lang_upload_media' => $LANG_MG03['upload_media']));
$T->parse('output', 'upload');
$retval = $T->finish($T->get_var('output'));
$navbar = new navbar();
$navbar->add_menuitem($LANG_MG01['html5upload_media'], $_MG_CONF['site_url'] . '/admin.php?mode=upload&album_id=' . $album_id);
$navbar->add_menuitem($LANG_MG01['browser_upload'], $_MG_CONF['site_url'] . '/admin.php?mode=browser&album_id=' . $album_id);
if (SEC_hasRights('mediagallery.admin')) {
$navbar->add_menuitem($LANG_MG01['ftp_media'], $_MG_CONF['site_url'] . '/admin.php?mode=import&album_id=' . $album_id);
}
$navbar->add_menuitem($LANG_MG01['remote_media'], $_MG_CONF['site_url'] . '/admin.php?mode=remote&album_id=' . $album_id);
$navbar->set_selected($selected);
$retval .= $navbar->generate();
$retval .= '<br />';
return $retval;
}
示例4: _mg_centerblock
function _mg_centerblock($where = 1, $page = 1, $topic = '')
{
global $_CONF, $_MG_CONF, $MG_albums, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_MG03, $mg_installed_version;
$pi_name = 'mediagallery';
// Plugin name
$retval = '';
if ($_MG_CONF['gallery_only'] == 1 && $topic == '') {
MG_galleryOnly();
}
if ($mg_installed_version != $_MG_CONF['pi_version']) {
return $retval;
}
if (COM_isAnonUser() && $_MG_CONF['loginrequired'] == 1) {
return '';
}
if ($topic == '') {
$sTopic = "none";
} else {
$sTopic = $topic;
}
if (!isset($_MG_CONF['feature_member_album'])) {
$_MG_CONF['feature_member_album'] = 1;
}
if ($_MG_CONF['feature_member_album'] == 1 && $_MG_CONF['member_albums'] == 1 && !COM_isAnonUser() && $where == 1) {
$cbpos = CENTERBLOCK_TOP;
//top of page
$cbpage = 'none';
if ($cbpage == 'none' && ($page > 1 or $topic != "")) {
$cbenable = 0;
} elseif ($cbpage == 'all' && $page > 1) {
$cbenable = 0;
} elseif ($cbpage != 'none' && $cbpage != 'all' && $cbpage != $topic) {
// $cbpage != $topic) {
$cbenable = 0;
} else {
$cbenable = 1;
}
if ($cbenable == 1) {
MG_initAlbums();
$sql = "SELECT album_id FROM {$_TABLES['mg_albums']} WHERE owner_id=" . (int) $_USER['uid'] . " AND album_parent='" . $_MG_CONF['member_album_root'] . "' LIMIT 1";
$result = DB_query($sql);
$numRows = DB_numRows($result);
if ($numRows > 0) {
$A = DB_fetchArray($result);
$album_id = $A['album_id'];
$T = new Template(MG_getTemplatePath(0));
$T->set_file('page', 'cb_featured_album.thtml');
require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php';
if ($MG_albums[$album_id]->last_update > 0) {
$album_last_update = MG_getUserDateTimeFormat($MG_albums[$album_id]->last_update);
} else {
$album_last_update = '';
}
$cover = $MG_albums[$album_id]->findCover();
if ($cover != '') {
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'tn/' . $cover[0] . '/' . $cover . $ext)) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/tn/' . $cover[0] . '/' . $cover . $ext;
$media_size = @getimagesize($_MG_CONF['path_mediaobjects'] . 'tn/' . $cover[0] . '/' . $cover . $ext);
break;
}
}
} else {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$media_size = array(200, 200);
//$media_size = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
}
$album_media_count = $MG_albums[$album_id]->getMediaCount();
$updated_prompt = $_MG_CONF['dfid'] == '99' ? '' : $LANG_MG03['updated_prompt'];
$album_title = $MG_albums[$album_id]->title;
$album_desc = $MG_albums[$album_id]->description;
if ($MG_albums[$album_id]->tn_attached == 1) {
$media_size = false;
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $MG_albums[$album_id]->id . $ext)) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/covers/cover_' . $MG_albums[$album_id]->id . $ext;
$media_size = @getimagesize($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $MG_albums[$album_id]->id . $ext);
break;
}
}
}
if ($media_size == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$media_size = array(200, 200);
// @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
if (!empty($MG_albums[$album_id]->children)) {
$saRows = 0;
$SAchildren = $MG_albums[$album_id]->getChildren();
if (isset($_MG_CONF['subalbum_select']) && $_MG_CONF['subalbum_select'] == 1) {
$subAlbumDisplay = '<form name="subalbums' . $MG_albums[$achild[$indexCounter]]->id . '" action="' . $_MG_CONF['site_url'] . '/album.php' . '" method="get" style="margin:0;padding:0">';
$subAlbumDisplay .= '<select name="aid" onchange="forms[\'subalbums' . $MG_albums[$achild[$indexCounter]]->id . '\'].submit()">';
$subAlbumDisplay .= '<optgroup label="' . $LANG_MG01['select_subalbum'] . '">' . LB;
} else {
$subAlbumDisplay = '';
}
foreach ($SAchildren as $SAchild) {
if ($MG_albums[$SAchild]->access > 0) {
if ($MG_albums[$SAchild]->hidden) {
if ($MG_albums[$SAchild]->access == 3) {
//.........這裏部分代碼省略.........
示例5: MG_mediaEdit
function MG_mediaEdit($album_id, $media_id, $actionURL = '', $mqueue = 0, $view = 0, $back = '')
{
global $_USER, $_CONF, $_MG_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG07, $_DB_dbms;
$album = new mgAlbum($album_id);
if ($actionURL == '') {
$actionURL = $_MG_CONF['site_url'] . '/index.php';
}
$retval = '';
$T = COM_newTemplate(MG_getTemplatePath($album_id));
$T->set_file(array('admin' => 'mediaedit.thtml', 'asf_options' => 'edit_asf_options.thtml', 'mp3_options' => 'edit_mp3_options.thtml', 'swf_options' => 'edit_swf_options.thtml', 'mov_options' => 'edit_mov_options.thtml', 'flv_options' => 'edit_flv_options.thtml'));
// pull the media information from the database...
$sql = "SELECT * FROM ";
if ($_DB_dbms == "mssql") {
$sql = "SELECT *,CAST(media_desc AS TEXT) AS media_desc FROM ";
}
$sql .= ($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media']) . " WHERE media_id='" . addslashes($media_id) . "'";
$result = DB_query($sql);
$row = DB_fetchArray($result);
if ($album->access != 3 && !SEC_inGroup($album->mod_group_id) && $row['media_user_id'] != $_USER['uid']) {
COM_errorLog("Someone has tried to illegally sort albums in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return COM_showMessageText($LANG_MG00['access_denied_msg']);
}
// Build Album List
$album_jumpbox = '<select name="albums" width="40">';
$root_album = new mgAlbum(0);
$root_album->buildJumpBox($album_jumpbox, $album_id);
$album_jumpbox .= '</select>';
// should check the above for errors, etc...
$exif_info = '';
if ($row['media_type'] == 0) {
if (!function_exists('MG_readEXIF')) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
}
$exif_info = MG_readEXIF($row['media_id'], 1, $mqueue);
if (empty($exif_info)) {
$exif_info = '';
}
}
$media_time_month = date("m", $row['media_time']);
$media_time_day = date("d", $row['media_time']);
$media_time_year = date("Y", $row['media_time']);
$media_time_hour = date("H", $row['media_time']);
$media_time_minute = date("i", $row['media_time']);
$month_select = '<select name="media_month">';
$month_select .= COM_getMonthFormOptions($media_time_month);
$month_select .= '</select>';
$day_select = '<select name="media_day">';
for ($i = 1; $i < 32; $i++) {
$day_select .= '<option value="' . $i . '"' . ($media_time_day == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$day_select .= '</select>';
$current_year = (int) date("Y");
$end_year = $current_year + 10;
$year_select = '<select name="media_year">';
for ($i = 1998; $i < $end_year; $i++) {
$year_select .= '<option value="' . $i . '"' . ($media_time_year == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$year_select .= '</select>';
$hour_select = '<select name="media_hour">';
for ($i = 0; $i < 24; $i++) {
$hour_select .= '<option value="' . $i . '"' . ($media_time_hour == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$hour_select .= '</select>';
$minute_select = '<select name="media_minute">';
for ($i = 0; $i < 60; $i++) {
$minute_select .= '<option value="' . $i . '"' . ($media_time_minute == $i ? 'selected="selected"' : "") . '>' . ($i < 10 ? '0' : '') . $i . '</option>';
}
$minute_select .= '</select>';
$media_time = MG_getUserDateTimeFormat($row['media_time']);
$tn_size = 1;
list($thumbnail, $pThumbnail, $size) = Media::getThumbInfo($row, $tn_size);
$attached_thumbnail = '';
if ($row['media_tn_attached'] == 1) {
$atnsize = '';
if ($size != false) {
list($newwidth, $newheight) = Media::getImageWH($size[0], $size[1], 150, 150);
$atnsize = 'width="' . $newwidth . '" height="' . $newheight . '"';
}
$attached_thumbnail = '<img src="' . $thumbnail . '" alt="" ' . $atnsize . XHTML . '>';
$tmpthumb = Media::getDefaultThumbnail($row, $tn_size);
$thumbnail = $_MG_CONF['mediaobjects_url'] . '/' . $tmpthumb;
$size = getimagesize($_MG_CONF['path_mediaobjects'] . $tmpthumb);
}
$preview = '';
$preview_end = '';
if ($row['media_type'] == 0 || $row['media_type'] == 1 || $row['media_type'] == 2) {
// image, video and music file
if ($row['media_type'] == 2) {
$win_width = 540;
$win_height = 320;
} elseif ($row['media_type'] == 1) {
$win_width = 660;
$win_height = 525;
} elseif ($row['media_type'] == 0) {
$path = Media::getFilePath('disp', $row['media_filename'], $row['media_mime_ext']);
$media_size_disp = @getimagesize($path);
$win_width = $media_size_disp[0] + 20;
$win_height = $media_size_disp[1] + 20;
} else {
$win_width = 800;
//.........這裏部分代碼省略.........
示例6: displayThumb
function displayThumb($s, $sortOrder, $force = 0)
{
global $_USER, $_CONF, $_MG_CONF, $MG_albums, $_TABLES, $_MG_USERPREFS, $LANG_MG03, $LANG_MG01, $glversion, $ratedIds;
$retval = '';
$T = new Template(MG_getTemplatePath($this->album_id));
if ($MG_albums[$this->album_id]->display_columns == 1) {
$media_cell_image_template = 'album_page_body_media_cell_1.thtml';
} else {
$media_cell_image_template = 'album_page_body_media_cell.thtml';
}
if ($force) {
$media_cell_image_template = 'album_page_body_media_cell.thtml';
}
$T->set_file(array('media_cell_image' => $media_cell_image_template, 'media_rate_results' => 'album_page_body_media_cell_rating.thtml', 'media_comments' => 'album_page_body_media_cell_comment.thtml', 'media_views' => 'album_page_body_media_cell_view.thtml', 'media_cell_keywords' => 'album_page_body_media_cell_keywords.thtml', 'mp3_podcast' => 'mp3_podcast.thtml'));
$F = new Template($_MG_CONF['template_path']);
$F->set_var('media_frame', $MG_albums[$this->album_id]->imageFrameTemplate);
// --- set the default thumbnail
switch ($this->type) {
case 0:
// standard image
$default_thumbnail = 'tn/' . $this->filename[0] . '/' . $this->filename . '.' . $this->mime_ext;
if (!file_exists($_MG_CONF['path_mediaobjects'] . $default_thumbnail)) {
$default_thumbnail = 'tn/' . $this->filename[0] . '/' . $this->filename . '.jpg';
}
break;
case 1:
// video file
switch ($this->mime_type) {
case 'video/x-flv':
$default_thumbnail = 'placeholder_flv.svg';
break;
case 'application/x-shockwave-flash':
$default_thumbnail = 'placeholder_flash.svg';
break;
case 'video/mpeg':
case 'video/x-mpeg':
case 'video/x-mpeq2a':
if ($_MG_CONF['use_wmp_mpeg'] == 1) {
$default_thumbnail = 'placeholder_video.svg';
break;
}
case 'video/x-motion-jpeg':
case 'video/quicktime':
case 'video/x-qtc':
case 'audio/mpeg':
case 'video/x-m4v':
$default_thumbnail = 'placeholder_quicktime.svg';
break;
case 'asf':
case 'video/x-ms-asf':
case 'video/x-ms-asf-plugin':
case 'video/avi':
case 'video/msvideo':
case 'video/x-msvideo':
case 'video/avs-video':
case 'video/x-ms-wmv':
case 'video/x-ms-wvx':
case 'video/x-ms-wm':
case 'application/x-troff-msvideo':
case 'application/x-ms-wmz':
case 'application/x-ms-wmd':
$default_thumbnail = 'placeholder_video.svg';
break;
default:
$default_thumbnail = 'placeholder_video.svg';
break;
}
break;
case 2:
// music file
$default_thumbnail = 'placeholder_audio.svg';
break;
case 4:
// other files
switch ($this->mime_type) {
case 'application/zip':
case 'zip':
case 'arj':
case 'rar':
case 'gz':
$default_thumbnail = 'zip.png';
break;
case 'pdf':
case 'application/pdf':
$default_thumbnail = 'placeholder_pdf.svg';
break;
default:
if (isset($_MG_CONF['dt'][$this->mime_ext])) {
$default_thumbnail = $_MG_CONF['dt'][$this->mime_ext];
} else {
switch ($this->mime_ext) {
case 'pdf':
$default_thumbnail = 'placeholder_pdf.svg';
break;
case 'arj':
$default_thumbnail = 'zip.png';
break;
case 'gz':
$default_thumbnail = 'zip.png';
break;
//.........這裏部分代碼省略.........
示例7: MG_index
function MG_index()
{
global $_USER, $_MG_CONF, $_CONF, $_TABLES, $MG_albums, $LANG_MG00, $LANG_MG01, $LANG_MG02, $LANG_MG03, $themeStyle;
$display = '';
$media_size = false;
$page = 0;
if (isset($_GET['page'])) {
$page = COM_applyFilter($_GET['page'], true);
}
if ($page != 0) {
$page = $page - 1;
}
$themeStyle = MG_getThemeCSS(0);
if (!isset($_MG_CONF['album_display_columns']) || $_MG_CONF['album_display_columns'] < 1) {
$_MG_CONF['album_display_columns'] = 1;
}
switch ($_MG_CONF['album_display_columns']) {
case 1:
$albumListTemplate = 'gallery_page_body_1.thtml';
$albumColumnWidth = "100%";
break;
case 2:
$albumListTemplate = 'gallery_page_body_2.thtml';
$albumColumnWidth = "50%";
break;
default:
$albumListTemplate = 'gallery_page_body_3.thtml';
$albumColumnWidth = @intval(100 / $_MG_CONF['album_display_columns']) . '%';
if ($albumColumnWidth == 0) {
$albumColumnWidth = "25%";
}
break;
}
$T = new Template(MG_getTemplatePath(0));
$T->set_file(array('page' => 'gallery_page.thtml', 'body' => $albumListTemplate, 'noitems' => 'gallery_page_noitems.thtml'));
$T->set_var(array('lang_menulabel' => $_MG_CONF['menulabel'], 'lang_search' => $LANG_MG01['search'], 'site_url' => $_MG_CONF['site_url']));
if ($_MG_CONF['rss_full_enabled']) {
$feedUrl = MG_getFeedUrl($_MG_CONF['rss_feed_name'] . '.rss');
$rsslink = '<a href="' . $feedUrl . '"' . ' type="application/rss+xml">';
$rsslink .= '<img src="' . MG_getImageFile('feed.png') . '" alt="" style="border:none;"/></a>';
$T->set_var('rsslink', $rsslink);
$T->set_var('rsslink_url', $feedUrl);
} else {
$T->set_var('rsslink', '');
}
$nFrame = new mgFrame();
$nFrame->constructor($_MG_CONF['indexskin']);
$MG_albums[0]->albumFrameTemplate = $nFrame->getTemplate();
$MG_albums[0]->afrWidth = $nFrame->frame['wHL'] + $nFrame->frame['wHR'];
$MG_albums[0]->afrHeight = $nFrame->frame['hVT'] + $nFrame->frame['hVB'];
// Let's build our admin menu options
$showAdminBox = 0;
$admin_box_item = '';
$admin_box = '<form name="adminbox" id="adminbox" action="' . $_MG_CONF['site_url'] . '/admin.php" method="get" style="margin:0;padding:0;">' . LB;
$admin_box .= '<div>';
$admin_box .= '<select onchange="javascript:forms[\'adminbox\'].submit();" name="mode">' . LB;
$admin_box_item .= '<option label="' . $LANG_MG01['options'] . '" value="">' . $LANG_MG01['options'] . '</option>' . LB;
if (($MG_albums[0]->member_uploads || $MG_albums[0]->access == 3) && !COM_isAnonUser()) {
$admin_box_item .= '<option value="upload">' . $LANG_MG01['add_media'] . '</option>' . LB;
$showAdminBox = 1;
}
if ($MG_albums[0]->owner_id) {
$admin_box_item .= '<option value="albumsort">' . $LANG_MG01['sort_albums'] . '</option>' . LB;
$admin_box_item .= '<option value="globalattr">' . $LANG_MG01['globalattr'] . '</option>' . LB;
$admin_box_item .= '<option value="globalperm">' . $LANG_MG01['globalperm'] . '</option>' . LB;
$queue_count = DB_count($_TABLES['mg_media_album_queue']);
$admin_box_item .= '<option value="moderate">' . $LANG_MG01['media_queue'] . ' (' . $queue_count . ')</option>' . LB;
$admin_box_item .= '<option value="wmmanage">' . $LANG_MG01['wm_management'] . '</option>' . LB;
$admin_box_item .= '<option value="create">' . $LANG_MG01['create_album'] . '</option>' . LB;
$showAdminBox = 1;
} elseif ($MG_albums[0]->access == 3) {
$admin_box_item .= '<option value="create">' . $LANG_MG01['create_album'] . '</option>' . LB;
$showAdminBox = 1;
} elseif ($_MG_CONF['member_albums'] == 1 && !COM_isAnonUser() && $_MG_CONF['member_album_root'] == 0 && $_MG_CONF['member_create_new']) {
$admin_box_item .= '<option value="create">' . $LANG_MG01['create_album'] . '</option>' . LB;
$showAdminBox = 1;
}
$admin_box .= $admin_box_item;
$admin_box .= '</select>' . LB;
$admin_box .= '<input type="hidden" name="album_id" value="0"/>' . LB;
$admin_box .= ' <input type="submit" value="' . $LANG_MG03['go'] . '"/>' . LB;
$admin_box .= '</div>';
$admin_box .= '</form>';
// build ul
$admin_menu = '';
$showAdminMenu = 0;
$admin_url = $_MG_CONF['site_url'] . '/admin.php?album_id=0';
if (($MG_albums[0]->member_uploads || $MG_albums[0]->access == 3) && !COM_isAnonUser()) {
$admin_menu .= '<li><a href="' . $admin_url . '&mode=upload">' . $LANG_MG01['add_media'] . '</a></li>';
$showAdminMenu = 1;
}
if ($MG_albums[0]->owner_id) {
$admin_menu .= '<li><a href="' . $admin_url . '&mode=albumsort">' . $LANG_MG01['sort_albums'] . '</a></li>';
$admin_menu .= '<li><a href="' . $admin_url . '&mode=globalattr">' . $LANG_MG01['globalattr'] . '</a></li>' . LB;
$admin_menu .= '<li><a href="' . $admin_url . '&mode=globalperm">' . $LANG_MG01['globalperm'] . '</a></li>' . LB;
$queue_count = DB_count($_TABLES['mg_media_album_queue']);
$admin_menu .= '<li><a href="' . $admin_url . '&mode=moderate">' . $LANG_MG01['media_queue'] . ' (' . $queue_count . ')</a></li>' . LB;
$admin_menu .= '<li><a href="' . $admin_url . '&mode=wmmanage">' . $LANG_MG01['wm_management'] . '</a></li>' . LB;
$admin_menu .= '<li><a href="' . $admin_url . '&mode=create">' . $LANG_MG01['create_album'] . '</a></li>' . LB;
$showAdminMenu = 1;
//.........這裏部分代碼省略.........
示例8: albumThumbnail
//.........這裏部分代碼省略.........
}
}
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$mediasize = array($this->tnWidth, $this->tnHeight);
// @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$album_last_update[0] = '';
$lang_updated = '';
}
if ($this->tn_attached == 1) {
$mediasize = false;
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $this->id . $ext)) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/covers/cover_' . $this->id . $ext;
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $this->id . $ext);
break;
}
}
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/placeholder.svg';
$mediasize = array($this->tnWidth, $this->tnHeight);
//@getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$subalbums = count($this->children);
$total_images_subalbums = $this->getMediaCount();
if (isset($_MG_USERPREFS['tn_size']) && $_MG_USERPREFS['tn_size'] != -1) {
$tn_size = $_MG_USERPREFS['tn_size'];
} else {
$tn_size = $MG_albums[$this->parent]->tn_size;
}
switch ($tn_size) {
case '0':
//small
$tn_height = 100;
$tn_width = 100;
break;
case '1':
//medium
$tn_height = 150;
$tn_width = 150;
break;
case '2':
$tn_height = 200;
$tn_width = 200;
break;
case '3':
case '4':
$tn_height = $MG_albums[$this->parent]->tnHeight;
$tn_width = $MG_albums[$this->parent]->tnWidth;
if ($tn_height == 0) {
$tn_height = 200;
}
if ($tn_width == 0) {
$tn_width = 200;
}
break;
default:
$tn_height = 200;
$tn_width = 200;
break;
}
if ($mediasize[0] > $mediasize[1]) {
$ratio = $mediasize[0] / $tn_height;
$newwidth = $tn_height;
$newheight = round($mediasize[1] / $ratio);
} else {
$ratio = $mediasize[1] / $tn_height;
$newheight = $tn_height;
$newwidth = round($mediasize[0] / $ratio);
}
$F = new Template($_MG_CONF['template_path']);
$F->set_var('media_frame', $MG_albums[$this->parent]->albumFrameTemplate);
$F->set_var(array('border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'media_link_start' => '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1' . '">', 'media_link_end' => '</a>', 'url_media_item' => $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1', 'media_thumbnail' => $album_last_image, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'media_height' => $newheight, 'media_width' => $newwidth, 'media_tag' => $this->title, 'frWidth' => $newwidth - $MG_albums[$this->parent]->afrWidth, 'frHeight' => $newheight - $MG_albums[$this->parent]->afrHeight));
$F->parse('media', 'media_frame');
$media_item_thumbnail = $F->finish($F->get_var('media'));
$C = new Template(MG_getTemplatePath($this->parent));
if ($this->parent != 0 && $MG_albums[$this->parent]->display_columns == 1) {
$C->set_file('cell', 'album_page_body_album_cell_1.thtml');
} else {
$C->set_file('cell', 'album_page_body_album_cell.thtml');
}
$C->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'media_item_thumbnail_raw' => $album_last_image, 'u_viewalbum' => $_MG_CONF['site_url'] . '/album.php?aid=' . $this->id . '&page=1', 'album_last_image' => $album_last_image, 'album_title' => $this->title, 'album_media_count' => $this->media_count, 'subalbum_media_count' => $total_images_subalbums, 'album_desc' => PLG_replaceTags($this->description, 'mediagallery', 'album_description'), 'album_last_update' => $album_last_update[0], 'img_height' => $newheight, 'img_width' => $newwidth, 's_media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'row_height' => $tn_height + 40, 'updated' => $lang_updated, 'lang_album' => $LANG_MG00['album'], 'lang_views' => $LANG_MG03['views'], 'views' => $this->views));
if ($this->enable_album_views) {
$C->set_var(array('lang_views' => $LANG_MG03['views'], 'views' => $this->views));
} else {
$C->set_var(array('lang_views' => '', 'views' => ''));
}
if ($subalbums > 0) {
$C->set_var(array('subalbumcount' => '(' . $subalbums . ')', 'lang_subalbums' => $LANG_MG01['subalbums']));
} else {
$C->set_var(array('subalbumcount' => '', 'lang_subalbums' => ''));
}
PLG_templateSetVars('mediagallery', $C);
$C->parse('output', 'cell');
$celldisplay = $C->finish($C->get_var('output'));
return $celldisplay;
}
示例9: MG_readEXIF
/**
* Build the HTML of EXIF/IPTC metadata for an item
*
* This will return the HTML table of the EXIF/IPTC data in an item.
*
* @param int $mid Media ID of item to process
* @param int $columns Number of columns to format output
* @param int $mqueue Are we reading the moderation queue or live media tables
* @return string HTML (table) or null string if no metadata available
*
*/
function MG_readEXIF($mid, $columns = 2, $mqueue = 0)
{
global $_CONF, $_MG_CONF, $_TABLES, $LANG_MG01, $LANG_MG04;
$count = 0;
$exifItems = 0;
$rowclass = 1;
$retval = '';
$media_filename = DB_getItem($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media'], 'media_filename', "media_id='" . DB_escapeString($mid) . "'");
if ($media_filename == '') {
return '';
}
$media_mime_ext = DB_getItem($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media'], 'media_mime_ext', "media_id='" . DB_escapeString($mid) . "'");
$aid = DB_getItem($_TABLES['mg_media_albums'], 'album_id', 'media_id="' . DB_escapeString($mid) . '"');
// setup the template...
$T = new Template(MG_getTemplatePath($aid));
$T->set_file(array('exif' => 'exif_detail.thtml'));
$T->set_block('exif', 'exifColumn', 'eColumn');
$T->set_block('exif', 'exifRow', 'eRow');
$exif = array();
if ($_MG_CONF['discard_original'] == 1) {
$exif = ExifProcessor($_MG_CONF['path_mediaobjects'] . 'disp/' . $media_filename[0] . '/' . $media_filename . '.jpg');
} else {
$exif = ExifProcessor($_MG_CONF['path_mediaobjects'] . 'orig/' . $media_filename[0] . '/' . $media_filename . '.' . $media_mime_ext);
}
for ($i = 0; $i < count($exif); $i++) {
$T->set_var(array('label' => $exif[$i]['title'], 'value' => $exif[$i]['value']));
$T->parse('eColumn', 'exifColumn', true);
$count++;
if ($count == $columns) {
$T->set_var('rowclass', $rowclass % 2 + 1);
$rowclass++;
$count = 0;
$T->parse('eRow', 'exifRow', true);
$T->set_var('eColumn', '');
}
$exifItems++;
}
if ($count != 0) {
$T->parse('eRow', 'exifRow', true);
}
$T->set_var('lang_exifheader', $LANG_MG04['exif_header']);
$T->set_var('exif_title', $LANG_MG01['image_properties']);
$T->parse('output', 'exif');
$retval .= $T->finish($T->get_var('output'));
if ($exifItems == 0) {
return '';
} else {
return $retval;
}
}
示例10: MG_profileblocksdisplay
function MG_profileblocksdisplay($uid)
{
global $_TABLES, $_MG_CONF, $_CONF, $LANG_MG10, $_USER;
$retval = '';
if ($_MG_CONF['profile_hook'] != 1) {
return '';
}
if ((!isset($_USER['uid']) || $_USER['uid'] < 2) && $_MG_CONF['loginrequired'] == 1) {
return '';
}
if (empty($uid)) {
return '';
}
$username = DB_getItem($_TABLES['users'], 'username', 'uid=' . intval($uid));
if (empty($username)) {
return '';
}
$T = COM_newTemplate(MG_getTemplatePath(0));
$T->set_file('mblock', 'profile_media.thtml');
$T->set_block('mblock', 'itemRow', 'iRow');
$T->set_var('start_block_last10mediaitems', COM_startBlock($LANG_MG10['last_10'] . $username));
$T->set_var('start_block_useralbums', COM_startBlock($LANG_MG10['albums_owned'] . $username));
$T->set_var('lang_thumbnail', $LANG_MG10['thumbnail']);
$T->set_var('lang_title', $LANG_MG10['title']);
$T->set_var('lang_album', $LANG_MG10['album']);
$T->set_var('lang_album_description', $LANG_MG10['album_desc']);
$T->set_var('lang_upload_date', $LANG_MG10['upload_date']);
$T->set_var('end_block', COM_endBlock());
$sql = "SELECT a.album_id,m.media_upload_time,m.media_id,m.media_filename,m.mime_type," . "m.media_mime_ext,m.media_title,m.remote_media,m.media_type,m.media_tn_attached " . "FROM {$_TABLES['mg_albums']} AS a LEFT JOIN {$_TABLES['mg_media_albums']} AS ma " . "ON a.album_id=ma.album_id LEFT JOIN {$_TABLES['mg_media']} AS m ON ma.media_id=m.media_id " . "WHERE m.media_user_id=" . intval($uid) . " AND a.hidden=0 " . COM_getPermSQL('and') . " ORDER BY m.media_upload_time DESC LIMIT 5";
$result = DB_query($sql);
$class = 0;
$mCount = 0;
while ($row = DB_fetchArray($result)) {
$album_id = $row['album_id'];
$album_data = MG_getAlbumData($album_id, array('album_title'));
$album_title = strip_tags($album_data['album_title']);
$upload_time = MG_getUserDateTimeFormat($row['media_upload_time']);
$url_media = $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'];
$url_album = $_MG_CONF['site_url'] . '/album.php?aid=' . $album_id;
$tn_size = 10;
list($url_thumb, $p_thumb, $msize) = Media::getThumbInfo($row, $tn_size);
$atnsize = '';
if ($msize != false) {
list($newwidth, $newheight) = Media::getImageWH($msize[0], $msize[1], 50, 50);
$atnsize = 'width="' . $newwidth . '" height="' . $newheight . '" ';
}
$T->set_var('mediaitem_image', '<img src="' . $url_thumb . '" alt="" ' . $atnsize . 'style="border:none;vertical-align:bottom;"' . XHTML . '>');
$T->set_var('mediaitem_begin_href', '<a href="' . $url_media . '">');
$T->set_var('mediaitem_title', strip_tags($row['media_title']));
$T->set_var('mediaitem_end_href', '</a>');
$T->set_var('mediaitem_album_begin_href', '<a href="' . $url_album . '">');
$T->set_var('mediaitem_album_title', $album_title);
$T->set_var('mediaitem_date', $upload_time[0]);
$T->set_var('rowclass', $class % 2 ? '1' : '2');
$T->parse('iRow', 'itemRow', true);
$class++;
$mCount++;
}
if ($mCount != 0) {
$retval .= $T->finish($T->parse('output', 'mblock'));
}
$T = COM_newTemplate(MG_getTemplatePath(0));
$T->set_file('ablock', 'profile_album.thtml');
$T->set_block('ablock', 'itemRow', 'iRow');
$T->set_var('start_block_useralbums', COM_startBlock($LANG_MG10['albums_owned'] . $username));
$T->set_var('lang_thumbnail', $LANG_MG10['thumbnail']);
$T->set_var('lang_album', $LANG_MG10['album']);
$T->set_var('lang_album_description', $LANG_MG10['album_desc']);
$T->set_var('end_block', COM_endBlock());
$sql = "SELECT album_id,album_title,album_desc,tn_attached " . "FROM " . $_TABLES['mg_albums'] . " WHERE owner_id=" . intval($uid) . " AND hidden=0 " . COM_getPermSQL('and') . " ORDER BY last_update DESC LIMIT 10";
$result = DB_query($sql);
$class = 0;
$aCount = 0;
while ($row = DB_fetchArray($result)) {
$aid = $row['album_id'];
$url_album = $_MG_CONF['site_url'] . '/album.php?aid=' . $row['album_id'];
$url_thumb = '';
$msize = false;
if ($row['tn_attached'] == 1) {
list($url_thumb, $msize) = MG_getImageUrl('covers/cover_' . $row['album_id']);
} else {
$cover_file = MG_getAlbumCover($aid);
if ($cover_file != '') {
$offset = substr($cover_file, 0, 3) == 'tn_' ? 3 : 0;
list($url_thumb, $msize) = MG_getImageUrl('tn/' . $cover_file[$offset] . '/' . $cover_file);
}
}
if ($msize == false || $url_thumb == '') {
$url_thumb = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$msize = getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
}
$atnsize = '';
if ($msize != false) {
list($newwidth, $newheight) = Media::getImageWH($msize[0], $msize[1], 50, 50);
$atnsize = 'width="' . $newwidth . '" height="' . $newheight . '" ';
}
$T->set_var('album_cover', '<img src="' . $url_thumb . '" alt="" ' . $atnsize . 'style="border:none;vertical-align:bottom;"' . XHTML . '>');
$T->set_var('album_begin_href', '<a href="' . $url_album . '">');
$T->set_var('album_title', strip_tags($row['album_title']));
$T->set_var('album_end_href', '</a>');
//.........這裏部分代碼省略.........
示例11: MG_albumThumbnail
function MG_albumThumbnail($album_id)
{
global $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_MG03;
$sql = "SELECT album_title,album_parent,album_views,enable_album_views," . "media_count,album_desc,album_cover_filename,last_update,tn_attached " . "FROM {$_TABLES['mg_albums']} " . "WHERE album_id=" . intval($album_id);
$result = DB_query($sql);
$album_data = DB_fetchArray($result);
$cover_filename = $album_data['album_cover_filename'];
if ($album_data['media_count'] > 0) {
if ($cover_filename != '' && $cover_filename != '0') {
// Testing!
if (strpos($cover_filename, 'tn_') === 0) {
$tmpfilename = 'tn/' . $cover_filename[3] . '/' . $cover_filename;
} else {
$type = $_MG_CONF['gallery_tn_size'];
// Root album
if ($album_data['album_parent'] > 0) {
$type = DB_getItem($_TABLES['mg_albums'], 'tn_size', 'album_id=' . $album_data['album_parent']);
}
$tmpfilename = 'tn/' . $cover_filename[0] . '/' . $cover_filename;
$tmpfilename = MG_getThumbPath($tmpfilename, $type);
$tmpfilename = rtrim($tmpfilename, '.');
}
list($album_last_image, $mediasize) = MG_getImageUrl($tmpfilename);
$album_last_update = MG_getUserDateTimeFormat($album_data['last_update']);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
}
} else {
$filename = MG_getAlbumCover($album_id);
if ($filename == '' || $filename == NULL || $filename == " ") {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
} else {
list($album_last_image, $mediasize) = MG_getImageUrl('tn/' . $filename[0] . '/' . $filename);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
}
$album_media_count = $album_data['media_count'];
if ($album_data['last_update'] > 0) {
$album_last_update = MG_getUserDateTimeFormat($album_data['last_update']);
$lang_updated = $_MG_CONF['dfid'] == '99' ? '' : $LANG_MG03['updated_prompt'];
} else {
$album_last_update[0] = '';
$lang_updated = '';
}
$lang_updated = $_MG_CONF['dfid'] == '99' ? '' : $LANG_MG03['updated_prompt'];
if (isset($_USER['uid']) && $_USER['uid'] > 1) {
$lastlogin = DB_getItem($_TABLES['userinfo'], 'lastlogin', "uid = '" . $_USER['uid'] . "'");
if ($album_data['last_update'] > $lastlogin) {
$album_last_update[0] = '<span class="mgUpdated">' . $album_last_update[0] . '</span>';
}
}
} else {
// nothing in the album yet...
$filename = MG_getAlbumCover($album_id);
if ($filename == '') {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/empty.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'empty.png');
} else {
list($album_last_image, $mediasize) = MG_getImageUrl('tn/' . $filename[0] . '/' . $filename);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$album_last_update[0] = '';
$lang_updated = '';
}
if ($album_data['tn_attached'] == 1) {
list($album_last_image, $mediasize) = MG_getImageUrl('covers/cover_' . $album_id);
if ($mediasize == false) {
$album_last_image = $_MG_CONF['mediaobjects_url'] . '/missing.png';
$mediasize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'missing.png');
}
}
$children = MG_getAlbumChildren($album_id);
$subalbums = count($children);
$total_images_subalbums = MG_getMediaCount($album_id);
$parent_album = new mgAlbum($album_data['album_parent']);
$_MG_USERPREFS = MG_getUserPrefs();
if (isset($_MG_USERPREFS['tn_size']) && $_MG_USERPREFS['tn_size'] != -1) {
$tn_size = $_MG_USERPREFS['tn_size'];
} else {
$tn_size = $parent_album->tn_size;
}
list($tn_height, $tn_width) = MG_getTNSize($tn_size, $parent_album->tnHeight, $parent_album->tnWidth);
list($newwidth, $newheight) = MG_getImageWH_3($mediasize[0], $mediasize[1], $tn_width, $tn_height);
$media_item_thumbnail = MG_getFramedImage($parent_album->album_skin, $album_data['album_title'], $_MG_CONF['site_url'] . '/album.php?aid=' . $album_id . '&page=1', $album_last_image, $newwidth, $newheight);
$C = COM_newTemplate(MG_getTemplatePath($album_data['album_parent']));
$C->set_file('cell', 'album_page_album_cell.thtml');
$C->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'u_viewalbum' => $_MG_CONF['site_url'] . '/album.php?aid=' . $album_id . '&page=1', 'album_last_image' => $album_last_image, 'album_title' => $album_data['album_title'], 'album_media_count' => $album_data['media_count'], 'subalbum_media_count' => $total_images_subalbums, 'album_desc' => PLG_replaceTags($album_data['album_desc']), 'album_last_update' => $album_last_update[0], 'img_height' => $newheight, 'img_width' => $newwidth, 's_media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'row_height' => $tn_height, 'updated' => $lang_updated, 'lang_album' => $LANG_MG00['album'], 'lang_views' => $LANG_MG03['views'], 'views' => $album_data['album_views'], 'lang_views' => $album_data['enable_album_views'] ? $LANG_MG03['views'] : '', 'views' => $album_data['enable_album_views'] ? $album_data['album_views'] : '', 'subalbumcount' => $subalbums > 0 ? '(' . $subalbums . ')' : '', 'lang_subalbums' => $subalbums > 0 ? $LANG_MG01['subalbums'] : ''));
PLG_templateSetVars('mediagallery', $C);
$C->parse('output', 'cell');
$celldisplay = $C->finish($C->get_var('output'));
return $celldisplay;
}
示例12: DB_escapeString
$resolution_x = $ThisFileInfo['video']['resolution_x'];
$resolution_y = $ThisFileInfo['video']['resolution_y'];
}
if ($resolution_x != 0) {
$sql = "UPDATE " . $_TABLES['mg_media'] . " SET media_resolution_x=" . $resolution_x . ",media_resolution_y=" . $resolution_y . " WHERE media_id='" . DB_escapeString($row['media_id']) . "'";
DB_query($sql);
}
} else {
$resolution_x = $row['media_resolution_x'];
$resolution_y = $row['media_resolution_y'];
}
}
// Initialize the flvpopup.thtml template
$T->set_file('video', 'flvpopup.thtml');
// now the player specific items.
$F = new Template(MG_getTemplatePath($aid));
if ($_MG_CONF['use_flowplayer'] == 1) {
// FlowPlayer Setup
$F->set_file(array('player' => 'flvfp.thtml'));
} else {
$F->set_file(array('player' => 'flvmg.thtml'));
}
if ($playback_options['play'] == 1) {
// auto start
$playButton = '';
$autoplay = 'true';
} else {
if ($row['media_tn_attached'] == 1) {
$playImage = MG_getImageFile('blank_blk.jpg');
$playButtonMG = '';
foreach ($_MG_CONF['validExtensions'] as $ext) {
示例13: MG_deleteAlbumConfirm
function MG_deleteAlbumConfirm($album_id, $actionURL = '')
{
global $_USER, $_CONF, $_TABLES, $MG_albums, $_MG_CONF, $LANG_MG00, $LANG_MG01, $_POST, $REMOTE_ADDR, $album_selectbox;
if ($actionURL == '') {
$actionURL = $_CONF['site_admin_url'] . '/plugins/mediagallery/index.php';
}
$retval = '';
$retval .= COM_startBlock($LANG_MG01['delete_album'], '', COM_getBlockTemplate('_admin_block', 'header'));
$T = new Template(MG_getTemplatePath($album_id));
$T->set_file('admin', 'deletealbum.thtml');
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
$T->set_var('album_id', $album_id);
if ($MG_albums[$album_id]->access != 3) {
COM_errorLog("MediaGallery: Someone has tried to delete a album they do not have permissions. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return MG_genericError($LANG_MG00['access_denied_msg']);
}
if (!isset($MG_albums[$album_id]->id)) {
COM_errorLog("MediaGallery: Someone has tried to delete a album to non-existent parent album. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return MG_genericError($LANG_MG00['access_denied_msg']);
}
$album_selectbox = '<select name="target"><option value="0">' . $LANG_MG01['delete_all_media'] . '</option>';
$level = 0;
$MG_albums[0]->buildAlbumBox(-1, 3, $album_id, 'create');
$album_selectbox .= '</select>';
$T->set_var(array('album_id' => $album_id, 'album_title' => strip_tags($MG_albums[$album_id]->title), 'album_desc' => $MG_albums[$album_id]->description, 's_form_action' => $actionURL, 'select_destination' => $album_selectbox, 'lang_delete' => $LANG_MG01['delete'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_delete_album' => $LANG_MG01['delete_album'], 'lang_title' => $LANG_MG01['title'], 'lang_description' => $LANG_MG01['description'], 'lang_move_all_media' => $LANG_MG01['move_all_media'], 'lang_album_delete_help' => $LANG_MG01['album_delete_help']));
$T->parse('output', 'admin');
$retval .= $T->finish($T->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
return $retval;
}
示例14: _mg_autotags
//.........這裏部分代碼省略.........
$link = '<a href="' . $row['remote_url'] . '"' . ($target == '' ? '' : ' target="' . $target . '"') . '>';
} else {
$link = '<a href="' . $_MG_CONF['site_url'] . '/media.php?f=0&sort=0&s=' . $parm1 . '"' . ($target == '' ? '' : ' target="' . $target . '"') . '>';
}
if ($caption != "") {
$link .= $caption;
} else {
$link .= $LANG_MG03['click_here'];
}
$link .= '</a>';
if ($destination != 'block') {
$content = str_replace($autotag['tagstr'], $link, $content);
} else {
$autoTagCount = $mgAutoTagArray['count'];
$mgAutoTagArray['tags'][$autoTagCount] = $link;
$mgAutoTagArray['count']++;
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
}
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
} else {
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
}
break;
case 'playall':
if (!isset($MG_albums[$parm1]->id) || $MG_albums[$parm1]->access == 0 || COM_isAnonUser() && $_MG_CONF['loginrequired'] == 1) {
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
}
$V = new Template(MG_getTemplatePath(0));
$V->set_file(array('xspf' => 'xspf_radio.thtml'));
$V->set_var(array('aid' => $parm1, 'site_url' => $_MG_CONF['site_url'], 'autoplay' => $autoplay ? 'play' : 'stop', 'id' => 'mp3radio' . rand(), 'id2' => 'mp3radio' . rand()));
$V->parse('output', 'xspf');
if ($align != '' && $align != "center") {
$link = '<span style="float:' . $align . ';padding:5px;">' . $V->finish($V->get_var('output')) . '</span>';
} else {
if ($align == "center") {
$link = '<span style="text-align:center;padding:5px;">' . $V->finish($V->get_var('output')) . '</span>';
} else {
$link = '<span style="padding:5px;">' . $V->finish($V->get_var('output')) . '</span>';
}
}
if ($destination != 'block') {
$content = str_replace($autotag['tagstr'], $link, $content);
} else {
$autoTagCount = $mgAutoTagArray['count'];
$mgAutoTagArray['tags'][$autoTagCount] = $link;
$mgAutoTagArray['count']++;
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
}
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
break;
case 'video':
$sql = "SELECT ma.album_id,m.media_id,m.mime_type,m.remote_url,m.media_filename,m.media_mime_ext,m.media_original_filename,m.media_tn_attached,m.media_resolution_x,m.media_resolution_y,m.remote_media FROM {$_TABLES['mg_media']} AS m LEFT JOIN {$_TABLES['mg_media_albums']} AS ma ON m.media_id=ma.media_id WHERE m.media_id='" . DB_escapeString($parm1) . "'";
$result = DB_query($sql);
if (DB_numRows($result) > 0) {
$row = DB_fetchArray($result);
$aid = $row['album_id'];
if (!isset($MG_albums[$aid]->id) || $MG_albums[$aid]->access == 0) {
$link = '';
示例15: MG_editAlbum
/**
* edits or creates an album
*
* @param int album_id album_id to edit
* @param string mode create or edit
* @param string actionURL where to redirection on finish
* @param int oldaid original album id
* @return string HTML
*
*/
function MG_editAlbum($album_id = 0, $mode = '', $actionURL = '', $oldaid = 0)
{
global $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_ACCESS, $REMOTE_ADDR;
global $MG_albums, $album_selectbox, $_DB_dbms;
$valid_albums = 0;
if ($actionURL == '') {
$actionURL = $_CONF['site_admin_url'] . '/plugins/mediagallery/index.php';
}
if ($_DB_dbms == "mssql") {
$sql = "SELECT *,CAST(album_desc AS TEXT) as album_desc FROM " . $_TABLES['mg_albums'] . " WHERE album_id=" . $album_id;
} else {
$sql = "SELECT * FROM " . $_TABLES['mg_albums'] . " WHERE album_id=" . intval($album_id);
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
if ($numRows > 0) {
$A = DB_fetchArray($result);
}
$retval = '';
$T = new Template(MG_getTemplatePath($album_id));
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
if ($album_id != 0 && $mode == 'edit') {
// If edit, pull up the existing album information...
if ($MG_albums[$album_id]->access != 3) {
COM_errorLog("MediaGallery: Someone has tried to illegally edit a Media Gallery Album. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return MG_genericError($LANG_MG00['access_denied_msg']);
}
} else {
if ($album_id == 0 && $mode == 'create') {
// create the album...
$A['album_id'] = -1;
$A['album_order'] = 0;
$album_id = -1;
$A['album_parent'] = 0;
$A['album_title'] = '';
$A['album_desc'] = '';
$A['hidden'] = 0;
$A['album_cover'] = -1;
$A['featured'] = 0;
$A['cbposition'] = 0;
$A['cbpage'] = 'all';
$A['owner_id'] = $_USER['uid'];
$A['member_uploads'] = $_MG_CONF['ad_member_uploads'];
$A['moderate'] = $_MG_CONF['ad_moderate'];
$A['tn_attached'] = 0;
$A['exif_display'] = $_MG_CONF['ad_exif_display'];
$A['enable_slideshow'] = $_MG_CONF['ad_enable_slideshow'];
$A['enable_random'] = $_MG_CONF['ad_enable_random'];
$A['enable_shutterfly'] = $_MG_CONF['ad_enable_shutterfly'];
$A['enable_views'] = $_MG_CONF['ad_enable_views'];
$A['enable_keywords'] = $_MG_CONF['ad_enable_keywords'];
$A['display_album_desc'] = $_MG_CONF['ad_display_album_desc'];
$A['enable_album_views'] = $_MG_CONF['ad_enable_album_views'];
$A['image_skin'] = $_MG_CONF['ad_image_skin'];
$A['album_skin'] = $_MG_CONF['ad_album_skin'];
$A['display_skin'] = $_MG_CONF['ad_display_skin'];
$A['enable_sort'] = $_MG_CONF['ad_enable_sort'];
$A['enable_rss'] = $_MG_CONF['ad_enable_rss'];
$A['enable_postcard'] = $_MG_CONF['ad_enable_postcard'];
$A['albums_first'] = $_MG_CONF['ad_albums_first'];
$A['enable_rating'] = $_MG_CONF['ad_enable_rating'];
$A['enable_comments'] = $_MG_CONF['ad_enable_comments'];
$A['tn_size'] = $_MG_CONF['ad_tn_size'];
$A['allow_download'] = $_MG_CONF['ad_allow_download'];
$A['max_image_height'] = $_MG_CONF['ad_max_image_height'];
$A['max_image_width'] = $_MG_CONF['ad_max_image_width'];
$A['max_filesize'] = $_MG_CONF['ad_max_filesize'];
$A['display_image_size'] = $_MG_CONF['ad_display_image_size'];
$A['display_rows'] = $_MG_CONF['ad_display_rows'];
$A['display_columns'] = $_MG_CONF['ad_display_columns'];
$A['valid_formats'] = $_MG_CONF['ad_valid_formats'];
$A['filename_title'] = $_MG_CONF['ad_filename_title'];
$A['wm_auto'] = $_MG_CONF['ad_wm_auto'];
$A['wm_id'] = $_MG_CONF['ad_wm_id'];
$A['opacity'] = $_MG_CONF['ad_wm_opacity'];
$A['wm_location'] = $_MG_CONF['ad_wm_location'];
$A['album_sort_order'] = $_MG_CONF['ad_album_sort_order'];
$A['email_mod'] = $_MG_CONF['ad_email_mod'];
$A['album_cover_filename'] = '';
$A['last_update'] = 0;
$A['media_count'] = 0;
$A['full_display'] = $_MG_CONF['ad_full_display'];
$A['playback_type'] = $_MG_CONF['ad_playback_type'];
$A['podcast'] = isset($_MG_CONF['ad_podcast']) ? $_MG_CONF['ad_podcast'] : 0;
$A['mp3ribbon'] = 0;
$A['rsschildren'] = 0;
$A['usealternate'] = isset($_MG_CONF['ad_use_alternate']) ? $_MG_CONF['ad_use_alternate'] : 0;
$A['skin'] = isset($_MG_CONF['ad_skin']) ? $_MG_CONF['ad_skin'] : 'default';
$gresult = DB_query("SELECT grp_id FROM {$_TABLES['groups']} WHERE grp_name LIKE 'mediagallery Admin'");
//.........這裏部分代碼省略.........