From 867c2379ff66ce0f2c4f872a13027fd649aa076d Mon Sep 17 00:00:00 2001 From: z0rglub Date: Fri, 9 May 2003 12:42:42 +0000 Subject: Initial revision git-svn-id: http://piwigo.org/svn/trunk@2 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/perm.php | 270 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 admin/perm.php (limited to 'admin/perm.php') diff --git a/admin/perm.php b/admin/perm.php new file mode 100644 index 000000000..2407d9f6f --- /dev/null +++ b/admin/perm.php @@ -0,0 +1,270 @@ +".$lang['user_err_unknown'].""; + $erreur = true; + } + if ( $row['pseudo'] == $conf['webmaster'] ) + { + echo"
".$lang['user_err_modify']."
"; + $erreur = true; + } + } + //---------------------------------------------------données de la catégorie + if ( isset( $HTTP_GET_VARS['cat_id'] ) ) + { + $HTTP_GET_VARS['cat'] = $HTTP_GET_VARS['cat_id']; + check_cat_id( $HTTP_GET_VARS['cat_id'] ); + if ( isset( $page['cat'] ) ) + { + $result = get_cat_info( $page['cat'] ); + $page['cat_name'] = $result['name']; + $page['id_uppercat'] = $result['id_uppercat']; + } + } + //--------------------------------------------------------------- mise à jour + if ( isset( $HTTP_POST_VARS['submit'] ) ) + { + if ( isset( $HTTP_GET_VARS['user_id'] ) ) + { + mysql_query ( "delete from $prefixeTable"."restrictions where user_id = ".$HTTP_GET_VARS['user_id'].";" ); + $result = mysql_query ( "select id from $prefixeTable"."categories;" ); + while ( $row = mysql_fetch_array ( $result ) ) + { + $nom_select = "acces-".$row['id']; + if ( $HTTP_POST_VARS[$nom_select] == 1 ) + { + mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$HTTP_GET_VARS['user_id']."','".$row['id']."');" ); + } + } + check_favorites( $HTTP_GET_VARS['user_id'] ); + echo "
".$lang['permuser_info_message']." [ ".$lang['adduser_info_back']." ]
"; + } + else if ( isset( $HTTP_GET_VARS['cat_id'] ) ) + { + mysql_query ( "delete from $prefixeTable"."restrictions where cat_id = '".$page['cat']."';" ); + $result = mysql_query( "select id from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" ); + while ( $row = mysql_fetch_array ( $result ) ) + { + $nom_select = "acces-".$row['id']; + if ( $HTTP_POST_VARS[$nom_select] == 1 ) + { + mysql_query ( "insert into $prefixeTable"."restrictions (user_id,cat_id) values ('".$row['id']."','".$page['cat']."');" ); + } + check_favorites( $row['id'] ); + } + echo "
".$lang['permuser_info_message']." [ ".$lang['editcat_back']." ]
"; + } + } + //--------------------------------------------------------------- formulaire + function display_cat_manager( $id_uppercat, $indent, $uppercat_authorized, $level, $restriction ) + { + global $prefixeTable,$lang,$conf; + + $output = ""; + + // will we use or lines ? + if ( $level == 0 ) + { + $start_line = "$indent\">\" "; + if ( in_array( $row['id'], $restriction ) || !$uppercat_authorized ) + { + $subcat_authorized = false; + $color = "red"; + } + else + { + $color = "green"; + } + $output.= ""; + if ( $row['name'] == "" ) + { + $output.= str_replace( "_", " ", $row['dir'] ); + } + else + { + $output.= $row['name']; + } + $output.= " [ dir : ".$row['dir']." ]"; + $output.= "".$end_line; + $output.= "\n\t".$start_line2." style=\"width:15%;white-space:nowrap;text-align:right;font-weight:normal;\">"; + $output.= "\n\t\t".$lang['permuser_authorized']; + $output.= "\n\t\t + + ".$lang['permuser_title']." \"".$page['pseudo']."\" + + "; + $restriction = get_restrictions( $HTTP_GET_VARS['user_id'], $page['status'], false ); + echo" +
+
".$lang['permuser_warning']."
+ "; + + echo display_cat_manager( "NULL", "    ", true, 0, $restriction ); + + echo" + + + +
+ "; + } + //---------------------------------------------- + // cas 2 : permissions pour une catégorie donnée + else if ( isset( $HTTP_GET_VARS['cat_id'] ) ) + { + echo" +
+ + + +
".$lang['permuser_cat_title']."\"".get_cat_display_name( $page['cat_name'], " - ", "font-style:italic;" )."\"
"; + echo" +
+ "; + + $result = mysql_query( "select id,pseudo,status from $prefixeTable"."users where pseudo != '".$conf['webmaster']."';" ); + $i = 0; + while ( $row = mysql_fetch_array( $result ) ) + { + $restrictions = get_restrictions( $row['id'], $row['status'], false ); + $is_user_allowed = is_user_allowed( $page['cat'], $restrictions ); + $class = ""; + if ( $i%2 == 1 ) + { + $class = "class=\"row2\""; + } + echo" + + + + "; + $i++; + } + echo" + + + +
"; + echo " 0 ) + { + echo "red"; + } + else + { + echo "green"; + } + echo "\">".$row['pseudo'].""; + if ( $is_user_allowed == 2 ) + { + echo "".$lang['permuser_parent_forbidden'].""; + } + else + { + echo" + ".$lang['permuser_authorized']." + ".$lang['permuser_forbidden']; + } + echo" +
+
"; + } + } +?> \ No newline at end of file -- cgit v1.2.3