本文整理匯總了PHP中MG_initAlbums函數的典型用法代碼示例。如果您正苦於以下問題:PHP MG_initAlbums函數的具體用法?PHP MG_initAlbums怎麽用?PHP MG_initAlbums使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MG_initAlbums函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: MG_MassdeleteAlbum
function MG_MassdeleteAlbum($album_id)
{
global $MG_albums, $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01;
// need to check perms here...
if ($MG_albums[$album_id]->access != 3) {
COM_errorLog("MediaGallery: Someone has tried to illegally delete an album in Media Gallery. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'], 1);
return MG_genericError($LANG_MG00['access_denied_msg']);
}
MG_MassdeleteChildAlbums($album_id);
if ($_MG_CONF['member_albums'] == 1 && $MG_albums[$album_id]->parent == $_MG_CONF['member_album_root']) {
$result = DB_query("SELECT * FROM {$_TABLES['mg_albums']} WHERE owner_id=" . $MG_albums[$album_id]->owner_id . " AND album_parent=" . $MG_albums[$album_id]->parent);
$numRows = DB_numRows($result);
if ($numRows == 0) {
DB_query("UPDATE {$_TABLES['mg_userprefs']} SET member_gallery=0 WHERE uid=" . $MG_albums[$album_id]->owner_id, 1);
}
}
MG_initAlbums();
require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
MG_buildFullRSS();
}
示例2: MG_initAlbums
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +--------------------------------------------------------------------------+
//
require_once '../../../lib-common.php';
require_once '../../auth.inc.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/init.php';
require_once $_MG_CONF['path_admin'] . 'navigation.php';
require_once $_CONF['path'] . 'plugins/mediagallery/include/classFrame.php';
MG_initAlbums();
// Only let admin users access this page
if (!SEC_hasRights('mediagallery.config')) {
// Someone is trying to illegally access this page
COM_errorLog("Someone has tried to illegally access the Media Gallery Configuration page. User id: {$_USER['uid']}, Username: {$_USER['username']}", 1);
$display = COM_siteHeader();
$display .= COM_showMessageText($LANG_MG00['access_denied_msg'], $LANG_MG00['access_denied'], true);
$display .= COM_siteFooter(true);
echo $display;
exit;
}
function MG_editConfig($msgString = '')
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_DIRECTION, $LANG04;
$retval = '';
$T = new Template($_MG_CONF['template_path'] . '/admin');
示例3: MG_mediaEdit
function MG_mediaEdit($album_id, $media_id, $actionURL = '', $mqueue = 0, $view = 0, $back = '')
{
global $MG_albums, $_USER, $_CONF, $_MG_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG07, $_POST, $_DB_dbms;
MG_initAlbums();
if ($actionURL == '') {
$actionURL = $_MG_CONF['site_url'] . '/index.php';
}
$retval = '';
$preview = '';
$preview_end = '';
$srcURL = '';
if ($view) {
$srcURL = '&s=1';
}
$T = new Template(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'));
$T->set_var('album_id', $album_id);
// a little sanity check, make sure the media item really belongs to the passed album.
$match = 0;
// Find which albums this image is already in...
$sql = "SELECT album_id FROM " . ($mqueue ? $_TABLES['mg_media_album_queue'] : $_TABLES['mg_media_albums']) . " WHERE media_id='" . DB_escapeString($media_id) . "'";
$result = DB_query($sql);
$nRows = DB_numRows($result);
$albums = array();
for ($i = 0; $i < $nRows; $i++) {
$row = DB_fetchArray($result);
$albums[$i] = $row['album_id'];
if ($row['album_id'] == $album_id) {
$match = 1;
}
}
// pull the media information from the database...
$sql = "SELECT * FROM " . ($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media']) . " WHERE media_id='" . DB_escapeString($media_id) . "'";
$result = DB_query($sql);
$row = DB_fetchArray($result);
if ($MG_albums[$album_id]->access != 3 && !SEC_inGroup($MG_albums[$album_id]->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 MG_genericError($LANG_MG00['access_denied_msg']);
}
// Build Album List
$level = 0;
$album_jumpbox = '<select name="albums" width="40">';
$MG_albums[0]->buildJumpBox($album_id);
$album_jumpbox .= '</select>';
// should check the above for errors, etc...
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 ($exif_info == '') {
$exif_info = '';
}
} else {
$exif_info = '';
}
$dtObject = new Date($row['media_time'], $_USER['tzid']);
$media_time_month = $dtObject->month;
$media_time_day = $dtObject->day;
$media_time_year = $dtObject->year;
$media_time_hour = $dtObject->hour;
$media_time_minute = $dtObject->minute;
$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>';
$i = 0;
switch ($row['media_type']) {
case 0:
if (!file_exists($_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'])) {
$pThumbnail = $row['media_filename'][0] . '/' . $row['media_filename'] . '.jpg';
} else {
$pThumbnail = $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'];
}
$thumbnail = $_MG_CONF['mediaobjects_url'] . '/tn/' . $pThumbnail;
$size = @getimagesize($_MG_CONF['path_mediaobjects'] . 'disp/' . $pThumbnail);
if ($_CONF['image_lib'] == 'gdlib' && !function_exists("imagerotate")) {
$rotate_right = '';
$rotate_left = '';
//.........這裏部分代碼省略.........
示例4: MG_editMemberDefaults
function MG_editMemberDefaults()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_ACCESS, $LANG_DIRECTION;
global $album_jumpbox, $album_selectbox, $MG_albums, $LANG04;
MG_initAlbums();
$retval = '';
$T = new Template($_MG_CONF['template_path'] . '/admin');
$T->set_file(array('admin' => 'editmember.thtml', 'admin_formats' => 'editalbum_formats.thtml'));
include_once $_CONF['path_system'] . "classes/navbar.class.php";
$navbar = new navbar();
$navbar->add_menuitem($LANG_MG01['member_albums'], 'showhideMGAdminEditorDiv("members",0);return false;', true);
$navbar->add_menuitem($LANG_MG01['allowed_media_formats'], 'showhideMGAdminEditorDiv("media",1);return false;', true);
$navbar->add_menuitem($LANG_MG01['album_attributes'], 'showhideMGAdminEditorDiv("attributes",2);return false;', true);
$navbar->add_menuitem($LANG_MG01['anonymous_uploads_prompt'], 'showhideMGAdminEditorDiv("useruploads",3);return false;', true);
$navbar->add_menuitem($LANG_ACCESS['accessrights'], 'showhideMGAdminEditorDiv("access",4);return false;', true);
$navbar->set_selected($LANG_MG01['member_albums']);
$T->set_var('navbar', $navbar->generate());
$T->set_var('no_javascript_warning', $LANG04[150]);
$T->set_var(array('jpg_checked' => $_MG_CONF['member_valid_formats'] & MG_JPG ? ' checked="checked"' : '', 'png_checked' => $_MG_CONF['member_valid_formats'] & MG_PNG ? ' checked="checked"' : '', 'tif_checked' => $_MG_CONF['member_valid_formats'] & MG_TIF ? ' checked="checked"' : '', 'gif_checked' => $_MG_CONF['member_valid_formats'] & MG_GIF ? ' checked="checked"' : '', 'bmp_checked' => $_MG_CONF['member_valid_formats'] & MG_BMP ? ' checked="checked"' : '', 'tga_checked' => $_MG_CONF['member_valid_formats'] & MG_TGA ? ' checked="checked"' : '', 'psd_checked' => $_MG_CONF['member_valid_formats'] & MG_PSD ? ' checked="checked"' : '', 'mp3_checked' => $_MG_CONF['member_valid_formats'] & MG_MP3 ? ' checked="checked"' : '', 'ogg_checked' => $_MG_CONF['member_valid_formats'] & MG_OGG ? ' checked="checked"' : '', 'asf_checked' => $_MG_CONF['member_valid_formats'] & MG_ASF ? ' checked="checked"' : '', 'swf_checked' => $_MG_CONF['member_valid_formats'] & MG_SWF ? ' checked="checked"' : '', 'mov_checked' => $_MG_CONF['member_valid_formats'] & MG_MOV ? ' checked="checked"' : '', 'mp4_checked' => $_MG_CONF['member_valid_formats'] & MG_MP4 ? ' checked="checked"' : '', 'mpg_checked' => $_MG_CONF['member_valid_formats'] & MG_MPG ? ' checked="checked"' : '', 'zip_checked' => $_MG_CONF['member_valid_formats'] & MG_ZIP ? ' checked="checked"' : '', 'flv_checked' => $_MG_CONF['member_valid_formats'] & MG_FLV ? ' checked="checked"' : '', 'rflv_checked' => $_MG_CONF['member_valid_formats'] & MG_RFLV ? ' checked="checked"' : '', 'emb_checked' => $_MG_CONF['member_valid_formats'] & MG_EMB ? ' checked="checked"' : '', 'other_checked' => $_MG_CONF['member_valid_formats'] & MG_OTHER ? ' checked="checked"' : '', 'lang_jpg' => $LANG_MG01['jpg'], 'lang_png' => $LANG_MG01['png'], 'lang_tif' => $LANG_MG01['tif'], 'lang_gif' => $LANG_MG01['gif'], 'lang_bmp' => $LANG_MG01['bmp'], 'lang_tga' => $LANG_MG01['tga'], 'lang_psd' => $LANG_MG01['psd'], 'lang_mp3' => $LANG_MG01['mp3'], 'lang_ogg' => $LANG_MG01['ogg'], 'lang_asf' => $LANG_MG01['asf'], 'lang_swf' => $LANG_MG01['swf'], 'lang_mov' => $LANG_MG01['mov'], 'lang_mp4' => $LANG_MG01['mp4'], 'lang_mpg' => $LANG_MG01['mpg'], 'lang_zip' => $LANG_MG01['zip'], 'lang_flv' => $LANG_MG01['flv'], 'lang_rflv' => $LANG_MG01['rflv'], 'lang_emb' => $LANG_MG01['emb'], 'lang_other' => $LANG_MG01['other'], 'lang_allowed_formats' => $LANG_MG01['allowed_media_formats'], 'lang_image' => $LANG_MG01['image'], 'lang_audio' => $LANG_MG01['audio'], 'lang_video' => $LANG_MG01['video']));
$T->parse('valid_formats', 'admin_formats');
$member_albums = '<input type="checkbox" name="member_albums" value="1" ' . ($_MG_CONF['member_albums'] ? ' checked="checked"' : '') . '/>';
$auto_create = '<input type="checkbox" name="auto_create" value="1" ' . ($_MG_CONF['member_auto_create'] ? ' checked="checked"' : '') . '/>';
$allow_create = '<input type="checkbox" name="allow_create" value="1" ' . ($_MG_CONF['member_create_new'] ? ' checked="checked"' : '') . '/>';
$album_jumpbox = '';
$MG_albums[0]->buildJumpBox($_MG_CONF['member_album_root']);
$album_list_root = '<select name="member_root">';
$album_list_root .= '<option value="0">' . $LANG_MG01['root_album'] . '</option>';
$album_list_root .= $album_jumpbox;
$album_list_root .= '</select>';
$MG_albums[0]->buildAlbumBox($_MG_CONF['member_album_archive'], 3, -1, 'upload');
$member_archive = '<select name="member_archive">';
$member_archive .= '<option value="0">' . $LANG_MG01['do_not_archive'] . '</option>';
$member_archive .= $album_selectbox;
$member_archive .= '</select>';
$T->set_var('site_url', $_CONF['site_url']);
$T->set_var('site_admin_url', $_CONF['site_admin_url']);
$ri_select = '<input type="checkbox" name="enable_random" value="1" ' . ($_MG_CONF['member_enable_random'] ? ' checked="checked"' : '') . '/>';
$max_image_height_input = '<input type="text" size="4" name="max_image_height" value="' . $_MG_CONF['member_max_height'] . '"' . '/>';
$max_image_width_input = '<input type="text" size="4" name="max_image_width" value="' . $_MG_CONF['member_max_width'] . '"' . '/>';
$max_filesize_input = '<input type="text" size="10" name="max_filesize" value="' . $_MG_CONF['member_max_filesize'] . '"' . '/>';
$email_mod_select = '<input type="checkbox" name="email_mod" value="1" ' . ($_MG_CONF['member_email_mod'] ? ' checked="checked"' : '') . '/>';
// permission template
$usergroups = SEC_getUserGroups();
$groupdd = '';
$moddd = '';
$gresult = DB_query("SELECT grp_id FROM {$_TABLES['groups']} WHERE grp_name LIKE 'mediagallery Admin'");
$grow = DB_fetchArray($gresult);
$grp_id = $grow['grp_id'];
if (!isset($_MG_CONF['ad_group_id'])) {
$_MG_CONF['ad_group_id'] = $grp_id;
}
if (!isset($_MG_CONF['member_mod_group_id'])) {
$_MG_CONF['member_mod_group_id'] = $grp_id;
}
$groupdd .= '<select name="group_id">';
$moddd .= '<select name="mod_id">';
for ($i = 0; $i < count($usergroups); $i++) {
$groupdd .= '<option value="' . $usergroups[key($usergroups)] . '"';
$moddd .= '<option value="' . $usergroups[key($usergroups)] . '"';
if ($_MG_CONF['ad_group_id'] == $usergroups[key($usergroups)]) {
$groupdd .= ' selected="selected"';
$groupname = key($usergroups);
}
if ($_MG_CONF['member_mod_group_id'] == $usergroups[key($usergroups)]) {
$moddd .= ' selected="selected"';
}
$groupdd .= '>' . key($usergroups) . '</option>';
$moddd .= '>' . key($usergroups) . '</option>';
next($usergroups);
}
$groupdd .= '</select>';
$moddd .= '</select>';
$upload_select = '<input type="checkbox" name="uploads" value="1" ' . ($_MG_CONF['member_uploads'] ? ' checked="checked"' : '') . '/>';
$moderate_select = '<input type="checkbox" name="moderate" value="1" ' . ($_MG_CONF['member_moderate'] ? ' checked="checked"' : '') . '/>';
if (!isset($_MG_CONF['member_use_fullname'])) {
$_MG_CONF['member_use_fullname'] = 0;
}
$fullname_select = '<input type="checkbox" name="member_use_fullname" value="1" ' . ($_MG_CONF['member_use_fullname'] ? ' checked="checked"' : '') . '/>';
if (!isset($_MG_CONF['feature_member_album'])) {
$_MG_CONF['feature_member_album'] = 0;
}
$feature_select = '<input type="checkbox" name="feature_member_album" value="1" ' . ($_MG_CONF['feature_member_album'] ? ' checked="checked"' : '') . '/>';
if (!isset($_MG_CONF['allow_remote'])) {
$_MG_CONF['allow_remote'] = 0;
}
$allow_remote = '<input type="checkbox" name="allow_remote" value="1" ' . ($_MG_CONF['allow_remote'] ? ' checked="checked"' : '') . '/>';
$T->set_var(array('site_url' => $_MG_CONF['site_url'], 'member_albums' => $member_albums, 'album_list_root' => $album_list_root, 'member_archive' => $member_archive, 'auto_create' => $auto_create, 'allow_create' => $allow_create, 'ri_select' => $ri_select, 'height_input' => $max_image_height_input, 'width_input' => $max_image_width_input, 'email_mod_select' => $email_mod_select, 'uploads' => $upload_select, 'moderate' => $moderate_select, 'member_quota' => $_MG_CONF['member_quota'] / 1048576, 'max_filesize' => $_MG_CONF['member_max_filesize'] / 1024, 'member_use_fullname' => $fullname_select, 'feature_member_album' => $feature_select, 'allow_remote' => $allow_remote, 'lang_uploads' => $LANG_MG01['anonymous_uploads_prompt'], 'lang_accessrights' => $LANG_ACCESS['accessrights'], 'lang_owner' => $LANG_ACCESS['owner'], 'lang_group' => $LANG_ACCESS['group'], 'lang_permissions' => $LANG_ACCESS['permissions'], 'lang_perm_key' => $LANG_ACCESS['permissionskey'], 'permissions_editor' => SEC_getPermissionsHTML($_MG_CONF['member_perm_owner'], $_MG_CONF['member_perm_group'], $_MG_CONF['member_perm_members'], $_MG_CONF['member_perm_anon']), 'permissions_msg' => $LANG_ACCESS['permmsg'], 'group_dropdown' => $groupdd, 'mod_dropdown' => $moddd, 'lang_member_upload' => $LANG_MG01['member_upload'], 'lang_moderate_album' => $LANG_MG01['mod_album'], 'lang_mod_group' => $LANG_MG01['moderation_group'], 'lang_zero_unlimited' => $LANG_MG01['zero_unlimited'], 'lang_ri_enable' => $LANG_MG01['ri_enable'], 'lang_max_image_height' => $LANG_MG01['max_image_height'], 'lang_max_image_width' => $LANG_MG01['max_image_width'], 'lang_max_filesize' => $LANG_MG01['max_filesize'], 'lang_display_image_size' => $LANG_MG01['display_image_size'], 'lang_email_mods_on_submission' => $LANG_MG01['email_mods_on_submission'], 'lang_album_attributes' => $LANG_MG01['album_attributes'], 'lang_member_albums' => $LANG_MG01['member_albums'], 'lang_enable_member_albums' => $LANG_MG01['enable_member_albums'], 'lang_member_quota' => $LANG_MG01['default_member_quota'], 'lang_auto_create' => $LANG_MG01['auto_create'], 'lang_allow_create' => $LANG_MG01['allow_create'], 'lang_member_root' => $LANG_MG01['member_root'], 'lang_member_archive' => $LANG_MG01['member_archive'], 'lang_member_use_fullname' => $LANG_MG01['member_use_fullname'], 'lang_feature_member_album' => $LANG_MG01['feature_member_album'], 'lang_allow_remote' => $LANG_MG01['allow_remote'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 's_form_action' => $_MG_CONF['admin_url'] . 'member.php', 'rtl' => $LANG_DIRECTION == "rtl" ? "rtl" : ""));
$T->parse('output', 'admin');
$retval .= $T->finish($T->get_var('output'));
return $retval;
}
示例5: parse
function parse($p1, $p2 = '', $fulltag)
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG03, $_PLUGINS, $MG_albums, $_DB_dbms, $mg_installed_version;
$retval = '';
$skip = 0;
$itemsToDisplay = 15;
if (!in_array('mediagallery', $_PLUGINS)) {
return $retval;
}
// defaults:
$itemsToDisplay = $p1;
$uniqueID = md5($p1);
if ($mg_installed_version != $_MG_CONF['pi_version']) {
return $retval;
}
$truncate = 1;
$caption = 0;
$px = explode(' ', trim($p2));
if (is_array($px)) {
foreach ($px as $part) {
if (substr($part, 0, 9) == 'truncate:') {
$a = explode(':', $part);
$truncate = (int) $a[1];
$skip++;
} elseif (substr($part, 0, 8) == 'caption:') {
$a = explode(':', $part);
$caption = (int) $a[1];
$skip++;
} else {
break;
}
}
}
if ($truncate == 1) {
$truncate_word = 'true';
} else {
$truncate_word = 'false';
}
$outputHandle = outputHandler::getInstance();
$outputHandle->addLinkScript($_CONF['site_url'] . '/mediagallery/js/jquery.flex-images.js');
$outputHandle->addLinkStyle($_CONF['site_url'] . '/mediagallery/js/jquery.flex-images.css');
$hash = CACHE_security_hash();
$instance_id = 'whatsnew_newimages_' . $uniqueID . '_' . $hash . '_' . $_USER['theme'];
if (($cache = CACHE_check_instance($instance_id, 0)) !== FALSE) {
return $cache;
}
$imageArray = array();
require_once $_CONF['path'] . 'plugins/mediagallery/include/init.php';
MG_initAlbums();
$sql = "SELECT ma.album_id,m.media_user_id,m.media_id,m.media_filename,m.media_title,\n u.fullname FROM {$_TABLES['mg_albums']} as a\n LEFT JOIN {$_TABLES['mg_media_albums']} as ma\n on a.album_id=ma.album_id LEFT JOIN {$_TABLES['mg_media']} as m\n on ma.media_id=m.media_id\n LEFT JOIN {$_TABLES['users']} as u ON m.media_user_id=u.uid\n WHERE\n m.media_type=0 AND a.enable_random=1 AND a.hidden=0 " . COM_getPermSQL('and') . " ORDER BY m.media_upload_time DESC LIMIT " . (int) $itemsToDisplay;
$result = DB_query($sql, 1);
$nRows = DB_numRows($result);
for ($x = 0; $x < $nRows; $x++) {
$row = DB_fetchArray($result);
$url_media = $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'];
$url_album = $_MG_CONF['site_url'] . '/album.php?aid=' . $row['album_id'] . '&s=' . $row['media_id'] . '#' . $row['media_id'];
$msize = false;
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext)) {
$media_thumbnail = $_MG_CONF['mediaobjects_url'] . '/disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext;
$msize = @getimagesize($_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext);
$media_url = $_MG_CONF['site_url'] . '/mediaobjects/' . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext;
break;
}
}
if ($msize == false) {
continue;
}
$imageArray[] = array('url' => $media_url, 'height' => $msize[1], 'width' => $msize[0], 'link' => $url_media, 'caption' => $row['media_title']);
}
$retval .= '<div class="flex-images uk-panel uk-panel-box">';
foreach ($imageArray as $image) {
$retval .= '<div class="item" data-w="' . $image['width'] . '" data-h="' . $image['height'] . '">';
if ($caption) {
$retval .= '<div class="over uk-hidden-small">' . $image['caption'] . '</div>';
}
$retval .= '<a href="' . $image['url'] . '" data-uk-lightbox>';
$retval .= '<img class="uk-thumbnail" src="' . $image['url'] . '">';
$retval .= '</a>';
$retval .= '</div>';
}
$retval .= '</div>';
$retval .= '<script>$(\'.flex-images\').flexImages({rowHeight: 200, truncate:' . $truncate_word . '});</script>';
CACHE_create_instance($instance_id, $retval, 0);
return $retval;
}
示例6: parse
function parse($p1, $p2 = '', $fulltag)
{
global $_CONF, $_TABLES, $_MG_CONF, $MG_albums;
$retval = '';
$skip = 0;
$template = 'mgslider.thtml';
$overlayPosition = 'top';
// top, bottom, left, right, center
$kenBurns = false;
$autoPlay = false;
$px = explode(' ', trim($p2));
if (is_array($px)) {
foreach ($px as $part) {
if (substr($part, 0, 9) == 'autoplay:') {
$a = explode(':', $part);
$autoPlay = $a[1];
$skip++;
} elseif (substr($part, 0, 9) == 'kenburns:') {
$a = explode(':', $part);
$kenBurns = $a[1];
$skip++;
} elseif (substr($part, 0, 8) == 'overlay:') {
$a = explode(':', $part);
$overlayPosition = $a[1];
$skip++;
} elseif (substr($part, 0, 9) == 'template:') {
$a = explode(':', $part);
$template = $a[1];
$skip++;
} else {
break;
}
}
}
MG_initAlbums();
if ($p1 == '' || $p1 == 0) {
return $content;
}
if (!isset($MG_albums[$p1]->id) || $MG_albums[$p1]->access == 0) {
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
}
$T = new Template($_CONF['path'] . 'system/autotags/');
$T->set_file('page', $template);
switch ($overlayPosition) {
case 'center':
$overlay_position = 'uk-flex uk-flex-center uk-flex-middle uk-text-center';
break;
case 'top':
$overlay_position = 'uk-overlay-top';
break;
case 'bottom':
$overlay_position = 'uk-overlay-bottom';
break;
default:
$overlay_position = 'uk-overlay-top';
break;
}
$options = '';
$T->set_var('overlay_position', $overlay_position);
if ($kenBurns == true) {
$options .= 'kenburns:true,';
} else {
$options .= 'kenburns:false,';
}
if ($autoPlay == true) {
$options .= 'autoplay:true';
}
$T->set_var('options', $options);
$T->set_block('page', 'slides', 'sl');
$T->set_block('page', 'dotnav', 'dn');
$aid = (int) $p1;
$counter = 0;
$sql = "SELECT m.* FROM {$_TABLES['mg_media_albums']} as ma INNER JOIN " . $_TABLES['mg_media'] . " as m " . " ON ma.media_id=m.media_id WHERE ma.album_id='" . DB_escapeString($aid) . "' AND m.media_type=0 AND m.include_ss=1 ORDER BY ma.media_order DESC";
$result = DB_query($sql);
while ($row = DB_fetchArray($result)) {
$media_size = @getimagesize($_MG_CONF['path_mediaobjects'] . 'orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext']);
$ext = $row['media_mime_ext'];
if ($media_size == false) {
continue;
}
$T->set_var('image_url', $_MG_CONF['mediaobjects_url'] . '/orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $ext);
$T->set_var('image_title', $row['media_title']);
$T->set_var('image_desc', $row['media_desc']);
$T->parse('sl', 'slides', true);
$T->set_var('image_counter', $counter);
$T->parse('dn', 'dotnav', true);
$counter++;
}
$retval = $T->finish($T->parse('output', 'page'));
return $retval;
}
示例7: _mg_autotags
//.........這裏部分代碼省略.........
break;
case 'l':
$align = "left";
$aSet = 1;
break;
case 'r':
$align = "right";
$aSet = 1;
break;
case 'a':
$align = !($side_count % 2) ? "left" : "right";
$side_count++;
$aSet = 1;
break;
default:
$align = !($side_count % 2) ? "left" : "right";
$side_count++;
break;
}
$parm1 = COM_applyFilter(substr($autotag['parm1'], 1, strlen($autotag['parm1']) - 1));
} else {
$parm1 = COM_applyFilter($autotag['parm1']);
if ($aSet == 0 || $align == 'auto') {
$align = !($side_count % 2) ? "left" : "right";
$side_count++;
}
}
if ($align == 'none') {
$align = '';
}
if (!in_array($autotag['tag'], array('album', 'media', 'img', 'slideshow', 'fslideshow', 'video', 'audio', 'download', 'image', 'oimage', 'mlink', 'alink', 'playall'))) {
return $content;
}
MG_initAlbums();
// sanity check incase the album has been deleted or something...
if ($autotag['tag'] != 'media' && $autotag['tag'] != 'image' && $autotag['tag'] != 'video' && $autotag['tag'] != 'audio' && $autotag['tag'] != 'download' && $autotag['tag'] != 'oimage' && $autotag['tag'] != 'img' && $autotag['tag'] != 'mlink' && $autotag['tag'] != 'alink' && $autotag['tag'] != 'playall') {
if (!isset($MG_albums[$parm1]->id)) {
$link = '';
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
}
}
$ss_count = mt_rand(0, 32768);
switch ($autotag['tag']) {
case 'download':
$side_count--;
$sql = "SELECT ma.album_id 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 = '';
$content = str_replace($autotag['tagstr'], $link, $content);
return $content;
}
$link = '<a href="' . $_MG_CONF['site_url'] . '/download.php?mid=' . $parm1 . '">';
if ($caption != "") {
$link .= $caption;
} else {
$link .= 'download';
}
$link .= '</a>';
if ($destination != 'block') {
$content = str_replace($autotag['tagstr'], $link, $content);
} else {
示例8: MG_saveAlbum
//.........這裏部分代碼省略.........
$album->description = substr($album->description, 0, 1500);
}
if ($album->last_update == '') {
$album->last_update = 0;
}
$album->last_update = intval($album->last_update);
if ($album->id < 1) {
$album->id = $album->createAlbumID();
$aid = $album->id;
$album->order = $album->getNextSortOrder();
}
if ($album->id == 0) {
COM_errorLog("MediaGallery: Internal Error - album_id = 0 - Contact mark@glfusion.org ");
return MG_genericError($LANG_MG00['access_denied_msg']);
}
$album->saveAlbum();
$album->updateChildPermissions($forceChildPermUpdate);
// now handle the attached cover...
if ($attachtn == 1) {
if (!function_exists('MG_getFile')) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-upload.php';
}
$media_filename = $_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $album->id;
MG_attachThumbnail($album->id, $thumbnail, $media_filename);
}
if ($remove_old_tn == 1) {
foreach ($_MG_CONF['validExtensions'] as $ext) {
if (file_exists($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $album->id . $ext)) {
@unlink($_MG_CONF['path_mediaobjects'] . 'covers/cover_' . $album->id . $ext);
break;
}
}
}
MG_initAlbums(1);
// do any album sorting here...
if (isset($MG_albums[$aid]) && $MG_albums[$aid]->parent == 0) {
switch ($MG_albums[$aid]->album_sort_order) {
case 0:
break;
case 3:
// upload, asc
MG_staticSortAlbum($aid, 2, 1, 0);
break;
case 4:
// upload, desc
MG_staticSortAlbum($aid, 2, 0, 0);
break;
case 5:
// title, asc
MG_staticSortAlbum($aid, 0, 1, 0);
break;
case 6:
// title, desc
MG_staticSortAlbum($aid, 0, 0, 0);
break;
case 7:
// rating, desc
MG_staticSortAlbum($aid, 3, 0, 0);
break;
case 8:
// rating, desc
MG_staticSortAlbum($aid, 3, 1, 0);
break;
default:
// skip it...
break;
示例9: _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) {
//.........這裏部分代碼省略.........
示例10: MG_purgeMemberAlbums
function MG_purgeMemberAlbums()
{
global $MG_albums, $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01, $_POST;
$numItems = count($_POST['album']);
for ($i = 0; $i < $numItems; $i++) {
// grab owner ID
$result = DB_query("SELECT owner_id FROM {$_TABLES['mg_albums']} WHERE album_id=" . (int) COM_applyFilter($_POST['album'][$i], true));
$numRows = DB_numRows($result);
if ($numRows > 0) {
list($owner_id) = DB_fetchArray($result);
DB_query("UPDATE {$_TABLES['mg_userprefs']} SET member_gallery=0 WHERE uid=" . $owner_id, 1);
}
MG_deleteChildAlbums((int) COM_applyFilter($_POST['album'][$i], true));
}
MG_initAlbums();
require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
MG_buildFullRSS();
echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=8');
exit;
}