Delete record "
+ $data = get_record_from_id($_GET["id"]);
+ print $data["name"]." IN ".$data["type"]." ".$data["content"];
+ ?>"
+ if (($data["type"] == "NS" && $data["name"] == get_domain_name_from_id($_GET["domain"])) || $data["type"] == "SOA") {
+ print "You are trying to delete a record that is needed for this zone to work. ";
+ }
+ ?> Are you sure?
+
+
+ include_once("inc/footer.inc.php");
+}
+else
+{
+ message("Nothing to do!");
+}
+
diff -r 2cd8c1649ba9 -r 58094faf794d docs/ChangeLog
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/ChangeLog Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,687 @@
+2003-05-15 00:49 azurazu
+
+ * inc/footer.inc.php: Changed the version id + did some HTML code
+ layouting.. a bit just
+
+2003-05-15 00:48 azurazu
+
+ * edit_record.php: Really stupid bug.. we also have to be able to
+ modify records...
+
+2003-05-10 22:21 azurazu
+
+ * inc/record.inc.php: Fixed a bug in the delete_record which didnt
+ make it update the SOA serial thanks to Dolphin for reporting
+
+2003-05-10 22:20 azurazu
+
+ * index.php: Fixed a minimum pass length when a user changes his
+ pass. Min length is chosen to be 4
+
+2003-05-10 22:10 azurazu
+
+ * edit.php, edit_record.php: Fixed the bugs as sent in by Mario
+ Peschel, thanks a lot
+
+2003-05-04 23:38 azurazu
+
+ * inc/: record.inc.php, error.inc.php: Bug fixes
+
+2003-03-03 23:14 azurazu
+
+ * inc/record.inc.php: Search modifications to allow wild searches
+
+2003-02-25 02:46 azurazu
+
+ * docs/README: Cyberkid is our documentation god! Thanks for making
+ it all perfect! We love you :)
+
+2003-02-24 17:10 azurazu
+
+ * inc/config-block.inc.php: Small changes to increase the
+ understandability
+
+2003-02-24 17:08 azurazu
+
+ * docs/README: Updated for 1.2.4
+
+2003-02-24 17:08 azurazu
+
+ * docs/TODO: Minor changes
+
+2003-02-24 02:46 azurazu
+
+ * inc/toolkit.inc.php: If I say I fixed I should fix it, doh. 4 ->
+ 6 was left out. Broken
+
+2003-02-24 00:32 azurazu
+
+ * inc/record.inc.php: SOA Fixed
+
+2003-02-23 22:32 azurazu
+
+ * edit.php: Removed the add or remove users gimmics for level1
+ users
+
+2003-02-23 22:31 azurazu
+
+ * inc/dns.inc.php: MX Fixme
+
+2003-02-23 22:30 azurazu
+
+ * inc/record.inc.php: SOA fix
+
+2003-02-23 22:29 azurazu
+
+ * inc/toolkit.inc.php: Email check had an error.. long live .museum
+ tld's
+
+2003-02-14 23:58 azurazu
+
+ * seq_update.php: hit me please.
+
+2003-02-14 23:11 azurazu
+
+ * seq_update.php: fixed the _seq table problem
+
+2003-02-14 23:01 azurazu
+
+ * inc/dns.inc.php: dmnd noticed some bugs with SOA, thanks a lot :)
+
+2003-02-06 00:23 azurazu
+
+ * inc/header.inc.php: removed some blank lines
+
+2003-02-06 00:22 azurazu
+
+ * users.php: removed header error after adding users
+
+2003-02-05 23:24 azurazu
+
+ * inc/dns.inc.php: Allowed '-' in urls useful for cgi-bin or so:)
+
+2003-02-05 23:22 azurazu
+
+ * index.php: operator && should be || on line 67..
+
+2003-02-05 16:25 azurazu
+
+ * add_record.php: Dynamically updating of TTL or DEFAULT_TTL was
+ borked
+
+2003-01-13 23:08 azurazu
+
+ * inc/auth.inc.php: DOS Format..
+
+2003-01-13 00:03 azurazu
+
+ * users.php: Cosmetics, moved the active to the middle
+
+2003-01-12 23:43 azurazu
+
+ * edit.php, index.php: Added the MASTER/SLAVE information and
+ cleaned up code
+
+2003-01-12 23:42 azurazu
+
+ * inc/config-block.inc.php: New toggle
+
+2003-01-12 23:39 azurazu
+
+ * inc/record.inc.php: A lot of changes, it might really screw up :/
+
+2003-01-12 21:20 azurazu
+
+ * style/style.css.php: New style added to override the table
+
+2003-01-10 00:26 azurazu
+
+ * index.php, seq_update.php, users.php: Added navigation and
+ navigation checks, also changed layout here and there a tiny bit
+
+2003-01-10 00:25 azurazu
+
+ * inc/footer.inc.php: New version, new footer :)
+
+2003-01-10 00:24 azurazu
+
+ * inc/record.inc.php: Added search_record function to support the
+ search of records or domains
+
+2003-01-10 00:23 azurazu
+
+ * search.php: search.php, to allow you too search through your
+ files, thanks to DeViCeD
+
+2003-01-09 17:23 azurazu
+
+ * docs/ChangeLog: Changes, as usual :)
+
+2003-01-09 17:15 azurazu
+
+ * edit.php: Fixed two stupid bugs in edit.php, you couldnt add
+ users
+
+2003-01-08 01:40 azurazu
+
+ * test_setup.php: Kicked out the nice binary stuff, ah well.. hehe
+ and changed ti to a variable array, just as handy I would say, also
+ removed the _seq table checks which arent needed if this is ran the
+ first time or alike, thanks to our bug reporters
+
+2003-01-08 00:46 azurazu
+
+ * migrator.php-pa: Heavily modified, build in check so that if your
+ domains tablei s filled already it will nicely work etc.
+
+2003-01-08 00:41 lyon
+
+ * inc/: footer.inc.php, toolkit.inc.php: added a check for
+ install.php and migrator .php. error if the exist( security) added
+ a little "$db is actually an object" check in the footer
+
+2003-01-08 00:29 lyon
+
+ * install.php: added a config check
+
+2003-01-08 00:20 lyon
+
+ * install.php: Did some addslashes/stripslashes magic. made the
+ warning to delete the install.php a bit clearer. Fixed the error
+ function (first commit by me, w00t)
+
+2003-01-02 00:13 azurazu
+
+ * inc/footer.inc.php: New version
+
+2003-01-01 23:39 azurazu
+
+ * docs/TODO: removed some issues
+
+2003-01-01 23:36 azurazu
+
+ * edit.php, edit_record.php, index.php, inc/header.inc.php: Made
+ w3c happier :)
+
+2003-01-01 23:34 azurazu
+
+ * users.php: Added some features on the TODO (Name validation etc.)
+
+2003-01-01 23:33 azurazu
+
+ * delete_user.php, inc/users.inc.php: Fixed the deletion of users
+ and cleaned up the source
+
+2002-12-31 18:35 azurazu
+
+ * users.php: Added that password, fullname, email and username MUST
+ BE filled in
+
+2002-12-31 04:23 azurazu
+
+ * install.php: New installer
+
+2002-12-31 04:13 azurazu
+
+ * inc/toolkit.inc.php: Small bug in xs, thanks neetmans
+
+2002-12-31 02:17 azurazu
+
+ * docs/: CHANGELOG, ChangeLog: Updated the ChangeLog
+
+2002-12-31 01:59 azurazu
+
+ * migrator.php-pa: Added the migrator tool
+
+2002-12-31 01:56 azurazu
+
+ * index.php: Build in security check to see if a database is
+ converted or not
+
+2002-12-31 01:55 azurazu
+
+ * seq_update.php: Removed a newbie string
+
+2002-12-31 01:53 azurazu
+
+ * docs/README-Sequence: Sequence updater documentation
+
+2002-12-31 01:53 azurazu
+
+ * docs/README: Changes for 1.2
+
+2002-12-31 01:47 azurazu
+
+ * migrator.php-pa: migration tool
+
+2002-12-30 20:06 azurazu
+
+ * install.php: Changed it for the new version
+
+2002-12-27 03:48 azurazu
+
+ * delete_user.php: Function rename
+
+2002-12-27 03:48 azurazu
+
+ * edit.php: Fixed it so you can assign owners to a domain and also
+ delete them
+
+2002-12-27 03:47 azurazu
+
+ * seq_update.php: Removed an echo, sloppy
+
+2002-12-27 03:45 azurazu
+
+ * inc/auth.inc.php: Added some functions to make error reporting
+ happier
+
+2002-12-27 03:45 azurazu
+
+ * inc/database.inc.php: Some formatting probs
+
+2002-12-27 03:41 azurazu
+
+ * inc/footer.inc.php: This will be version 1.2 not 1.1.3
+
+2002-12-27 03:40 azurazu
+
+ * inc/record.inc.php: added delete_owner and changed change_owner
+ to add_owner to support multi ownage features and domains table
+
+2002-12-27 03:16 azurazu
+
+ * inc/toolkit.inc.php: Error handling in xs removed
+
+2002-12-24 21:33 azurazu
+
+ * edit.php, users.php: Inserted domains table
+
+2002-12-24 20:46 azurazu
+
+ * inc/: db.inc.php, record.inc.php: File is totally deprecated
+
+2002-12-21 01:50 azurazu
+
+ * seq_update.php: It was one big bug! How the heck could this
+ happen
+
+2002-12-20 20:17 azurazu
+
+ * inc/auth.inc.php: Dirty QUERY_STRING bug
+
+2002-12-18 02:13 azurazu
+
+ * delete_domain.php: Quickly added a ERROR define
+
+2002-12-18 02:09 azurazu
+
+ * index.php, seq_update.php: Added sequene number updater. Fixed
+ your database in case you do manual inserts
+
+2002-12-18 02:08 azurazu
+
+ * test_setup.php: Build a better test_setup
+
+2002-12-18 01:37 azurazu
+
+ * style/style.css.php: Added two style definitions: message and
+ messagetable
+
+2002-12-18 01:36 azurazu
+
+ * inc/toolkit.inc.php: Added message function
+
+2002-12-17 16:20 sjeemz
+
+ * inc/footer.inc.php: Changed our website (again)
+
+2002-12-17 16:17 sjeemz
+
+ * inc/footer.inc.php: Changed our website
+
+2002-12-17 16:16 azurazu
+
+ * docs/README: Added a story about PEAR
+
+2002-12-17 00:16 azurazu
+
+ * inc/footer.inc.php: CVS version
+
+2002-12-17 00:01 azurazu
+
+ * inc/dns.inc.php: MAJOR, really MAJOR regexp changes
+
+2002-12-16 01:42 azurazu
+
+ * inc/toolkit.inc.php: Added footer to error
+
+2002-12-16 01:38 azurazu
+
+ * docs/ChangeLog: GNU Style ChangeLog
+
+2002-12-16 01:26 azurazu
+
+ * edit_record.php: Fixed TTL bug
+
+2002-12-16 01:20 azurazu
+
+ * inc/toolkit.inc.php: Fixed a cough small cough is_valid_email
+ return bug
+
+2002-12-16 01:09 azurazu
+
+ * inc/dns.inc.php: Geez dumb bug, left a var_dump
+
+2002-12-16 00:43 azurazu
+
+ * install.php: Small bug, thanks l0ngb0ng
+
+2002-12-14 17:32 azurazu
+
+ * inc/dns.inc.php: Typo..
+
+2002-12-14 17:26 azurazu
+
+ * inc/dns.inc.php: Added wildcard records functionality, thanks
+ oscar
+
+2002-12-14 02:27 azurazu
+
+ * docs/REDHAT-README: Dirty Fix + BUG Description for RedHat 8.0
+
+2002-12-14 02:26 azurazu
+
+ * inc/dns.inc.php: is_valid_mx was borking with prio modifications,
+ thanks to oscar
+
+2002-12-14 01:52 azurazu
+
+ * install.php: RedHat BUG
+
+2002-12-14 01:07 azurazu
+
+ * install.php: Newline error?
+
+2002-12-10 02:30 azurazu
+
+ * style/style.css.php: Headers etc
+
+2002-12-10 02:28 azurazu
+
+ * test_setup.php: Changed it for PEAR, headers added aswell
+
+2002-12-10 02:27 azurazu
+
+ * users.php, add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, install.php: And made an error, DOH
+
+2002-12-10 02:26 azurazu
+
+ * add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, install.php, users.php: And added ID
+
+2002-12-10 02:24 azurazu
+
+ * add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, install.php: Added license and headers
+
+2002-12-10 01:55 azurazu
+
+ * inc/: auth.inc.php, database.inc.php, dns.inc.php, error.inc.php,
+ footer.inc.php, header.inc.php, record.inc.php, toolkit.inc.php,
+ users.inc.php: Added license information and headers
+
+2002-12-10 01:45 azurazu
+
+ * inc/auth.inc.php: Added fancy header (test:P)
+
+2002-12-10 01:31 azurazu
+
+ * inc/error.inc.php: Added errors
+
+2002-12-10 01:31 azurazu
+
+ * inc/dns.inc.php: Changed is_valid_hostname and is_valid_soa
+
+2002-12-09 23:52 azurazu
+
+ * inc/dns.inc.php: DNS Function enhancements (return values)
+
+2002-12-09 23:51 azurazu
+
+ * inc/error.inc.php: Added errors
+
+2002-12-09 22:19 azurazu
+
+ * inc/users.inc.php: Typo
+
+2002-12-04 02:51 azurazu
+
+ * install.php: Modifications all over... the script was weak in
+ general. Added some sort of support for pgsql but its not
+ implemented, just queries are there
+
+2002-12-03 23:12 azurazu
+
+ * docs/TODO: Changed the layout and added a few things
+
+2002-12-03 23:11 azurazu
+
+ * inc/users.inc.php: Removed is_valid_email and changed
+ implementation
+
+2002-12-03 23:11 azurazu
+
+ * inc/dns.inc.php: changed the function order and added some
+ comments
+
+2002-12-03 23:10 azurazu
+
+ * inc/toolkit.inc.php: moved is_valid_email to toolkit
+
+2002-12-03 01:04 azurazu
+
+ * inc/dns.inc.php: Finalized a big part of the checking.
+
+2002-12-03 01:03 azurazu
+
+ * inc/users.inc.php: Build is_valid_email functionality
+
+2002-12-02 22:05 azurazu
+
+ * inc/config-block.inc.php: Added fancy records toggle
+
+2002-12-02 21:41 azurazu
+
+ * docs/TODO: Changes
+
+2002-11-30 02:16 azurazu
+
+ * inc/toolkit.inc.php: Another newline bug.. bah
+
+2002-11-30 00:11 azurazu
+
+ * inc/dns.inc.php: Newline problems and NS validation added
+
+2002-11-29 23:32 azurazu
+
+ * inc/dns.inc.php: Splitted up and worked stuff out not bug free
+ yet I think
+
+2002-11-29 23:18 azurazu
+
+ * inc/record.inc.php: Bug Fix
+
+2002-11-26 01:09 azurazu
+
+ * users.php: Added ERR_LEVEL_10
+
+2002-11-26 01:05 azurazu
+
+ * inc/dns.inc.php: Removed a bug
+
+2002-11-26 01:05 azurazu
+
+ * inc/footer.inc.php: Added URL
+
+2002-11-26 01:04 azurazu
+
+ * inc/record.inc.php: Removed two bugs
+
+2002-11-26 01:02 azurazu
+
+ * inc/config-block.inc.php: Added 3 fields and removed deprecated
+ stuff
+
+2002-11-25 22:01 azurazu
+
+ * delete_user.php, edit_user.php: Changed the name of
+ get_name_from_userid to get_fullname_from_userid
+
+2002-11-25 22:00 azurazu
+
+ * inc/error.inc.php: Fixed a DUMB error in error.. d'oh and added
+ some more
+
+2002-11-25 21:59 azurazu
+
+ * inc/users.inc.php: Implemented comments and error handling in
+ users.inc.php
+
+2002-11-25 21:11 azurazu
+
+ * inc/: error.inc.php, toolkit.inc.php: Added error define
+ functionality
+
+2002-11-25 21:09 azurazu
+
+ * inc/record.inc.php: Added documentation for each function and
+ changed the error processing to a file called error.inc.php
+
+2002-11-25 19:16 azurazu
+
+ * docs/TODO: [no log message]
+
+2002-11-25 18:35 azurazu
+
+ * inc/dns.inc.php: Allow the notation of
+ 12.8/123.123.123.123.in-addr.arpa in the validators. Thanks to mijo
+ for reporting this bug
+
+2002-11-25 18:30 azurazu
+
+ * inc/: record.inc.php, users.inc.php: Major modifications and bug
+ fixes. Also added comments
+
+2002-11-21 23:40 azurazu
+
+ * inc/record.inc.php: Removed some comment crap
+
+2002-11-21 23:39 azurazu
+
+ * inc/dns.inc.php: Fixed some prio bugs
+
+2002-11-21 23:26 azurazu
+
+ * inc/: dns.inc.php, record.inc.php: Build in basic record
+ validation, not totally done yet. Moved the validation function to
+ dns.inc.php
+
+2002-11-05 00:57 azurazu
+
+ * inc/record.inc.php: I dont get the errors (one e ok) but the rest
+ is just stupid Windows probly :/
+
+2002-11-05 00:38 azurazu
+
+ * delete_user.php, index.php: Small bug fixes and enhancements
+
+2002-11-05 00:35 azurazu
+
+ * inc/record.inc.php: Heavy modifications and _STUPID_ bugfixes,
+ really checkout the CVS
+
+2002-11-03 16:07 azurazu
+
+ * inc/dns.inc.php: Fixed a nasty bug in is_valid_hostname
+
+2002-10-30 01:04 azurazu
+
+ * inc/: dns.inc.php, record.inc.php: A lot of changes for
+ validation. Has to be split up still but testing purposes first.
+ Not done yet
+
+2002-10-28 13:45 sjeemz
+
+ * docs/TODO: modified TODO file
+
+2002-10-28 02:57 azurazu
+
+ * inc/record.inc.php: Fixed several small bugs
+
+2002-10-28 02:56 azurazu
+
+ * inc/dns.inc.php: Fixed even better ipv4 check (oneliner) and
+ added function validate_record
+
+2002-10-27 23:00 azurazu
+
+ * docs/TODO: Removed database changes - see changelog
+
+2002-10-27 20:22 azurazu
+
+ * add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, users.php: Changing because of db.inc.php to
+ toolkit.inc.php
+
+2002-10-27 20:20 azurazu
+
+ * inc/footer.inc.php: Changed closing database system
+
+2002-10-27 20:19 azurazu
+
+ * inc/: auth.inc.php, dns.inc.php, record.inc.php, toolkit.inc.php,
+ users.inc.php: Clean up of db.inc.php
+
+2002-10-27 20:18 azurazu
+
+ * inc/: dal.inc.php, database.inc.php: Database Abstraction Layer
+ and implementation
+
+2002-10-27 20:17 azurazu
+
+ * inc/config-block.inc.php: Changed mysql fields to db fields
+
+2002-10-27 20:12 azurazu
+
+ * docs/CHANGELOG: Changed a few things
+
+2002-10-26 23:38 azurazu
+
+ * docs/TODO: Added 2 remarks
+
+2002-10-25 22:20 azurazu
+
+ * add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, install.php, test_setup.php, users.php, docs/CHANGELOG,
+ docs/README, docs/TODO, images/background.jpg, images/delete.gif,
+ images/edit.gif, inc/config-block.inc.php, inc/db.inc.php,
+ inc/footer.inc.php, inc/header.inc.php, style/style.css.php:
+ PowerAdmin initial source code submit
+
+2002-10-25 22:20 azurazu
+
+ * add_record.php, delete_domain.php, delete_record.php,
+ delete_user.php, edit.php, edit_record.php, edit_user.php,
+ index.php, install.php, test_setup.php, users.php, docs/CHANGELOG,
+ docs/README, docs/TODO, images/background.jpg, images/delete.gif,
+ images/edit.gif, inc/config-block.inc.php, inc/db.inc.php,
+ inc/footer.inc.php, inc/header.inc.php, style/style.css.php:
+ Initial revision
+
diff -r 2cd8c1649ba9 -r 58094faf794d docs/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/README Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,178 @@
+1. What is PowerAdmin
+------------------------------
+
+PowerAdmin is a non commercial front-end for the PowerDNS (www.powerdns.com) nameserver.
+The goal of PowerAdmin is to manage the (MySQL) database behind PowerDNS, which contains
+the DNS records.
+
+There have been some changes in this release, both of major and minor importance.
+Please read the following document to familiarize yourself with them. You are also
+requested to report any bugs should you encounter them.
+
+
+
+2. Where to get PowerAdmin
+------------------------------
+
+The main location of PowerAdmin is http://www.poweradmin.org
+
+
+
+3. Notes
+------------------------------
+
+
+3.1 Migrating
+------------------------------
+
+If you are running a stone-age version of PowerAdmin read the following information!
+
+Due to some major changes in this release the current version of PowerAdmin
+supports gmysql backend. You are strongly advised to backup your data before running the
+migrator.php tool in your poweradmin directory. This is to protect you against any data
+loss should anything go wrong. We assume it all works properly, but due to a limited
+number of betatesters we cannot guarantee our tool is 100% bug free.
+
+!! Please be sure you have a working backup of your data !!
+
+Do the following to migrate:
+- rename the file migrator.php-pa in your webdir to migrator.php.
+- Go here to migrate it.
+It is recommended to synchronize your database aswell after the update
+
+
+3.2 DB Information
+------------------------------
+
+For now on PowerAdmin supports PowerDNS' MySQL back-end only. If there is demand for other
+database layers support will be added in the near future. Of course, since the code is opensource,
+everyone who cannot wait is encouraged to plug in their own database layer (and if you dare, send the
+code to us so we can evaluate it and maybe integrate it with the current PowerAdmin).
+We are still busy with PostGreSQL, but the experience needs a bit more tweaking for us.
+Time will release it, we cannot yet.
+
+By using PEAR::DB we are bound to have some way to keep track of indexes. This is done by using seperate
+tables called users_seq and zones_seq. Also records_seq will be there. This means that if you manually
+insert a record, chances are 90% that you will have corrupted workings of PowerAdmin (because the ID is
+not in order.) The problem can be solved by running the Synchronize Database tool (select it or use the
+seq_update.php url). This will let you resynch your indexes. It is also useful if you are migrating
+from 1.0 to 1.1 or higher.
+
+Read more about this in README-Sequence
+
+
+4. Documentation
+------------------------------
+
+PowerAdmin has the following core features:
+
+- User Level dependant editing of domains. For example an administrator
+ can edit all domains, while a user can for example only edit the domain(s)
+ owned by him/her.
+
+- Simple administration of users that can access PowerAdmin.
+
+- Easy creating of domains. Next of that, the proper assignment of rights
+ is simply and done within a few clicks.
+
+- Ability to apply a record-template when creating domains. For now, the template
+ can only be configured in the config file, but this will be moved to a nice
+ database-table soon.
+
+- Editting records in existing zones.
+
+
+5. Installation
+------------------------------
+
+!! If you are updating, you should necessarily read paragraph 3 !!
+
+What you need:
+- PowerDNS (Duh!) (Versions 2.1 through 2.6 have been tested, others might work aswell)
+ http://www.powerdns.com/
+- MySQL
+ http://www.mysql.com/
+- An (Apache) webserver that supports php4 and php4-mysql. The PHP version must be at least 4.2.1.
+ http://www.apache.org/
+ http://www.php.net/
+
+First of all, install PowerDNS with it's MySQL Generic back-end.
+
+Next to the MySQL user you created for PowerDNS, you need a MySQL user for PowerAdmin that can do
+the following actions on the PowerDNS database you created: SELECT, INSERT, DELETE, UPDATE, CREATE.
+
+Untar/gzip poweradmin-VERSION.tar.gz in your webdir. This will create a directory called
+poweradmin-VERSION.
+
+In the 'inc' subdirectory of your newly created directory, you'll find a file called
+config-block.inc.php. Edit this file to suit your environment. Then rename it to
+config.inc.php to be able to load the site. The website will not work properly without a config,
+so pay attention to your configuration!
+
+Next, go to http://www.yourdomain.com/poweradmin-VERSION/install.php
+
+Fill in the required information to make an administrator login for your
+PowerAdmin. If all goes well, the user is made, and you can log in using that username.
+WARNING! Be sure to remove install.php from the webdir!
+
+After you are done, run http://www.yourdomain.com/poweradmin-VERSION/test_setup.php to see if
+everything is set up well.
+This test also includes the functionality testing of your PowerDNS records (whether you
+have read/write access or not)
+
+
+6. User levels explained
+------------------------------
+User levels explained:
+
+[x] = yes
+[ ] = no
+
+User Permission to Permission to Permission to Permission to
+Level change own change other create domains add/modify
+ domain(s) domain(s) users
+
+ 1 [x] [ ] [ ] [ ]
+ 5 [x] [x] [x] [ ]
+ 10 [x] [x] [x] [x]
+
+
+7. Further Info && Bugs
+------------------------------
+
+The latest contact information can always be found at http://www.poweradmin.org .
+
+
+8. Links and more information
+------------------------------
+
+http://www.poweradmin.org Our main site
+http://www.powerdns.com PowerDNS
+http://www.ietf.org Information about DNS
+http://poweradmin.sf.net PowerAdmin @ SourceForge
+http://www.apache.org/ The Apache Webserver
+http://www.php.net/ PHP programming language
+http://www.mysql.com/ MySQL database server
+
+9. Changes
+------------------------------
+
+Changes for this version are:
+- Many many many bug fixes!
+- Enhanced sequence updater that is now smarter.
+- SOA Fields fixed.
+- Automatically SOA serial updating after each change in the DNS.
+- MASTER/SLAVE Functionality but that stays untested at the moment of writing.
+ Use the toggles with care, see the config-block.inc.php for more information.
+- Search abilities added thanks to DeViCeD
+- A lot of other stuff and minor details not worth mentioning that much.
+
+
+--------------------------------------------------------------------------
+Enjoy!
+
+There are some major changes, we would like feedback!
+See paragraph 7 for contact information.
+
+Regards,
+The PowerAdmin Team
diff -r 2cd8c1649ba9 -r 58094faf794d docs/README-Sequence
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/README-Sequence Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,60 @@
+1. What is the Sequence Updater
+-------------------------------
+
+The Sequence updater is written to synchronize your PowerAdmin/DNS database
+after you have manually inserted records into it.
+
+2. Why do I need that?
+-------------------------------
+
+Because PowerAdmin uses the php-PEAR::DB library it is using sequence numbers.
+A sequence number simply tells the application what will be the next ID
+for insertion. Some of the mysql users are now shouting auto_increment.
+Yes auto_increment, but we cant use this here because we plan to use
+PostGreSQL or Other db's that dont have auto_increment so we are stuck to
+using sequence numbers.
+
+3. What does this mean?
+-------------------------------
+
+This means that if you dont run this tool after you have been manually adding
+records, your database might be corrupted and PowerAdmin might be kicking
+you back with a lot of errors.
+
+4. Ok, I got it, now what?
+-------------------------------
+
+Put this file in your PowerAdmin directory. Login into PowerAdmin using the normal
+system. Now go to the url where you put it and done, the sequence numbers are
+updated.
+
+5. Future versions
+-------------------------------
+
+In all versions higher than 1.1.2 this function will be automatically there for
+administrators.
+
+6. Contact
+
+6. Further Info && Bugs
+------------------------------
+
+To contact us we refer you to http://www.poweradmin.org/ for the latest
+contact information.
+
+7. Links and more information
+------------------------------
+
+http://www.poweradmin.org l Our main site
+http://www.powerdns.com PowerDNS
+http://www.ietf.org Information about DNS
+http://poweradmin.sf.net PowerAdmin @ SourceForge
+http://www.apache.org/ The Apache Webserver
+http://www.php.net/ PHP programming language
+http://www.mysql.com/ MySQL database server
+
+--------------------------------------------------------------------------
+
+Regards,
+The PowerAdmin Team
+
diff -r 2cd8c1649ba9 -r 58094faf794d docs/REDHAT-README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/REDHAT-README Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,88 @@
+RedHat 8.0 BUG and howto 'fix'
+
+Ok it seems to be that there is some bug in PowerAdmin (for now we assume so).
+It is currently reported all on RedHat 8.0 machines.
+
+The bug seems to be appear when Apache 2.0 is being used with the default
+installed PHP RPM on the platform. New shapshots might remove this bug. We havent
+tested this yet. If you have any more insights on this bug please email us
+at info@poweradmin.sjeemz.nl
+
+We kindly refer you to http://bugs.php.net/bug.php?id=18648
+We havent tested this out fully yet! Not even the fix since we arent native
+RedHat users.
+
+Quick dirty fix. We just avoid the bug by not using php :)
+
+NOTE: THIS IS A MYSQL FIX!
+
+Ok what to do:
+
+- Login to mysql using the poweradmin account information.
+- Issue the following queries:
+
+
+/****************
+ * USER TABLE *
+ ***************/
+
+CREATE TABLE users (
+id int(11) NOT NULL,
+username varchar(16) NOT NULL default '',
+password varchar(255) NOT NULL default '',
+fullname varchar(255) NOT NULL default '',
+email varchar(255) NOT NULL default '',
+description text NOT NULL,
+level tinyint(4) NOT NULL default '0',
+active tinyint(4) NOT NULL default '0',
+PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+/****************
+ * ZONES TABLE *
+ ***************/
+
+CREATE TABLE zones (
+id int(11) NOT NULL,
+name varchar(255) NOT NULL default '',
+owner int(11) NOT NULL default '0',
+comment text NOT NULL,
+PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+
+
+/************************
+ * INSTALL YOURSELF *
+ ***********************/
+
+- $login == your prefered login
+- $full == your fullname
+- $pass == your prefered password
+- $email == your prefered email
+- $desc == your prefered description
+
+INSERT INTO users VALUES (1,'$login',md5('$pass'),'$full','$email','$description',10,1)
+
+Example
+INSERT INTO users VALUES (1,'trance',md5('test'),'me','trancer@nospam.trancer.nl','its me!',10,1);
+
+- Ok, now we have a problem. PowerAdmin uses PEAR. And to remain independent PEAR has
+its own incrementation functions. For this there is a seperate table. We didnt use pear yet, therefore
+the current setup is inconsistent with what pear is thinking (you are one id behind).
+We now have to setup a users_seq table for this.
+
+
+CREATE TABLE users_seq (
+ id int(10) unsigned NOT NULL auto_increment,
+ PRIMARY KEY (id)
+) TYPE=MyISAM;
+
+INSERT INTO users_seq VALUES (1);
+
+
+Done! It should now work. If you encounter any problems feel free to email us, also monitor the website
+bugfixes might come available.
+
+Roeland, PowerAdmin Team
+
diff -r 2cd8c1649ba9 -r 58094faf794d docs/TODO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/TODO Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,26 @@
+The TODO isnt much atm, to be fixed in the feature using a bug tracker.
+The documentation has to be converted to docbook or a similar format.
+
+Legenda:
+ + = useful option, or not too hard to implement, should be implemented in time.
+ - = might be useful but time consuming and maybe a bit overkill. Nice if we have time left :)
+ * = being worked on
+
+ +- Add some more webbased support for those who dont know DNS.
+ -- disable priority when adding IN A (JavaScript)
+ +- put the template(s) in database.
+ -- Multilanguage support is an option?
+ +- logging functionality
+ +- accept email/url when adding new domains.
+ +- add support for more pdns backends
+ *- Move error codes to defined file.
+ -- a little checkbox that would state: create corresponding PTR record
+ -- change the listing order (Ian's remark)
+Priority:
+ +- slave master functionality, also includes issue below
+ +- mijo requested a function so that SOA records serials would be auto incremented. This in combination with bind
+ backends that require so
+ +- fix multidatabase install.php
+ +- Document security issues on mysql level.
+
+
diff -r 2cd8c1649ba9 -r 58094faf794d edit.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/edit.php Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,279 @@
+ trancer nl> |
+// | Sjeemz sjeemz nl> |
+// +--------------------------------------------------------------------+
+
+//
+// $Id: edit.php,v 1.12 2003/05/10 20:10:47 azurazu Exp $
+//
+
+require_once("inc/toolkit.inc.php");
+
+// Assigning records to user: Check for records owned by user
+
+if (isset($_POST["action"]) && $_POST["action"]=="record-user") {
+ foreach ($_POST["rowid"] as $x_user => $x_value){
+ $x_userid = $db->getOne("SELECT id FROM record_owners WHERE user_id = '".$_POST["userid"]."' AND record_id='".$x_value."'");
+ if (empty($x_userid)) {
+ $db->query("INSERT INTO record_owners SET user_id = '".$_POST["userid"]."',record_id='".$x_value."'");
+ }
+ }
+}
+
+$server_types = array("MASTER", "SLAVE", "NATIVE");
+
+if(isset($_POST['type_change']) && in_array($_POST['newtype'], $server_types))
+{
+ change_domain_type($_POST['newtype'], $_GET['id']);
+}
+if(isset($_POST["newowner"]) && is_numeric($_POST["domain"]) && is_numeric($_POST["newowner"]))
+{
+ add_owner($_POST["domain"], $_POST["newowner"]);
+}
+
+if(isset($_POST["del_user"]) && is_numeric($_POST["del_user"]) && level(5))
+{
+ delete_owner($_GET["id"], $_POST["del_user"]);
+}
+
+include_once("inc/header.inc.php");
+?>
+
+
+$x_result = $db->query("SELECT r.id,u.username FROM record_owners as r, users as u WHERE r.record_id='".$_GET['id']."' AND u.id=r.user_id");
+while ($x_r = $x_result->fetchRow()) {
+ echo "
Edit user "= get_fullname_from_userid($_GET["id"]) ?>"
+
+if (level(10))
+{
+?>
+ User Admin >> Edit User
+
+}
+
+$r = array();
+$r = get_user_info($_GET["id"]);
+
+?>
+
+
+
+include_once("inc/footer.inc.php");
+
+?>
diff -r 2cd8c1649ba9 -r 58094faf794d images/arrow.png
Binary file images/arrow.png has changed
diff -r 2cd8c1649ba9 -r 58094faf794d images/background.jpg
Binary file images/background.jpg has changed
diff -r 2cd8c1649ba9 -r 58094faf794d images/delete.gif
Binary file images/delete.gif has changed
diff -r 2cd8c1649ba9 -r 58094faf794d images/edit.gif
Binary file images/edit.gif has changed
diff -r 2cd8c1649ba9 -r 58094faf794d inc/BAKrecord.inc.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/BAKrecord.inc.php Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,1084 @@
+
+
+// +--------------------------------------------------------------------+
+// | PowerAdmin |
+// +--------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PowerAdmin Team |
+// +--------------------------------------------------------------------+
+// | This source file is subject to the license carried by the overal |
+// | program PowerAdmin as found on http://poweradmin.sf.net |
+// | The PowerAdmin program falls under the QPL License: |
+// | http://www.trolltech.com/developer/licensing/qpl.html |
+// +--------------------------------------------------------------------+
+// | Authors: Roeland Nieuwenhuis trancer nl> |
+// | Sjeemz sjeemz nl> |
+// +--------------------------------------------------------------------+
+
+// Filename: record.inc.php
+// Startdate: 26-10-2002
+// This file is ought to edit the records in the database.
+// Records are domains aswell, they also belong here.
+// All database functions are associative.
+// use nextID first to get a new id. Then insert it into the database.
+// do not rely on auto_increment (see above).
+// use dns.inc.php for validation functions.
+//
+// $Id: record.inc.php,v 1.21 2003/05/10 20:21:01 azurazu Exp $
+//
+
+
+function update_soa_serial($domain_id)
+{
+ global $db;
+ /*
+ * THIS CODE ISNT TESTED THROUGH MUCH YET!
+ * !!!!!!! BETACODE !!!!!!!!!!
+ * Code committed by DeViCeD, Thanks a lot!
+ * Heavily hax0red by Trancer/azurazu
+ *
+ * First we have to check, wheather current searial number
+ * was already updated on the other nameservers.
+ * If field 'notified_serial' is NULL, then I guess domain is
+ * NATIVE and we don't have any secondary nameservers for this domain.
+ * NOTICE: Serial number *will* be RFC1912 compilant after update
+ * NOTICE: This function will allow only 100 DNS zone transfers ;-)
+ * YYYYMMDDnn
+ */
+
+ $sqlq = "SELECT `notified_serial` FROM `domains` WHERE `id` = '".$domain_id."'";
+ $notified_serial = $db->getOne($sqlq);
+
+ $sqlq = "SELECT `content` FROM `records` WHERE `type` = 'SOA' AND `domain_id` = '".$domain_id."'";
+ $content = $db->getOne($sqlq);
+ $need_to_update = false;
+
+ // Getting the serial field.
+ $soa = explode(" ", $content);
+
+ if(empty($notified_serial))
+ {
+ // Ok native replication, so we have to update.
+ $need_to_update = true;
+ }
+ elseif($notified_serial >= $soa[2])
+ {
+ $need_to_update = true;
+ }
+ elseif(strlen($soa[2]) != 10)
+ {
+ $need_to_update = true;
+ }
+ else
+ {
+ $need_to_update = false;
+ }
+ if($need_to_update)
+ {
+ // Ok so we have to update it seems.
+ $current_serial = $soa[2];
+
+ /*
+ * What we need here (for RFC1912) is YEAR, MONTH and DAY
+ * so let's get it ...
+ */
+ $new_serial = date('Ymd'); // we will add revision number later
+
+ if(strncmp($new_serial, $current_serial, 8) === 0)
+ {
+ /*
+ * Ok, so we already made updates tonight
+ * let's just increase the revision number
+ */
+ $revision_number = (int) substr($current_serial, -2);
+ if ($revision_number == 99) return false; // ok, we cannot update anymore tonight
+ ++$revision_number;
+ // here it is ... same date, new revision
+ $new_serial .= str_pad($revision_number, 2, "0", STR_PAD_LEFT);
+ }
+ else
+ {
+ /*
+ * Current serial is not RFC1912 compilant, so let's make a new one
+ */
+ $new_serial .= '00';
+ }
+ $soa[2] = $new_serial; // change serial in SOA array
+ $new_soa = "";
+ // build new soa and update SQL after that
+ for ($i = 0; $i < count($soa); $i++)
+ {
+ $new_soa .= $soa[$i] . " ";
+ }
+ $sqlq = "UPDATE `records` SET `content` = '".$new_soa."' WHERE `domain_id` = '".$domain_id."' AND `type` = 'SOA' LIMIT 1";
+ $db->Query($sqlq);
+ return true;
+ }
+}
+
+/*
+ * Edit a record.
+ * This function validates it if correct it inserts it into the database.
+ * return values: true if succesful.
+ */
+function edit_record($recordid, $zoneid, $name, $type, $content, $ttl, $prio)
+{
+ global $db;
+ if($content == "")
+ {
+ error(ERR_RECORD_EMPTY_CONTENT);
+ }
+ // Edits the given record (validates specific stuff first)
+ if (!xs(recid_to_domid($recordid)))
+ {
+ error(ERR_RECORD_ACCESS_DENIED);
+ }
+ if (is_numeric($zoneid))
+ {
+ validate_input($recordid, $zoneid, $type, $content, $name, $prio, $ttl);
+ $change = time();
+ $db->query("UPDATE records set name='$name', type='$type', content='$content', ttl='$ttl', prio='$prio', change_date='$change' WHERE id=$recordid");
+
+ /*
+ * Added by DeViCeD - Update SOA Serial number
+ * There should be more checks
+ */
+ if ($type != 'SOA')
+ {
+ update_soa_serial($zoneid);
+ }
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "edit_record", "no zoneid given"));
+ }
+
+}
+
+
+/*
+ * Adds a record.
+ * This function validates it if correct it inserts it into the database.
+ * return values: true if succesful.
+ */
+function add_record($zoneid, $name, $type, $content, $ttl, $prio)
+{
+ global $db;
+ if (!xs($zoneid))
+ {
+ error(ERR_RECORD_ACCESS_DENIED);
+ }
+ if (is_numeric($zoneid))
+ {
+
+ // Get the Insert ID, we can not rely on auto_increment
+ $idrecords = $db->nextID('records');
+
+ // Check the user input.
+ validate_input($idrecords, $zoneid, $type, $content, $name, $prio, $ttl);
+
+ // Generate new timestamp for the Daemon
+ $change = time();
+
+ // Execute query.
+ $db->query("INSERT INTO records (id, domain_id, name, type, content, ttl, prio, change_date) VALUES ($idrecords, $zoneid, '$name', '$type', '$content', $ttl, '$prio', $change)");
+ if ($type != 'SOA')
+ {
+ update_soa_serial($zoneid);
+ }
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "add_record"));
+ }
+}
+
+
+/*
+ * Delete a record by a given id.
+ * return values: true, this function is always succesful.
+ */
+function delete_record($id)
+{
+ global $db;
+
+ // Check if the user has access.
+ if (!xs(recid_to_domid($id)))
+ {
+ error(ERR_RECORD_ACCESS_DENIED);
+ }
+
+ // Retrieve the type of record to see if we can actually remove it.
+ $recordtype = get_recordtype_from_id($id);
+
+ // If the record type is NS and the user tries to delete it while ALLOW_NS_EDIT is set to 0
+ // OR
+ // check if the name of the record isnt the domain name (if so it should delete all records)
+ // OR
+ // check if we are dealing with a SOA field (same story as NS)
+ if (($recordtype == "NS" && $GLOBALS["ALLOW_NS_EDIT"] != 1 && (get_name_from_record_id($id) == get_domain_name_from_id(recid_to_domid($id)))) || ($recordtype == "SOA" && $GLOBALS["ALLOW_SOA_EDIT"] != 1))
+ {
+ error(sprintf(ERR_RECORD_DELETE_TYPE_DENIED, $recordtype));
+
+ }
+ if (is_numeric($id))
+ {
+ $did = recid_to_domid($id);
+ $db->query('DELETE FROM records WHERE id=' . $id . ' LIMIT 1');
+ if ($type != 'SOA')
+ {
+ update_soa_serial($did);
+ }
+ // $id doesnt exist in database anymore so its deleted or just not there which means "true"
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "delete_record"));
+ }
+}
+
+
+/*
+ * Add a domain to the database.
+ * A domain is name obligatory, so is an owner.
+ * return values: true when succesful.
+ * Empty means templates dont have to be applied.
+ * --------------------------------------------------------------------------
+ * This functions eats a template and by that it inserts various records.
+ * first we start checking if something in an arpa record
+ * remember to request nextID's from the database to be able to insert record.
+ * if anything is invalid the function will error
+ */
+function add_domain($domain, $owner, $webip, $mailip, $empty, $type)
+{
+
+ global $db;
+
+ if (!level(5))
+ {
+ error(ERR_LEVEL_5);
+ }
+
+ // If domain, owner and mailip are given
+ // OR
+ // empty is given and owner and domain
+ // OR
+ // the domain is an arpa record and owner is given
+ // THAN
+ // Continue this function
+ if (($domain && $owner && $webip && $mailip) || ($empty && $owner && $domain) || (eregi('in-addr.arpa', $domain) && $owner))
+ {
+ // Retrieve next zones id.
+ $idzones = $db->nextID('zones');
+ $iddomains = $db->nextID('domains');
+
+ $db->query("INSERT INTO zones (id, domain_id, owner) VALUES ('$idzones', '$iddomains', $owner)");
+
+ /*
+ * TODO : NATIVE OPERATION ONLY FOR NOW
+ */
+
+ $db->query("INSERT INTO domains (id, name, type) VALUES ('$iddomains', '$domain', '$type')");
+
+ // Generate new timestamp. We need this one anyhow.
+ $now = time();
+
+ if ($empty && $iddomains)
+ {
+ // If we come into this if statement we dont want to apply templates.
+ // Retrieve configuration settings.
+ $ns1 = $GLOBALS["NS1"];
+ $hm = $GLOBALS["HOSTMASTER"];
+ $ttl = $GLOBALS["DEFAULT_TTL"];
+
+ // Retrieve next records id
+ $idrecords = $db->nextID('records');
+
+ // Build and execute query
+ $sql = "INSERT INTO records (id, domain_id, name, content, type, ttl, prio, change_date) VALUES ('$idrecords', '$iddomains', '$domain', '$ns1 $hm 1', 'SOA', $ttl, '', '$now')";
+ $db->query($sql);
+
+ // Done
+ return true;
+ }
+ elseif ($iddomains)
+ {
+ // If we are here we want to apply templates.
+ global $template;
+
+ // Iterate over the template and apply it for each field.
+ foreach ($template as $r)
+ {
+ // Same type of if statement as previous.
+ if ((eregi('in-addr.arpa', $domain) && ($r["type"] == "NS" || $r["type"] == "SOA")) || (!eregi('in-addr.arpa', $domain)))
+ {
+ // Parse the template.
+ $name = parse_template_value($r["name"], $domain, $webip, $mailip);
+ $type = $r["type"];
+ $content = parse_template_value($r["content"], $domain, $webip, $mailip);
+ $ttl = $r["ttl"];
+ $prio = $r["prio"];
+
+ // If no ttl is given, use the default.
+ if (!$ttl)
+ {
+ $ttl = $GLOBALS["DEFAULT_TTL"];
+ }
+
+ // Retrieve new record id;
+ $idrecords = $db->nextID('records');
+ $sql = "INSERT INTO records (id, domain_id, name, content, type, ttl, prio, change_date) VALUES ('$idrecords', '$iddomains', '$name','$content','$type','$ttl','$prio','$now')";
+ $db->query($sql);
+ }
+ }
+ // All done.
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "add_domain", "could not create zone"));
+ }
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "add_domain"));
+ }
+}
+
+
+/*
+ * Deletes a domain by a given id.
+ * Function always succeeds. If the field is not found in the database, thats what we want anyway.
+ */
+function delete_domain($id)
+{
+ global $db;
+
+ if (!level(5))
+ {
+ error(ERR_LEVEL_5);
+ }
+
+ // See if the ID is numeric.
+ if (is_numeric($id))
+ {
+ $db->query("DELETE FROM zones WHERE domain_id=$id");
+ $db->query("DELETE FROM domains WHERE id=$id");
+ $db->query("DELETE FROM records WHERE domain_id=$id");
+ // Nothing in the database. If the delete deleted 0 records it means the id is just not there.
+ // therefore the is no need to check the affectedRows values.
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "delete_domain", "id must be a number"));
+ }
+}
+
+
+/*
+ * Gets the id of the domain by a given record id.
+ * return values: the domain id that was requested.
+ */
+function recid_to_domid($id)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT domain_id FROM records WHERE id=$id");
+ $r = $result->fetchRow();
+ return $r["domain_id"];
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "recid_to_domid", "id must be a number"));
+ }
+}
+
+
+/*
+ * Sorts a zone by records.
+ * return values: the sorted zone.
+ */
+function sort_zone($records)
+{
+ $ar_so = array();
+ $ar_ns = array();
+ $ar_mx = array();
+ $ar_mb = array();
+ $ar_ur = array();
+ $ar_ov = array();
+ foreach ($records as $c)
+ {
+ switch(strtoupper($c['type']))
+ {
+ case "SOA":
+ $ar_so[] = $c;
+ break;
+ case "NS":
+ $ar_ns[] = $c;
+ break;
+ case "MX":
+ $ar_mx[] = $c;
+ break;
+ case "MBOXFW":
+ $ar_mb[] = $c;
+ break;
+ case "URL":
+ $ar_ur[] = $c;
+ break;
+ default:
+ $ar_ov[] = $c;
+ break;
+ }
+ }
+
+ $res = array_merge($ar_so, $ar_ns, $ar_mx, $ar_mb, $ar_ur, $ar_ov);
+
+ if (count($records) == count($res))
+ {
+ $records = $res;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "sort_zone", "records sorting failed!"));
+ }
+ return $records;
+}
+
+
+/*
+ * Change owner of a domain.
+ * Function should actually be in users.inc.php. But its more of a record modification than a user modification
+ * return values: true when succesful.
+ */
+function add_owner($domain, $newowner)
+{
+ global $db;
+
+ if (!level(5))
+ {
+ error(ERR_LEVEL_5);
+ }
+
+ if (is_numeric($domain) && is_numeric($newowner) && is_valid_user($newowner))
+ {
+ $iid = $db->nextID('zones');
+ if($db->getOne("SELECT COUNT(id) FROM zones WHERE owner=$newowner AND domain_id=$domain") == 0)
+ {
+ $db->query("INSERT INTO zones(id, domain_id, owner) VALUES($iid, $domain, $newowner)");
+ }
+ return true;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "change_owner", "$domain / $newowner"));
+ }
+}
+
+
+function delete_owner($domain, $owner)
+{
+ global $db;
+ if($db->getOne("SELECT COUNT(id) FROM zones WHERE owner=$owner AND domain_id=$domain") != 0)
+ {
+ $db->query("DELETE FROM zones WHERE owner=$owner AND domain_id=$domain");
+ }
+ return true;
+}
+
+/*
+ * Retrieves all supported dns record types
+ * This function might be deprecated.
+ * return values: array of types in string form.
+ */
+function get_record_types()
+{
+ global $rtypes;
+ return $rtypes;
+}
+
+
+/*
+ * Retrieve all records by a given type and domain id.
+ * Example: get all records that are of type A from domain id 1
+ * return values: a DB class result object
+ */
+function get_records_by_type_from_domid($type, $recid)
+{
+ global $rtypes;
+ global $db;
+
+ // Does this type exist?
+ if(!in_array(strtoupper($type), $rtypes))
+ {
+ error(sprintf(ERR_INV_ARGC, "get_records_from_type", "this is not a supported record"));
+ }
+
+ // Get the domain id.
+ $domid = recid_to_domid($recid);
+
+ $result = $db->query("select id, type from records where domain_id=$recid and type='$type'");
+ return $result;
+}
+
+
+/*
+ * Retrieves the type of a record from a given id.
+ * return values: the type of the record (one of the records types in $rtypes assumable).
+ */
+function get_recordtype_from_id($id)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT type FROM records WHERE id=$id");
+ $r = $result->fetchRow();
+ return $r["type"];
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "get_recordtype_from_id"));
+ }
+}
+
+
+/*
+ * Retrieves the name (e.g. bla.test.com) of a record by a given id.
+ * return values: the name associated with the id.
+ */
+function get_name_from_record_id($id)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT name FROM records WHERE id=$id");
+ $r = $result->fetchRow();
+ return $r["name"];
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "get_name_from_record_id"));
+ }
+}
+
+
+/*
+ * Get all the domains from a database of which the user is the owner.
+ * return values: an array with the id of the domain and its name.
+ */
+function get_domains_from_userid($id)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT domains.id AS domain_id, domains.name AS name FROM domains LEFT JOIN zones ON domains.id=zones.domain_id WHERE owner=$id");
+
+ $ret = array();
+
+ // Put all the information in a big array.
+ while ($r = $result->fetchRow())
+ {
+ $ret[] = array(
+ "id" => $r["domain_id"],
+ "name" => $r["name"]
+ );
+ }
+ return $ret;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "get_domains_from_userid", "This is not a valid userid: $id"));
+ }
+}
+
+
+/*
+ * Get domain name from a given id
+ * return values: the name of the domain associated with the id.
+ */
+function get_domain_name_from_id($id)
+{
+ global $db;
+ if (!xs($id))
+ {
+ error(ERR_RECORD_ACCESS_DENIED);
+ }
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT name FROM domains WHERE id=$id");
+ if ($result->numRows() == 1)
+ {
+ $r = $result->fetchRow();
+ return $r["name"];
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "get_domain_name_from_id", "more than one domain found?! whaaa! BAD! BAD! Contact admin!"));
+ }
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "get_domain_name_from_id", "Not a valid domainid: $id"));
+ }
+}
+
+
+/*
+ * Get information about a domain name from a given domain id.
+ * the function looks up the domainname, the owner of the domain and the number of records in it.
+ * return values: an array containing the information.
+ */
+function get_domain_info_from_id($id)
+{
+ global $db;
+ if (!xs($id))
+ {
+ error(ERR_RECORD_ACCESS_DENIED);
+ }
+ if (is_numeric($id))
+ {
+
+ if ($_SESSION[$id."_ispartial"] == 1) {
+
+ $sqlq = "SELECT domains.name AS name,
+ users.fullname AS owner,
+ count(record_owners.id) AS aantal
+ FROM domains, users, record_owners, records
+
+ WHERE record_owners.user_id = ".$_SESSION["userid"]."
+ AND record_owners.record_id = records.id
+ AND records.domain_id = ".$id."
+
+ GROUP BY name, owner, users.fullname
+ ORDER BY name";
+
+ $result = $db->getRow($sqlq);
+
+ $ret = array(
+ "name" => $result["name"],
+ "ownerid" => $_SESSION["userid"],
+ "owner" => $result["owner"],
+ "numrec" => $result["aantal"]
+ );
+
+ return $ret;
+
+ } else{
+
+ // Query that retrieves the information we need.
+ $sqlq = "SELECT domains.name AS name,
+ min(zones.owner) AS ownerid,
+ users.fullname AS owner,
+ count(records.domain_id) AS aantal
+ FROM domains
+ LEFT JOIN records ON domains.id=records.domain_id
+ LEFT JOIN zones ON domains.id=zones.domain_id
+ LEFT JOIN users ON zones.owner=users.id
+ WHERE domains.id=$id
+ GROUP BY name, owner, users.fullname
+ ORDER BY zones.id";
+
+ // Put the first occurence in an array and return it.
+ $result = $db->getRow($sqlq);
+
+ //$result["ownerid"] = ($result["ownerid"] == NULL) ? $db->getOne("select min(id) from users where users.level=10") : $result["ownerid"];
+
+ $ret = array(
+ "name" => $result["name"],
+ "ownerid" => $result["ownerid"],
+ "owner" => $result["owner"],
+ "numrec" => $result["aantal"]
+ );
+ return $ret;
+ }
+
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "get_domain_num_records_from_id", "This is not a valid domainid: $id"));
+ }
+}
+
+
+/*
+ * Check if a domain is already existing.
+ * return values: true if existing, false if it doesnt exist.
+ */
+function domain_exists($domain)
+{
+ global $db;
+
+ if (!level(5))
+ {
+ error(ERR_LEVEL_5);
+ }
+ if (is_valid_domain($domain))
+ {
+ $result = $db->query("SELECT id FROM domains WHERE name='$domain'");
+ if ($result->numRows() == 0)
+ {
+ return false;
+ }
+ elseif ($result->numRows() >= 1)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ error(ERR_DOMAIN_INVALID);
+ }
+}
+
+
+/*
+ * Get all domains from the database.
+ * This function gets all the domains from the database unless a user id is below 5.
+ * if a user id is below 5 this function will only retrieve records for that user.
+ * return values: the array of domains or -1 if nothing is found.
+ */
+function get_domains($userid=true,$letterstart=all,$rowstart=0,$rowamount=999999)
+{
+ global $db;
+ if((!level(5) || !$userid) && !level(10) && !level(5))
+ {
+ $add = " AND zones.owner=".$_SESSION["userid"];
+ }
+ else
+ {
+ $add = "";
+ }
+
+ $sqlq = "SELECT domains.id AS domain_id,
+ min(zones.owner) AS owner,
+ count(DISTINCT records.id) AS aantal,
+ domains.name AS domainname
+ FROM domains
+ LEFT JOIN zones ON domains.id=zones.domain_id
+ LEFT JOIN records ON records.domain_id=domains.id
+ WHERE 1 $add ";
+ if ($letterstart!=all && $letterstart!=1) {
+ $sqlq.=" AND domains.name LIKE '".$letterstart."%' ";
+ } elseif ($letterstart==1) {
+ $sqlq.=" AND ";
+ for ($i=0;$i<=9;$i++) {
+ $sqlq.="domains.name LIKE '".$i."%'";
+ if ($i!=9) $sqlq.=" OR ";
+ }
+ }
+ $sqlq.=" GROUP BY domainname, domain_id
+ ORDER BY domainname
+ LIMIT $rowstart,$rowamount";
+
+ $result = $db->query($sqlq);
+ $result2 = $db->query($sqlq);
+
+ $andnot="";
+ while($r = $result2->fetchRow()) {
+ $andnot.=" AND domains.id!= '".$r["domain_id"]."' ";
+ }
+
+ $sqlq = "SELECT domains.id AS domain_id,
+ count(DISTINCT record_owners.record_id) AS aantal,
+ domains.name AS domainname
+ FROM domains, record_owners,records, zones
+ WHERE record_owners.user_id = '".$_SESSION["userid"]."'
+ AND (records.id = record_owners.record_id
+ AND domains.id = records.domain_id)
+ $andnot ";
+
+ if ($letterstart!=all && $letterstart!=1) {
+ $sqlq.=" AND domains.name LIKE '".$letterstart."%' ";
+ } // elseif ($letterstart==1) {
+/*
+ $sqlq.=" AND ";
+ for ($i=0;$i<=9;$i++) {
+ $sqlq.="domains.name LIKE '".$i."%'";
+ if ($i!=9) $sqlq.=" OR ";
+ }
+ }
+*/
+
+ $sqlq.= " AND (zones.domain_id != records.domain_id AND zones.owner!='".$_SESSION["userid"]."')
+ GROUP BY domainname, domain_id
+ ORDER BY domainname";
+
+ $result_extra = $db->query($sqlq);
+
+ if ($result->numRows() == 0)
+ {
+ // Nothing found.
+ return -1;
+ }
+
+ while($r = $result->fetchRow())
+ {
+ $r["owner"] = ($r["owner"] == NULL) ? $db->getOne("select min(id) from users where users.level=10") : $r["owner"];
+ $ret[$r["domainname"]] = array(
+ "name" => $r["domainname"],
+ "id" => $r["domain_id"],
+ "owner" => $r["owner"],
+ "numrec" => $r["aantal"]
+ );
+ }
+
+ while($r = $result_extra->fetchRow())
+ {
+ $ret[$r["domainname"]] = array(
+ "name" => $r["domainname"]."*",
+ "id" => $r["domain_id"],
+ "owner" => $_SESSION["userid"],
+ "numrec" => $r["aantal"]
+ );
+ }
+
+ sort($ret);
+
+ return $ret;
+}
+
+
+/*
+ * Get a record from an id.
+ * Retrieve all fields of the record and send it back to the function caller.
+ * return values: the array with information, or -1 is nothing is found.
+ */
+function get_record_from_id($id)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ $result = $db->query("SELECT id, domain_id, name, type, content, ttl, prio, change_date FROM records WHERE id=$id");
+ if($result->numRows() == 0)
+ {
+ return -1;
+ }
+ elseif ($result->numRows() == 1)
+ {
+ $r = $result->fetchRow();
+ $ret = array(
+ "id" => $r["id"],
+ "domain_id" => $r["domain_id"],
+ "name" => $r["name"],
+ "type" => $r["type"],
+ "content" => $r["content"],
+ "ttl" => $r["ttl"],
+ "prio" => $r["prio"],
+ "change_date" => $r["change_date"]
+ );
+ return $ret;
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARGC, "get_record_from_id", "More than one row returned! This is bad!"));
+ }
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "get_record_from_id"));
+ }
+}
+
+
+/*
+ * Get all records from a domain id.
+ * Retrieve all fields of the records and send it back to the function caller.
+ * return values: the array with information, or -1 is nothing is found.
+ */
+function get_records_from_domain_id($id,$rowstart=0,$rowamount=999999)
+{
+ global $db;
+ if (is_numeric($id))
+ {
+ if ($_SESSION[$id."_ispartial"] == 1) {
+
+ $result = $db->query("SELECT record_owners.record_id as id
+ FROM record_owners,domains,records
+ WHERE record_owners.user_id = ".$_SESSION["userid"]."
+ AND record_owners.record_id = records.id
+ AND records.domain_id = ".$id."
+ GROUP bY record_owners.record_id
+ LIMIT $rowstart,$rowamount");
+
+ $ret = array();
+ if($result->numRows() == 0)
+ {
+ return -1;
+ }
+ else
+ {
+ $ret[] = array();
+ $retcount = 0;
+ while($r = $result->fetchRow())
+ {
+ // Call get_record_from_id for each row.
+ $ret[$retcount] = get_record_from_id($r["id"]);
+ $retcount++;
+ }
+ return $ret;
+ }
+
+ } else {
+
+ $result = $db->query("SELECT id FROM records WHERE domain_id=$id LIMIT $rowstart,$rowamount");
+ $ret = array();
+ if($result->numRows() == 0)
+ {
+ return -1;
+ }
+ else
+ {
+ $ret[] = array();
+ $retcount = 0;
+ while($r = $result->fetchRow())
+ {
+ // Call get_record_from_id for each row.
+ $ret[$retcount] = get_record_from_id($r["id"]);
+ $retcount++;
+ }
+ return $ret;
+ }
+
+ }
+ }
+ else
+ {
+ error(sprintf(ERR_INV_ARG, "get_records_from_domain_id"));
+ }
+}
+
+
+function get_users_from_domain_id($id)
+{
+ global $db;
+ $result = $db->getCol("SELECT owner FROM zones WHERE domain_id=$id");
+ $ret = array();
+ foreach($result as $uid)
+ {
+ $fullname = $db->getOne("SELECT fullname FROM users WHERE id=$uid");
+ $ret[] = array(
+ "id" => $uid,
+ "fullname" => $fullname
+ );
+ }
+ return $ret;
+}
+
+function search_record($question)
+{
+ global $db;
+ $question = trim($question);
+ if (empty($question))
+ {
+ $S_INPUT_TYPE = -1;
+ }
+
+ /* now for some input-type searching */
+ if (is_valid_ip($question) || is_valid_ip6($question))
+ {
+ $S_INPUT_TYPE = 0;
+ }
+ elseif(is_valid_domain($question) ||
+ is_valid_hostname($question) ||
+ is_valid_mboxfw($question)) // I guess this one can appear in records table too (content?!)
+ {
+ $S_INPUT_TYPE = 1;
+ }
+ else
+ {
+ $S_INPUT_TYPE = -1;
+ }
+ switch($S_INPUT_TYPE)
+ {
+ case '0':
+ $sqlq = "SELECT * FROM `records` WHERE `content` = '".$question."' ORDER BY `type` DESC";
+ $result = $db->query($sqlq);
+ $ret_r = array();
+ while ($r = $result->fetchRow())
+ {
+ if(xs($r['domain_id']))
+ {
+ $ret_r[] = array(
+ 'id' => $r['id'],
+ 'domain_id' => $r['domain_id'],
+ 'name' => $r['name'],
+ 'type' => $r['type'],
+ 'content' => $r['content'],
+ 'ttl' => $r['ttl'],
+ 'prio' => $r['prio'],
+ 'change_date' => $r['change_date']
+ );
+ }
+ }
+ break;
+
+ case '1' :
+ $sqlq = "SELECT `domains`.*, count(`records`.`id`) AS `numrec`, `zones`.`owner`
+ FROM `domains`, `records`, `zones`
+ WHERE `domains`.`id` = `records`.`domain_id`
+ AND `zones`.`domain_id` = `domains`.`id`
+ AND `domains`.`name` = '".$question."'
+ GROUP BY (`domains`.`id`)";
+
+ $result = $db->query($sqlq);
+ $ret_d = array();
+ while ($r = $result->fetchRow())
+ {
+ if(xs($r['domain_id']))
+ {
+ $ret_d[] = array(
+ 'id' => $r['id'],
+ 'name' => $r['name'],
+ 'numrec' => $r['numrec'],
+ 'owner' => $r['owner']
+ );
+ }
+ }
+
+ $sqlq = "SELECT * FROM `records` WHERE `name` = '".$question."' OR `content` = '".$question."' ORDER BY `type` DESC";
+ $result = $db->query($sqlq);
+ while ($r = $result->fetchRow())
+ {
+ if(xs($r['domain_id']))
+ {
+ $ret_r[] = array(
+ 'id' => $r['id'],
+ 'domain_id' => $r['domain_id'],
+ 'name' => $r['name'],
+ 'type' => $r['type'],
+ 'content' => $r['content'],
+ 'ttl' => $r['ttl'],
+ 'prio' => $r['prio'],
+ );
+ }
+ }
+ break;
+ }
+ if($S_INPUT_TYPE == 1)
+ {
+ return array('domains' => $ret_d, 'records' => $ret_r);
+ }
+ return array('records' => $ret_r);
+}
+
+function get_domain_type($id)
+{
+ global $db;
+ $type = $db->getOne("SELECT `type` FROM `domains` WHERE `id` = '".$id."'");
+ if($type == "")
+ {
+ $type = "NATIVE";
+ }
+ return $type;
+
+}
+
+function change_domain_type($type, $id)
+{
+ global $db;
+ $result = $db->query("UPDATE `domains` SET `type` = '" .$type. "' WHERE `id` = '".$id."'");
+}
+?>
diff -r 2cd8c1649ba9 -r 58094faf794d inc/auth.inc.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/auth.inc.php Tue Apr 10 22:40:43 2007 +0000
@@ -0,0 +1,118 @@
+
+
+// +--------------------------------------------------------------------+
+// | PowerAdmin |
+// +--------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PowerAdmin Team |
+// +--------------------------------------------------------------------+
+// | This source file is subject to the license carried by the overal |
+// | program PowerAdmin as found on http://poweradmin.sf.net |
+// | The PowerAdmin program falls under the QPL License: |
+// | http://www.trolltech.com/developer/licensing/qpl.html |
+// +--------------------------------------------------------------------+
+// | Authors: Roeland Nieuwenhuis trancer nl> |
+// | Sjeemz sjeemz nl> |
+// +--------------------------------------------------------------------+
+
+// Filename: auth.inc.php
+// Startdate: 26-10-2002
+// Description: file is supposed to validate users and check whether they are authorized.
+// If they are authorized this code handles that they can access stuff.
+//
+// $Id: auth.inc.php,v 1.6 2003/01/13 22:08:52 azurazu Exp $
+//
+
+session_start();
+
+if (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] == "logout")
+{
+ logout();
+}
+
+// If a user had just entered his/her login && password, store them in our session.
+if(isset($_POST["authenticate"]))
+{
+ $_SESSION["userpwd"] = $_POST["password"];
+ $_SESSION["userlogin"] = $_POST["username"];
+}
+
+// Check if the session hasnt expired yet.
+if ((isset($_SESSION["userid"])) && ($_SESSION["lastmod"] != "") && ((time() - $_SESSION["lastmod"]) > $EXPIRE))
+{
+ logout("Session expired, please login again.");
+}
+
+// If the session hasn't expired yet, give our session a fresh new timestamp.
+$_SESSION["lastmod"] = time();
+
+if(isset($_SESSION["userlogin"]) && isset($_SESSION["userpwd"]))
+{
+ //Username and password are set, lets try to authenticate.
+ $result = $db->query("SELECT id, fullname, level FROM users WHERE username='". $_SESSION["userlogin"] ."' AND password='". md5($_SESSION["userpwd"]) ."' AND active=1");
+ if($result->numRows() == 1)
+ {
+ $rowObj = $result->fetchRow();
+ $_SESSION["userid"] = $rowObj["id"];
+ $_SESSION["name"] = $rowObj["fullname"];
+ $_SESSION["level"] = $rowObj["level"];
+ if($_POST["authenticate"])
+ {
+ //If a user has just authenticated, redirect him to index with timestamp, so post-data gets lost.
+ session_write_close();
+ clean_page("index.php");
+ exit;
+ }
+ }
+ else
+ {
+ //Authentication failed, retry.
+ auth("Authentication failed!");
+ }
+}
+else
+{
+ //No username and password set, show auth form (again).
+ auth();
+}
+
+/*
+ * Print the login form.
+ */
+
+function auth($msg="")
+{
+ include_once('inc/header.inc.php');
+ ?>
+