[feladat @ 156]
Made a lot of small changes to allow PHP to run with error_reporting E_ALL without giving notices.
Most functions have been checked but some situations might give a notice.
<?php/* PowerAdmin, a friendly web-based admin tool for PowerDNS. * See <https://rejo.zenger.nl/poweradmin> for more details. * * Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */require_once("inc/toolkit.inc.php");if(isset($_POST["submit"])&&isset($_POST['username'])&&$_POST["username"]!=""&&isset($_POST['password'])&&$_POST["password"]!=""&&isset($_POST['fullname'])&&$_POST["fullname"]!=""&&isset($_POST['email'])&&$_POST["email"]!=""&&isset($_POST['level'])&&$_POST["level"]>0){if(substr_count($_POST["username"]," ")==0){if(strlen($_POST["password"])<8){$error=_('Password length should be at least 8 characters.');}else{add_user($_POST["username"],$_POST["password"],$_POST["fullname"],$_POST["email"],$_POST["level"],$_POST["description"],$_POST["active"]);clean_page("users.php");}}else{$error=_('Usernames can\'t contain spaces');}}elseif(isset($_POST["submit"])){$error=_('Please fill in all fields');}include_once("inc/header.inc.php");if(isset($error)&&$error!=""){?> <div class="error"><?phpecho$error;?></div><?php}?> <h2><?phpecho_('User admin');?></h2><?phpif(!level(10)){error(ERR_LEVEL_10);}?> <h3><?phpecho_('Current users');?></h3><?php$users=show_users('');?> <table> <tr> <th> </th> <th><?phpecho_('Name');?></th> <th><?phpecho_('Zones');?> (<?phpecho_('access');?>)</th> <th><?phpecho_('Zones');?> (<?phpecho_('owner');?>)</th> <th><?phpecho_('Zone list');?></th> <th><?phpecho_('Level');?></th> <th><?phpecho_('Status');?></th> </tr><?php$users=show_users('',ROWSTART,ROWAMOUNT);foreach($usersas$c){$domains=get_domains_from_userid($c["id"]);$num_zones_access=count($domains);?> <tr> <td class="n"><a href="delete_user.php?id=<?phpecho$c["id"]?>"><img src="images/delete.gif" alt="[ <?phpecho_('Delete user');?> ]"></a></td> <td class="n"><a href="edit_user.php?id=<?phpecho$c["id"]?>"><?phpecho$c["fullname"]?></A> (<?phpecho$c["username"]?>)</td> <td class="n"><?phpecho$num_zones_access?></td> <td class="n"><?phpecho$c["numdomains"]?></td> <td class="n"><?phpforeach($domainsas$d){?><a href="delete_domain.php?id=<?phpecho$d["id"]?>"><img src="images/delete.gif" alt="[ <?phpecho_('Delete domain');?> ]"></a> <a href="edit.php?id=<?phpecho$d["id"]?>"><?phpecho$d["name"]?><?phpif($d["partial"]=="1"){echo" *";};?></a><br><?php}?></td> <td class="n"><?phpecho$c["level"]?></td> <td class="n"><?phpechoget_status($c["active"])?></td> </tr><?phpprint"\n";}?> </table> <p><?phpecho_('Users may only change some of the records of zones marked with an (*).');?></p> <p><?phpecho_('Number of users');?>: <?phpechocount($users);?>.</p> <div class="showmax"><?phpshow_pages(count($users),ROWAMOUNT);?> </div> <?php// eo div showmax ?><h3><?phpecho_('Create new user');?></h3> <form method="post" action="users.php"> <table> <tr> <td class="n"><?phpecho_('User name');?>:</td> <td class="n"><input type="text" class="input" name="username" value="<?phpif(isset($error))print$_POST["username"];?>"></td> </tr> <tr> <td class="n"><?phpecho_('Full name');?>:</td> <td class="n"><input type="text" class="input" NAME="fullname" VALUE="<?phpif(isset($error))print$_POST["fullname"];?>"></td> </tr> <tr> <td class="n"><?phpecho_('Password');?>:</td> <td class="n"><input type="password" class="input" NAME="password" VALUE="<?phpif(isset($error))print$_POST["password"];?>"></td> </tr> <tr> <td class="n"><?phpecho_('E-mail');?>:</td> <td class="n"><input type="text" class="input" NAME="email" VALUE="<?phpif(isset($error))print$_POST["email"];?>"></td> </tr> <tr> <td class="n"><?phpecho_('User level');?>:</td> <td class="n"> <select name="level"> <option value="1">1 (<?phpecholeveldescription(1)?>)</option> <option value="5">5 (<?phpecholeveldescription(5)?>)</option> <option value="10">10 (<?phpecholeveldescription(10)?>)</option> </select> </td> </tr> <tr> <td class="n"><?phpecho_('Description');?>:</td> <td class="n"><textarea rows="6" cols="30" class="inputarea" name="description"><?phpif(isset($error))print$_POST["description"];?></textarea></td> </tr> <tr> <td class="n"><?phpecho_('Active');?>:</td> <td class="n"><input type="checkbox" name="active" value="1" checked></td> </tr> <tr> <td class="n"> </td> <td class="n"><input type="submit" class="button" name="submit" value="<?phpecho_('Add user');?>"></td> </tr> </table> </form><?phpinclude_once("inc/footer.inc.php");?>