} $db->sql_freeresult(); } // MG SITEMAP - DOWNLOADS - END // MG SITEMAP - ALBUM - BEGIN if (isset($cms_config_layouts['album']['view']) && ($cms_config_layouts['album']['view'] == AUTH_ALL)) { // Get general album information include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT); $album_user_id = ALBUM_PUBLIC_GALLERY; //$album_user_id = ALBUM_ROOT_CATEGORY; $catrows = array (); $options = ALBUM_READ_ALL_CATEGORIES|ALBUM_AUTH_VIEW; $catrows = album_read_tree($album_user_id, $options); album_read_tree($album_user_id); $allowed_cat = ''; // For Recent Public Pics below for ($i = 0; $i < sizeof($catrows); $i++) { $allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id']; } if($config['sitemap_sort'] == 'ASC') { $order = 'DESC'; } else { $order = 'ASC'; } $sql = "SELECT pic_id FROM " . ALBUM_TABLE . "
$module['2200_Photo_Album']['130_Album_Permissions'] = $filename; return; } // Load default Header if (!defined('IP_ROOT_PATH')) { define('IP_ROOT_PATH', './../'); } if (!defined('PHP_EXT')) { define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); } require 'pagestart.' . PHP_EXT; setup_extra_lang(array('lang_album_main', 'lang_album_admin')); require ALBUM_MOD_PATH . 'album_common.' . PHP_EXT; $album_user_id = ALBUM_PUBLIC_GALLERY; if (!isset($_POST['submit'])) { album_read_tree(); $s_album_cat_list = album_get_tree_option(ALBUM_ROOT_CATEGORY, ALBUM_AUTH_VIEW, ALBUM_SELECTBOX_INCLUDE_ALL | ALBUM_SELECTBOX_INCLUDE_ROOT); $template->set_filenames(array('body' => ADM_TPL . 'album_cat_select_body.tpl')); $template->assign_vars(array('L_ALBUM_AUTH_TITLE' => $lang['Album_Auth_Title'], 'L_ALBUM_AUTH_EXPLAIN' => $lang['Album_Auth_Explain'], 'L_SELECT_CAT' => $lang['Select_a_Category'], 'S_ALBUM_ACTION' => append_sid("admin_album_auth." . PHP_EXT), 'L_LOOK_UP_CAT' => $lang['Look_up_Category'], 'CAT_SELECT_TITLE' => $s_album_cat_list)); $template->pparse('body'); include IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT; } else { if (!isset($_GET['cat_id'])) { $cat_id = intval($_POST['cat_id']); $template->set_filenames(array('body' => ADM_TPL . 'album_auth_body.tpl')); $template->assign_vars(array('L_ALBUM_AUTH_TITLE' => $lang['Album_Auth_Title'], 'L_ALBUM_AUTH_EXPLAIN' => $lang['Album_Auth_Explain'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_GROUPS' => $lang['Usergroups'], 'L_VIEW' => $lang['View'], 'L_UPLOAD' => $lang['Upload'], 'L_RATE' => $lang['Rate'], 'L_COMMENT' => $lang['Comment'], 'L_EDIT' => $lang['Edit'], 'L_DELETE' => $lang['Delete'], 'L_IS_MODERATOR' => $lang['Is_Moderator'], 'S_ALBUM_ACTION' => append_sid('admin_album_auth.' . PHP_EXT . '?cat_id=' . $cat_id))); $groups_data = get_groups_data(false, false, array()); // Get info of this cat $sql = "SELECT cat_id, cat_title, cat_view_groups, cat_upload_groups, cat_rate_groups, cat_comment_groups, cat_edit_groups, cat_delete_groups, cat_moderator_groups\n\t\t\t\tFROM " . ALBUM_CAT_TABLE . "\n\t\t\t\tWHERE cat_id = '{$cat_id}'"; $result = $db->sql_query($sql); $thiscat = $db->sql_fetchrow($result);
} if ($album_user_id < 1) { if (!$user->data['session_logged_in']) { redirect(append_sid(album_append_uid(CMS_PAGE_LOGIN . '?redirect=album.' . PHP_EXT, true))); } else { $album_user_id = $user->data['user_id']; redirect(append_sid(album_append_uid('album.' . PHP_EXT, true))); } } if ($cat_id != ALBUM_ROOT_CATEGORY && $cat_id != album_get_personal_root_id($album_user_id)) { redirect(append_sid(album_append_uid('album_cat.' . PHP_EXT . album_build_url_parameters($_GET), false))); } } $catrows = array(); $options = $album_view_mode == ALBUM_VIEW_LIST ? ALBUM_READ_ALL_CATEGORIES | ALBUM_AUTH_VIEW : ALBUM_AUTH_VIEW; $catrows = album_read_tree($album_user_id, $options); // Mighty Gorgon: is this really needed? Maybe not... let's keep it commented until someone complains!!! //album_read_tree($album_user_id); $album_nav_cat_desc = album_make_nav_tree($cat_id, 'album_cat.' . PHP_EXT, 'nav', $album_user_id); if ($album_nav_cat_desc != '') { $nav_server_url = create_server_url(); $album_nav_cat_desc = ALBUM_NAV_ARROW . $album_nav_cat_desc; $breadcrumbs['address'] = ALBUM_NAV_ARROW . '<a href="' . $nav_server_url . append_sid('album.' . PHP_EXT) . '">' . $lang['Album'] . '</a>' . $album_nav_cat_desc; } // -------------------------------- // Build allowed category-list (for recent pics after here) // $catrows array now stores all categories which this user can view. // -------------------------------- $allowed_cat = ''; // For Recent Public Pics below for ($i = 0; $i < sizeof($catrows); $i++) {
if (sizeof($pic_images[$key])) { $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>'; } } $s_categories .= '</select>'; $s_colspan = 0; $pic_cat_reg = preg_replace('/[^A-Za-z0-9]+/', '_', $pic_cat); $js_include = ''; $js_images_list = ''; // Upload To Album - BEGIN $select_cat = ''; if ($user->data['user_level'] == ADMIN) { $template->assign_block_vars('upload_allowed', array()); $cat_id = ALBUM_ROOT_CATEGORY; $personal_gallery_list = ''; album_read_tree($user->data['user_id'], ALBUM_READ_ALL_CATEGORIES | ALBUM_AUTH_VIEW_AND_UPLOAD); $temp_tree = album_get_tree_option($cat_id, ALBUM_AUTH_VIEW_AND_UPLOAD) . $personal_gallery_list; if ($temp_tree == '') { message_die(GENERAL_ERROR, $lang['No_category_to_upload']); } $select_cat = '<select name="cat_id">'; $select_cat .= $temp_tree; $select_cat .= '</select>'; unset($personal_gallery_list); album_free_album_data(); } // Upload To Album - END $nav_server_url = create_server_url(); $breadcrumbs['address'] = ALBUM_NAV_ARROW . '<a href="' . $nav_server_url . append_sid('album.' . PHP_EXT) . '">' . $lang['Album'] . '</a>' . ALBUM_NAV_ARROW . '<a class="nav-current" href="' . $nav_server_url . append_sid('album_otf.' . PHP_EXT) . '">' . $lang['Pic_Gallery'] . '</a>'; // Upload To Album - BEGIN $upload_counter = 0;
function album_move_tree($cat_id, $move, $user_id = ALBUM_PUBLIC_GALLERY) { global $db, $album_data; // if the album_tree is NOT filled then reload the data // this will ensure that the album IS populated with data if (sizeof($album_data['data']) == 0) { album_read_tree($user_id); } // 'search' the object $AH_this = isset($album_data['keys'][$cat_id]) ? $album_data['keys'][$cat_id] : ALBUM_ROOT_CATEGORY; // get the root or parent cat id $parent = $AH_this < 0 ? ALBUM_ROOT_CATEGORY : $album_data['parent'][$AH_this]; // renum objects of the same level and regenerate all $order = 0; $cats = array(); $parents = array(); // for the nuber of rows read/categories do this loop for ($i = 0; $i < sizeof($album_data['data']); $i++) { // ------------------------------------------------------------------------ // if the current itetorated parent id is equal to the selected category's parent id then // reorder the cat_order, the way that, if the found category is the selected category // then move the category by the sequentual order number + 'move direction value' // else give it the sequentual order number...this will ensure that the selected category // always is moved up or down compared to its siblings // ------------------------------------------------------------------------ if ($album_data['parent'][$i] == $parent) { $order = $order + 10; $neworder = $i == $AH_this ? $order + $move : $order; $album_data['data'][$i]['cat_order'] = $neworder; } // ------------------------------------------------------------------------ // fill these arrays which are going to be need in building the tree // (see album_read_tree for similiar code) // ------------------------------------------------------------------------ $idx = sizeof($cats); $cats[$idx] = $album_data['data'][$i]; $parents[$album_data['parent'][$i]][] = $idx; } // rebuild the tree $album_data = array(); album_build_tree($cats, $parents); // ------------------------------------------------------------------------ // re-order all categories...in the database acording to the album_tree // is really the same things as the reorder_cat in admin/album_cat.php // ------------------------------------------------------------------------ $order = 0; for ($i = 0; $i < sizeof($album_data['data']); $i++) { $order = $order + 10; $sql = "UPDATE " . ALBUM_CAT_TABLE . " SET cat_order={$order} WHERE cat_id=" . $album_data['id'][$i]; $db->sql_query($sql); } }
function album_build_jumpbox($cat_id, $user_id = ALBUM_PUBLIC_GALLERY, $auth_key = ALBUM_AUTH_VIEW) { global $lang, $album_data, $user; if (sizeof($album_data['data']) == 0) { // if $user_id != 0 then it's a personal gallery album_read_tree($user_id); } $user_ref = $user_id == ALBUM_PUBLIC_GALLERY ? "" : "?user_id={$user_id}"; $javascript = "<script type=\"text/JavaScript\"><!-- \n"; $javascript .= "function onchangeCheck() {\n"; $javascript .= " if(document.jumpbox.cat_id.value != " . ALBUM_JUMPBOX_SEPARATOR . ") {\n"; $javascript .= " document.jumpbox.submit();"; $javascript .= " }\n"; $javascript .= "}\n"; $javascript .= "// -->\n"; $javascript .= "</script>\n"; $res = $javascript; $res .= '<form name="jumpbox" action="' . append_sid(album_append_uid("album_cat." . PHP_EXT)) . '" method="get">'; $res .= $lang['Jump_to'] . ': <select name="cat_id" onchange="onChangeCheck()">'; $res .= album_get_tree_option($cat_id, $auth_key, ALBUM_SELECTBOX_INCLUDE_ROOT); $res .= '</select>'; $res .= ' <input type="submit" class="liteoption" value="' . $lang['Go'] . '" />'; $res .= '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />'; $res .= $user_id != ALBUM_PUBLIC_GALLERY ? '<input type="hidden" name="user_id" value="' . $user_id . '" />' : ''; $res .= '</form>'; return $res; }