Exemplo n.º 1
0
    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);
        $view_groups = @explode(',', $thiscat['cat_view_groups']);
Exemplo n.º 2
0
        $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;
$otf_pic_time = time();
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'] . ':&nbsp;<select name="cat_id" onchange="onChangeCheck()">';
    $res .= album_get_tree_option($cat_id, $auth_key, ALBUM_SELECTBOX_INCLUDE_ROOT);
    $res .= '</select>';
    $res .= '&nbsp;<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;
}
Exemplo n.º 4
0
            album_move_tree($cat_id, $move);
            // Return a message...
            showResultMessage($lang['Category_changed_order']);
        }
    }
} else {
    if ($_POST['mode'] == 'new') {
        if (is_array($_POST['addcategory'])) {
            list($cat_id) = each($_POST['addcategory']);
            $cat_title = stripslashes($_POST['name'][$cat_id]);
            $cat_parent = $cat_id;
            $cat_id = -1;
        }
        if (!isset($_POST['cat_title'])) {
            album_read_tree();
            $s_album_cat_list = album_get_tree_option($cat_parent, ALBUM_AUTH_VIEW, ALBUM_SELECTBOX_INCLUDE_ALL);
            $template->set_filenames(array('body' => ADM_TPL . 'album_cat_new_body.tpl'));
            $template->assign_vars(array('L_ALBUM_CAT_TITLE' => $lang['Album_Categories_Title'], 'L_ALBUM_CAT_EXPLAIN' => $lang['Album_Categories_Explain'], 'S_ALBUM_ACTION' => append_sid('admin_album_cat.' . PHP_EXT), 'L_CAT_TITLE' => $lang['Category_Title'], 'L_CAT_DESC' => $lang['Category_Desc'], 'L_CAT_PARENT_TITLE' => $lang['Parent_Category'], 'L_CAT_PERMISSIONS' => $lang['Category_Permissions'], 'L_VIEW_LEVEL' => $lang['View_level'], 'L_UPLOAD_LEVEL' => $lang['Upload_level'], 'L_RATE_LEVEL' => $lang['Rate_level'], 'L_COMMENT_LEVEL' => $lang['Comment_level'], 'L_EDIT_LEVEL' => $lang['Edit_level'], 'L_DELETE_LEVEL' => $lang['Delete_level'], 'L_PICS_APPROVAL' => $lang['Pics_Approval'], 'L_GUEST' => $lang['Forum_ALL'], 'L_REG' => $lang['Forum_REG'], 'L_PRIVATE' => $lang['Forum_PRIVATE'], 'L_MOD' => $lang['Forum_MOD'], 'L_ADMIN' => $lang['Forum_ADMIN'], 'L_DISABLED' => $lang['Disabled'], 'L_WATERMARK' => $lang['Watermark'], 'L_WATERMARK_EXPLAIN' => $lang['Watermark_explain'], 'S_CAT_TITLE' => stripslashes($cat_title), 'S_CAT_PARENT_OPTIONS' => $s_album_cat_list, 'VIEW_GUEST' => 'selected="selected"', 'UPLOAD_REG' => 'selected="selected"', 'RATE_REG' => 'selected="selected"', 'COMMENT_REG' => 'selected="selected"', 'EDIT_REG' => 'selected="selected"', 'DELETE_MOD' => 'selected="selected"', 'APPROVAL_DISABLED' => 'selected="selected"', 'S_MODE' => 'new', 'S_GUEST' => ALBUM_GUEST, 'S_USER' => ALBUM_USER, 'S_PRIVATE' => ALBUM_PRIVATE, 'S_MOD' => ALBUM_MOD, 'S_ADMIN' => ALBUM_ADMIN, 'L_PANEL_TITLE' => $lang['Create_category']));
            $template->pparse('body');
            include IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT;
        } else {
            if (!get_magic_quotes_gpc()) {
                $cat_title = addslashes(htmlspecialchars(trim($_POST['cat_title'])));
                $cat_desc = addslashes(trim($_POST['cat_desc']));
            } else {
                $cat_title = htmlspecialchars(trim($_POST['cat_title']));
                $cat_desc = trim($_POST['cat_desc']);
            }
            $cat_wm = trim($_POST['cat_wm']);
            $view_level = intval($_POST['cat_view_level']);
            $upload_level = intval($_POST['cat_upload_level']);
            $move = intval($_GET['move']);
            album_move_tree($cat_id, $move);
            // Return a message...
            showResultMessage($lang['Category_changed_order']);
        }
    }
} else {
    if ($_POST['mode'] == 'new') {
        if (is_array($_POST['addcategory'])) {
            list($cat_id) = each($_POST['addcategory']);
            $cat_title = stripslashes($_POST['name'][$cat_id]);
            $cat_parent = $cat_id;
            $cat_id = -1;
        }
        if (!isset($_POST['cat_title'])) {
            $s_album_cat_list = album_get_tree_option($cat_parent, ALBUM_AUTH_VIEW);
            if (empty($s_album_cat_list) || $cat_parent == 0) {
                $s_album_cat_list = '<option value="-1" selected="selected">' . sprintf($lang['Personal_Gallery_Of_User'], $username) . '</option>';
            }
            $template->assign_vars(array('S_ALBUM_ACTION' => append_sid(album_append_uid('album_personal_cat_admin.' . PHP_EXT)), 'L_CAT_TITLE' => $lang['Category_Title'], 'L_CAT_DESC' => $lang['Category_Desc'], 'L_CAT_PARENT_TITLE' => $lang['Parent_Category'], 'L_CAT_PERMISSIONS' => $lang['Category_Permissions'], 'ALBUM_NAVIGATION_ARROW' => ALBUM_NAV_ARROW, 'U_PERSONAL_ALBUM' => append_sid('album.' . PHP_EXT), 'L_PERSONAL_ALBUM' => sprintf($lang['Personal_Gallery_Of_User'], $username), 'U_PERSONAL_CAT_ADMIN' => append_sid(album_append_uid('album_personal_cat_admin.' . PHP_EXT . '?cat_id=' . $cat_id)), 'L_PERSONAL_CAT_ADMIN' => $lang['Personal_Cat_Admin'], 'L_VIEW_LEVEL' => $lang['View_level'], 'L_UPLOAD_LEVEL' => $lang['Upload_level'], 'L_RATE_LEVEL' => $lang['Rate_level'], 'L_COMMENT_LEVEL' => $lang['Comment_level'], 'L_GUEST' => $lang['Forum_ALL'], 'L_REG' => $lang['Forum_REG'], 'L_PRIVATE' => $lang['Forum_PRIVATE'], 'VIEW_GUEST' => $album_config['personal_gallery_view'] == ALBUM_GUEST ? 'selected="selected"' : '', 'VIEW_REG' => $album_config['personal_gallery_view'] == ALBUM_USER ? 'selected="selected"' : '', 'VIEW_PRIVATE' => $album_config['personal_gallery_view'] == ALBUM_PRIVATE ? 'selected="selected"' : '', 'UPLOAD_PRIVATE' => 'selected="selected"', 'RATE_REG' => 'selected="selected"', 'COMMENT_REG' => 'selected="selected"', 'S_CAT_TITLE' => stripslashes($cat_title), 'S_CAT_PARENT_OPTIONS' => $s_album_cat_list, 'CATEGORY_ID' => 0, 'ROOT_CATEGORY_ID' => ALBUM_ROOT_CATEGORY, 'ALBUM_PUBLIC_GALLERY' => intval(ALBUM_JUMPBOX_PUBLIC_GALLERY), 'ALBUM_ROOT_CATEGORY' => intval(ALBUM_ROOT_CATEGORY), 'ALBUM_USERS_GALLERY' => intval(ALBUM_JUMPBOX_USERS_GALLERY), 'ALBUM_JUMPBOX_SEPARATOR' => intval(ALBUM_JUMPBOX_SEPARATOR), 'L_NO_VALID_CAT_SELECTED' => $lang['No_valid_category_selected'], 'S_MODE' => 'new', 'S_GUEST' => ALBUM_GUEST, 'S_USER' => ALBUM_USER, 'S_PRIVATE' => ALBUM_PRIVATE, 'S_MOD' => ALBUM_MOD, 'S_ADMIN' => ALBUM_ADMIN, 'L_PANEL_TITLE' => $lang['Create_category']));
            full_page_generation('album_personal_cat_new_body.tpl', $lang['Album'], '', '');
        } else {
            $cat_title = request_var('cat_title', '', true);
            $cat_desc = request_var('cat_desc', '', true);
            $view_level = intval($_POST['cat_view_level']);
            $upload_level = intval($_POST['cat_upload_level']);
            $rate_level = intval($_POST['cat_rate_level']);
            $comment_level = intval($_POST['cat_comment_level']);
            $edit_level = intval($_POST['cat_edit_level']);
            $delete_level = intval($_POST['cat_delete_level']);
            $cat_approval = intval($_POST['cat_approval']);