예제 #1
0
		// Range: -1 Access: 0 Flags: ( 0, 4, 255 )
		public static void load_admins(  ) {
			dynamic C = null;
			ByTable rank_names = null;
			AdminRank R = null;
			ByTable Lines = null;
			dynamic line = null;
			ByTable List = null;
			string ckey = null;
			string rank = null;
			Admins D = null;
			DBQuery query = null;
			string ckey2 = null;
			string rank2 = null;
			Admins D2 = null;
			GlobalVars.admin_datums.Cut();
			C = null;
			foreach (dynamic _a in GlobalVars.admins ) {
				C = _a;
				if ( !Lang13.Bool( ((dynamic)typeof(Client)).IsInstanceOfType( C ) ) ) {
					continue;
				}
				((dynamic)C).remove_admin_verbs();
				C.holder = null;
			};
			GlobalVars.admins.Cut();
			GlobalFuncs.load_admin_ranks();
			rank_names = new ByTable();
			R = null;
			foreach (dynamic _b in GlobalVars.admin_ranks ) {
				if ( !( _b is AdminRank ) ) {
					continue;
				}
				R = _b;
				rank_names[R.name] = R;
			};
			if ( GlobalVars.config.admin_legacy_system ) {
				Lines = GlobalFuncs.file2list( "config/admins.txt" );
				line = null;
				foreach (dynamic _c in Lines ) {
					line = _c;
					if ( !Lang13.Bool( line.Length ) ) {
						continue;
					}
					if ( String13.find_exact_case( line, "#", 1, 2 ) != 0 ) {
						continue;
					}
					List = GlobalFuncs.text2list( line, "=" );
					if ( !( List.len != 0 ) ) {
						continue;
					}
					ckey = String13.ckey( List[1] );
					if ( !Lang13.Bool( ckey ) ) {
						continue;
					}
					rank = "";
					if ( List.len >= 2 ) {
						rank = String13.ckey_preserve_case( List[2] );
					}
					D = new Admins( rank_names[rank], ckey );
					if ( !( D != null ) ) {
						continue;
					}
					D.associate( GlobalVars.directory[ckey] );
				};
			} else {
				GlobalFuncs.establish_db_connection();
				if ( !GlobalVars.dbcon.IsConnected() ) {
					((dynamic)Game13.log).write( "Failed to connect to database in load_admins(). Reverting to legacy system." );
					((dynamic)GlobalVars.diary).write( "Failed to connect to database in load_admins(). Reverting to legacy system." );
					GlobalVars.config.admin_legacy_system = true;
					GlobalFuncs.load_admins();
					return;
				}
				query = GlobalVars.dbcon.NewQuery( "SELECT ckey, rank FROM " + GlobalFuncs.format_table_name( "admin" ) );
				query.Execute();
				while (query.NextRow()) {
					ckey2 = String13.ckey( query.item[1] );
					rank2 = String13.ckey_preserve_case( query.item[2] );
					if ( rank_names[rank2] == null ) {
						GlobalFuncs.warning( "" + ( "Admin rank (" + rank2 + ") does not exist." ) + " in " + "code/modules/admin/admin_ranks.dm" + " at line " + 183 + " src: " + Task13.source + " usr: "******"." );
						continue;
					}
					D2 = new Admins( rank_names[rank2], ckey2 );
					if ( !( D2 != null ) ) {
						continue;
					}
					D2.associate( GlobalVars.directory[ckey2] );
				}
			}
			return;
		}