function create_guilds_xml($shard) { global $time, $guilds_cache_timeout; $xml = simplexml_load_string('<guilds/>'); $cache = $xml->addChild('cache'); $cache->addAttribute('created', $time); $cache->addAttribute('expire', $time + $guilds_cache_timeout); $xml->addChild('shard', $shard); foreach (glob("/home/api/public_html/data/cache/guilds/guild_?????.xml") as $fn) { create_guild($xml, $fn, $shard); } // $dirname = "tmp/$shard"; // if ($handle = opendir($dirname)) { // while (false !== ($file = readdir($handle))) { // if (end(explode(".", $file)) == 'xml') { // create_guild($xml, "$dirname/$file"); // } // } // closedir($handle); // } save_xml("guilds_{$shard}", $xml); }
$char_data['online'] = user_is_online_10($user_id) ? 1 : 0; } // If character level is high enough if ($char_data['level'] >= $config['create_guild_level']) { // If character is offline if ($char_data['online'] == 0) { $acc_data = user_data($user_data['id'], 'premdays'); // If character is premium if ($config['guild_require_premium'] == false || $acc_data['premdays'] > 0) { if (get_character_guild_rank($user_id) < 1) { if (preg_match("/^[a-zA-Z_ ]+\$/", $_POST['guild_name'])) { // Only allow normal symbols as guild name $guildname = sanitize($_POST['guild_name']); $gid = get_guild_id($guildname); if ($gid === false) { create_guild($user_id, $guildname); header('Location: success.php'); exit; } else { echo 'A guild with that name already exist.'; } } else { echo 'Guild name may only contain a-z, A-Z and spaces.'; } } else { echo 'You are already in a guild.'; } } else { echo 'You need a premium account to create a guild.'; } } else {