All In One WP Security & Firewall - Version 1.0

Version Description

None

Download this release

Release Info

Developer mra13
Plugin Icon 128x128 All In One WP Security & Firewall
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (174) hide show
  1. admin/general/wp-security-list-table.php +907 -0
  2. admin/index.php +5 -0
  3. admin/wp-security-admin-init.php +167 -0
  4. admin/wp-security-admin-menu.php +93 -0
  5. admin/wp-security-blacklist-menu.php +332 -0
  6. admin/wp-security-dashboard-menu.php +304 -0
  7. admin/wp-security-database-menu.php +463 -0
  8. admin/wp-security-filesystem-menu.php +500 -0
  9. admin/wp-security-firewall-menu.php +445 -0
  10. admin/wp-security-list-acct-activity.php +159 -0
  11. admin/wp-security-list-comment-spammer-ip.php +195 -0
  12. admin/wp-security-list-locked-ip.php +194 -0
  13. admin/wp-security-list-login-fails.php +158 -0
  14. admin/wp-security-settings-menu.php +433 -0
  15. admin/wp-security-user-accounts-menu.php +289 -0
  16. admin/wp-security-user-login-menu.php +435 -0
  17. admin/wp-security-whois-menu.php +126 -0
  18. classes/grade-system/wp-security-feature-item-manager.php +388 -0
  19. classes/grade-system/wp-security-feature-item.php +40 -0
  20. classes/index.php +5 -0
  21. classes/wp-security-backup.php +191 -0
  22. classes/wp-security-config.php +54 -0
  23. classes/wp-security-configure-settings.php +70 -0
  24. classes/wp-security-cronjob-handler.php +27 -0
  25. classes/wp-security-debug-logger.php +100 -0
  26. classes/wp-security-installer.php +73 -0
  27. classes/wp-security-user-login.php +373 -0
  28. classes/wp-security-utility-file.php +230 -0
  29. classes/wp-security-utility-htaccess.php +783 -0
  30. classes/wp-security-utility-ip-address.php +146 -0
  31. classes/wp-security-utility.php +105 -0
  32. css/wp-security-admin-styles.css +255 -0
  33. images/error.png +0 -0
  34. images/feature-difficulty-badge-bg.png +0 -0
  35. images/feature-points-badge-bg.png +0 -0
  36. images/info-icon.png +0 -0
  37. images/loading.gif +0 -0
  38. images/plugin-icon.png +0 -0
  39. images/plugin-icon2.png +0 -0
  40. images/shield-info-icon-36.png +0 -0
  41. images/shield-security-icon-36.png +0 -0
  42. images/success.png +0 -0
  43. js/wp-security-admin-script.js +39 -0
  44. lib/whois/LICENSE +340 -0
  45. lib/whois/handler.template.php +40 -0
  46. lib/whois/npdata.ser +1 -0
  47. lib/whois/whois.ae.php +58 -0
  48. lib/whois/whois.aero.php +45 -0
  49. lib/whois/whois.ag.php +45 -0
  50. lib/whois/whois.asia.php +44 -0
  51. lib/whois/whois.at.php +102 -0
  52. lib/whois/whois.au.php +63 -0
  53. lib/whois/whois.be.php +76 -0
  54. lib/whois/whois.biz.php +45 -0
  55. lib/whois/whois.br.php +84 -0
  56. lib/whois/whois.ca.php +76 -0
  57. lib/whois/whois.cat.php +47 -0
  58. lib/whois/whois.ch.php +82 -0
  59. lib/whois/whois.cl.php +56 -0
  60. lib/whois/whois.client.php +595 -0
  61. lib/whois/whois.cn.php +91 -0
  62. lib/whois/whois.co.php +43 -0
  63. lib/whois/whois.co.za.php +73 -0
  64. lib/whois/whois.coop.php +106 -0
  65. lib/whois/whois.cz.php +73 -0
  66. lib/whois/whois.de.php +78 -0
  67. lib/whois/whois.edu.php +62 -0
  68. lib/whois/whois.eu.php +85 -0
  69. lib/whois/whois.fi.php +57 -0
  70. lib/whois/whois.fj.php +67 -0
  71. lib/whois/whois.fm.php +80 -0
  72. lib/whois/whois.fr.php +78 -0
  73. lib/whois/whois.gtld.afternic.php +51 -0
  74. lib/whois/whois.gtld.alldomains.php +49 -0
  75. lib/whois/whois.gtld.ascio.php +51 -0
  76. lib/whois/whois.gtld.assorted.php +51 -0
  77. lib/whois/whois.gtld.corporatedomains.php +53 -0
  78. lib/whois/whois.gtld.directnic.php +53 -0
  79. lib/whois/whois.gtld.domaindiscover.php +51 -0
  80. lib/whois/whois.gtld.domainpeople.php +59 -0
  81. lib/whois/whois.gtld.dotster.php +53 -0
  82. lib/whois/whois.gtld.dreamhost.php +54 -0
  83. lib/whois/whois.gtld.enom.php +62 -0
  84. lib/whois/whois.gtld.fabulous.php +54 -0
  85. lib/whois/whois.gtld.fastdomain.php +78 -0
  86. lib/whois/whois.gtld.gandi.php +56 -0
  87. lib/whois/whois.gtld.genericb.php +40 -0
  88. lib/whois/whois.gtld.godaddy.php +56 -0
  89. lib/whois/whois.gtld.iana.php +51 -0
  90. lib/whois/whois.gtld.interdomain.php +80 -0
  91. lib/whois/whois.gtld.itsyourdomain.php +52 -0
  92. lib/whois/whois.gtld.joker.php +78 -0
  93. lib/whois/whois.gtld.markmonitor.php +55 -0
  94. lib/whois/whois.gtld.melbourneit.php +59 -0
  95. lib/whois/whois.gtld.moniker.php +52 -0
  96. lib/whois/whois.gtld.namejuice.php +53 -0
  97. lib/whois/whois.gtld.nameking.php +70 -0
  98. lib/whois/whois.gtld.names4ever.php +54 -0
  99. lib/whois/whois.gtld.namevault.php +52 -0
  100. lib/whois/whois.gtld.networksolutions.php +50 -0
  101. lib/whois/whois.gtld.nicco.php +62 -0
  102. lib/whois/whois.gtld.nicline.php +51 -0
  103. lib/whois/whois.gtld.onlinenic.php +83 -0
  104. lib/whois/whois.gtld.opensrs.php +58 -0
  105. lib/whois/whois.gtld.ovh.php +51 -0
  106. lib/whois/whois.gtld.php +81 -0
  107. lib/whois/whois.gtld.psiusa.php +90 -0
  108. lib/whois/whois.gtld.publicdomainregistry.php +57 -0
  109. lib/whois/whois.gtld.register.php +62 -0
  110. lib/whois/whois.gtld.rrpproxy.php +92 -0
  111. lib/whois/whois.gtld.schlund.php +86 -0
  112. lib/whois/whois.gtld.srsplus.php +51 -0
  113. lib/whois/whois.gtld.tmagnic.php +52 -0
  114. lib/whois/whois.gtld.tvcorp.php +50 -0
  115. lib/whois/whois.gtld.wildwestdomains.php +52 -0
  116. lib/whois/whois.hu.php +95 -0
  117. lib/whois/whois.icon.png +0 -0
  118. lib/whois/whois.idna.php +969 -0
  119. lib/whois/whois.ie.php +64 -0
  120. lib/whois/whois.in.php +45 -0
  121. lib/whois/whois.info.php +45 -0
  122. lib/whois/whois.int.php +44 -0
  123. lib/whois/whois.ip.afrinic.php +77 -0
  124. lib/whois/whois.ip.apnic.php +122 -0
  125. lib/whois/whois.ip.arin.php +78 -0
  126. lib/whois/whois.ip.krnic.php +112 -0
  127. lib/whois/whois.ip.lacnic.php +79 -0
  128. lib/whois/whois.ip.lib.php +120 -0
  129. lib/whois/whois.ip.php +285 -0
  130. lib/whois/whois.ip.ripe.php +85 -0
  131. lib/whois/whois.ir.php +60 -0
  132. lib/whois/whois.is.php +69 -0
  133. lib/whois/whois.it.php +78 -0
  134. lib/whois/whois.jp.php +111 -0
  135. lib/whois/whois.lt.php +64 -0
  136. lib/whois/whois.lu.php +78 -0
  137. lib/whois/whois.ly.php +72 -0
  138. lib/whois/whois.main.php +327 -0
  139. lib/whois/whois.me.php +45 -0
  140. lib/whois/whois.mobi.php +47 -0
  141. lib/whois/whois.museum.php +45 -0
  142. lib/whois/whois.mx.php +70 -0
  143. lib/whois/whois.name.php +45 -0
  144. lib/whois/whois.nl.php +88 -0
  145. lib/whois/whois.nu.php +90 -0
  146. lib/whois/whois.nz.php +102 -0
  147. lib/whois/whois.org.php +47 -0
  148. lib/whois/whois.org.za.php +64 -0
  149. lib/whois/whois.parser.php +873 -0
  150. lib/whois/whois.pl.php +54 -0
  151. lib/whois/whois.pro.php +43 -0
  152. lib/whois/whois.pt.php +81 -0
  153. lib/whois/whois.ro.php +99 -0
  154. lib/whois/whois.ru.php +63 -0
  155. lib/whois/whois.rwhois.php +58 -0
  156. lib/whois/whois.sc.php +45 -0
  157. lib/whois/whois.se.php +58 -0
  158. lib/whois/whois.servers.php +252 -0
  159. lib/whois/whois.si.php +55 -0
  160. lib/whois/whois.su.php +63 -0
  161. lib/whois/whois.tel.php +45 -0
  162. lib/whois/whois.travel.php +43 -0
  163. lib/whois/whois.uk.php +72 -0
  164. lib/whois/whois.us.php +44 -0
  165. lib/whois/whois.utils.php +152 -0
  166. lib/whois/whois.ve.php +75 -0
  167. lib/whois/whois.ws.php +76 -0
  168. lib/whois/whois.zanet.php +90 -0
  169. license.txt +674 -0
  170. logs/wp-security-log-cron-job.txt +0 -0
  171. logs/wp-security-log.txt +0 -0
  172. readme.txt +109 -0
  173. wp-security-core.php +204 -0
  174. wp-security.php +26 -0
admin/general/wp-security-list-table.php ADDED
@@ -0,0 +1,907 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Base class for displaying a list of items in an ajaxified HTML table.
4
+ */
5
+ class AIOWPSecurity_List_Table
6
+ {
7
+ /**
8
+ * The current list of items
9
+ *
10
+ * @since 3.1.0
11
+ * @var array
12
+ * @access protected
13
+ */
14
+ var $items;
15
+
16
+ /**
17
+ * Various information about the current table
18
+ *
19
+ * @since 3.1.0
20
+ * @var array
21
+ * @access private
22
+ */
23
+ var $_args;
24
+
25
+ /**
26
+ * Various information needed for displaying the pagination
27
+ *
28
+ * @since 3.1.0
29
+ * @var array
30
+ * @access private
31
+ */
32
+ var $_pagination_args = array();
33
+
34
+ /**
35
+ * The current screen
36
+ *
37
+ * @since 3.1.0
38
+ * @var object
39
+ * @access protected
40
+ */
41
+ var $screen;
42
+
43
+ /**
44
+ * Cached bulk actions
45
+ *
46
+ * @since 3.1.0
47
+ * @var array
48
+ * @access private
49
+ */
50
+ var $_actions;
51
+
52
+ /**
53
+ * Cached pagination output
54
+ *
55
+ * @since 3.1.0
56
+ * @var string
57
+ * @access private
58
+ */
59
+ var $_pagination;
60
+
61
+ /**
62
+ * Constructor. The child class should call this constructor from it's own constructor
63
+ *
64
+ * @param array $args An associative array with information about the current table
65
+ * @access protected
66
+ */
67
+ function __construct( $args = array() ) {
68
+ $args = wp_parse_args( $args, array(
69
+ 'plural' => '',
70
+ 'singular' => '',
71
+ 'ajax' => false,
72
+ 'screen' => null,
73
+ ) );
74
+
75
+ $this->screen = convert_to_screen( $args['screen'] );
76
+
77
+ add_filter( "manage_{$this->screen->id}_columns", array( &$this, 'get_columns' ), 0 );
78
+
79
+ if ( !$args['plural'] )
80
+ $args['plural'] = $this->screen->base;
81
+
82
+ $args['plural'] = sanitize_key( $args['plural'] );
83
+ $args['singular'] = sanitize_key( $args['singular'] );
84
+
85
+ $this->_args = $args;
86
+
87
+ if ( $args['ajax'] ) {
88
+ // wp_enqueue_script( 'list-table' );
89
+ add_action( 'admin_footer', array( &$this, '_js_vars' ) );
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Checks the current user's permissions
95
+ * @uses wp_die()
96
+ *
97
+ * @since 3.1.0
98
+ * @access public
99
+ * @abstract
100
+ */
101
+ function ajax_user_can() {
102
+ die( 'function AIOWPSecurity_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
103
+ }
104
+
105
+ /**
106
+ * Prepares the list of items for displaying.
107
+ * @uses AIOWPSecurity_List_Table::set_pagination_args()
108
+ *
109
+ * @since 3.1.0
110
+ * @access public
111
+ * @abstract
112
+ */
113
+ function prepare_items() {
114
+ die( 'function AIOWPSecurity_List_Table::prepare_items() must be over-ridden in a sub-class.' );
115
+ }
116
+
117
+ /**
118
+ * An internal method that sets all the necessary pagination arguments
119
+ *
120
+ * @param array $args An associative array with information about the pagination
121
+ * @access protected
122
+ */
123
+ function set_pagination_args( $args ) {
124
+ $args = wp_parse_args( $args, array(
125
+ 'total_items' => 0,
126
+ 'total_pages' => 0,
127
+ 'per_page' => 0,
128
+ ) );
129
+
130
+ if ( !$args['total_pages'] && $args['per_page'] > 0 )
131
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
132
+
133
+ // redirect if page number is invalid and headers are not already sent
134
+ if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
135
+ wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
136
+ exit;
137
+ }
138
+
139
+ $this->_pagination_args = $args;
140
+ }
141
+
142
+ /**
143
+ * Access the pagination args
144
+ *
145
+ * @since 3.1.0
146
+ * @access public
147
+ *
148
+ * @param string $key
149
+ * @return array
150
+ */
151
+ function get_pagination_arg( $key ) {
152
+ if ( 'page' == $key )
153
+ return $this->get_pagenum();
154
+
155
+ if ( isset( $this->_pagination_args[$key] ) )
156
+ return $this->_pagination_args[$key];
157
+ }
158
+
159
+ /**
160
+ * Whether the table has items to display or not
161
+ *
162
+ * @since 3.1.0
163
+ * @access public
164
+ *
165
+ * @return bool
166
+ */
167
+ function has_items() {
168
+ return !empty( $this->items );
169
+ }
170
+
171
+ /**
172
+ * Message to be displayed when there are no items
173
+ *
174
+ * @since 3.1.0
175
+ * @access public
176
+ */
177
+ function no_items() {
178
+ _e( 'No items found.' );
179
+ }
180
+
181
+ /**
182
+ * Display the search box.
183
+ *
184
+ * @since 3.1.0
185
+ * @access public
186
+ *
187
+ * @param string $text The search button text
188
+ * @param string $input_id The search input id
189
+ */
190
+ function search_box( $text, $input_id ) {
191
+ if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
192
+ return;
193
+
194
+ $input_id = $input_id . '-search-input';
195
+
196
+ if ( ! empty( $_REQUEST['orderby'] ) )
197
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
198
+ if ( ! empty( $_REQUEST['order'] ) )
199
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
200
+ if ( ! empty( $_REQUEST['post_mime_type'] ) )
201
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
202
+ if ( ! empty( $_REQUEST['detached'] ) )
203
+ echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
204
+ ?>
205
+ <p class="search-box">
206
+ <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
207
+ <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
208
+ <?php submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); ?>
209
+ </p>
210
+ <?php
211
+ }
212
+
213
+ /**
214
+ * Get an associative array ( id => link ) with the list
215
+ * of views available on this table.
216
+ *
217
+ * @since 3.1.0
218
+ * @access protected
219
+ *
220
+ * @return array
221
+ */
222
+ function get_views() {
223
+ return array();
224
+ }
225
+
226
+ /**
227
+ * Display the list of views available on this table.
228
+ *
229
+ * @since 3.1.0
230
+ * @access public
231
+ */
232
+ function views() {
233
+ $views = $this->get_views();
234
+ $views = apply_filters( 'views_' . $this->screen->id, $views );
235
+
236
+ if ( empty( $views ) )
237
+ return;
238
+
239
+ echo "<ul class='subsubsub'>\n";
240
+ foreach ( $views as $class => $view ) {
241
+ $views[ $class ] = "\t<li class='$class'>$view";
242
+ }
243
+ echo implode( " |</li>\n", $views ) . "</li>\n";
244
+ echo "</ul>";
245
+ }
246
+
247
+ /**
248
+ * Get an associative array ( option_name => option_title ) with the list
249
+ * of bulk actions available on this table.
250
+ *
251
+ * @since 3.1.0
252
+ * @access protected
253
+ *
254
+ * @return array
255
+ */
256
+ function get_bulk_actions() {
257
+ return array();
258
+ }
259
+
260
+ /**
261
+ * Display the bulk actions dropdown.
262
+ *
263
+ * @since 3.1.0
264
+ * @access public
265
+ */
266
+ function bulk_actions() {
267
+ if ( is_null( $this->_actions ) ) {
268
+ $no_new_actions = $this->_actions = $this->get_bulk_actions();
269
+ // This filter can currently only be used to remove actions.
270
+ $this->_actions = apply_filters( 'bulk_actions-' . $this->screen->id, $this->_actions );
271
+ $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
272
+ $two = '';
273
+ } else {
274
+ $two = '2';
275
+ }
276
+
277
+ if ( empty( $this->_actions ) )
278
+ return;
279
+
280
+ echo "<select name='action$two'>\n";
281
+ echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
282
+
283
+ foreach ( $this->_actions as $name => $title ) {
284
+ $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
285
+
286
+ echo "\t<option value='$name'$class>$title</option>\n";
287
+ }
288
+
289
+ echo "</select>\n";
290
+
291
+ submit_button( __( 'Apply' ), 'action', false, false, array( 'id' => "doaction$two" ) );
292
+ echo "\n";
293
+ }
294
+
295
+ /**
296
+ * Get the current action selected from the bulk actions dropdown.
297
+ *
298
+ * @since 3.1.0
299
+ * @access public
300
+ *
301
+ * @return string|bool The action name or False if no action was selected
302
+ */
303
+ function current_action() {
304
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
305
+ return $_REQUEST['action'];
306
+
307
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
308
+ return $_REQUEST['action2'];
309
+
310
+ return false;
311
+ }
312
+
313
+ /**
314
+ * Generate row actions div
315
+ *
316
+ * @since 3.1.0
317
+ * @access protected
318
+ *
319
+ * @param array $actions The list of actions
320
+ * @param bool $always_visible Whether the actions should be always visible
321
+ * @return string
322
+ */
323
+ function row_actions( $actions, $always_visible = false ) {
324
+ $action_count = count( $actions );
325
+ $i = 0;
326
+
327
+ if ( !$action_count )
328
+ return '';
329
+
330
+ $out = '<div class="' . ( $always_visible ? 'row-actions-visible' : 'row-actions' ) . '">';
331
+ foreach ( $actions as $action => $link ) {
332
+ ++$i;
333
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
334
+ $out .= "<span class='$action'>$link$sep</span>";
335
+ }
336
+ $out .= '</div>';
337
+
338
+ return $out;
339
+ }
340
+
341
+ /**
342
+ * Display a monthly dropdown for filtering items
343
+ *
344
+ * @since 3.1.0
345
+ * @access protected
346
+ */
347
+ function months_dropdown( $post_type ) {
348
+ global $wpdb, $wp_locale;
349
+
350
+ $months = $wpdb->get_results( $wpdb->prepare( "
351
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
352
+ FROM $wpdb->posts
353
+ WHERE post_type = %s
354
+ ORDER BY post_date DESC
355
+ ", $post_type ) );
356
+
357
+ $month_count = count( $months );
358
+
359
+ if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
360
+ return;
361
+
362
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
363
+ ?>
364
+ <select name='m'>
365
+ <option<?php selected( $m, 0 ); ?> value='0'><?php _e( 'Show all dates' ); ?></option>
366
+ <?php
367
+ foreach ( $months as $arc_row ) {
368
+ if ( 0 == $arc_row->year )
369
+ continue;
370
+
371
+ $month = zeroise( $arc_row->month, 2 );
372
+ $year = $arc_row->year;
373
+
374
+ printf( "<option %s value='%s'>%s</option>\n",
375
+ selected( $m, $year . $month, false ),
376
+ esc_attr( $arc_row->year . $month ),
377
+ /* translators: 1: month name, 2: 4-digit year */
378
+ sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
379
+ );
380
+ }
381
+ ?>
382
+ </select>
383
+ <?php
384
+ }
385
+
386
+ /**
387
+ * Display a view switcher
388
+ *
389
+ * @since 3.1.0
390
+ * @access protected
391
+ */
392
+ function view_switcher( $current_mode ) {
393
+ $modes = array(
394
+ 'list' => __( 'List View' ),
395
+ 'excerpt' => __( 'Excerpt View' )
396
+ );
397
+
398
+ ?>
399
+ <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
400
+ <div class="view-switch">
401
+ <?php
402
+ foreach ( $modes as $mode => $title ) {
403
+ $class = ( $current_mode == $mode ) ? 'class="current"' : '';
404
+ echo "<a href='" . esc_url( add_query_arg( 'mode', $mode, $_SERVER['REQUEST_URI'] ) ) . "' $class><img id='view-switch-$mode' src='" . esc_url( includes_url( 'images/blank.gif' ) ) . "' width='20' height='20' title='$title' alt='$title' /></a>\n";
405
+ }
406
+ ?>
407
+ </div>
408
+ <?php
409
+ }
410
+
411
+ /**
412
+ * Display a comment count bubble
413
+ *
414
+ * @since 3.1.0
415
+ * @access protected
416
+ *
417
+ * @param int $post_id
418
+ * @param int $pending_comments
419
+ */
420
+ function comments_bubble( $post_id, $pending_comments ) {
421
+ $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
422
+
423
+ if ( $pending_comments )
424
+ echo '<strong>';
425
+
426
+ echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . "</span></a>";
427
+
428
+ if ( $pending_comments )
429
+ echo '</strong>';
430
+ }
431
+
432
+ /**
433
+ * Get the current page number
434
+ *
435
+ * @since 3.1.0
436
+ * @access protected
437
+ *
438
+ * @return int
439
+ */
440
+ function get_pagenum() {
441
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
442
+
443
+ if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
444
+ $pagenum = $this->_pagination_args['total_pages'];
445
+
446
+ return max( 1, $pagenum );
447
+ }
448
+
449
+ /**
450
+ * Get number of items to display on a single page
451
+ *
452
+ * @since 3.1.0
453
+ * @access protected
454
+ *
455
+ * @return int
456
+ */
457
+ function get_items_per_page( $option, $default = 20 ) {
458
+ $per_page = (int) get_user_option( $option );
459
+ if ( empty( $per_page ) || $per_page < 1 )
460
+ $per_page = $default;
461
+
462
+ return (int) apply_filters( $option, $per_page );
463
+ }
464
+
465
+ /**
466
+ * Display the pagination.
467
+ *
468
+ * @since 3.1.0
469
+ * @access protected
470
+ */
471
+ function pagination( $which ) {
472
+ if ( empty( $this->_pagination_args ) )
473
+ return;
474
+
475
+ extract( $this->_pagination_args, EXTR_SKIP );
476
+
477
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
478
+
479
+ $current = $this->get_pagenum();
480
+
481
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
482
+
483
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
484
+
485
+ $page_links = array();
486
+
487
+ $disable_first = $disable_last = '';
488
+ if ( $current == 1 )
489
+ $disable_first = ' disabled';
490
+ if ( $current == $total_pages )
491
+ $disable_last = ' disabled';
492
+
493
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
494
+ 'first-page' . $disable_first,
495
+ esc_attr__( 'Go to the first page' ),
496
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
497
+ '&laquo;'
498
+ );
499
+
500
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
501
+ 'prev-page' . $disable_first,
502
+ esc_attr__( 'Go to the previous page' ),
503
+ esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
504
+ '&lsaquo;'
505
+ );
506
+
507
+ if ( 'bottom' == $which )
508
+ $html_current_page = $current;
509
+ else
510
+ $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
511
+ esc_attr__( 'Current page' ),
512
+ $current,
513
+ strlen( $total_pages )
514
+ );
515
+
516
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
517
+ $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
518
+
519
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
520
+ 'next-page' . $disable_last,
521
+ esc_attr__( 'Go to the next page' ),
522
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
523
+ '&rsaquo;'
524
+ );
525
+
526
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
527
+ 'last-page' . $disable_last,
528
+ esc_attr__( 'Go to the last page' ),
529
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
530
+ '&raquo;'
531
+ );
532
+
533
+ $pagination_links_class = 'pagination-links';
534
+ if ( ! empty( $infinite_scroll ) )
535
+ $pagination_links_class = ' hide-if-js';
536
+ $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
537
+
538
+ if ( $total_pages )
539
+ $page_class = $total_pages < 2 ? ' one-page' : '';
540
+ else
541
+ $page_class = ' no-pages';
542
+
543
+ $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
544
+
545
+ echo $this->_pagination;
546
+ }
547
+
548
+ /**
549
+ * Get a list of columns. The format is:
550
+ * 'internal-name' => 'Title'
551
+ *
552
+ * @since 3.1.0
553
+ * @access protected
554
+ * @abstract
555
+ *
556
+ * @return array
557
+ */
558
+ function get_columns() {
559
+ die( 'function AIOWPSecurity_List_Table::get_columns() must be over-ridden in a sub-class.' );
560
+ }
561
+
562
+ /**
563
+ * Get a list of sortable columns. The format is:
564
+ * 'internal-name' => 'orderby'
565
+ * or
566
+ * 'internal-name' => array( 'orderby', true )
567
+ *
568
+ * The second format will make the initial sorting order be descending
569
+ *
570
+ * @since 3.1.0
571
+ * @access protected
572
+ *
573
+ * @return array
574
+ */
575
+ function get_sortable_columns() {
576
+ return array();
577
+ }
578
+
579
+ /**
580
+ * Get a list of all, hidden and sortable columns, with filter applied
581
+ *
582
+ * @since 3.1.0
583
+ * @access protected
584
+ *
585
+ * @return array
586
+ */
587
+ function get_column_info() {
588
+ if ( isset( $this->_column_headers ) )
589
+ return $this->_column_headers;
590
+
591
+ $columns = get_column_headers( $this->screen );
592
+ $hidden = get_hidden_columns( $this->screen );
593
+
594
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $this->get_sortable_columns() );
595
+
596
+ $sortable = array();
597
+ foreach ( $_sortable as $id => $data ) {
598
+ if ( empty( $data ) )
599
+ continue;
600
+
601
+ $data = (array) $data;
602
+ if ( !isset( $data[1] ) )
603
+ $data[1] = false;
604
+
605
+ $sortable[$id] = $data;
606
+ }
607
+
608
+ $this->_column_headers = array( $columns, $hidden, $sortable );
609
+
610
+ return $this->_column_headers;
611
+ }
612
+
613
+ /**
614
+ * Return number of visible columns
615
+ *
616
+ * @since 3.1.0
617
+ * @access public
618
+ *
619
+ * @return int
620
+ */
621
+ function get_column_count() {
622
+ list ( $columns, $hidden ) = $this->get_column_info();
623
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
624
+ return count( $columns ) - count( $hidden );
625
+ }
626
+
627
+ /**
628
+ * Print column headers, accounting for hidden and sortable columns.
629
+ *
630
+ * @since 3.1.0
631
+ * @access protected
632
+ *
633
+ * @param bool $with_id Whether to set the id attribute or not
634
+ */
635
+ function print_column_headers( $with_id = true ) {
636
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
637
+
638
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
639
+ $current_url = remove_query_arg( 'paged', $current_url );
640
+
641
+ if ( isset( $_GET['orderby'] ) )
642
+ $current_orderby = $_GET['orderby'];
643
+ else
644
+ $current_orderby = '';
645
+
646
+ if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
647
+ $current_order = 'desc';
648
+ else
649
+ $current_order = 'asc';
650
+
651
+ if ( ! empty( $columns['cb'] ) ) {
652
+ static $cb_counter = 1;
653
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
654
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
655
+ $cb_counter++;
656
+ }
657
+
658
+ foreach ( $columns as $column_key => $column_display_name ) {
659
+ $class = array( 'manage-column', "column-$column_key" );
660
+
661
+ $style = '';
662
+ if ( in_array( $column_key, $hidden ) )
663
+ $style = 'display:none;';
664
+
665
+ $style = ' style="' . $style . '"';
666
+
667
+ if ( 'cb' == $column_key )
668
+ $class[] = 'check-column';
669
+ elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
670
+ $class[] = 'num';
671
+
672
+ if ( isset( $sortable[$column_key] ) ) {
673
+ list( $orderby, $desc_first ) = $sortable[$column_key];
674
+
675
+ if ( $current_orderby == $orderby ) {
676
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
677
+ $class[] = 'sorted';
678
+ $class[] = $current_order;
679
+ } else {
680
+ $order = $desc_first ? 'desc' : 'asc';
681
+ $class[] = 'sortable';
682
+ $class[] = $desc_first ? 'asc' : 'desc';
683
+ }
684
+
685
+ $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
686
+ }
687
+
688
+ $id = $with_id ? "id='$column_key'" : '';
689
+
690
+ if ( !empty( $class ) )
691
+ $class = "class='" . join( ' ', $class ) . "'";
692
+
693
+ echo "<th scope='col' $id $class $style>$column_display_name</th>";
694
+ }
695
+ }
696
+
697
+ /**
698
+ * Display the table
699
+ *
700
+ * @since 3.1.0
701
+ * @access public
702
+ */
703
+ function display() {
704
+ extract( $this->_args );
705
+
706
+ $this->display_tablenav( 'top' );
707
+
708
+ ?>
709
+ <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
710
+ <thead>
711
+ <tr>
712
+ <?php $this->print_column_headers(); ?>
713
+ </tr>
714
+ </thead>
715
+
716
+ <tfoot>
717
+ <tr>
718
+ <?php $this->print_column_headers( false ); ?>
719
+ </tr>
720
+ </tfoot>
721
+
722
+ <tbody id="the-list"<?php if ( $singular ) echo " data-wp-lists='list:$singular'"; ?>>
723
+ <?php $this->display_rows_or_placeholder(); ?>
724
+ </tbody>
725
+ </table>
726
+ <?php
727
+ $this->display_tablenav( 'bottom' );
728
+ }
729
+
730
+ /**
731
+ * Get a list of CSS classes for the <table> tag
732
+ *
733
+ * @since 3.1.0
734
+ * @access protected
735
+ *
736
+ * @return array
737
+ */
738
+ function get_table_classes() {
739
+ return array( 'widefat', 'fixed', $this->_args['plural'] );
740
+ }
741
+
742
+ /**
743
+ * Generate the table navigation above or below the table
744
+ *
745
+ * @since 3.1.0
746
+ * @access protected
747
+ */
748
+ function display_tablenav( $which ) {
749
+ if ( 'top' == $which )
750
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
751
+ ?>
752
+ <div class="tablenav <?php echo esc_attr( $which ); ?>">
753
+
754
+ <div class="alignleft actions">
755
+ <?php $this->bulk_actions(); ?>
756
+ </div>
757
+ <?php
758
+ $this->extra_tablenav( $which );
759
+ $this->pagination( $which );
760
+ ?>
761
+
762
+ <br class="clear" />
763
+ </div>
764
+ <?php
765
+ }
766
+
767
+ /**
768
+ * Extra controls to be displayed between bulk actions and pagination
769
+ *
770
+ * @since 3.1.0
771
+ * @access protected
772
+ */
773
+ function extra_tablenav( $which ) {}
774
+
775
+ /**
776
+ * Generate the <tbody> part of the table
777
+ *
778
+ * @since 3.1.0
779
+ * @access protected
780
+ */
781
+ function display_rows_or_placeholder() {
782
+ if ( $this->has_items() ) {
783
+ $this->display_rows();
784
+ } else {
785
+ list( $columns, $hidden ) = $this->get_column_info();
786
+ echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
787
+ $this->no_items();
788
+ echo '</td></tr>';
789
+ }
790
+ }
791
+
792
+ /**
793
+ * Generate the table rows
794
+ *
795
+ * @since 3.1.0
796
+ * @access protected
797
+ */
798
+ function display_rows() {
799
+ foreach ( $this->items as $item )
800
+ $this->single_row( $item );
801
+ }
802
+
803
+ /**
804
+ * Generates content for a single row of the table
805
+ *
806
+ * @since 3.1.0
807
+ * @access protected
808
+ *
809
+ * @param object $item The current item
810
+ */
811
+ function single_row( $item ) {
812
+ static $row_class = '';
813
+ $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
814
+
815
+ echo '<tr' . $row_class . '>';
816
+ echo $this->single_row_columns( $item );
817
+ echo '</tr>';
818
+ }
819
+
820
+ /**
821
+ * Generates the columns for a single row of the table
822
+ *
823
+ * @since 3.1.0
824
+ * @access protected
825
+ *
826
+ * @param object $item The current item
827
+ */
828
+ function single_row_columns( $item ) {
829
+ list( $columns, $hidden ) = $this->get_column_info();
830
+
831
+ foreach ( $columns as $column_name => $column_display_name ) {
832
+ $class = "class='$column_name column-$column_name'";
833
+
834
+ $style = '';
835
+ if ( in_array( $column_name, $hidden ) )
836
+ $style = ' style="display:none;"';
837
+
838
+ $attributes = "$class$style";
839
+
840
+ if ( 'cb' == $column_name ) {
841
+ echo '<th scope="row" class="check-column">';
842
+ echo $this->column_cb( $item );
843
+ echo '</th>';
844
+ }
845
+ elseif ( method_exists( $this, 'column_' . $column_name ) ) {
846
+ echo "<td $attributes>";
847
+ echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
848
+ echo "</td>";
849
+ }
850
+ else {
851
+ echo "<td $attributes>";
852
+ echo $this->column_default( $item, $column_name );
853
+ echo "</td>";
854
+ }
855
+ }
856
+ }
857
+
858
+ /**
859
+ * Handle an incoming ajax request (called from admin-ajax.php)
860
+ *
861
+ * @since 3.1.0
862
+ * @access public
863
+ */
864
+ function ajax_response() {
865
+ $this->prepare_items();
866
+
867
+ extract( $this->_args );
868
+ extract( $this->_pagination_args, EXTR_SKIP );
869
+
870
+ ob_start();
871
+ if ( ! empty( $_REQUEST['no_placeholder'] ) )
872
+ $this->display_rows();
873
+ else
874
+ $this->display_rows_or_placeholder();
875
+
876
+ $rows = ob_get_clean();
877
+
878
+ $response = array( 'rows' => $rows );
879
+
880
+ if ( isset( $total_items ) )
881
+ $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
882
+
883
+ if ( isset( $total_pages ) ) {
884
+ $response['total_pages'] = $total_pages;
885
+ $response['total_pages_i18n'] = number_format_i18n( $total_pages );
886
+ }
887
+
888
+ die( json_encode( $response ) );
889
+ }
890
+
891
+ /**
892
+ * Send required variables to JavaScript land
893
+ *
894
+ * @access private
895
+ */
896
+ function _js_vars() {
897
+ $args = array(
898
+ 'class' => get_class( $this ),
899
+ 'screen' => array(
900
+ 'id' => $this->screen->id,
901
+ 'base' => $this->screen->base,
902
+ )
903
+ );
904
+
905
+ printf( "<script type='text/javascript'>list_args = %s;</script>\n", json_encode( $args ) );
906
+ }
907
+ }
admin/index.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Do not modify the files in this folder.
5
+ */
admin/wp-security-admin-init.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Inits the admin dashboard side of things.
4
+ * Main admin file which loads all settings panels and sets up admin menus.
5
+ */
6
+ class AIOWPSecurity_Admin_Init
7
+ {
8
+ var $main_menu_page;
9
+ var $dashboard_menu;
10
+ var $settings_menu;
11
+ var $user_accounts_menu;
12
+ var $user_login_menu;
13
+ var $db_security_menu;
14
+ var $filesystem_menu;
15
+ var $whois_menu;
16
+ var $blacklist_menu;
17
+ var $firewall_menu;
18
+
19
+ function __construct()
20
+ {
21
+ $this->admin_includes();
22
+ add_action('admin_menu', array(&$this, 'create_admin_menus'));
23
+
24
+ //make sure we are on our plugin's menu pages
25
+ if (isset($_GET['page']) && strpos($_GET['page'], AIOWPSEC_MENU_SLUG_PREFIX ) !== false ) {
26
+ add_action('admin_print_scripts', array(&$this, 'admin_menu_page_scripts'));
27
+ add_action('admin_print_styles', array(&$this, 'admin_menu_page_styles'));
28
+ add_action('admin_init', array( &$this, 'admin_init_hook_handler')); //For changing button text inside media uploader (thickbox)
29
+ }
30
+ }
31
+
32
+ function admin_includes()
33
+ {
34
+ include_once('wp-security-admin-menu.php');
35
+ }
36
+
37
+ function admin_menu_page_scripts()
38
+ {
39
+ wp_enqueue_script('jquery');
40
+ wp_enqueue_script('postbox');
41
+ wp_enqueue_script('dashboard');
42
+ wp_enqueue_script('thickbox');
43
+ wp_enqueue_script('media-upload');
44
+ wp_register_script('aiowpsec-admin-js', AIO_WP_SECURITY_URL. '/js/wp-security-admin-script.js', array('jquery'));
45
+ wp_enqueue_script('aiowpsec-admin-js');
46
+ }
47
+
48
+ function admin_menu_page_styles()
49
+ {
50
+ wp_enqueue_style('dashboard');
51
+ wp_enqueue_style('thickbox');
52
+ wp_enqueue_style('global');
53
+ wp_enqueue_style('wp-admin');
54
+ wp_enqueue_style('aiowpsec-admin-css', AIO_WP_SECURITY_URL. '/css/wp-security-admin-styles.css');
55
+ }
56
+
57
+ function admin_init_hook_handler()
58
+ {
59
+ $this->aiowps_media_uploader_modification();
60
+ $this->initialize_feature_manager();
61
+ }
62
+
63
+ //For media uploader thickbox - change button text
64
+ function aiowps_media_uploader_modification()
65
+ {
66
+ global $pagenow;
67
+ if ('media-upload.php' == $pagenow || 'async-upload.php' == $pagenow)
68
+ {
69
+ // Here we will customize the 'Insert into Post' Button text inside Thickbox
70
+ add_filter( 'gettext', array($this, 'aiowps_media_uploader_replace_thickbox_text'), 1, 2);
71
+ }
72
+ }
73
+
74
+ function aiowps_media_uploader_replace_thickbox_text($translated_text, $text)
75
+ {
76
+ if ('Insert into Post' == $text)
77
+ {
78
+ $referer = strpos(wp_get_referer(), 'aiowpsec');
79
+ if ($referer != '')
80
+ {
81
+ return ('Select File');
82
+ }
83
+ }
84
+ return $translated_text;
85
+ }
86
+
87
+ function initialize_feature_manager()
88
+ {
89
+ $aiowps_feature_mgr = new AIOWPSecurity_Feature_Item_Manager();
90
+ $aiowps_feature_mgr->initialize_features();
91
+ $aiowps_feature_mgr->check_and_set_feature_status();
92
+ $aiowps_feature_mgr->calculate_total_points();
93
+ $GLOBALS['aiowps_feature_mgr'] = $aiowps_feature_mgr;
94
+ }
95
+
96
+ function create_admin_menus()
97
+ {
98
+ $menu_icon_url = AIO_WP_SECURITY_URL.'/images/plugin-icon.png';
99
+ $this->main_menu_page = add_menu_page(__('WP Security', 'aiowpsecurity'), __('WP Security', 'aiowpsecurity'), AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_MAIN_MENU_SLUG , array(&$this, 'handle_dashboard_menu_rendering'), $menu_icon_url);
100
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Dashboard', 'aiowpsecurity'), __('Dashboard', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_MAIN_MENU_SLUG, array(&$this, 'handle_dashboard_menu_rendering'));
101
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Settings', 'aiowpsecurity'), __('Settings', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_SETTINGS_MENU_SLUG, array(&$this, 'handle_settings_menu_rendering'));
102
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('User Accounts', 'aiowpsecurity'), __('User Accounts', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_USER_ACCOUNTS_MENU_SLUG, array(&$this, 'handle_user_accounts_menu_rendering'));
103
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('User Login', 'aiowpsecurity'), __('User Login', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_USER_LOGIN_MENU_SLUG, array(&$this, 'handle_user_login_menu_rendering'));
104
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Database Security', 'aiowpsecurity'), __('Database Security', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_DB_SEC_MENU_SLUG, array(&$this, 'handle_database_menu_rendering'));
105
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Filesystem Security', 'aiowpsecurity'), __('Filesystem Security', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_FILESYSTEM_MENU_SLUG, array(&$this, 'handle_filesystem_menu_rendering'));
106
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('WHOIS Lookup', 'aiowpsecurity'), __('WHOIS Lookup', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_WHOIS_MENU_SLUG, array(&$this, 'handle_whois_menu_rendering'));
107
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Blacklist Manager', 'aiowpsecurity'), __('Blacklist Manager', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_BLACKLIST_MENU_SLUG, array(&$this, 'handle_blacklist_menu_rendering'));
108
+ add_submenu_page(AIOWPSEC_MAIN_MENU_SLUG, __('Firewall', 'aiowpsecurity'), __('Firewall', 'aiowpsecurity') , AIOWPSEC_MANAGEMENT_PERMISSION, AIOWPSEC_FIREWALL_MENU_SLUG, array(&$this, 'handle_firewall_menu_rendering'));
109
+ do_action('aiowpsecurity_admin_menu_created');
110
+ }
111
+
112
+ function handle_dashboard_menu_rendering()
113
+ {
114
+ include_once('wp-security-dashboard-menu.php');
115
+ $this->dashboard_menu = new AIOWPSecurity_Dashboard_Menu();
116
+ }
117
+
118
+ function handle_settings_menu_rendering()
119
+ {
120
+ include_once('wp-security-settings-menu.php');
121
+ $this->settings_menu = new AIOWPSecurity_Settings_Menu();
122
+
123
+ }
124
+
125
+ function handle_user_accounts_menu_rendering()
126
+ {
127
+ include_once('wp-security-user-accounts-menu.php');
128
+ $this->user_accounts_menu = new AIOWPSecurity_User_Accounts_Menu();
129
+ }
130
+
131
+ function handle_user_login_menu_rendering()
132
+ {
133
+ include_once('wp-security-user-login-menu.php');
134
+ $this->user_login_menu = new AIOWPSecurity_User_Login_Menu();
135
+ }
136
+
137
+ function handle_database_menu_rendering()
138
+ {
139
+ include_once('wp-security-database-menu.php');
140
+ $this->db_security_menu = new AIOWPSecurity_Database_Menu();
141
+ }
142
+
143
+ function handle_filesystem_menu_rendering()
144
+ {
145
+ include_once('wp-security-filesystem-menu.php');
146
+ $this->filesystem_menu = new AIOWPSecurity_Filescan_Menu();
147
+ }
148
+
149
+ function handle_whois_menu_rendering()
150
+ {
151
+ include_once('wp-security-whois-menu.php');
152
+ $this->whois_menu = new AIOWPSecurity_WhoIs_Menu();
153
+ }
154
+
155
+ function handle_blacklist_menu_rendering()
156
+ {
157
+ include_once('wp-security-blacklist-menu.php');
158
+ $this->blacklist_menu = new AIOWPSecurity_Blacklist_Menu();
159
+ }
160
+
161
+ function handle_firewall_menu_rendering()
162
+ {
163
+ include_once('wp-security-firewall-menu.php');
164
+ $this->firewall_menu = new AIOWPSecurity_Firewall_Menu();
165
+ }
166
+ }//End of class
167
+
admin/wp-security-admin-menu.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* Parent class for all admin menu classes */
4
+ abstract class AIOWPSecurity_Admin_Menu
5
+ {
6
+ /**
7
+ * Shows postbox for settings menu
8
+ *
9
+ * @param string $id css ID for postbox
10
+ * @param string $title title of the postbox section
11
+ * @param string $content the content of the postbox
12
+ **/
13
+ function postbox_toggle($id, $title, $content)
14
+ {
15
+ //Always send string with translation markers in it
16
+ ?>
17
+ <div id="<?php echo $id; ?>" class="postbox">
18
+ <div class="handlediv" title="Click to toggle"><br /></div>
19
+ <h3 class="hndle"><span><?php echo $title; ?></span></h3>
20
+ <div class="inside">
21
+ <?php echo $content; ?>
22
+ </div>
23
+ </div>
24
+ <?php
25
+ }
26
+
27
+ function postbox($title, $content)
28
+ {
29
+ //Always send string with translation markers in it
30
+ ?>
31
+ <div class="postbox">
32
+ <h3><label for="title"><?php echo $title; ?></label></h3>
33
+ <div class="inside">
34
+ <?php echo $content; ?>
35
+ </div>
36
+ </div>
37
+ <?php
38
+ }
39
+
40
+ function show_msg_settings_updated()
41
+ {
42
+ echo '<div id="message" class="updated fade"><p><strong>';
43
+ _e('Settings successfully updated.','aiowpsecurity');
44
+ echo '</strong></p></div>';
45
+ }
46
+
47
+ static function show_msg_record_deleted_st()
48
+ {
49
+ echo '<div id="message" class="updated fade"><p><strong>';
50
+ _e('The selected record(s) deleted successfully!','aiowpsecurity');
51
+ echo '</strong></p></div>';
52
+ }
53
+
54
+ function show_msg_updated($msg)
55
+ {
56
+ echo '<div id="message" class="updated fade"><p><strong>';
57
+ echo $msg;
58
+ echo '</strong></p></div>';
59
+ }
60
+
61
+ static function show_msg_updated_st($msg)
62
+ {
63
+ echo '<div id="message" class="updated fade"><p><strong>';
64
+ echo $msg;
65
+ echo '</strong></p></div>';
66
+ }
67
+
68
+ function show_msg_error($error_msg)
69
+ {
70
+ echo '<div id="message" class="error"><p><strong>';
71
+ echo $error_msg;
72
+ echo '</strong></p></div>';
73
+ }
74
+
75
+ static function show_msg_error_st($error_msg)
76
+ {
77
+ echo '<div id="message" class="error"><p><strong>';
78
+ echo $error_msg;
79
+ echo '</strong></p></div>';
80
+ }
81
+
82
+ function start_buffer()
83
+ {
84
+ ob_start();
85
+ }
86
+
87
+ function end_buffer_and_collect()
88
+ {
89
+ $output = ob_get_contents();
90
+ ob_end_clean();
91
+ return $output;
92
+ }
93
+ }
admin/wp-security-blacklist-menu.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Blacklist_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_BLACKLIST_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'Ban Users',
10
+ 'tab2' => 'SPAM Comments IP Monitoring',
11
+ );
12
+
13
+ var $menu_tabs_handler = array(
14
+ 'tab1' => 'render_tab1',
15
+ 'tab2' => 'render_tab2',
16
+ );
17
+
18
+ function __construct()
19
+ {
20
+ $this->render_menu_page();
21
+ }
22
+
23
+ function get_current_tab()
24
+ {
25
+ $tab_keys = array_keys($this->menu_tabs);
26
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
27
+ return $tab;
28
+ }
29
+
30
+ /*
31
+ * Renders our tabs of this menu as nav items
32
+ */
33
+ function render_menu_tabs()
34
+ {
35
+ $current_tab = $this->get_current_tab();
36
+
37
+ echo '<h2 class="nav-tab-wrapper">';
38
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
39
+ {
40
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
41
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
42
+ }
43
+ echo '</h2>';
44
+ }
45
+
46
+ /*
47
+ * The menu rendering goes here
48
+ */
49
+ function render_menu_page()
50
+ {
51
+ $tab = $this->get_current_tab();
52
+ ?>
53
+ <div class="wrap">
54
+ <div id="poststuff"><div id="post-body">
55
+ <?php
56
+ $this->render_menu_tabs();
57
+ //$tab_keys = array_keys($this->menu_tabs);
58
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
59
+ ?>
60
+ </div></div>
61
+ </div><!-- end of wrap -->
62
+ <?php
63
+ }
64
+
65
+ function render_tab1()
66
+ {
67
+ //if this is the case there is no need to display a "fix permissions" button
68
+ global $wpdb, $aio_wp_security;
69
+ $result = 1;
70
+ if (isset($_POST['aiowps_save_blacklist_settings']))
71
+ {
72
+ $nonce=$_REQUEST['_wpnonce'];
73
+ if (!wp_verify_nonce($nonce, 'aiowpsec-blacklist-settings-nonce'))
74
+ {
75
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed for save blacklist settings!",4);
76
+ die(__('Nonce check failed for save blacklist settings!','aiowpsecurity'));
77
+ }
78
+
79
+ if (isset($_POST["aiowps_enable_blacklisting"]) && empty($_POST['aiowps_banned_ip_addresses']) && empty($_POST['aiowps_banned_user_agents']))
80
+ {
81
+ $this->show_msg_error('You must submit at least one IP address or one User Agent value or both!','aiowpsecurity');
82
+ }
83
+ else
84
+ {
85
+ if (!empty($_POST['aiowps_banned_ip_addresses']))
86
+ {
87
+ $ip_addresses = $_POST['aiowps_banned_ip_addresses'];
88
+ $ip_list_array = AIOWPSecurity_Utility_IP::create_ip_list_array_from_string_with_newline($ip_addresses);
89
+ $payload = AIOWPSecurity_Utility_IP::validate_ip_list($ip_list_array);
90
+ if($payload[0] == 1){
91
+ //success case
92
+ $result = 1;
93
+ $list = $payload[1];
94
+ $banned_ip_data = implode(PHP_EOL, $list);
95
+ $aio_wp_security->configs->set_value('aiowps_banned_ip_addresses',$banned_ip_data);
96
+ $_POST['aiowps_banned_ip_addresses'] = ''; //Clear the post variable for the banned address list
97
+ }
98
+ else{
99
+ $result = -1;
100
+ $error_msg = $payload[1][0];
101
+ $this->show_msg_error($error_msg);
102
+ }
103
+
104
+ }
105
+ else
106
+ {
107
+ $aio_wp_security->configs->set_value('aiowps_banned_ip_addresses',''); //Clear the IP address config value
108
+ }
109
+
110
+ if (!empty($_POST['aiowps_banned_user_agents']))
111
+ {
112
+ $result = $result * $this->validate_user_agent_list();
113
+ }
114
+
115
+ if ($result == 1)
116
+ {
117
+ $aio_wp_security->configs->set_value('aiowps_enable_blacklisting',isset($_POST["aiowps_enable_blacklisting"])?'1':'');
118
+ $aio_wp_security->configs->save_config(); //Save the configuration
119
+ $this->show_msg_settings_updated();
120
+
121
+ $write_result = AIOWPSecurity_Utility_Htaccess::write_to_htaccess(); //now let's write to the .htaccess file
122
+ if ($write_result == -1)
123
+ {
124
+ $this->show_msg_error(__('The plugin was unable to write to the .htaccess file. Please edit file manually.','aiowpsecurity'));
125
+ $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Blacklist_Menu - The plugin was unable to write to the .htaccess file.");
126
+ }
127
+ }
128
+ }
129
+ }
130
+ ?>
131
+ <h2><?php _e('Ban IPs or User Agents', 'aiowpsecurity')?></h2>
132
+ <div class="aio_blue_box">
133
+ <?php
134
+ echo '<p>'.__('The All In One WP Security Blacklist feature gives you the option of banning certain host IP addresses or ranges and also user agents.', 'aiowpsecurity').'
135
+ <br />'.__('This feature will deny total site access for users which have IP addresses or user agents matching those which you have configured in the settings below.', 'aiowpsecurity').'
136
+ <br />'.__('The plugin achieves this by making appropriate modifications to your .htaccess file.', 'aiowpsecurity').'
137
+ <br />'.__('By blocking people via the .htaccess file your are using the most secure first line of defence which denies all access to blacklisted visitors as soon as they hit your hosting server.', 'aiowpsecurity').'
138
+ </p>';
139
+ ?>
140
+ </div>
141
+
142
+ <div class="postbox">
143
+ <h3><label for="title"><?php _e('IP Hosts and User Agent Blacklist Settings', 'aiowpsecurity'); ?></label></h3>
144
+ <div class="inside">
145
+ <?php
146
+ //Display security info badge
147
+ global $aiowps_feature_mgr;
148
+ $aiowps_feature_mgr->output_feature_details_badge("blacklist-manager-ip-user-agent-blacklisting");
149
+ ?>
150
+ <form action="" method="POST">
151
+ <?php wp_nonce_field('aiowpsec-blacklist-settings-nonce'); ?>
152
+ <table class="form-table">
153
+ <tr valign="top">
154
+ <th scope="row"><?php _e('Enable IP or User Agent Blacklisting', 'aiowpsecurity')?>:</th>
155
+ <td>
156
+ <input name="aiowps_enable_blacklisting" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_blacklisting')=='1') echo ' checked="checked"'; ?> value="1"/>
157
+ <span class="description"><?php _e('Check this if you want to enable the banning (or blacklisting) of selected IP addresses and/or user agents specified in the settings below', 'aiowpsecurity'); ?></span>
158
+ </td>
159
+ </tr>
160
+ <tr valign="top">
161
+ <th scope="row"><?php _e('Enter IP Addresses:', 'aiowpsecurity')?></th>
162
+ <td>
163
+ <textarea name="aiowps_banned_ip_addresses" rows="5" cols="50"><?php echo ($result == -1)?$_POST['aiowps_banned_ip_addresses']:$aio_wp_security->configs->get_value('aiowps_banned_ip_addresses'); ?></textarea>
164
+ <br />
165
+ <span class="description"><?php _e('Enter one or more IP addresses or IP ranges.','aiowpsecurity');?></span>
166
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
167
+ <div class="aiowps_more_info_body">
168
+ <?php
169
+ echo '<p class="description">'.__('Each IP address must be on a new line.', 'aiowpsecurity').'</p>';
170
+ echo '<p class="description">'.__('To specify an IP range use a wildcard "*" character. Acceptable ways to use wildcards is shown in the examples below:', 'aiowpsecurity').'</p>';
171
+ echo '<p class="description">'.__('Example 1: 195.47.89.*', 'aiowpsecurity').'</p>';
172
+ echo '<p class="description">'.__('Example 2: 195.47.*.*', 'aiowpsecurity').'</p>';
173
+ echo '<p class="description">'.__('Example 3: 195.*.*.*', 'aiowpsecurity').'</p>';
174
+ ?>
175
+ </div>
176
+
177
+ </td>
178
+ </tr>
179
+ <tr valign="top">
180
+ <th scope="row"><?php _e('Enter User Agents:', 'aiowpsecurity')?></th>
181
+ <td>
182
+ <textarea name="aiowps_banned_user_agents" rows="5" cols="50"><?php echo ($result == -1)?$_POST['aiowps_banned_user_agents']:$aio_wp_security->configs->get_value('aiowps_banned_user_agents'); ?></textarea>
183
+ <br />
184
+ <span class="description">
185
+ <?php _e('Enter one or more user agent strings.','aiowpsecurity');?></span>
186
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
187
+ <div class="aiowps_more_info_body">
188
+ <?php
189
+ echo '<p class="description">'.__('Each user agent string must be on a new line.', 'aiowpsecurity').'</p>';
190
+ echo '<p class="description">'.__('Example 1 - A single user agent string to block:', 'aiowpsecurity').'</p>';
191
+ echo '<p class="description">SquigglebotBot</p>';
192
+ echo '<p class="description">'.__('Example 2 - A list of more than 1 user agent strings to block', 'aiowpsecurity').'</p>';
193
+ echo '<p class="description">baiduspider<br />SquigglebotBot<br />SurveyBot<br />VoidEYE<br />webcrawl.net<br />YottaShopping_Bot</p>';
194
+ ?>
195
+ </div>
196
+
197
+ </td>
198
+ </tr>
199
+ </table>
200
+ <input type="submit" name="aiowps_save_blacklist_settings" value="<?php _e('Save Settings', 'aiowpsecurity')?>" class="button-primary" />
201
+ </form>
202
+ </div></div>
203
+ <?php
204
+ }
205
+
206
+ function render_tab2()
207
+ {
208
+ global $aio_wp_security;
209
+ include_once 'wp-security-list-comment-spammer-ip.php'; //For rendering the AIOWPSecurity_List_Table in tab2
210
+ $spammer_ip_list = new AIOWPSecurity_List_Comment_Spammer_IP();
211
+
212
+ if (isset($_POST['aiowps_ip_spam_comment_search']))
213
+ {
214
+ $error = '';
215
+ $nonce=$_REQUEST['_wpnonce'];
216
+ if (!wp_verify_nonce($nonce, 'aiowpsec-spammer-ip-list-nonce'))
217
+ {
218
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed for list SPAM comment IPs!",4);
219
+ die(__('Nonce check failed for list SPAM comment IPs!','aiowpsecurity'));
220
+ }
221
+
222
+ $min_comments_per_ip = sanitize_text_field($_POST['aiowps_spam_ip_min_comments']);
223
+ if(!is_numeric($min_comments_per_ip))
224
+ {
225
+ $error .= '<br />'.__('You entered a non numeric value for the minimum SPAM comments per IP field. It has been set to the default value.','aiowpsecurity');
226
+ $min_comments_per_ip = '5';//Set it to the default value for this field
227
+ }
228
+
229
+ if($error)
230
+ {
231
+ $this->show_msg_error(__('Attention!','aiowpsecurity').$error);
232
+ }
233
+
234
+ //Save all the form values to the options
235
+ $aio_wp_security->configs->set_value('aiowps_spam_ip_min_comments',absint($min_comments_per_ip));
236
+ $aio_wp_security->configs->save_config();
237
+ $info_msg_string = sprintf( __('Displaying results for IP addresses which have posted a minimum of %s SPAM comments', 'aiowpsecurity'), $min_comments_per_ip);
238
+ $this->show_msg_updated($info_msg_string);
239
+
240
+ }
241
+
242
+ if(isset($_REQUEST['action'])) //Do list table form row action tasks
243
+ {
244
+ if($_REQUEST['action'] == 'block_spammer_ip')
245
+ { //The "block" link was clicked for a row in the list table
246
+ $spammer_ip_list->block_spammer_ip_records(strip_tags($_REQUEST['spammer_ip']));
247
+ }
248
+ }
249
+
250
+ ?>
251
+ <div class="aio_blue_box">
252
+ <?php
253
+ echo '<p>'.__('This tab displays a list of the IP addresses of the people or bots who have left SPAM comments on your site.', 'aiowpsecurity').'
254
+ <br />'.__('This information can be handy for identifying the most persistent IP addresses or ranges used by spammers.', 'aiowpsecurity').'
255
+ <br />'.__('By inspecting the IP address data coming from spammers you will be in a better position to determine which addresses or address ranges you should block by adding them to your blacklist.', 'aiowpsecurity').'
256
+ <br />'.__('To add one or more of the IP addresses displayed in the table below to your blacklist, simply click the "Block" link for the individual row or select more than one address
257
+ using the checkboxes and then choose the "block" option from the Bulk Actions dropdown list and click the "Apply" button.', 'aiowpsecurity').'
258
+ </p>';
259
+ ?>
260
+ </div>
261
+ <div class="postbox">
262
+ <h3><label for="title"><?php _e('List SPAMMER IP Addresses', 'aiowpsecurity'); ?></label></h3>
263
+ <div class="inside">
264
+ <form action="" method="POST">
265
+ <?php wp_nonce_field('aiowpsec-spammer-ip-list-nonce'); ?>
266
+ <table class="form-table">
267
+ <tr valign="top">
268
+ <th scope="row"><?php _e('Minimum number of SPAM comments per IP', 'aiowpsecurity')?>:</th>
269
+ <td><input size="5" name="aiowps_spam_ip_min_comments" value="<?php echo $aio_wp_security->configs->get_value('aiowps_spam_ip_min_comments'); ?>" />
270
+ <span class="description"><?php _e('This field allows you to list only those IP addresses which have been used to post X or more SPAM comments.', 'aiowpsecurity');?></span>
271
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
272
+ <div class="aiowps_more_info_body">
273
+ <?php
274
+ echo '<p class="description">'.__('Example 1: Setting this value to "0" or "1" will list ALL IP addresses which were used to submit SPAM comments.', 'aiowpsecurity').'</p>';
275
+ echo '<p class="description">'.__('Example 2: Setting this value to "5" will list only those IP addresses which were used to submit 5 SPAM comments or more on your site.', 'aiowpsecurity').'</p>';
276
+ ?>
277
+ </div>
278
+
279
+ </td>
280
+ </tr>
281
+ </table>
282
+ <input type="submit" name="aiowps_ip_spam_comment_search" value="<?php _e('Find IP Addresses', 'aiowpsecurity')?>" class="button-primary" />
283
+ </form>
284
+ </div></div>
285
+ <div class="postbox">
286
+ <h3><label for="title"><?php _e('SPAMMER IP Address Results', 'aiowpsecurity'); ?></label></h3>
287
+ <div class="inside">
288
+ <?php
289
+ //Fetch, prepare, sort, and filter our data...
290
+ $spammer_ip_list->prepare_items();
291
+ //echo "put table of locked entries here";
292
+ ?>
293
+ <form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
294
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
295
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
296
+ <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab']; ?>" />
297
+ <!-- Now we can render the completed list table -->
298
+ <?php $spammer_ip_list->display(); ?>
299
+ </form>
300
+ </div></div>
301
+ <?php
302
+ }
303
+
304
+ function validate_user_agent_list()
305
+ {
306
+ global $aio_wp_security;
307
+ @ini_set('auto_detect_line_endings', true);
308
+ //$errors = '';
309
+
310
+ $submitted_agents = explode(PHP_EOL, $_POST['aiowps_banned_user_agents']);
311
+ $agents = array();
312
+ if (!empty($submitted_agents))
313
+ {
314
+ foreach ($submitted_agents as $agent)
315
+ {
316
+ $text = quotemeta(sanitize_text_field($agent));
317
+ $agents[] = $text;
318
+ }
319
+ }
320
+
321
+ if (sizeof($agents) > 1)
322
+ {
323
+ sort( $agents );
324
+ $agents = array_unique($agents, SORT_STRING);
325
+ }
326
+
327
+ $banned_user_agent_data = implode(PHP_EOL, $agents);
328
+ $aio_wp_security->configs->set_value('aiowps_banned_user_agents',$banned_user_agent_data);
329
+ $_POST['aiowps_banned_user_agents'] = ''; //Clear the post variable for the banned address list
330
+ return 1;
331
+ }
332
+ } //end class
admin/wp-security-dashboard-menu.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Dashboard_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $dashboard_menu_page_slug = AIOWPSEC_MAIN_MENU_SLUG;
6
+
7
+ var $menu_tabs = array(
8
+ 'tab1' => 'Dashboard',
9
+ 'tab2' => 'System Info',
10
+ );
11
+
12
+ var $menu_tabs_handler = array(
13
+ 'tab1' => 'render_tab1',
14
+ 'tab2' => 'render_tab2',
15
+ );
16
+
17
+ function __construct()
18
+ {
19
+ $this->render_menu_page();
20
+ }
21
+
22
+ function get_current_tab()
23
+ {
24
+ $tab_keys = array_keys($this->menu_tabs);
25
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
26
+ return $tab;
27
+ }
28
+
29
+ /*
30
+ * Renders our tabs of this menu as nav items
31
+ */
32
+ function render_menu_tabs()
33
+ {
34
+ $current_tab = $this->get_current_tab();
35
+
36
+ echo '<h2 class="nav-tab-wrapper">';
37
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
38
+ {
39
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
40
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->dashboard_menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
41
+ }
42
+ echo '</h2>';
43
+ }
44
+
45
+ /*
46
+ * The menu rendering goes here
47
+ */
48
+ function render_menu_page()
49
+ {
50
+ $tab = $this->get_current_tab();
51
+ ?>
52
+ <div class="wrap">
53
+ <div id="poststuff"><div id="post-body">
54
+ <?php
55
+ $this->render_menu_tabs();
56
+ //$tab_keys = array_keys($this->menu_tabs);
57
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
58
+ ?>
59
+ </div></div>
60
+ </div><!-- end of wrap -->
61
+ <?php
62
+ }
63
+
64
+ function render_tab1()
65
+ {
66
+ echo '<div class="aio_grey_box">';
67
+ echo '<p>For information, updates and documentation, please visit the <a href="http://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin" target="_blank">AIO WP Security & Firewall Plugin</a> Page.</p>';
68
+ echo '<p><a href="http://www.tipsandtricks-hq.com/development-center" target="_blank">Follow us</a> on Twitter, Google+ or via Email to stay upto date about the new security features of this plugin.</p>';
69
+ echo '</div>';
70
+
71
+ echo "<script type='text/javascript' src='https://www.google.com/jsapi'></script>";//Include the google chart library
72
+
73
+ global $aiowps_feature_mgr;
74
+ $feature_mgr = $aiowps_feature_mgr;
75
+ $total_site_security_points = $feature_mgr->get_total_site_points();
76
+ $total_security_points_achievable = $feature_mgr->get_total_achievable_points();
77
+
78
+ ?>
79
+ <div class="aiowps_dashboard_box_small">
80
+ <div class="postbox">
81
+ <h3><label for="title">Security Strength Meter</label></h3>
82
+ <div class="inside">
83
+
84
+ <script type='text/javascript'>
85
+ google.load('visualization', '1', {packages:['gauge']});
86
+ google.setOnLoadCallback(drawChart);
87
+ function drawChart() {
88
+ var data = google.visualization.arrayToDataTable([
89
+ ['Label', 'Value'],
90
+ ['Strength', <?php echo $total_site_security_points; ?>]
91
+ ]);
92
+
93
+ var options = {
94
+ width: 320, height: 200, max: <?php echo $total_security_points_achievable; ?>,
95
+ greenColor: '8EFA9B', yellowColor: 'F5EE90', redColor: 'FA7373',
96
+ redFrom: 0, redTo: 10,
97
+ yellowFrom:10, yellowTo: 50,
98
+ greenFrom:50, greenTo: <?php echo $total_security_points_achievable; ?>,
99
+ minorTicks: 5
100
+ };
101
+
102
+ var chart = new google.visualization.Gauge(document.getElementById('security_strength_chart_div'));
103
+ chart.draw(data, options);
104
+ }
105
+ </script>
106
+ <div id='security_strength_chart_div'></div>
107
+
108
+ <div class="aiowps_dashboard_widget_footer">
109
+ <?php
110
+ _e('Total Achievable Points: ','aiowpsecurity');
111
+ echo '<strong>'.$total_security_points_achievable.'</strong><br />';
112
+ _e('Current Score of Your Site: ','aiowpsecurity');
113
+ echo '<strong>'.$total_site_security_points.'</strong>';
114
+ ?>
115
+ </div>
116
+
117
+ </div></div>
118
+ </div><!-- aiowps_dashboard_box -->
119
+
120
+ <div class="aiowps_dashboard_box_small">
121
+ <div class="postbox">
122
+ <h3><label for="title">Security Points Breakdown</label></h3>
123
+ <div class="inside">
124
+
125
+ <?php
126
+ $feature_items = $feature_mgr->feature_items;
127
+ $pt_src_chart_data = "";
128
+ $pt_src_chart_data .= "['Feature Name', 'Points'],";
129
+ foreach($feature_items as $item)
130
+ {
131
+ if($item->feature_status == $feature_mgr->feature_active)
132
+ {
133
+ $pt_src_chart_data .= "['".$item->feature_name."', ".$item->item_points."],";
134
+ }
135
+ }
136
+
137
+ ?>
138
+ <script type="text/javascript">
139
+ google.load("visualization", "1", {packages:["corechart"]});
140
+ google.setOnLoadCallback(drawChart);
141
+ function drawChart() {
142
+ var data = google.visualization.arrayToDataTable([
143
+ <?php echo $pt_src_chart_data; ?>
144
+ ]);
145
+
146
+ var options = {
147
+ height: '250',
148
+ width: '320',
149
+ backgroundColor: 'F6F6F6'
150
+ };
151
+
152
+ var chart = new google.visualization.PieChart(document.getElementById('points_source_breakdown_chart_div'));
153
+ chart.draw(data, options);
154
+ }
155
+ </script>
156
+ <div id='points_source_breakdown_chart_div'></div>
157
+
158
+ </div></div>
159
+ </div><!-- aiowps_dashboard_box -->
160
+
161
+ <div class="aiowps_dashboard_box_small">
162
+ <div class="postbox">
163
+ <h3><label for="title">Critical Feature Status</label></h3>
164
+ <div class="inside">
165
+
166
+ <?php
167
+ _e('Below is the current status of the critical features that you should activate on your site for maximum security','aiowpsecurity');
168
+ $feature_items = $feature_mgr->feature_items;
169
+ $username_admin_feature = $feature_mgr->get_feature_item_by_id("user-accounts-change-admin-user");
170
+ echo '<div class="aiowps_feature_status_container">';
171
+ echo '<div class="aiowps_feature_status_name">'.__('Admin Username','aiowpsecurity').'</div>';
172
+ echo '<a href="admin.php?page='.AIOWPSEC_USER_ACCOUNTS_MENU_SLUG.'" target="_blank">';
173
+ echo '<div class="aiowps_feature_status_bar">';
174
+ if($username_admin_feature->feature_status == $feature_mgr->feature_active){
175
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_on">On</div>';
176
+ echo '<div class="aiowps_feature_status_label">Off</div>';
177
+ }else{
178
+ echo '<div class="aiowps_feature_status_label">On</div>';
179
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_off">Off</div>';
180
+ }
181
+ echo '</div></div></a>';
182
+ echo '<div class="aio_clear_float"></div>';
183
+
184
+ $login_lockdown_feature = $feature_mgr->get_feature_item_by_id("user-login-login-lockdown");
185
+ echo '<div class="aiowps_feature_status_container">';
186
+ echo '<div class="aiowps_feature_status_name">'.__('Login Lockdown','aiowpsecurity').'</div>';
187
+ echo '<a href="admin.php?page='.AIOWPSEC_USER_LOGIN_MENU_SLUG.'" target="_blank">';
188
+ echo '<div class="aiowps_feature_status_bar">';
189
+ if($login_lockdown_feature->feature_status == $feature_mgr->feature_active){
190
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_on">On</div>';
191
+ echo '<div class="aiowps_feature_status_label">Off</div>';
192
+ }else{
193
+ echo '<div class="aiowps_feature_status_label">On</div>';
194
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_off">Off</div>';
195
+ }
196
+ echo '</div></div></a>';
197
+ echo '<div class="aio_clear_float"></div>';
198
+
199
+ $filesystem_feature = $feature_mgr->get_feature_item_by_id("filesystem-file-permissions");
200
+ echo '<div class="aiowps_feature_status_container">';
201
+ echo '<div class="aiowps_feature_status_name">'.__('File Permission','aiowpsecurity').'</div>';
202
+ echo '<a href="admin.php?page='.AIOWPSEC_FILESYSTEM_MENU_SLUG.'" target="_blank">';
203
+ echo '<div class="aiowps_feature_status_bar">';
204
+ if($filesystem_feature->feature_status == $feature_mgr->feature_active){
205
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_on">On</div>';
206
+ echo '<div class="aiowps_feature_status_label">Off</div>';
207
+ }else{
208
+ echo '<div class="aiowps_feature_status_label">On</div>';
209
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_off">Off</div>';
210
+ }
211
+ echo '</div></div></a>';
212
+ echo '<div class="aio_clear_float"></div>';
213
+
214
+ $basic_firewall_feature = $feature_mgr->get_feature_item_by_id("firewall-basic-rules");
215
+ echo '<div class="aiowps_feature_status_container">';
216
+ echo '<div class="aiowps_feature_status_name">'.__('Basic Firewall','aiowpsecurity').'</div>';
217
+ echo '<a href="admin.php?page='.AIOWPSEC_FIREWALL_MENU_SLUG.'" target="_blank">';
218
+ echo '<div class="aiowps_feature_status_bar">';
219
+ if($basic_firewall_feature->feature_status == $feature_mgr->feature_active){
220
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_on">On</div>';
221
+ echo '<div class="aiowps_feature_status_label">Off</div>';
222
+ }else{
223
+ echo '<div class="aiowps_feature_status_label">On</div>';
224
+ echo '<div class="aiowps_feature_status_label aiowps_feature_status_off">Off</div>';
225
+ }
226
+ echo '</div></div></a>';
227
+ echo '<div class="aio_clear_float"></div>';
228
+ ?>
229
+ </div></div>
230
+ </div><!-- aiowps_dashboard_box -->
231
+
232
+ <div class="aiowps_dashboard_box_small">
233
+ <div class="postbox">
234
+ <h3><label for="title">Spread the Word</label></h3>
235
+ <div class="inside">
236
+
237
+ <p>We are working to make your WordPress site more secure. Please support us, here is how:</p>
238
+ <p>
239
+ <a href="http://twitter.com/intent/tweet?url=http://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin&text=I love the All In One WP Security and Firewall plugin!" target="_blank" class="aio_tweet_link">Post to Tweeter</a>
240
+ </p>
241
+ <p>
242
+ <a href="http://wordpress.org/plugins/all-in-one-wp-security-and-firewall/" target="_blank" class="aio_rate_us_link">Vote & Rate Now</a>
243
+ </p>
244
+
245
+ </div></div>
246
+ </div><!-- aiowps_dashboard_box -->
247
+
248
+ <div class="aio_clear_float"></div>
249
+ <?php
250
+ }
251
+
252
+
253
+ function render_tab2()
254
+ {
255
+ global $wpdb;
256
+ ?>
257
+ <div class="postbox">
258
+ <h3><label for="title">Site Info</label></h3>
259
+ <div class="inside">
260
+ <strong>Plugin Version: </strong><code><?php echo AIO_WP_SECURITY_VERSION;?></code><br />
261
+ <strong>WP Version: </strong><code><?php echo get_bloginfo("version"); ?></code><br />
262
+ <strong>WPMU: </strong><code><?php echo (!defined('MULTISITE') || !MULTISITE) ? "No" : "Yes"; ?></code><br />
263
+ <strong>MySQL Version: </strong><code><?php echo $wpdb->db_version();?></code><br />
264
+ <strong>WP Table Prefix: </strong><code><?php echo $wpdb->prefix; ?></code><br />
265
+ <strong>PHP Version: </strong><code><?php echo phpversion(); ?></code><br />
266
+ <strong>Session Save Path: </strong><code><?php echo ini_get("session.save_path"); ?></code><br />
267
+ <strong>WP URL: </strong><code><?php echo get_bloginfo('wpurl'); ?></code><br />
268
+ <strong>Server Name: </strong><code><?php echo $_SERVER['SERVER_NAME']; ?></code><br />
269
+ <strong>Cookie Domain: </strong><code><?php $cookieDomain = parse_url( strtolower( get_bloginfo('wpurl') ) ); echo $cookieDomain['host']; ?></code><br />
270
+ <strong>CURL Library Present: </strong><code><?php echo (function_exists('curl_init')) ? "Yes" : "No"; ?></code><br />
271
+ <strong>Debug File Write Permissions: </strong><code><?php echo (is_writable(AIO_WP_SECURITY_PATH)) ? "Writable" : "Not Writable"; ?></code><br />
272
+ </div></div>
273
+
274
+ <div class="postbox">
275
+ <h3><label for="title">Active Plugins</label></h3>
276
+ <div class="inside">
277
+ <?php
278
+ $all_plugins = get_plugins();
279
+ $active_plugins = get_option('active_plugins');
280
+ //var_dump($all_plugins);
281
+ ?>
282
+ <table class="widefat aio_spacer_10_tb">
283
+ <thead>
284
+ <tr>
285
+ <th><?php _e('Name', 'aiowpsecurity') ?></th>
286
+ <th><?php _e('Version', 'aiowpsecurity') ?></th>
287
+ <th><?php _e('Plugin URL', 'aiowpsecurity') ?></th>
288
+ </tr>
289
+ </thead>
290
+ <tbody>
291
+ <?php
292
+ foreach ($active_plugins as $plugin_key)
293
+ {
294
+ $plugin_details = $all_plugins[$plugin_key];
295
+ echo '<tr><td>'.$plugin_details['Name'].'</td><td>'.$plugin_details['Version'].'</td><td>'.$plugin_details['PluginURI'].'</td></tr>';
296
+ }
297
+ ?>
298
+ </tbody>
299
+ </table>
300
+ </div></div>
301
+ <?php
302
+ }
303
+
304
+ } //end class
admin/wp-security-database-menu.php ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Database_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_DB_SEC_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'DB Prefix',
10
+ 'tab2' => 'DB Backup',
11
+ );
12
+
13
+ var $menu_tabs_handler = array(
14
+ 'tab1' => 'render_tab1',
15
+ 'tab2' => 'render_tab2',
16
+ );
17
+
18
+ function __construct()
19
+ {
20
+ $this->render_menu_page();
21
+ }
22
+
23
+ function get_current_tab()
24
+ {
25
+ $tab_keys = array_keys($this->menu_tabs);
26
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
27
+ return $tab;
28
+ }
29
+
30
+ /*
31
+ * Renders our tabs of this menu as nav items
32
+ */
33
+ function render_menu_tabs()
34
+ {
35
+ $current_tab = $this->get_current_tab();
36
+
37
+ echo '<h2 class="nav-tab-wrapper">';
38
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
39
+ {
40
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
41
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
42
+ }
43
+ echo '</h2>';
44
+ }
45
+
46
+ /*
47
+ * The menu rendering goes here
48
+ */
49
+ function render_menu_page()
50
+ {
51
+ $tab = $this->get_current_tab();
52
+ ?>
53
+ <div class="wrap">
54
+ <div id="poststuff"><div id="post-body">
55
+ <?php
56
+ $this->render_menu_tabs();
57
+ //$tab_keys = array_keys($this->menu_tabs);
58
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
59
+ ?>
60
+ </div></div>
61
+ </div><!-- end of wrap -->
62
+ <?php
63
+ }
64
+
65
+ function render_tab1()
66
+ {
67
+ global $wpdb, $aio_wp_security;
68
+ $old_db_prefix = $wpdb->prefix;
69
+ $new_db_prefix = '';
70
+ $perform_db_change = false;
71
+
72
+ if (isset($_POST['aiowps_db_prefix_change']))//Do form submission tasks
73
+ {
74
+ $nonce=$_REQUEST['_wpnonce'];
75
+ if (!wp_verify_nonce($nonce, 'aiowpsec-db-prefix-change-nonce'))
76
+ {
77
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed for DB prefix change operation!",4);
78
+ die(__('Nonce check failed for DB prefix change operation!','aiowpsecurity'));
79
+ }
80
+ if( isset($_POST['aiowps_enable_random_prefix']))
81
+ {//User has elected to generate a random DB prefix
82
+ $string = AIOWPSecurity_Utility::generate_alpha_numeric_random_string('6');
83
+ $new_db_prefix = $string . '_';
84
+ $perform_db_change = true;
85
+ }else
86
+ {
87
+ if (empty($_POST['aiowps_new_manual_db_prefix']))
88
+ {
89
+ $this->show_msg_error(__('Please enter a value for the DB prefix.', 'aiowpsecurity'));
90
+ }
91
+ else
92
+ {
93
+ //User has chosen their own DB prefix value
94
+ $new_db_prefix = wp_strip_all_tags( trim( $_POST['aiowps_new_manual_db_prefix'] ) );
95
+ $error = $wpdb->set_prefix( $new_db_prefix );
96
+ if(is_wp_error($error))
97
+ {
98
+ wp_die( __('<strong>ERROR</strong>: The table prefix can only contain numbers, letters, and underscores.', 'aiowpsecurity') );
99
+ }
100
+ $perform_db_change = true;
101
+ }
102
+ }
103
+ }
104
+ ?>
105
+ <h2><?php _e('Change Database Prefix', 'aiowpsecurity')?></h2>
106
+ <div class="aio_blue_box">
107
+ <?php
108
+ echo '<p>'.__('Your WordPress DB is the most important asset of your website because it contains a lot of your site\'s precious information.', 'aiowpsecurity').'
109
+ <br />'.__('The DB is also a target for hackers via methods such as SQL injections and malicious and automated code which targets certain tables.', 'aiowpsecurity').'
110
+ <br />'.__('One way to add a layer of protection for your DB is to change the default WordPress table prefix from "wp_" to something else which will be difficult for hackers to guess.', 'aiowpsecurity').'
111
+ <br />'.__('This feature allows you to easily change the prefix to a value of your choice or to a random value set by this plugin.', 'aiowpsecurity').'
112
+ </p>';
113
+ ?>
114
+ </div>
115
+
116
+ <div class="postbox">
117
+ <h3><label for="title"><?php _e('DB Prefix Options', 'aiowpsecurity'); ?></label></h3>
118
+ <div class="inside">
119
+ <?php
120
+ //Display security info badge
121
+ global $aiowps_feature_mgr;
122
+ $aiowps_feature_mgr->output_feature_details_badge("db-security-db-prefix");
123
+ ?>
124
+
125
+ <div class="aio_yellow_box">
126
+ <?php
127
+ $backup_tab_link = '<a href="admin.php?page='.AIOWPSEC_DB_SEC_MENU_SLUG.'&tab=tab2">DB Backup</a>';
128
+ $info_msg = '<p>'.sprintf( __('It is recommended that you perform a %s before using this feature', 'aiowpsecurity'), $backup_tab_link).'</p>';
129
+ echo $info_msg;
130
+ ?>
131
+ </div>
132
+
133
+ <form action="" method="POST">
134
+ <?php wp_nonce_field('aiowpsec-db-prefix-change-nonce'); ?>
135
+ <table class="form-table">
136
+ <tr valign="top">
137
+ <th scope="row"><?php _e('Current DB Table Prefix', 'aiowpsecurity')?>:</th>
138
+ <td>
139
+ <span class="aiowpsec_field_value"><strong><?php echo $wpdb->prefix; ?></strong></span>
140
+ <?php
141
+ //now let's display a warning notification if default prefix is used
142
+ if ($old_db_prefix == 'wp_') {
143
+ echo '&nbsp;&nbsp;&nbsp;<span class="aio_error_with_icon">'.__('Your site is currently using the default WordPress DB prefix value of "wp_".
144
+ To increase your site\'s security you should consider changing the DB prefix value to another value.', 'aiowpsecurity').'</span>';
145
+ }
146
+ ?>
147
+ </td>
148
+ </tr>
149
+ <tr valign="top">
150
+ <th scope="row"><?php _e('Generate New DB Table Prefix', 'aiowpsecurity')?>:</th>
151
+ <td>
152
+ <input name="aiowps_enable_random_prefix" type="checkbox" <?php if($aio_wp_security->configs->get_value('aiowps_enable_random_prefix')=='1') echo ' checked="checked"'; ?> value="1"/>
153
+ <span class="description"><?php _e('Check this if you want the plugin to generate a random 6 character string for the table prefix', 'aiowpsecurity'); ?></span>
154
+ <br /><?php _e('OR', 'aiowpsecurity'); ?>
155
+ <br /><input size="10" name="aiowps_new_manual_db_prefix" value="<?php //echo $aio_wp_security->configs->get_value('aiowps_new_manual_db_prefix'); ?>" />
156
+ <span class="description"><?php _e('Choose your own DB prefix by specifying a string which contains letters and/or numbers and/or underscores. Example: xyz_', 'aiowpsecurity'); ?></span>
157
+ </td>
158
+ </tr>
159
+ </table>
160
+ <input type="submit" name="aiowps_db_prefix_change" value="<?php _e('Change DB Prefix', 'aiowpsecurity')?>" class="button-primary" />
161
+ </form>
162
+ </div></div>
163
+ <?php
164
+ if ($perform_db_change)
165
+ {
166
+ //Do the DB prefix change operations
167
+ $this->change_db_prefix($old_db_prefix,$new_db_prefix);
168
+ }
169
+ }
170
+
171
+ function render_tab2()
172
+ {
173
+ global $aio_wp_security;
174
+ if (isset($_POST['aiowps_manual_db_backup']))
175
+ {
176
+ $nonce=$_REQUEST['_wpnonce'];
177
+ if (!wp_verify_nonce($nonce, 'aiowpsec-db-manual-change-nonce'))
178
+ {
179
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed for manual DB backup operation!",4);
180
+ die(__('Nonce check failed for manual DB backup operation!','aiowpsecurity'));
181
+ }
182
+
183
+ $result = $aio_wp_security->backup_obj->execute_backup();
184
+ if ($result)
185
+ {
186
+ $backup_file_name = $aio_wp_security->backup_obj->last_backup_file_name;
187
+ $backup_file_url = AIO_WP_SECURITY_URL . '/backups/'. $backup_file_name;
188
+ echo '<div id="message" class="updated fade"><p>';
189
+ _e('DB Backup was successfully completed! Right click on the following file name and save the backup to your computer.','aiowpsecurity');
190
+ echo '<p>';
191
+ _e('Your DB Backup File: ');
192
+ echo '<a href="'.$backup_file_url.'" target="_blank">'.$backup_file_name.'</a>';
193
+ echo '</p>';
194
+ echo '</p></div>';
195
+ }
196
+ else
197
+ {
198
+ $aio_wp_security->debug_logger->log_debug("DB Backup - Backup operation failed!",4);
199
+ $this->show_msg_error(__('DB Backup failed. Please check the permissions of the backup directory.','aiowpsecurity'));
200
+ }
201
+ }
202
+
203
+ if(isset($_POST['aiowps_schedule_backups']))//Do form submission tasks
204
+ {
205
+ $error = '';
206
+ $nonce=$_REQUEST['_wpnonce'];
207
+ if (!wp_verify_nonce($nonce, 'aiowpsec-scheduled-backup-nonce'))
208
+ {
209
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on scheduled DB backup options save!",4);
210
+ die("Nonce check failed on scheduled DB backup options save!");
211
+ }
212
+
213
+ $backup_frequency = sanitize_text_field($_POST['aiowps_db_backup_frequency']);
214
+ if(!is_numeric($backup_frequency))
215
+ {
216
+ $error .= '<br />'.__('You entered a non numeric value for the "backup time interval" field. It has been set to the default value.','aiowpsecurity');
217
+ $backup_frequency = '4';//Set it to the default value for this field
218
+ }
219
+
220
+ $files_to_keep = sanitize_text_field($_POST['aiowps_backup_files_stored']);
221
+ if(!is_numeric($files_to_keep))
222
+ {
223
+ $error .= '<br />'.__('You entered a non numeric value for the "number of backup files to keep" field. It has been set to the default value.','aiowpsecurity');
224
+ $files_to_keep = '2';//Set it to the default value for this field
225
+ }
226
+
227
+ $email_address = sanitize_email($_POST['aiowps_backup_email_address']);
228
+ if(!is_email($email_address))
229
+ {
230
+ $error .= '<br />'.__('You have entered an incorrect email address format. It has been set to your WordPress admin email as default.','aiowpsecurity');
231
+ $email_address = get_bloginfo('admin_email'); //Set the default value to the blog admin email
232
+ }
233
+
234
+ if($error)
235
+ {
236
+ $this->show_msg_error(__('Attention!','aiowpsecurity').$error);
237
+ }
238
+
239
+ //Save all the form values to the options
240
+ $aio_wp_security->configs->set_value('aiowps_enable_automated_backups',isset($_POST["aiowps_enable_automated_backups"])?'1':'');
241
+ $aio_wp_security->configs->set_value('aiowps_db_backup_frequency',absint($backup_frequency));
242
+ $aio_wp_security->configs->set_value('aiowps_db_backup_interval',$_POST["aiowps_db_backup_interval"]);
243
+ $aio_wp_security->configs->set_value('aiowps_backup_files_stored',absint($files_to_keep));
244
+ $aio_wp_security->configs->set_value('aiowps_send_backup_email_address',isset($_POST["aiowps_send_backup_email_address"])?'1':'');
245
+ $aio_wp_security->configs->set_value('aiowps_backup_email_address',$email_address);
246
+ $aio_wp_security->configs->save_config();
247
+ $this->show_msg_settings_updated();
248
+ }
249
+
250
+ ?>
251
+ <div class="postbox">
252
+ <h3><label for="title"><?php _e('Manual Backup', 'aiowpsecurity'); ?></label></h3>
253
+ <div class="inside">
254
+ <form action="" method="POST">
255
+ <?php wp_nonce_field('aiowpsec-db-manual-change-nonce'); ?>
256
+ <table class="form-table">
257
+ <tr valign="top">
258
+ <span class="description"><?php _e('To create a new DB backup just click on the button below.', 'aiowpsecurity'); ?></span>
259
+ </tr>
260
+ </table>
261
+ <input type="submit" name="aiowps_manual_db_backup" value="<?php _e('Create DB Backup Now', 'aiowpsecurity')?>" class="button-primary" />
262
+ </form>
263
+ </div></div>
264
+ <div class="postbox">
265
+ <h3><label for="title"><?php _e('Automated Scheduled Backups', 'aiowpsecurity'); ?></label></h3>
266
+ <div class="inside">
267
+ <?php
268
+ //Display security info badge
269
+ global $aiowps_feature_mgr;
270
+ $aiowps_feature_mgr->output_feature_details_badge("db-security-db-backup");
271
+ ?>
272
+
273
+ <form action="" method="POST">
274
+ <?php wp_nonce_field('aiowpsec-scheduled-backup-nonce'); ?>
275
+ <table class="form-table">
276
+ <tr valign="top">
277
+ <th scope="row"><?php _e('Enable Automated Scheduled Backups', 'aiowpsecurity')?>:</th>
278
+ <td>
279
+ <input name="aiowps_enable_automated_backups" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_automated_backups')=='1') echo ' checked="checked"'; ?> value="1"/>
280
+ <span class="description"><?php _e('Check this if you want the system to automatically generate backups periodically based on the settings below', 'aiowpsecurity'); ?></span>
281
+ </td>
282
+ </tr>
283
+ <tr valign="top">
284
+ <th scope="row"><?php _e('Backup Time Interval', 'aiowpsecurity')?>:</th>
285
+ <td><input size="5" name="aiowps_db_backup_frequency" value="<?php echo $aio_wp_security->configs->get_value('aiowps_db_backup_frequency'); ?>" />
286
+ <select id="backup_interval" name="aiowps_db_backup_interval">
287
+ <option value="0" <?php selected( $aio_wp_security->configs->get_value('aiowps_db_backup_interval'), '0' ); ?>><?php _e( 'Hours', 'aiowpsecurity' ); ?></option>
288
+ <option value="1" <?php selected( $aio_wp_security->configs->get_value('aiowps_db_backup_interval'), '1' ); ?>><?php _e( 'Days', 'aiowpsecurity' ); ?></option>
289
+ <option value="2" <?php selected( $aio_wp_security->configs->get_value('aiowps_db_backup_interval'), '2' ); ?>><?php _e( 'Weeks', 'aiowpsecurity' ); ?></option>
290
+ </select>
291
+ <span class="description"><?php _e('Set the value for how often you would like an automated backup to occur', 'aiowpsecurity'); ?></span>
292
+ </td>
293
+ </tr>
294
+ <tr valign="top">
295
+ <th scope="row"><?php _e('Number of Backup Files To Keep', 'aiowpsecurity')?>:</th>
296
+ <td><input size="5" name="aiowps_backup_files_stored" value="<?php echo $aio_wp_security->configs->get_value('aiowps_backup_files_stored'); ?>" />
297
+ <span class="description"><?php _e('Thie field allows you to choose the number of backup files you would like to keep in the backup directory', 'aiowpsecurity'); ?></span>
298
+ </td>
299
+ </tr>
300
+ <tr valign="top">
301
+ <th scope="row"><?php _e('Send Backup File Via Email', 'aiowpsecurity')?>:</th>
302
+ <td>
303
+ <input name="aiowps_send_backup_email_address" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_send_backup_email_address')=='1') echo ' checked="checked"'; ?> value="1"/>
304
+ <span class="description"><?php _e('Check this if you want the system to email you the backup file after a DB backup has been performed', 'aiowpsecurity'); ?></span>
305
+ <br /><input size="30" name="aiowps_backup_email_address" value="<?php echo $aio_wp_security->configs->get_value('aiowps_backup_email_address'); ?>" />
306
+ <span class="description"><?php _e('Enter an email address', 'aiowpsecurity'); ?></span>
307
+ </td>
308
+ </tr>
309
+ </table>
310
+ <input type="submit" name="aiowps_schedule_backups" value="<?php _e('Save Settings', 'aiowpsecurity')?>" class="button-primary" />
311
+ </form>
312
+ </div></div>
313
+
314
+ <?php
315
+ }
316
+
317
+ /*
318
+ * Changes the DB prefix
319
+ */
320
+ function change_db_prefix($table_old_prefix, $table_new_prefix)
321
+ {
322
+ global $wpdb, $aio_wp_security;
323
+ $old_prefix_length = strlen( $table_old_prefix );
324
+
325
+ //Get the table resource
326
+ $result = mysql_list_tables(DB_NAME);
327
+
328
+ //Count the number of tables
329
+ $num_rows = mysql_num_rows( $result );
330
+ $table_count = 0;
331
+
332
+ //TODO - after reading up on internationalization mixed with html code I found that the WP experts say to do it as below. We will need to clean up other areas where we haven't used the following convention
333
+ $info_msg_string = '<p class="aio_info_with_icon">'.sprintf( __('Starting DB prefix change.....', 'aiowpsecurity')).'</p>';
334
+ $info_msg_string .= '<p class="aio_info_with_icon">'.sprintf( __('Your WordPress system has a total of %s tables and your new DB prefix will be: %s', 'aiowpsecurity'), '<strong>'.$num_rows.'</strong>', '<strong>'.$table_new_prefix.'</strong>').'</p>';
335
+ echo ($info_msg_string);
336
+
337
+ //Config file path
338
+ $config_file = ABSPATH.'wp-config.php';
339
+ //Do a back of the config file
340
+ if(!AIOWPSecurity_Utility_File::backup_a_file($config_file))
341
+ {
342
+ echo '<div class="aio_red_box"><p>'.__('Failed to make a backup of the wp-config.php file. This operation will not go ahead.', 'aiowpsecurity').'</p></div>';
343
+ return;
344
+ }
345
+ else{
346
+ echo '<p class="aio_success_with_icon">'.__('A backup copy of your wp-config.php file was created successfully!', 'aiowpsecurity').'</p>';
347
+ }
348
+
349
+ //Rename all the tables name
350
+ for ($i = 0; $i < $num_rows; $i++)
351
+ {
352
+ //Get table name with old prefix
353
+ $table_old_name = mysql_tablename($result, $i);
354
+
355
+ if ( strpos( $table_old_name, $table_old_prefix ) === 0 )
356
+ {
357
+ //Get table name with new prefix
358
+ $table_new_name = $table_new_prefix . substr( $table_old_name, $old_prefix_length );
359
+
360
+ //Write query to rename tables name
361
+ $sql = "RENAME TABLE `".$table_old_name."` TO `".$table_new_name."`";
362
+ //$sql = "RENAME TABLE %s TO %s";
363
+
364
+ //Execute the query
365
+ //if ( false === $wpdb->query($wpdb->prepare($sql, $table_old_name, $table_new_name)) ) //$wpdb->prepare is adding single quotes instead of backticks and hence causing the query to fail
366
+ if ( false === $wpdb->query($sql) )
367
+ {
368
+ $error = 1;
369
+ echo '<p class="aio_error_with_icon">'.sprintf( __('%s table name update failed', 'aiowpsecurity'), '<strong>'.$table_old_name.'</strong>').'</p>';
370
+ $aio_wp_security->debug_logger->log_debug("DB Security Feature - Unable to change prefix of table ".$table_old_name,4);
371
+ } else {
372
+ $table_count++;
373
+ }
374
+ } else
375
+ {
376
+ continue;
377
+ }
378
+ }
379
+ if ( @$error == 1 )
380
+ {
381
+ echo '<p class="aio_error_with_icon">'.sprintf( __('Please change the prefix manually for the above tables to: %s', 'aiowpsecurity'), '<strong>'.$table_new_prefix.'</strong>').'</p>';
382
+ } else
383
+ {
384
+ echo '<p class="aio_success_with_icon">'.sprintf( __('%s tables had their prefix updated successfully!', 'aiowpsecurity'), '<strong>'.$table_count.'</strong>').'</p>';
385
+ }
386
+
387
+ //Get wp-config.php file contents and modify it with new info
388
+ $config_contents = file($config_file);
389
+ foreach ($config_contents as $line_num => $line) {
390
+ switch (substr($line,0,16)) {
391
+ case '$table_prefix =':
392
+ $config_contents[$line_num] = str_replace($table_old_prefix, $table_new_prefix, $line);
393
+ break;
394
+ }
395
+ }
396
+ //Now let's modify the wp-config.php file
397
+ if (AIOWPSecurity_Utility_File::write_content_to_file($config_file, $config_contents))
398
+ {
399
+ echo '<p class="aio_success_with_icon">'. __('wp-config.php file was updated successfully!', 'aiowpsecurity').'</p>';
400
+ }else
401
+ {
402
+ echo '<p class="aio_error_with_icon">'.sprintf( __('The "wp-config.php" file was not able to be modified. Please modify this file manually using your favourite editor and search
403
+ for variable "$table_prefix" and assign the following value to that variable: %s', 'aiowpsecurity'), '<strong>'.$table_new_prefix.'</strong>').'</p>';
404
+ $aio_wp_security->debug_logger->log_debug("DB Security Feature - Unable to modify wp-config.php",4);
405
+ }
406
+
407
+ //Now let's update the options table
408
+ $update_option_table_query = "UPDATE " . $table_new_prefix . "options
409
+ SET option_name = '".$table_new_prefix ."user_roles'
410
+ WHERE option_name = '".$table_old_prefix."user_roles'
411
+ LIMIT 1";
412
+
413
+ if ( false === $wpdb->query($update_option_table_query) )
414
+ {
415
+ echo "<p class='error'>Changing value: ",
416
+ $table_old_prefix,
417
+ "user_roles in table ",
418
+ $table_new_prefix,
419
+ "options to ",
420
+ $table_new_prefix,
421
+ "user_roles</p>";
422
+
423
+ echo '<p class="aio_error_with_icon">'.sprintf( __('There was an error when updating the options table.', 'aiowpsecurity')).'</p>';
424
+ $aio_wp_security->debug_logger->log_debug("DB Security Feature - Error when updating the options table",4);//Log the highly unlikely event of DB error
425
+ } else
426
+ {
427
+ echo '<p class="aio_success_with_icon">'.sprintf( __('The options table records which had references to the old DB prefix were updated successfully!', 'aiowpsecurity')).'</p>';
428
+ }
429
+ //Now let's update the user meta table
430
+ $custom_sql = "SELECT user_id, meta_key
431
+ FROM " . $table_new_prefix . "usermeta
432
+ WHERE meta_key
433
+ LIKE '" . $table_old_prefix . "%'";
434
+
435
+ $meta_keys = $wpdb->get_results( $custom_sql );
436
+
437
+ $error_update_usermeta = '';
438
+
439
+ //Update all meta_key field values which have the old table prefix in user_meta table
440
+ foreach ($meta_keys as $meta_key ) {
441
+
442
+ //Create new meta key
443
+ $new_meta_key = $table_new_prefix . substr( $meta_key->meta_key, $old_prefix_length );
444
+
445
+ $update_user_meta_sql = "UPDATE " . $table_new_prefix . "usermeta
446
+ SET meta_key='" . $new_meta_key . "'
447
+ WHERE meta_key='" . $meta_key->meta_key . "'
448
+ AND user_id='" . $meta_key->user_id."'";
449
+
450
+ if (false === $wpdb->query($update_user_meta_sql))
451
+ {
452
+ $error_update_usermeta .= '<p class="aio_error_with_icon">'.sprintf( __('Error updating user_meta table where new meta_key = %s, old meta_key = %s and user_id = %s.', 'aiowpsecurity'),$new_meta_key,$meta_key->meta_key,$meta_key->user_id).'</p>';
453
+ echo $error_update_usermeta;
454
+ $aio_wp_security->debug_logger->log_debug("DB Security Feature - Error updating user_meta table where new meta_key = ".$new_meta_key." old meta_key = ".$meta_key->meta_key." and user_id = ".$meta_key->user_id,4);//Log the highly unlikely event of DB error
455
+ }
456
+
457
+ }
458
+ echo '<p class="aio_success_with_icon">'.__('The usermeta table records which had references to the old DB prefix were updated successfully!', 'aiowpsecurity').'</p>';
459
+ //Display tasks finished message
460
+ $tasks_finished_msg_string = '<p class="aio_info_with_icon">'. __('DB prefix change tasks have been completed.', 'aiowpsecurity').'</p>';
461
+ echo ($tasks_finished_msg_string);
462
+ }
463
+ } //end class
admin/wp-security-filesystem-menu.php ADDED
@@ -0,0 +1,500 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Filescan_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_FILESYSTEM_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'File Permissions',
10
+ 'tab2' => 'PHP File Editing',
11
+ 'tab3' => 'Host System Logs',
12
+ );
13
+
14
+ var $menu_tabs_handler = array(
15
+ 'tab1' => 'render_tab1',
16
+ 'tab2' => 'render_tab2',
17
+ 'tab3' => 'render_tab3',
18
+ );
19
+
20
+ function __construct()
21
+ {
22
+ $this->render_menu_page();
23
+ add_action( 'admin_footer', array( &$this, 'filesystem_menu_footer_code' ) );
24
+ }
25
+
26
+ function get_current_tab()
27
+ {
28
+ $tab_keys = array_keys($this->menu_tabs);
29
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
30
+ return $tab;
31
+ }
32
+
33
+ /*
34
+ * Renders our tabs of this menu as nav items
35
+ */
36
+ function render_menu_tabs()
37
+ {
38
+ $current_tab = $this->get_current_tab();
39
+
40
+ echo '<h2 class="nav-tab-wrapper">';
41
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
42
+ {
43
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
44
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
45
+ }
46
+ echo '</h2>';
47
+ }
48
+
49
+ /*
50
+ * The menu rendering goes here
51
+ */
52
+ function render_menu_page()
53
+ {
54
+ $tab = $this->get_current_tab();
55
+ ?>
56
+ <div class="wrap">
57
+ <div id="poststuff"><div id="post-body">
58
+ <?php
59
+ $this->render_menu_tabs();
60
+ //$tab_keys = array_keys($this->menu_tabs);
61
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
62
+ ?>
63
+ </div></div>
64
+ </div><!-- end of wrap -->
65
+ <?php
66
+ }
67
+
68
+ function render_tab1()
69
+ {
70
+ //if this is the case there is no need to display a "fix permissions" button
71
+ global $wpdb, $aio_wp_security;
72
+ if (isset($_POST['aiowps_fix_permissions']))
73
+ {
74
+ $nonce=$_REQUEST['_wpnonce'];
75
+ if (!wp_verify_nonce($nonce, 'aiowpsec-fix-permissions-nonce'))
76
+ {
77
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed for manual DB backup operation!",4);
78
+ die(__('Nonce check failed for manual DB backup operation!','aiowpsecurity'));
79
+ }
80
+ if (isset($_POST['aiowps_permission_chg_file']))
81
+ {
82
+ $folder_or_file = $_POST['aiowps_permission_chg_file'];
83
+ $rec_perm_oct_string = $_POST['aiowps_recommended_permissions']; //Convert the octal string to dec so the chmod func will accept it
84
+ $rec_perm_dec = octdec($rec_perm_oct_string); //Convert the octal string to dec so the chmod func will accept it
85
+ $perm_result = @chmod($_POST['aiowps_permission_chg_file'], $rec_perm_dec);
86
+ if ($perm_result === true)
87
+ {
88
+ $msg = sprintf( __('The permissions for %s were succesfully changed to %s', 'aiowpsecurity'), $folder_or_file, $rec_perm_oct_string);
89
+ $this->show_msg_updated($msg);
90
+ }else if($perm_result === false)
91
+ {
92
+ $msg = sprintf( __('Unable to change permissions for %s!', 'aiowpsecurity'), $folder_or_file);
93
+ $this->show_msg_error($msg);
94
+ }
95
+ }
96
+ }
97
+ ?>
98
+ <h2><?php _e('File Permissions Scan', 'aiowpsecurity')?></h2>
99
+ <div class="aio_blue_box">
100
+ <?php
101
+ echo '<p>'.__('Your WordPress file and folder permission settings govern the accessability and read/write privileges of the files and folders which make up your WP installation.', 'aiowpsecurity').'
102
+ <br />'.__('Your WP installation already comes with reasonably secure file permission settings for the filesystem.', 'aiowpsecurity').'
103
+ <br />'.__('However, sometimes people or other plugins modify the various permission settings of certain core WP folders or files such that they end up making their site less secure because they chose the wrong permission values.', 'aiowpsecurity').'
104
+ <br />'.__('This feature will scan the critical WP core folders and files and will highlight any permission settings which are insecure.', 'aiowpsecurity').'
105
+ </p>';
106
+ ?>
107
+ </div>
108
+
109
+ <div class="postbox">
110
+ <h3><label for="title"><?php _e('WP Directory and File Permissions Scan Results', 'aiowpsecurity'); ?></label></h3>
111
+ <div class="inside">
112
+ <?php
113
+ //Display security info badge
114
+ global $aiowps_feature_mgr;
115
+ $aiowps_feature_mgr->output_feature_details_badge("filesystem-file-permissions");
116
+ ?>
117
+ <form action="" method="POST">
118
+ <?php wp_nonce_field('aiowpsec-fix-permissions-nonce'); ?>
119
+ <table class="widefat file_permission_table">
120
+ <thead>
121
+ <tr>
122
+ <th><?php _e('Name', 'aiowpsecurity') ?></th>
123
+ <th><?php _e('File/Folder', 'aiowpsecurity') ?></th>
124
+ <th><?php _e('Current Permissions', 'aiowpsecurity') ?></th>
125
+ <th><?php _e('Recommended Permissions', 'aiowpsecurity') ?></th>
126
+ <th><?php _e('Recommended Action', 'aiowpsecurity') ?></th>
127
+ </tr>
128
+ </thead>
129
+ <tbody>
130
+ <?php
131
+ $util = new AIOWPSecurity_Utility_File;
132
+ $files_dirs_to_check = $util->files_and_dirs_to_check;
133
+ foreach ($files_dirs_to_check as $file_or_dir)
134
+ {
135
+ $this->show_wp_filesystem_permission_status($file_or_dir['name'],$file_or_dir['path'],$file_or_dir['permissions']);
136
+ }
137
+ ?>
138
+ </tbody>
139
+ <tfoot>
140
+ <tr>
141
+ <th><?php _e('Name', 'aiowpsecurity') ?></th>
142
+ <th><?php _e('File/Folder', 'aiowpsecurity') ?></th>
143
+ <th><?php _e('Current Permissions', 'aiowpsecurity') ?></th>
144
+ <th><?php _e('Recommended Permissions', 'aiowpsecurity') ?></th>
145
+ <th><?php _e('Recommended Action', 'aiowpsecurity') ?></th>
146
+ </tfoot>
147
+ </table>
148
+ </form>
149
+ </div></div>
150
+ <?php
151
+ }
152
+
153
+ function render_tab2()
154
+ {
155
+ global $aio_wp_security;
156
+
157
+ if(isset($_POST['aiowps_disable_file_edit']))//Do form submission tasks
158
+ {
159
+ $nonce=$_REQUEST['_wpnonce'];
160
+ if (!wp_verify_nonce($nonce, 'aiowpsec-disable-file-edit-nonce'))
161
+ {
162
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on disable PHP file edit options save!",4);
163
+ die("Nonce check failed on disable PHP file edit options save!");
164
+ }
165
+
166
+ if(isset($_POST['aiowps_disable_file_editing']))
167
+ {
168
+
169
+ $res = $this->disable_file_edits();
170
+ } else
171
+ {
172
+ $res = $this->enable_file_edits();
173
+ }
174
+ if ($res)
175
+ {
176
+ //Save settings if no errors
177
+ $aio_wp_security->configs->set_value('aiowps_disable_file_editing',isset($_POST["aiowps_disable_file_editing"])?'1':'');
178
+ $aio_wp_security->configs->save_config();
179
+ }
180
+ //$this->show_msg_settings_updated();
181
+
182
+ }
183
+ ?>
184
+ <h2><?php _e('File Editing', 'aiowpsecurity')?></h2>
185
+ <div class="aio_blue_box">
186
+ <?php
187
+ echo '<p>'.__('The Wordpress Dashboard by default allows administrators to edit PHP files, such as plugin and theme files.', 'aiowpsecurity').'
188
+ <br />'.__('This is often the first tool an attacker will use if able to login, since it allows code execution.', 'aiowpsecurity').'
189
+ <br />'.__('This feature will disable the ability for people to edit PHP files via the dashboard.', 'aiowpsecurity').'
190
+ </p>';
191
+ ?>
192
+ </div>
193
+
194
+ <div class="postbox">
195
+ <h3><label for="title"><?php _e('Disable PHP File Editing', 'aiowpsecurity'); ?></label></h3>
196
+ <div class="inside">
197
+ <?php
198
+ //Display security info badge
199
+ global $aiowps_feature_mgr;
200
+ $aiowps_feature_mgr->output_feature_details_badge("filesystem-file-editing");
201
+ ?>
202
+
203
+ <form action="" method="POST">
204
+ <?php wp_nonce_field('aiowpsec-disable-file-edit-nonce'); ?>
205
+ <table class="form-table">
206
+ <tr valign="top">
207
+ <th scope="row"><?php _e('Disable Ability To Edit PHP Files', 'aiowpsecurity')?>:</th>
208
+ <td>
209
+ <input name="aiowps_disable_file_editing" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_disable_file_editing')=='1') echo ' checked="checked"'; ?> value="1"/>
210
+ <span class="description"><?php _e('Check this if you want to remove the ability for people to edit PHP files via the WP dashboard', 'aiowpsecurity'); ?></span>
211
+ </td>
212
+ </tr>
213
+ </table>
214
+ <input type="submit" name="aiowps_disable_file_edit" value="<?php _e('Save Settings', 'aiowpsecurity')?>" class="button-primary" />
215
+ </form>
216
+ </div></div>
217
+ <?php
218
+ }
219
+
220
+ function render_tab3()
221
+ {
222
+ global $aio_wp_security;
223
+
224
+ ?>
225
+ <h2><?php _e('System Logs', 'aiowpsecurity')?></h2>
226
+ <div class="aio_blue_box">
227
+ <?php
228
+ echo '<p>'.__('Sometimes your hosting platform will produce error or warning logs in a file called "error_log".', 'aiowpsecurity').'
229
+ <br />'.__('Depending on the nature and cause of the error or warning, your hosting server can create multiple instances of this file in numerous directory locations of your WordPress installation.', 'aiowpsecurity').'
230
+ <br />'.__('By occassionally viewing the contents of these logs files you can keep informed of any underlying problems on your system which you might need to address.', 'aiowpsecurity').'
231
+ </p>';
232
+ ?>
233
+ </div>
234
+
235
+ <div class="postbox">
236
+ <h3><label for="title"><?php _e('View System Logs', 'aiowpsecurity'); ?></label></h3>
237
+ <div class="inside">
238
+ <p>Please click the button below to view the latest system logs:</p>
239
+ <form action="" method="POST">
240
+ <?php wp_nonce_field('aiowpsec-view-system-logs-nonce'); ?>
241
+ <input type="submit" name="aiowps_search_error_files" value="<?php _e('View Latest System Logs', 'aiowpsecurity'); ?>" class="button-primary search-error-files" />
242
+ <span class="aiowps_loading_1">
243
+ <img src="<?php echo AIO_WP_SECURITY_URL.'/images/loading.gif'; ?>" alt="<?php __('Loading...', 'aiowpsecurity'); ?>" />
244
+ </span>
245
+ </form>
246
+ </div></div>
247
+ <?php
248
+ if (isset($_POST['aiowps_search_error_files']))
249
+ {
250
+ $nonce=$_REQUEST['_wpnonce'];
251
+ if (!wp_verify_nonce($nonce, 'aiowpsec-view-system-logs-nonce'))
252
+ {
253
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on view system log operation!",4);
254
+ die("Nonce check failed on view system log operation!");
255
+ }
256
+
257
+ $logResults = AIOWPSecurity_Utility_File::recursive_file_search('error_log', 0, ABSPATH);
258
+ if (empty($logResults) || $logResults == NULL || $logResults == '')
259
+ {
260
+ $this->show_msg_updated(__('No system logs were found!', 'aiowpsecurity'));
261
+ }
262
+ else
263
+ {
264
+ foreach($logResults as $file)
265
+ {
266
+ $this->display_system_logs_in_table($file);
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ /*
273
+ * Scans WP key core files and directory permissions and populates a wp wide_fat table
274
+ * Displays a red background entry with a "Fix" button for permissions which are "777"
275
+ * Displays a yellow background entry with a "Fix" button for permissions which are less secure than the recommended
276
+ * Displays a green entry for permissions which are as secure or better than the recommended
277
+ */
278
+ function show_wp_filesystem_permission_status($name,$path,$recommended)
279
+ {
280
+ $fix = false;
281
+ $configmod = AIOWPSecurity_Utility_File::get_file_permission($path);
282
+ if ($configmod == "0777"){
283
+ $trclass = "aio_table_row_red"; //Display a red background if permissions are set as least secure ("777")
284
+ $fix = true;
285
+ }
286
+ else if($configmod != $recommended)
287
+ {
288
+ //$res = $this->is_file_permission_secure($recommended, $configmod);
289
+ $res = AIOWPSecurity_Utility_File::is_file_permission_secure($recommended, $configmod);
290
+ if ($res)
291
+ {
292
+ $trclass = "aio_table_row_green"; //If the current permissions are even tighter than recommended then display a green row
293
+ $fix = true;
294
+ }
295
+ else
296
+ {
297
+ $trclass = "aio_table_row_yellow"; //Display a yellow background if permissions are set to something different than recommended
298
+ $fix = true;
299
+ }
300
+ }
301
+ else
302
+ {
303
+ $trclass = "aio_table_row_green";
304
+ }
305
+ echo "<tr class=".$trclass.">";
306
+ echo '<td>' . $name . "</td>";
307
+ echo '<td>'. $path ."</td>";
308
+ echo '<td>' . $configmod . '</td>';
309
+ echo '<td>' . $recommended . '</td>';
310
+ if ($fix)
311
+ {
312
+ echo '<td>
313
+ <input type="submit" name="aiowps_fix_permissions" value="'.__('Set Recommended Permissions','aiowpsecurity').'" class="button-secondary" />
314
+ <input type="hidden" name="aiowps_permission_chg_file" value="'.$path.'"/>
315
+ <input type="hidden" name="aiowps_recommended_permissions" value="'.$recommended.'"/>
316
+ </td>';
317
+ } else
318
+ {
319
+ echo '<td>'.__('No Action Required', 'aiowpsecurity').'</td>';
320
+ }
321
+ echo "</tr>";
322
+ }
323
+
324
+
325
+ /*
326
+ * Modifies the wp-config.php file to disable PHP file editing from the admin panel
327
+ * This func will add the following code:
328
+ * define('DISALLOW_FILE_EDIT', false);
329
+ *
330
+ * NOTE: This function will firstly check if the above code already exists and it will modify the bool value, otherwise it will insert the code mentioned above
331
+ */
332
+ function disable_file_edits()
333
+ {
334
+ global $aio_wp_security;
335
+ $edit_file_config_entry_exists = false;
336
+
337
+ //Config file path
338
+ $config_file = ABSPATH.'wp-config.php';
339
+
340
+ //Get wp-config.php file contents so we can check if the "DISALLOW_FILE_EDIT" variable already exists
341
+ $config_contents = file($config_file);
342
+ foreach ($config_contents as $line_num => $line)
343
+ {
344
+ if (strpos($line, "'DISALLOW_FILE_EDIT', false"))
345
+ {
346
+ $config_contents[$line_num] = str_replace('false', 'true', $line);
347
+ $edit_file_config_entry_exists = true;
348
+ //$this->show_msg_updated(__('Settings Saved - The ability to edit PHP files via the admin the panel has been DISABLED.', 'aiowpsecurity'));
349
+ } else if(strpos($line, "'DISALLOW_FILE_EDIT', true"))
350
+ {
351
+ $edit_file_config_entry_exists = true;
352
+ $this->show_msg_updated(__('Your system config file is already configured to disallow PHP file editing.', 'aiowpsecurity'));
353
+ return true;
354
+
355
+ }
356
+ }
357
+
358
+ if ($edit_file_config_entry_exists)
359
+ {
360
+ //Now let's modify the wp-config.php file
361
+ if (AIOWPSecurity_Utility_File::write_content_to_file($config_file, $config_contents))
362
+ {
363
+ $this->show_msg_updated(__('Settings Saved - Your system is now configured to not allow PHP file editing.', 'aiowpsecurity'));
364
+ return true;
365
+ }else
366
+ {
367
+ $this->show_msg_error(__('Operation failed! Unable to modify wp-config.php file!', 'aiowpsecurity'));
368
+ $aio_wp_security->debug_logger->log_debug("Disable PHP File Edit - Unable to modify wp-config.php",4);
369
+ return false;
370
+ }
371
+ }else
372
+ {
373
+ //Make a backup of the config file
374
+ if(!AIOWPSecurity_Utility_File::backup_a_file($config_file))
375
+ {
376
+ $this->show_msg_error(__('Failed to make a backup of the wp-config.php file. This operation will not go ahead.', 'aiowpsecurity'));
377
+ $aio_wp_security->debug_logger->log_debug("Disable PHP File Edit - Failed to make a backup of the wp-config.php file.",4);
378
+ return false;
379
+ }
380
+ else{
381
+ $this->show_msg_updated(__('A backup copy of your wp-config.php file was created successfully....', 'aiowpsecurity'));
382
+ }
383
+
384
+ //Construct the config code which we will insert into wp-config.php
385
+ $new_snippet = "//Disable File Edits\n";
386
+ $new_snippet .= 'define(\'DISALLOW_FILE_EDIT\', true);';
387
+ $write_result = file_put_contents($config_file, $new_snippet, FILE_APPEND | LOCK_EX);
388
+ if ($write_result)
389
+ {
390
+ $this->show_msg_updated(__('Settings Saved - Your system is now configured to not allow PHP file editing.', 'aiowpsecurity'));
391
+ }else
392
+ {
393
+ $this->show_msg_error(__('Operation failed! Unable to modify wp-config.php file!', 'aiowpsecurity'));
394
+ }
395
+ }
396
+ return $write_result; //will return true or false depending on whether file write was successful
397
+ }
398
+
399
+ /*
400
+ * Modifies the wp-config.php file to allow PHP file editing from the admin panel
401
+ * This func will modify the following code by replacing "true" with "false":
402
+ * define('DISALLOW_FILE_EDIT', true);
403
+ */
404
+
405
+ function enable_file_edits()
406
+ {
407
+ global $aio_wp_security;
408
+ $edit_file_config_entry_exists = false;
409
+
410
+ //Config file path
411
+ $config_file = ABSPATH.'wp-config.php';
412
+
413
+ //Get wp-config.php file contents
414
+ $config_contents = file($config_file);
415
+ foreach ($config_contents as $line_num => $line)
416
+ {
417
+ if (strpos($line, "'DISALLOW_FILE_EDIT', true"))
418
+ {
419
+ $config_contents[$line_num] = str_replace('true', 'false', $line);
420
+ $edit_file_config_entry_exists = true;
421
+ } else if(strpos($line, "'DISALLOW_FILE_EDIT', false"))
422
+ {
423
+ $edit_file_config_entry_exists = true;
424
+ $this->show_msg_updated(__('Your system config file is already configured to allow PHP file editing.', 'aiowpsecurity'));
425
+ return true;
426
+ }
427
+ }
428
+
429
+ if (!$edit_file_config_entry_exists)
430
+ {
431
+ //if the DISALLOW_FILE_EDIT settings don't exist in wp-config.php then we don't need to do anything
432
+ $this->show_msg_updated(__('Your system config file is already configured to allow PHP file editing.', 'aiowpsecurity'));
433
+ return true;
434
+ } else
435
+ {
436
+ //Now let's modify the wp-config.php file
437
+ if (AIOWPSecurity_Utility_File::write_content_to_file($config_file, $config_contents))
438
+ {
439
+ $this->show_msg_updated(__('Settings Saved - Your system is now configured to allow PHP file editing.', 'aiowpsecurity'));
440
+ return true;
441
+ }else
442
+ {
443
+ $this->show_msg_error(__('Operation failed! Unable to modify wp-config.php file!', 'aiowpsecurity'));
444
+ $aio_wp_security->debug_logger->log_debug("Disable PHP File Edit - Unable to modify wp-config.php",4);
445
+ return false;
446
+ }
447
+ }
448
+ }
449
+
450
+ function filesystem_menu_footer_code()
451
+ {
452
+ ?>
453
+ <script type="text/javascript">
454
+ /* <![CDATA[ */
455
+ jQuery(document).ready(function($) {
456
+ loading_span = $('.aiowps_loading_1');
457
+ loading_span.hide(); //hide the spinner gif after page has successfully loaded
458
+ $('.search-error-files').on("click",function(){
459
+ loading_span.show();
460
+ });
461
+ });
462
+ /* ]]> */
463
+ </script>
464
+ <?php
465
+ }
466
+
467
+ function display_system_logs_in_table($filepath)
468
+ {
469
+ global $aio_wp_security;
470
+ //Get contents of the error_log file
471
+ $error_file_contents = file($filepath);
472
+ if (!$error_file_contents)
473
+ {
474
+ //TODO - error could not read file, display notice???
475
+ $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Filescan_Menu - Unable to read file: ".$filepath,4);
476
+
477
+ }
478
+ $last_50_entries = array_slice($error_file_contents, -50); //extract the last 50 entries
479
+ ?>
480
+ <table class="widefat file_permission_table">
481
+ <thead>
482
+ <tr>
483
+ <th><?php echo(sprintf(__('Showing latest entries of error_log file: %s', 'aiowpsecurity'),'<strong>'.$filepath.'</strong>')); ?></th>
484
+ </tr>
485
+ </thead>
486
+ <tbody>
487
+ <?php
488
+ foreach ($last_50_entries as $entry)
489
+ {
490
+ echo "<tr>";
491
+ echo '<td>' . $entry . "</td>";
492
+ echo "</tr>";
493
+ }
494
+ ?>
495
+ </tbody>
496
+ </table>
497
+ <?php
498
+
499
+ }
500
+ } //end class
admin/wp-security-firewall-menu.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Firewall_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_FIREWALL_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'Basic Firewall Rules',
10
+ 'tab2' => 'Additional Firewall Rules',
11
+ 'tab3' => '5G Blacklist Firewall Rules',
12
+ );
13
+
14
+ var $menu_tabs_handler = array(
15
+ 'tab1' => 'render_tab1',
16
+ 'tab2' => 'render_tab2',
17
+ 'tab3' => 'render_tab3',
18
+ );
19
+
20
+ function __construct()
21
+ {
22
+ $this->render_menu_page();
23
+ }
24
+
25
+ function get_current_tab()
26
+ {
27
+ $tab_keys = array_keys($this->menu_tabs);
28
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
29
+ return $tab;
30
+ }
31
+
32
+ /*
33
+ * Renders our tabs of this menu as nav items
34
+ */
35
+ function render_menu_tabs()
36
+ {
37
+ $current_tab = $this->get_current_tab();
38
+
39
+ echo '<h2 class="nav-tab-wrapper">';
40
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
41
+ {
42
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
43
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
44
+ }
45
+ echo '</h2>';
46
+ }
47
+
48
+ /*
49
+ * The menu rendering goes here
50
+ */
51
+ function render_menu_page()
52
+ {
53
+ $tab = $this->get_current_tab();
54
+ ?>
55
+ <div class="wrap">
56
+ <div id="poststuff"><div id="post-body">
57
+ <?php
58
+ $this->render_menu_tabs();
59
+ //$tab_keys = array_keys($this->menu_tabs);
60
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
61
+ ?>
62
+ </div></div>
63
+ </div><!-- end of wrap -->
64
+ <?php
65
+ }
66
+
67
+ function render_tab1()
68
+ {
69
+ global $aio_wp_security;
70
+ if(isset($_POST['aiowps_apply_basic_firewall_settings']))//Do form submission tasks
71
+ {
72
+ $nonce=$_REQUEST['_wpnonce'];
73
+ if (!wp_verify_nonce($nonce, 'aiowpsec-enable-basic-firewall-nonce'))
74
+ {
75
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on enable basic firewall settings!",4);
76
+ die("Nonce check failed on enable basic firewall settings!");
77
+ }
78
+
79
+ //Save settings
80
+ if(isset($_POST['aiowps_enable_basic_firewall']))
81
+ {
82
+ $aio_wp_security->configs->set_value('aiowps_enable_basic_firewall','1');
83
+ }
84
+ else
85
+ {
86
+ $aio_wp_security->configs->set_value('aiowps_enable_basic_firewall','');
87
+ }
88
+
89
+ //Commit the config settings
90
+ $aio_wp_security->configs->save_config();
91
+
92
+ //Now let's write the applicable rules to the .htaccess file
93
+ $res = AIOWPSecurity_Utility_Htaccess::write_to_htaccess();
94
+
95
+ if ($res)
96
+ {
97
+ $this->show_msg_updated(__('You have successfully saved the Basic Firewall Protection configuration', 'aiowpsecurity'));
98
+ }
99
+ else if($res == -1)
100
+ {
101
+ $this->show_msg_error(__('Could not write to the .htaccess file. Please check the file permissions.', 'aiowpsecurity'));
102
+ }
103
+ }
104
+
105
+ ?>
106
+ <h2><?php _e('Firewall Settings', 'aiowpsecurity')?></h2>
107
+ <div class="aio_blue_box">
108
+ <?php
109
+ $backup_tab_link = '<a href="admin.php?page='.AIOWPSEC_SETTINGS_MENU_SLUG.'&tab=tab2" target="_blank">backup</a>';
110
+ $info_msg = sprintf( __('This should not have any impact on your site\'s general functionality but if you wish you can take a %s of your .htaccess file before proceeding.', 'aiowpsecurity'), $backup_tab_link);
111
+ echo '<p>'.__('This feature allows you to activate some basic firewall security protection rules for your site.', 'aiowpsecurity').
112
+ '<br />'.__('The firewall functionality is achieved via the insertion of special code into your currently active .htaccess file.', 'aiowpsecurity').
113
+ '<br />'.$info_msg.'</p>';
114
+ ?>
115
+ </div>
116
+
117
+ <div class="postbox">
118
+ <h3><label for="title"><?php _e('Basic Firewall Settings', 'aiowpsecurity'); ?></label></h3>
119
+ <div class="inside">
120
+ <?php
121
+ //Display security info badge
122
+ global $aiowps_feature_mgr;
123
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-basic-rules");
124
+ ?>
125
+ <form action="" method="POST">
126
+ <?php wp_nonce_field('aiowpsec-enable-basic-firewall-nonce'); ?>
127
+ <table class="form-table">
128
+ <tr valign="top">
129
+ <th scope="row"><?php _e('Enable Basic Firewall Protection', 'aiowpsecurity')?>:</th>
130
+ <td>
131
+ <input name="aiowps_enable_basic_firewall" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_basic_firewall')=='1') echo ' checked="checked"'; ?> value="1"/>
132
+ <span class="description"><?php _e('Check this if you want to apply basic firewall protection to your site.', 'aiowpsecurity'); ?></span>
133
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
134
+ <div class="aiowps_more_info_body">
135
+ <?php
136
+ echo '<p class="description">'.__('This setting will implement the following basic firewall protection mechanisms on your site:', 'aiowpsecurity').'</p>';
137
+ echo '<p class="description">'.__('1) Protect your htaccess file by denying access to it.', 'aiowpsecurity').'</p>';
138
+ echo '<p class="description">'.__('2) Disable the server signature.', 'aiowpsecurity').'</p>';
139
+ echo '<p class="description">'.__('3) Limit file upload size (10MB).', 'aiowpsecurity').'</p>';
140
+ echo '<p class="description">'.__('4) Protect your wp-config.php file by denying access to it.', 'aiowpsecurity').'</p>';
141
+ echo '<p class="description">'.__('The above firewall features will be applied via your .htaccess file and should not affect your site\'s overall functionality.', 'aiowpsecurity').'</p>';
142
+ echo '<p class="description">'.__('You are still advised to take a backup of your active .htaccess file just in case.', 'aiowpsecurity').'</p>';
143
+ ?>
144
+ </div>
145
+ </td>
146
+ </tr>
147
+ </table>
148
+ <input type="submit" name="aiowps_apply_basic_firewall_settings" value="<?php _e('Save Basic Firewall Settings', 'aiowpsecurity')?>" class="button-primary" />
149
+ </form>
150
+ </div></div>
151
+ <?php
152
+ }
153
+
154
+ function render_tab2()
155
+ {
156
+ global $aio_wp_security;
157
+ if(isset($_POST['aiowps_apply_additional_firewall_settings']))//Do advanced firewall submission tasks
158
+ {
159
+ $nonce=$_REQUEST['_wpnonce'];
160
+ if (!wp_verify_nonce($nonce, 'aiowpsec-enable-additional-firewall-nonce'))
161
+ {
162
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on enable advanced firewall settings!",4);
163
+ die("Nonce check failed on enable advanced firewall settings!");
164
+ }
165
+
166
+ //Save settings
167
+ if(isset($_POST['aiowps_disable_trace_and_track']))
168
+ {
169
+ $aio_wp_security->configs->set_value('aiowps_disable_trace_and_track','1');
170
+ }
171
+ else
172
+ {
173
+ $aio_wp_security->configs->set_value('aiowps_disable_trace_and_track','');
174
+ }
175
+
176
+ if(isset($_POST['aiowps_forbid_proxy_comments']))
177
+ {
178
+ $aio_wp_security->configs->set_value('aiowps_forbid_proxy_comments','1');
179
+ }
180
+ else
181
+ {
182
+ $aio_wp_security->configs->set_value('aiowps_forbid_proxy_comments','');
183
+ }
184
+
185
+ if(isset($_POST['aiowps_deny_bad_query_strings']))
186
+ {
187
+ $aio_wp_security->configs->set_value('aiowps_deny_bad_query_strings','1');
188
+ }
189
+ else
190
+ {
191
+ $aio_wp_security->configs->set_value('aiowps_deny_bad_query_strings','');
192
+ }
193
+
194
+ if(isset($_POST['aiowps_advanced_char_string_filter']))
195
+ {
196
+ $aio_wp_security->configs->set_value('aiowps_advanced_char_string_filter','1');
197
+ }
198
+ else
199
+ {
200
+ $aio_wp_security->configs->set_value('aiowps_advanced_char_string_filter','');
201
+ }
202
+
203
+ //Commit the config settings
204
+ $aio_wp_security->configs->save_config();
205
+
206
+ //Now let's write the applicable rules to the .htaccess file
207
+ $res = AIOWPSecurity_Utility_Htaccess::write_to_htaccess();
208
+
209
+ if ($res)
210
+ {
211
+ $this->show_msg_updated(__('You have successfully saved the Additional Firewall Protection configuration', 'aiowpsecurity'));
212
+ }
213
+ else if($res == -1)
214
+ {
215
+ $this->show_msg_error(__('Could not write to the .htaccess file. Please check the file permissions.', 'aiowpsecurity'));
216
+ }
217
+
218
+ }
219
+ ?>
220
+ <h2><?php _e('Additional Firewall Protection', 'aiowpsecurity')?></h2>
221
+ <div class="aio_blue_box">
222
+ <?php
223
+ $backup_tab_link = '<a href="admin.php?page='.AIOWPSEC_SETTINGS_MENU_SLUG.'&tab=tab2" target="_blank">backup</a>';
224
+ $info_msg = sprintf( __('Due to the nature of the code being inserted to the .htaccess file, this feature may break some functionality for certain plugins and you are therefore advised to take a %s of .htaccess before applying this configuration.', 'aiowpsecurity'), $backup_tab_link);
225
+
226
+ echo '<p>'.__('This feature allows you to activate more advanced firewall settings to your site.', 'aiowpsecurity').
227
+ '<br />'.__('The advanced firewall rules are applied via the insertion of special code to your currently active .htaccess file.', 'aiowpsecurity').
228
+ '<br />'.$info_msg.'</p>';
229
+ ?>
230
+ </div>
231
+
232
+ <form action="" method="POST">
233
+ <?php wp_nonce_field('aiowpsec-enable-additional-firewall-nonce'); ?>
234
+
235
+ <div class="postbox">
236
+ <h3><label for="title"><?php _e('Trace and Track', 'aiowpsecurity'); ?></label></h3>
237
+ <div class="inside">
238
+ <?php
239
+ //Display security info badge
240
+ global $aiowps_feature_mgr;
241
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-disable-trace-track");
242
+ ?>
243
+ <table class="form-table">
244
+ <tr valign="top">
245
+ <th scope="row"><?php _e('Disable Trace and Track', 'aiowpsecurity')?>:</th>
246
+ <td>
247
+ <input name="aiowps_disable_trace_and_track" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_disable_trace_and_track')=='1') echo ' checked="checked"'; ?> value="1"/>
248
+ <span class="description"><?php _e('Check this if you want to disable trace and track.', 'aiowpsecurity'); ?></span>
249
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
250
+ <div class="aiowps_more_info_body">
251
+ <p class="description">
252
+ <?php
253
+ _e('HTTP Trace attack (XST) can be used to return header requests and grab cookies and other information.', 'aiowpsecurity');
254
+ echo '<br />';
255
+ _e('This hacking technique is usually used together with cross site scripting attacks (XSS).', 'aiowpsecurity');
256
+ echo '<br />';
257
+ _e('Disabling trace and track on your site will help prevent HTTP Trace attacks.', 'aiowpsecurity');
258
+ ?>
259
+ </p>
260
+ </div>
261
+ </td>
262
+ </tr>
263
+ </table>
264
+ </div></div>
265
+ <div class="postbox">
266
+ <h3><label for="title"><?php _e('Proxy Comment Posting', 'aiowpsecurity'); ?></label></h3>
267
+ <div class="inside">
268
+ <?php
269
+ //Display security info badge
270
+ global $aiowps_feature_mgr;
271
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-forbid-proxy-comments");
272
+ ?>
273
+
274
+ <table class="form-table">
275
+ <tr valign="top">
276
+ <th scope="row"><?php _e('Forbid Proxy Comment Posting', 'aiowpsecurity')?>:</th>
277
+ <td>
278
+ <input name="aiowps_forbid_proxy_comments" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_forbid_proxy_comments')=='1') echo ' checked="checked"'; ?> value="1"/>
279
+ <span class="description"><?php _e('Check this if you want to forbid proxy comment posting.', 'aiowpsecurity'); ?></span>
280
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
281
+ <div class="aiowps_more_info_body">
282
+ <p class="description">
283
+ <?php
284
+ _e('This setting will deny any requests that use a proxy server when posting comments.', 'aiowpsecurity');
285
+ echo '<br />'.__('By forbidding proxy comments you are in effect eliminating some SPAM and other proxy requests.', 'aiowpsecurity');
286
+ ?>
287
+ </p>
288
+ </div>
289
+ </td>
290
+ </tr>
291
+ </table>
292
+ </div></div>
293
+ <div class="postbox">
294
+ <h3><label for="title"><?php _e('Bad Query Strings', 'aiowpsecurity'); ?></label></h3>
295
+ <div class="inside">
296
+ <?php
297
+ //Display security info badge
298
+ global $aiowps_feature_mgr;
299
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-deny-bad-queries");
300
+ ?>
301
+
302
+ <table class="form-table">
303
+ <tr valign="top">
304
+ <th scope="row"><?php _e('Deny Bad Query Strings', 'aiowpsecurity')?>:</th>
305
+ <td>
306
+ <input name="aiowps_deny_bad_query_strings" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_deny_bad_query_strings')=='1') echo ' checked="checked"'; ?> value="1"/>
307
+ <span class="description"><?php _e('This will help protect you against malicious queries via XSS.', 'aiowpsecurity'); ?></span>
308
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
309
+ <div class="aiowps_more_info_body">
310
+ <p class="description">
311
+ <?php
312
+ _e('This feature will write rules in your .htaccess file to prevent malicious string attacks on your site using XSS.', 'aiowpsecurity');
313
+ echo '<br />'.__('NOTE: Some of these strings might be used for plugins or themes and hence this might break some functionality.', 'aiowpsecurity');
314
+ echo '<br /><strong>'.__('You are therefore strongly advised to take a backup of your active .htaccess file before applying this feature.', 'aiowpsecurity').'<strong>';
315
+ ?>
316
+ </p>
317
+ </div>
318
+ </td>
319
+ </tr>
320
+ </table>
321
+ </div></div>
322
+ <div class="postbox">
323
+ <h3><label for="title"><?php _e('Advanced Character String Filter', 'aiowpsecurity'); ?></label></h3>
324
+ <div class="inside">
325
+ <?php
326
+ //Display security info badge
327
+ global $aiowps_feature_mgr;
328
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-advanced-character-string-filter");
329
+ ?>
330
+
331
+ <table class="form-table">
332
+ <tr valign="top">
333
+ <th scope="row"><?php _e('Enable Advanced Character String Filter', 'aiowpsecurity')?>:</th>
334
+ <td>
335
+ <input name="aiowps_advanced_char_string_filter" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_advanced_char_string_filter')=='1') echo ' checked="checked"'; ?> value="1"/>
336
+ <span class="description"><?php _e('This will block bad character matches from XSS.', 'aiowpsecurity'); ?></span>
337
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
338
+ <div class="aiowps_more_info_body">
339
+ <p class="description">
340
+ <?php
341
+ _e('This is an advanced character string filter to prevent malicious string attacks on your site coming from Cross Site Scripting (XSS).', 'aiowpsecurity');
342
+ echo '<br />'.__('This setting matches for common malicious string patterns and exploits and will produce a 403 error for the hacker attempting the query.', 'aiowpsecurity');
343
+ echo '<br />'.__('NOTE: Some strings for this setting might break some functionality.', 'aiowpsecurity');
344
+ echo '<br /><strong>'.__('You are therefore strongly advised to take a backup of your active .htaccess file before applying this feature.', 'aiowpsecurity').'<strong>';
345
+ ?>
346
+ </p>
347
+ </div>
348
+ </td>
349
+ </tr>
350
+ </table>
351
+ </div></div>
352
+ <input type="submit" name="aiowps_apply_additional_firewall_settings" value="<?php _e('Save Additional Firewall Settings', 'aiowpsecurity')?>" class="button-primary" />
353
+ </form>
354
+ <?php
355
+ }
356
+
357
+ function render_tab3()
358
+ {
359
+ global $aio_wp_security;
360
+ if(isset($_POST['aiowps_apply_5g_firewall_settings']))//Do form submission tasks
361
+ {
362
+ $nonce=$_REQUEST['_wpnonce'];
363
+ if (!wp_verify_nonce($nonce, 'aiowpsec-enable-5g-firewall-nonce'))
364
+ {
365
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on enable 5G firewall settings!",4);
366
+ die("Nonce check failed on enable 5G firewall settings!");
367
+ }
368
+
369
+ //Save settings
370
+ if(isset($_POST['aiowps_enable_5g_firewall']))
371
+ {
372
+ $aio_wp_security->configs->set_value('aiowps_enable_5g_firewall','1');
373
+ }
374
+ else
375
+ {
376
+ $aio_wp_security->configs->set_value('aiowps_enable_5g_firewall','');
377
+ }
378
+
379
+ //Commit the config settings
380
+ $aio_wp_security->configs->save_config();
381
+
382
+ //Now let's write the applicable rules to the .htaccess file
383
+ $res = AIOWPSecurity_Utility_Htaccess::write_to_htaccess();
384
+
385
+ if ($res)
386
+ {
387
+ $this->show_msg_updated(__('You have successfully saved the 5G Firewall Protection configuration', 'aiowpsecurity'));
388
+ }
389
+ else if($res == -1)
390
+ {
391
+ $this->show_msg_error(__('Could not write to the .htaccess file. Please check the file permissions.', 'aiowpsecurity'));
392
+ }
393
+ }
394
+
395
+ ?>
396
+ <h2><?php _e('Firewall Settings', 'aiowpsecurity')?></h2>
397
+ <div class="aio_blue_box">
398
+ <?php
399
+ $backup_tab_link = '<a href="admin.php?page='.AIOWPSEC_SETTINGS_MENU_SLUG.'&tab=tab2" target="_blank">backup</a>';
400
+ $info_msg = '<p>'.sprintf( __('This feature allows you to activate the 5G firewall security protection rules designed and produced by %s.', 'aiowpsecurity'), '<a href="http://perishablepress.com/5g-blacklist-2013/" target="_blank">Perishable Press</a>').'</p>';
401
+ $info_msg .= '<p>'.__('The 5G Blacklist is a simple, flexible blacklist that helps reduce the number of malicious URL requests that hit your website.', 'aiowpsecurity').'</p>';
402
+ $info_msg .= '<p>'.__('The added advantage of applying the 5G firewall to your site is that it has been tested and confirmed by the people at PerishablePress.com to be an optimal and least disruptive set of .htaccess security rules for general WP sites running on an Apache server or similar.', 'aiowpsecurity').'</p>';
403
+ $info_msg .= '<p>'.sprintf( __('Therefore the 5G firewall rules should not have any impact on your site\'s general functionality but if you wish you can take a %s of your .htaccess file before proceeding.', 'aiowpsecurity'), $backup_tab_link).'</p>';
404
+ echo $info_msg;
405
+ ?>
406
+ </div>
407
+
408
+ <div class="postbox">
409
+ <h3><label for="title"><?php _e('5G Blacklist/Firewall Settings', 'aiowpsecurity'); ?></label></h3>
410
+ <div class="inside">
411
+ <?php
412
+ //Display security info badge
413
+ global $aiowps_feature_mgr;
414
+ $aiowps_feature_mgr->output_feature_details_badge("firewall-enable-5g-blacklist");
415
+ ?>
416
+
417
+ <form action="" method="POST">
418
+ <?php wp_nonce_field('aiowpsec-enable-5g-firewall-nonce'); ?>
419
+ <table class="form-table">
420
+ <tr valign="top">
421
+ <th scope="row"><?php _e('Enable 5G Firewall Protection', 'aiowpsecurity')?>:</th>
422
+ <td>
423
+ <input name="aiowps_enable_5g_firewall" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_5g_firewall')=='1') echo ' checked="checked"'; ?> value="1"/>
424
+ <span class="description"><?php _e('Check this if you want to apply the 5G Blacklist firewall protection from perishablepress.com to your site.', 'aiowpsecurity'); ?></span>
425
+ <span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php _e('More Info', 'aiowpsecurity'); ?></span></span>
426
+ <div class="aiowps_more_info_body">
427
+ <?php
428
+ echo '<p class="description">'.__('This setting will implement the 5G security firewall protection mechanisms on your site which include the following things:', 'aiowpsecurity').'</p>';
429
+ echo '<p class="description">'.__('1) Block forbidden characters commonly used in exploitative attacks.', 'aiowpsecurity').'</p>';
430
+ echo '<p class="description">'.__('2) Block malicious encoded URL characters such as the ".css(" string.', 'aiowpsecurity').'</p>';
431
+ echo '<p class="description">'.__('3) Guard against the common patterns and specific exploits in the root portion of targeted URLs.', 'aiowpsecurity').'</p>';
432
+ echo '<p class="description">'.__('4) Stop attackers from manipulating query strings by disallowing illicit characters.', 'aiowpsecurity').'</p>';
433
+ echo '<p class="description">'.__('....and much more.', 'aiowpsecurity').'</p>';
434
+ ?>
435
+ </div>
436
+ </td>
437
+ </tr>
438
+ </table>
439
+ <input type="submit" name="aiowps_apply_5g_firewall_settings" value="<?php _e('Save 5G Firewall Settings', 'aiowpsecurity')?>" class="button-primary" />
440
+ </form>
441
+ </div></div>
442
+ <?php
443
+ }
444
+
445
+ } //end class
admin/wp-security-list-acct-activity.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_List_Account_Activity extends AIOWPSecurity_List_Table {
3
+
4
+ function __construct(){
5
+ global $status, $page;
6
+
7
+ //Set parent defaults
8
+ parent::__construct( array(
9
+ 'singular' => 'item', //singular name of the listed records
10
+ 'plural' => 'items', //plural name of the listed records
11
+ 'ajax' => false //does this table support ajax?
12
+ ) );
13
+
14
+ }
15
+
16
+ function column_default($item, $column_name){
17
+ return $item[$column_name];
18
+ }
19
+
20
+ function column_user_id($item){
21
+ $tab = strip_tags($_REQUEST['tab']);
22
+ //Build row actions
23
+ $actions = array(
24
+ 'delete' => sprintf('<a href="admin.php?page=%s&tab=%s&action=%s&activity_login_rec=%s" onclick="return confirm(\'Are you sure you want to delete this item?\')">Delete</a>',AIOWPSEC_USER_LOGIN_MENU_SLUG,$tab,'delete_acct_activity_rec',$item['id']),
25
+ );
26
+
27
+ //Return the user_login contents
28
+ return sprintf('%1$s <span style="color:silver"></span>%2$s',
29
+ /*$1%s*/ $item['user_id'],
30
+ /*$2%s*/ $this->row_actions($actions)
31
+ );
32
+ }
33
+
34
+
35
+ function column_cb($item){
36
+ return sprintf(
37
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
38
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label
39
+ /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
40
+ );
41
+ }
42
+
43
+ function get_columns(){
44
+ $columns = array(
45
+ 'cb' => '<input type="checkbox" />', //Render a checkbox
46
+ 'user_id' => 'User ID',
47
+ 'user_login' => 'Username',
48
+ 'login_date' => 'Login Date',
49
+ 'logout_date' => 'Logout Date',
50
+ 'login_ip' => 'IP'
51
+ );
52
+ return $columns;
53
+ }
54
+
55
+ function get_sortable_columns() {
56
+ $sortable_columns = array(
57
+ 'user_id' => array('user_id',false),
58
+ 'user_login' => array('user_login',false),
59
+ 'login_date' => array('login_date',false),
60
+ 'login_ip' => array('login_ip',false),
61
+ 'logout_date' => array('logout_date',false),
62
+ );
63
+ return $sortable_columns;
64
+ }
65
+
66
+ function get_bulk_actions() {
67
+ $actions = array(
68
+ 'delete' => 'Delete'
69
+ );
70
+ return $actions;
71
+ }
72
+
73
+ function process_bulk_action() {
74
+ if('delete'===$this->current_action())
75
+ {//Process delete bulk actions
76
+ if(!isset($_REQUEST['item']))
77
+ {
78
+ $error_msg = '<div id="message" class="error"><p><strong>';
79
+ $error_msg .= __('Please select some records using the checkboxes','aiowpsecurity');
80
+ $error_msg .= '</strong></p></div>';
81
+ _e($error_msg);
82
+ } else{
83
+ $this->delete_login_activity_records(($_REQUEST['item']));
84
+ }
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /*
91
+ * This function will delete selected records from the "user_login_activity" table.
92
+ * The function accepts either an array of IDs or a single ID
93
+ */
94
+ function delete_login_activity_records($entries)
95
+ {
96
+ global $wpdb;
97
+ $login_activity_table = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
98
+ if (is_array($entries))
99
+ {
100
+ //Delete multiple records
101
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
102
+ $delete_command = "DELETE FROM ".$login_activity_table." WHERE id IN ".$id_list;
103
+ $result = $wpdb->query($delete_command);
104
+ if($result != NULL)
105
+ {
106
+ $success_msg = '<div id="message" class="updated fade"><p><strong>';
107
+ $success_msg .= __('The selected entries were deleted successfully!','aiowpsecurity');
108
+ $success_msg .= '</strong></p></div>';
109
+ _e($success_msg);
110
+ }
111
+ }
112
+ elseif ($entries != NULL)
113
+ {
114
+ //Delete single record
115
+ $delete_command = "DELETE FROM ".$login_activity_table." WHERE id = '".absint($entries)."'";
116
+ $result = $wpdb->query($delete_command);
117
+ if($result != NULL)
118
+ {
119
+ $success_msg = '<div id="message" class="updated fade"><p><strong>';
120
+ $success_msg .= __('The selected entry was deleted successfully!','aiowpsecurity');
121
+ $success_msg .= '</strong></p></div>';
122
+ _e($success_msg);
123
+ }
124
+ }
125
+ }
126
+
127
+ function prepare_items() {
128
+ /**
129
+ * First, lets decide how many records per page to show
130
+ */
131
+ $per_page = 20;
132
+ $columns = $this->get_columns();
133
+ $hidden = array();
134
+ $sortable = $this->get_sortable_columns();
135
+
136
+ $this->_column_headers = array($columns, $hidden, $sortable);
137
+
138
+ $this->process_bulk_action();
139
+
140
+ global $wpdb;
141
+ $login_activity_table = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
142
+
143
+ /* -- Ordering parameters -- */
144
+ //Parameters that are going to be used to order the result
145
+ $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'login_date';
146
+ $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : 'DESC';
147
+
148
+ $data = $wpdb->get_results("SELECT * FROM $login_activity_table ORDER BY $orderby $order LIMIT 50", ARRAY_A); //Get the last 50 records
149
+ $current_page = $this->get_pagenum();
150
+ $total_items = count($data);
151
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
152
+ $this->items = $data;
153
+ $this->set_pagination_args( array(
154
+ 'total_items' => $total_items, //WE have to calculate the total number of items
155
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
156
+ 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
157
+ ) );
158
+ }
159
+ }
admin/wp-security-list-comment-spammer-ip.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_List_Comment_Spammer_IP extends AIOWPSecurity_List_Table {
4
+
5
+ function __construct(){
6
+ global $status, $page;
7
+
8
+ //Set parent defaults
9
+ parent::__construct( array(
10
+ 'singular' => 'item', //singular name of the listed records
11
+ 'plural' => 'items', //plural name of the listed records
12
+ 'ajax' => false //does this table support ajax?
13
+ ) );
14
+
15
+ }
16
+
17
+ function column_default($item, $column_name){
18
+ return $item[$column_name];
19
+ }
20
+
21
+ function column_comment_author_IP($item){
22
+ $tab = strip_tags($_REQUEST['tab']);
23
+ //Build row actions
24
+ $actions = array(
25
+ 'block' => sprintf('<a href="admin.php?page=%s&tab=%s&action=%s&spammer_ip=%s" onclick="return confirm(\'Are you sure you want to add this IP address to your blacklist?\')">Block</a>',AIOWPSEC_BLACKLIST_MENU_SLUG,$tab,'block_spammer_ip',$item['comment_author_IP']),
26
+ );
27
+
28
+ //Return the user_login contents
29
+ return sprintf('%1$s <span style="color:silver"></span>%2$s',
30
+ /*$1%s*/ $item['comment_author_IP'],
31
+ /*$2%s*/ $this->row_actions($actions)
32
+ );
33
+ }
34
+
35
+
36
+ function column_cb($item){
37
+ return sprintf(
38
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
39
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label
40
+ /*$2%s*/ $item['comment_author_IP'] //The value of the checkbox should be the record's id
41
+ );
42
+ }
43
+
44
+ function get_columns(){
45
+ $columns = array(
46
+ 'cb' => '<input type="checkbox" />', //Render a checkbox
47
+ 'comment_author_IP' => 'Spammer IP',
48
+ 'amount' => 'Number of SPAM Comments From This IP',
49
+ );
50
+ return $columns;
51
+ }
52
+
53
+ function get_sortable_columns() {
54
+ $sortable_columns = array(
55
+ 'comment_author_IP' => array('comment_author_IP',false),
56
+ 'amount' => array('amount',false),
57
+ );
58
+ return $sortable_columns;
59
+ }
60
+
61
+ function get_bulk_actions() {
62
+ $actions = array(
63
+ 'block' => 'Block'
64
+ );
65
+ return $actions;
66
+ }
67
+
68
+ function process_bulk_action() {
69
+ global $aio_wp_security;
70
+ if('block'===$this->current_action())
71
+ {
72
+ //Process block bulk actions
73
+ if(!isset($_REQUEST['item']))
74
+ {
75
+ $error_msg = '<div id="message" class="error"><p><strong>';
76
+ $error_msg .= __('Please select some records using the checkboxes','aiowpsecurity');
77
+ $error_msg .= '</strong></p></div>';
78
+ _e($error_msg);
79
+ } else {
80
+ $this->block_spammer_ip_records(($_REQUEST['item']));
81
+ }
82
+ }
83
+ }
84
+
85
+
86
+
87
+ /*
88
+ * This function will add the selected IP addresses to the blacklist.
89
+ * The function accepts either an array of IDs or a single ID
90
+ */
91
+ function block_spammer_ip_records($entries)
92
+ {
93
+ global $wpdb, $aio_wp_security;
94
+ $raw_banned_ip_list = $aio_wp_security->configs->get_value('aiowps_banned_ip_addresses');
95
+ $currently_banned_ips = explode(PHP_EOL, $aio_wp_security->configs->get_value('aiowps_banned_ip_addresses'));
96
+ if (is_array($entries))
97
+ {
98
+ //Bulk selection using checkboxes were used
99
+ foreach ($entries as $ip_add)
100
+ {
101
+ if (!empty($currently_banned_ips) && !(sizeof($currently_banned_ips) == 1 && trim($currently_banned_ips[0]) == ''))
102
+ {
103
+ //Check if the IP address is already in the blacklist. If not add it to the list.
104
+ if (!in_array($ip_add, $currently_banned_ips))
105
+ {
106
+ $raw_banned_ip_list .= PHP_EOL.$ip_add;
107
+ }
108
+ }
109
+ else
110
+ {
111
+ //if blacklist is currently empty just add all IP addresses to the list regardless
112
+ $raw_banned_ip_list .= PHP_EOL.$ip_add;
113
+ }
114
+ }
115
+ }
116
+ else if ($entries != NULL)
117
+ {
118
+ //individual entry where "block" link was clicked
119
+ //Check if the IP address is already in the blacklist. If not add it to the list.
120
+ if (!in_array($entries, $currently_banned_ips))
121
+ {
122
+ $raw_banned_ip_list .= PHP_EOL.$entries;
123
+ }
124
+ }
125
+
126
+ //Let's save the selected IP addresses to the blacklist config
127
+ $aio_wp_security->configs->set_value('aiowps_banned_ip_addresses',$raw_banned_ip_list); //Save the blocked IP address config variable with the newly added addresses
128
+ $aio_wp_security->configs->save_config();
129
+ AIOWPSecurity_Admin_Menu::show_msg_updated_st(__('The selected IP addresses were saved in the blacklist configuration settings.','aiowpsecurity'));
130
+
131
+ //Let's check if the Enable Blacklisting flag has been set - If so, we will write the new data to the .htaccess file.
132
+ if($aio_wp_security->configs->get_value('aiowps_enable_blacklisting')=='1')
133
+ {
134
+ $write_result = AIOWPSecurity_Utility_Htaccess::write_to_htaccess();
135
+ if ($write_result == -1)
136
+ {
137
+ AIOWPSecurity_Admin_Menu::show_msg_error_st(__('The plugin was unable to write to the .htaccess file. Please edit file manually.','aiowpsecurity'));
138
+ $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_Blacklist_Menu - The plugin was unable to write to the .htaccess file.");
139
+ }
140
+ else
141
+ {
142
+
143
+ AIOWPSecurity_Admin_Menu::show_msg_updated_st(__('The .htaccess file was successfully modified to include the selected IP addresses.','aiowpsecurity'));
144
+ }
145
+ }
146
+ else
147
+ {
148
+ $blacklist_settings_link = '<a href="admin.php?page='.AIOWPSEC_BLACKLIST_MENU_SLUG.'">Ban Users</a>';
149
+ $info_msg = '<p>'.__('NOTE: The .htaccess file was not modified because you have disabled the "Enable IP or User Agent Blacklisting" check box.', 'aiowpsecurity').
150
+ '<br />'.sprintf( __('To block these IP addresses you will need to enable the above flag in the %s menu', 'aiowpsecurity'), $blacklist_settings_link).'</p>';
151
+ AIOWPSecurity_Admin_Menu::show_msg_updated_st($info_msg);
152
+ }
153
+ }
154
+
155
+ function prepare_items() {
156
+ //First, lets decide how many records per page to show
157
+ $per_page = 20;
158
+ $columns = $this->get_columns();
159
+ $hidden = array();
160
+ $sortable = $this->get_sortable_columns();
161
+
162
+ $this->_column_headers = array($columns, $hidden, $sortable);
163
+
164
+ $this->process_bulk_action();
165
+
166
+ global $wpdb;
167
+ global $aio_wp_security;
168
+ $minimum_comments_per_ip = $aio_wp_security->configs->get_value('aiowps_spam_ip_min_comments');
169
+ if(empty($minimum_comments_per_ip)){
170
+ $minimum_comments_per_ip = 5;
171
+ }
172
+ /* -- Ordering parameters -- */
173
+ //Parameters that are going to be used to order the result
174
+ $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'amount';
175
+ $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : 'DESC';
176
+
177
+ $sql = "SELECT comment_author_IP, COUNT(*) AS amount
178
+ FROM $wpdb->comments
179
+ WHERE comment_approved = 'spam'
180
+ GROUP BY comment_author_IP
181
+ HAVING amount >= $minimum_comments_per_ip
182
+ ORDER BY $orderby $order
183
+ ";
184
+ $data = $wpdb->get_results($sql, ARRAY_A);
185
+ $current_page = $this->get_pagenum();
186
+ $total_items = count($data);
187
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
188
+ $this->items = $data;
189
+ $this->set_pagination_args( array(
190
+ 'total_items' => $total_items, //WE have to calculate the total number of items
191
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
192
+ 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
193
+ ));
194
+ }
195
+ }
admin/wp-security-list-locked-ip.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_List_Locked_IP extends AIOWPSecurity_List_Table {
3
+
4
+ function __construct(){
5
+ global $status, $page;
6
+
7
+ //Set parent defaults
8
+ parent::__construct( array(
9
+ 'singular' => 'item', //singular name of the listed records
10
+ 'plural' => 'items', //plural name of the listed records
11
+ 'ajax' => false //does this table support ajax?
12
+ ) );
13
+
14
+ }
15
+
16
+ function column_default($item, $column_name){
17
+ return $item[$column_name];
18
+ }
19
+
20
+ function column_failed_login_ip($item){
21
+ $tab = strip_tags($_REQUEST['tab']);
22
+ //Build row actions
23
+ $actions = array(
24
+ 'unlock' => sprintf('<a href="admin.php?page=%s&tab=%s&action=%s&lockdown_id=%s" onclick="return confirm(\'Are you sure you want to unlock this address range?\')">Unlock</a>',AIOWPSEC_USER_LOGIN_MENU_SLUG,$tab,'unlock_ip',$item['id']),
25
+ 'delete' => sprintf('<a href="admin.php?page=%s&tab=%s&action=%s&lockdown_id=%s" onclick="return confirm(\'Are you sure you want to delete this item?\')">Delete</a>',AIOWPSEC_USER_LOGIN_MENU_SLUG,$tab,'delete_blocked_ip',$item['id']),
26
+ );
27
+
28
+ //Return the user_login contents
29
+ return sprintf('%1$s <span style="color:silver"></span>%2$s',
30
+ /*$1%s*/ $item['failed_login_ip'],
31
+ /*$2%s*/ $this->row_actions($actions)
32
+ );
33
+ }
34
+
35
+
36
+ function column_cb($item){
37
+ return sprintf(
38
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
39
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label
40
+ /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
41
+ );
42
+ }
43
+
44
+ function get_columns(){
45
+ $columns = array(
46
+ 'cb' => '<input type="checkbox" />', //Render a checkbox
47
+ 'failed_login_ip' => 'Locked IP Range',
48
+ 'user_id' => 'User ID',
49
+ 'user_login' => 'Username',
50
+ 'lockdown_date' => 'Date Locked',
51
+ 'release_date' => 'Release Date'
52
+ );
53
+ return $columns;
54
+ }
55
+
56
+ function get_sortable_columns() {
57
+ $sortable_columns = array(
58
+ 'failed_login_ip' => array('failed_login_ip',false),
59
+ 'user_id' => array('user_id',false),
60
+ 'user_login' => array('user_login',false),
61
+ 'lockdown_date' => array('lockdown_date',false),
62
+ 'release_date' => array('release_date',false)
63
+ );
64
+ return $sortable_columns;
65
+ }
66
+
67
+ function get_bulk_actions() {
68
+ $actions = array(
69
+ 'unlock' => 'Unlock',
70
+ 'delete' => 'Delete'
71
+ );
72
+ return $actions;
73
+ }
74
+
75
+ function process_bulk_action() {
76
+ if('delete'===$this->current_action())
77
+ {//Process delete bulk actions
78
+ if(!isset($_REQUEST['item']))
79
+ {
80
+ AIOWPSecurity_Admin_Menu::show_msg_error_st(__('Please select some records using the checkboxes','aiowpsecurity'));
81
+ }else
82
+ {
83
+ $this->delete_lockdown_records(($_REQUEST['item']));
84
+ }
85
+ }
86
+
87
+ if('unlock'===$this->current_action())
88
+ {//Process unlock bulk actions
89
+ if(!isset($_REQUEST['item']))
90
+ {
91
+ AIOWPSecurity_Admin_Menu::show_msg_error_st(__('Please select some records using the checkboxes','aiowpsecurity'));
92
+ }else
93
+ {
94
+ $this->unlock_ip_range(($_REQUEST['item']));
95
+ }
96
+ }
97
+ }
98
+
99
+
100
+ /*
101
+ * This function will unlock an IP range by modifying the "release_date" column of a record in the "login_lockdown" table
102
+ */
103
+ function unlock_ip_range($entries)
104
+ {
105
+ global $wpdb;
106
+ $lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
107
+ if (is_array($entries))
108
+ {
109
+ //Unlock multiple records
110
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
111
+ $unlock_command = "UPDATE ".$lockdown_table." SET release_date = now() WHERE id IN ".$id_list;
112
+ $result = $wpdb->query($unlock_command);
113
+ if($result != NULL)
114
+ {
115
+ AIOWPSecurity_Admin_Menu::show_msg_updated_st(__('The selected IP ranges were unlocked successfully!','aiowpsecurity'));
116
+ }
117
+ } elseif ($entries != NULL)
118
+ {
119
+ //Delete single record
120
+ $unlock_command = "UPDATE ".$lockdown_table." SET release_date = now() WHERE id = '".absint($entries)."'";
121
+ $result = $wpdb->query($unlock_command);
122
+ if($result != NULL)
123
+ {
124
+ AIOWPSecurity_Admin_Menu::show_msg_updated_st(__('The selected IP range was unlocked successfully!','aiowpsecurity'));
125
+ }
126
+ }
127
+ }
128
+
129
+ /*
130
+ * This function will delete selected records from the "login_lockdown" table.
131
+ * The function accepts either an array of IDs or a single ID
132
+ */
133
+ function delete_lockdown_records($entries)
134
+ {
135
+ global $wpdb;
136
+ $lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
137
+ if (is_array($entries))
138
+ {
139
+ //Delete multiple records
140
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
141
+ $delete_command = "DELETE FROM ".$lockdown_table." WHERE id IN ".$id_list;
142
+ $result = $wpdb->query($delete_command);
143
+ if($result != NULL)
144
+ {
145
+ AIOWPSecurity_Admin_Menu::show_msg_record_deleted_st();
146
+ }
147
+ }
148
+ elseif ($entries != NULL)
149
+ {
150
+ //Delete single record
151
+ $delete_command = "DELETE FROM ".$lockdown_table." WHERE id = '".absint($entries)."'";
152
+ $result = $wpdb->query($delete_command);
153
+ if($result != NULL)
154
+ {
155
+ AIOWPSecurity_Admin_Menu::show_msg_record_deleted_st();
156
+ }
157
+ }
158
+ }
159
+
160
+ function prepare_items() {
161
+ /**
162
+ * First, lets decide how many records per page to show
163
+ */
164
+ $per_page = 20;
165
+ $columns = $this->get_columns();
166
+ $hidden = array();
167
+ $sortable = $this->get_sortable_columns();
168
+
169
+ $this->_column_headers = array($columns, $hidden, $sortable);
170
+
171
+ $this->process_bulk_action();
172
+
173
+ global $wpdb;
174
+ $lockdown_table_name = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
175
+
176
+ /* -- Ordering parameters -- */
177
+ //Parameters that are going to be used to order the result
178
+ $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'lockdown_date';
179
+ $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : 'DESC';
180
+
181
+ $data = $wpdb->get_results("SELECT * FROM $lockdown_table_name WHERE release_date > now() ORDER BY $orderby $order", ARRAY_A);
182
+ //$data = $wpdb->get_results("SELECT ID, floor((UNIX_TIMESTAMP(release_date)-UNIX_TIMESTAMP(now()))/60) AS minutes_left, ".
183
+ // "failed_login_IP FROM $lockdown_table_name WHERE release_date > now()", ARRAY_A);
184
+ $current_page = $this->get_pagenum();
185
+ $total_items = count($data);
186
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
187
+ $this->items = $data;
188
+ $this->set_pagination_args( array(
189
+ 'total_items' => $total_items, //WE have to calculate the total number of items
190
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
191
+ 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
192
+ ) );
193
+ }
194
+ }
admin/wp-security-list-login-fails.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_List_Login_Failed_Attempts extends AIOWPSecurity_List_Table {
3
+
4
+ function __construct(){
5
+ global $status, $page;
6
+
7
+ //Set parent defaults
8
+ parent::__construct( array(
9
+ 'singular' => 'item', //singular name of the listed records
10
+ 'plural' => 'items', //plural name of the listed records
11
+ 'ajax' => false //does this table support ajax?
12
+ ) );
13
+
14
+ }
15
+
16
+ function column_default($item, $column_name){
17
+ return $item[$column_name];
18
+ }
19
+
20
+ function column_login_attempt_ip($item){
21
+ $tab = strip_tags($_REQUEST['tab']);
22
+ //Build row actions
23
+ $actions = array(
24
+ 'delete' => sprintf('<a href="admin.php?page=%s&tab=%s&action=%s&failed_login_id=%s" onclick="return confirm(\'Are you sure you want to delete this item?\')">Delete</a>',AIOWPSEC_USER_LOGIN_MENU_SLUG,$tab,'delete_failed_login_rec',$item['id']),
25
+ );
26
+
27
+ //Return the user_login contents
28
+ return sprintf('%1$s <span style="color:silver"></span>%2$s',
29
+ /*$1%s*/ $item['login_attempt_ip'],
30
+ /*$2%s*/ $this->row_actions($actions)
31
+ );
32
+ }
33
+
34
+
35
+ function column_cb($item){
36
+ return sprintf(
37
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
38
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label
39
+ /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
40
+ );
41
+ }
42
+
43
+ function get_columns(){
44
+ $columns = array(
45
+ 'cb' => '<input type="checkbox" />', //Render a checkbox
46
+ 'login_attempt_ip' => 'Login IP Range',
47
+ 'user_id' => 'User ID',
48
+ 'user_login' => 'Username',
49
+ 'failed_login_date' => 'Date'
50
+ );
51
+ return $columns;
52
+ }
53
+
54
+ function get_sortable_columns() {
55
+ $sortable_columns = array(
56
+ 'login_attempt_ip' => array('login_attempt_ip',false),
57
+ 'user_id' => array('user_id',false),
58
+ 'user_login' => array('user_login',false),
59
+ 'failed_login_date' => array('failed_login_date',false),
60
+ );
61
+ return $sortable_columns;
62
+ }
63
+
64
+ function get_bulk_actions() {
65
+ $actions = array(
66
+ 'delete' => 'Delete'
67
+ );
68
+ return $actions;
69
+ }
70
+
71
+ function process_bulk_action() {
72
+ global $aio_wp_security;
73
+ if('delete'===$this->current_action())
74
+ {//Process delete bulk actions
75
+ if(!isset($_REQUEST['item']))
76
+ {
77
+ $error_msg = '<div id="message" class="error"><p><strong>';
78
+ $error_msg .= __('Please select some records using the checkboxes','aiowpsecurity');
79
+ $error_msg .= '</strong></p></div>';
80
+ _e($error_msg);
81
+ } else{
82
+ $this->delete_login_failed_records(($_REQUEST['item']));
83
+
84
+ }
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /*
91
+ * This function will delete selected records from the "failed_logins" table.
92
+ * The function accepts either an array of IDs or a single ID
93
+ */
94
+ function delete_login_failed_records($entries)
95
+ {
96
+ global $wpdb, $aio_wp_security;
97
+ $failed_login_table = AIOWPSEC_TBL_FAILED_LOGINS;
98
+ if (is_array($entries))
99
+ {
100
+ //Delete multiple records
101
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
102
+ $delete_command = "DELETE FROM ".$failed_login_table." WHERE ID IN ".$id_list;
103
+ $result = $wpdb->query($delete_command);
104
+ if($result != NULL)
105
+ {
106
+ $success_msg = '<div id="message" class="updated fade"><p><strong>';
107
+ $success_msg .= __('The selected entries were deleted successfully!','aiowpsecurity');
108
+ $success_msg .= '</strong></p></div>';
109
+ _e($success_msg);
110
+ }
111
+ } elseif ($entries != NULL)
112
+ {
113
+ //Delete single record
114
+ $delete_command = "DELETE FROM ".$failed_login_table." WHERE ID = '".absint($entries)."'";
115
+ $result = $wpdb->query($delete_command);
116
+ if($result != NULL)
117
+ {
118
+ $success_msg = '<div id="message" class="updated fade"><p><strong>';
119
+ $success_msg .= __('The selected entry was deleted successfully!','aiowpsecurity');
120
+ $success_msg .= '</strong></p></div>';
121
+ _e($success_msg);
122
+ }
123
+ }
124
+ }
125
+
126
+ function prepare_items() {
127
+ /**
128
+ * First, lets decide how many records per page to show
129
+ */
130
+ $per_page = 20;
131
+ $columns = $this->get_columns();
132
+ $hidden = array();
133
+ $sortable = $this->get_sortable_columns();
134
+
135
+ $this->_column_headers = array($columns, $hidden, $sortable);
136
+
137
+ $this->process_bulk_action();
138
+
139
+ global $wpdb;
140
+ $failed_logins_table_name = AIOWPSEC_TBL_FAILED_LOGINS;
141
+
142
+ /* -- Ordering parameters -- */
143
+ //Parameters that are going to be used to order the result
144
+ $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'failed_login_date';
145
+ $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : 'DESC';
146
+
147
+ $data = $wpdb->get_results("SELECT * FROM $failed_logins_table_name ORDER BY $orderby $order", ARRAY_A);
148
+ $current_page = $this->get_pagenum();
149
+ $total_items = count($data);
150
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
151
+ $this->items = $data;
152
+ $this->set_pagination_args( array(
153
+ 'total_items' => $total_items, //WE have to calculate the total number of items
154
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
155
+ 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
156
+ ) );
157
+ }
158
+ }
admin/wp-security-settings-menu.php ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Settings_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_SETTINGS_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'General Settings',
10
+ 'tab2' => '.htaccess File',
11
+ 'tab3' => 'wp-config.php File',
12
+ );
13
+
14
+ var $menu_tabs_handler = array(
15
+ 'tab1' => 'render_tab1',
16
+ 'tab2' => 'render_tab2',
17
+ 'tab3' => 'render_tab3',
18
+ );
19
+
20
+ function __construct()
21
+ {
22
+ $this->render_menu_page();
23
+ }
24
+
25
+ function get_current_tab()
26
+ {
27
+ $tab_keys = array_keys($this->menu_tabs);
28
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
29
+ return $tab;
30
+ }
31
+
32
+ /*
33
+ * Renders our tabs of this menu as nav items
34
+ */
35
+ function render_menu_tabs()
36
+ {
37
+ $current_tab = $this->get_current_tab();
38
+
39
+ echo '<h2 class="nav-tab-wrapper">';
40
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
41
+ {
42
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
43
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
44
+ }
45
+ echo '</h2>';
46
+ }
47
+
48
+ /*
49
+ * The menu rendering goes here
50
+ */
51
+ function render_menu_page()
52
+ {
53
+ $tab = $this->get_current_tab();
54
+ ?>
55
+ <div class="wrap">
56
+ <div id="poststuff"><div id="post-body">
57
+ <?php
58
+ $this->render_menu_tabs();
59
+ //$tab_keys = array_keys($this->menu_tabs);
60
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
61
+ ?>
62
+ </div></div>
63
+ </div><!-- end of wrap -->
64
+ <?php
65
+ }
66
+
67
+ function render_tab1()
68
+ {
69
+ global $aio_wp_security;
70
+ if(isset($_POST['aiowpsec_disable_all_features']))//Do form submission tasks
71
+ {
72
+ $nonce=$_REQUEST['_wpnonce'];
73
+ if (!wp_verify_nonce($nonce, 'aiowpsec-disable-all-features'))
74
+ {
75
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on disable all security features!",4);
76
+ die("Nonce check failed on disable all security features!");
77
+ }
78
+ AIOWPSecurity_Configure_Settings::turn_off_all_security_features();
79
+ $this->show_msg_updated(__('All the security features have been disabled successfully!', 'aiowpsecurity'));
80
+ }
81
+
82
+
83
+ ?>
84
+ <div class="aio_grey_box">
85
+ <p>For information, updates and documentation, please visit the <a href="http://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin" target="_blank">AIO WP Security & Firewall Plugin</a> Page.</p>
86
+ <p><a href="http://www.tipsandtricks-hq.com/development-center" target="_blank">Follow us</a> on Twitter, Google+ or via Email to stay upto date about the new security features of this plugin.</p>
87
+ </div>
88
+
89
+ <div class="postbox">
90
+ <h3><label for="title"><?php _e('WP Security Plugin', 'aiowpsecurity'); ?></label></h3>
91
+ <div class="inside">
92
+ <p><?php _e('Thank you for using our WordPress security plugin. There are a lot of security features in this plugin.', 'aiowpsecurity'); ?></p>
93
+ <p><?php _e('Go through each menu items and enable the security options to add more security to your site.', 'aiowpsecurity'); ?></p>
94
+ <p><?php _e('It is a good practice to take a backup of your .htaccess file, database and wp-config.php file before activating the security features. This plugin has options that you can use to backup those resources easily.', 'aiowpsecurity'); ?></p>
95
+ <p>
96
+ <ul class="aiowps_admin_ul_grp1">
97
+ <li><a href="admin.php?page=aiowpsec_database&tab=tab2" target="_blank"><?php _e('Backup your database', 'aiowpsecurity'); ?></a></li>
98
+ <li><a href="admin.php?page=aiowpsec_settings&tab=tab2" target="_blank"><?php _e('Backup .htaccess file', 'aiowpsecurity'); ?></a></li>
99
+ <li><a href="admin.php?page=aiowpsec_settings&tab=tab3" target="_blank"><?php _e('Backup wp-config.php file', 'aiowpsecurity'); ?></a></li>
100
+ </ul>
101
+ </p>
102
+ </div></div>
103
+
104
+ <div class="postbox">
105
+ <h3><label for="title"><?php _e('Disable Security Features', 'aiowpsecurity'); ?></label></h3>
106
+ <div class="inside">
107
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
108
+ <?php wp_nonce_field('aiowpsec-disable-all-features'); ?>
109
+ <div class="aio_blue_box">
110
+ <?php
111
+ echo '<p>'.__('If you think that some plugin functionality on your site is broken due to a security feature you enabled in this plugin, then use the following option to turn off all the security features of this plugin.', 'aiowpsecurity').'</p>';
112
+ ?>
113
+ </div>
114
+ <div class="submit">
115
+ <input type="submit" name="aiowpsec_disable_all_features" value="<?php _e('Disable All Security Features'); ?>" />
116
+ </div>
117
+ </form>
118
+ </div></div>
119
+ <?php
120
+ }
121
+
122
+ function render_tab2()
123
+ {
124
+ global $aio_wp_security;
125
+
126
+ if(isset($_POST['aiowps_save_htaccess']))//Do form submission tasks
127
+ {
128
+ $nonce=$_REQUEST['_wpnonce'];
129
+ if (!wp_verify_nonce($nonce, 'aiowpsec-save-htaccess-nonce'))
130
+ {
131
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on htaccess file save!",4);
132
+ die("Nonce check failed on htaccess file save!");
133
+ }
134
+ $htaccess_path = ABSPATH . '.htaccess';
135
+ $result = AIOWPSecurity_Utility_File::backup_a_file($htaccess_path); //Backup the htaccess file
136
+
137
+ if ($result)
138
+ {
139
+ if (rename(ABSPATH.'.htaccess.backup', ABSPATH.'htaccess_backup.txt'))
140
+ {
141
+ $backup_file_url = AIOWPSEC_WP_URL . '/htaccess_backup.txt';
142
+ echo '<div id="message" class="updated fade"><p>';
143
+ _e('Your .htaccess file was successfully backed up! Right click on the following file name and save the backup to your computer.','aiowpsecurity');
144
+ echo '<p>';
145
+ _e('Your .htaccess File: ');
146
+ echo '<a href="'.$backup_file_url.'" target="_blank">'.$backup_file_url.'</a>';
147
+ echo '</p>';
148
+ echo '</p></div>';
149
+ }
150
+ else
151
+ {
152
+ $aio_wp_security->debug_logger->log_debug("htaccess file rename failed during backup!",4);
153
+ $this->show_msg_error(__('htaccess file rename failed during backup. Please check your root directory for the backup file using FTP.','aiowpsecurity'));
154
+ }
155
+ }
156
+ else
157
+ {
158
+ $aio_wp_security->debug_logger->log_debug("htaccess - Backup operation failed!",4);
159
+ $this->show_msg_error(__('htaccess backup failed.','aiowpsecurity'));
160
+ }
161
+ }
162
+
163
+ if(isset($_POST['aiowps_restore_htaccess_button']))//Do form submission tasks
164
+ {
165
+ $nonce=$_REQUEST['_wpnonce'];
166
+ if (!wp_verify_nonce($nonce, 'aiowpsec-restore-htaccess-nonce'))
167
+ {
168
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on htaccess file restore!",4);
169
+ die("Nonce check failed on htaccess file restore!");
170
+ }
171
+
172
+ if (empty($_POST['aiowps_htaccess_file']))
173
+ {
174
+ $this->show_msg_error(__('Please choose a .htaccess to restore from.', 'aiowpsecurity'));
175
+ }
176
+ else
177
+ {
178
+ //Let's copy the uploaded .htaccess file into the active root file
179
+ $new_htaccess_file_path = trim($_POST['aiowps_htaccess_file']);
180
+ //TODO
181
+ //Verify that file chosen has contents which are relevant to .htaccess file
182
+ $is_htaccess = AIOWPSecurity_Utility_Htaccess::check_if_htaccess_contents($new_htaccess_file_path);
183
+ if ($is_htaccess == 1)
184
+ {
185
+ $active_root_htaccess = ABSPATH.'.htaccess';
186
+ if (!copy($new_htaccess_file_path, $active_root_htaccess))
187
+ {
188
+ //Failed to make a backup copy
189
+ $aio_wp_security->debug_logger->log_debug("htaccess - Restore from .htaccess operation failed!",4);
190
+ $this->show_msg_error(__('htaccess file restore failed. Please attempt to restore the .htaccess manually using FTP.','aiowpsecurity'));
191
+ }
192
+ else
193
+ {
194
+ $this->show_msg_updated(__('Your .htaccess file has successfully been restored!', 'aiowpsecurity'));
195
+ }
196
+ }
197
+ else
198
+ {
199
+ $aio_wp_security->debug_logger->log_debug("htaccess restore failed - Contents of restore file appear invalid!",4);
200
+ $this->show_msg_error(__('htaccess Restore operation failed! Please check the contents of the file you are trying to restore from.','aiowpsecurity'));
201
+ }
202
+ }
203
+ }
204
+
205
+ ?>
206
+ <h2><?php _e('.htaccess File Operations', 'aiowpsecurity')?></h2>
207
+ <div class="aio_blue_box">
208
+ <?php
209
+ echo '<p>'.__('Your ".htaccess" file is a key component of your website\'s security and it can be modified to implement various levels of protection mechanisms.', 'aiowpsecurity').'
210
+ <br />'.__('This feature allows you to backup and save your currently active .htaccess file should you need to re-use the the backed up file in the future.', 'aiowpsecurity').'
211
+ <br />'.__('You can also restore your site\'s .htaccess settings using a backed up .htaccess file.', 'aiowpsecurity').'
212
+ </p>';
213
+ ?>
214
+ </div>
215
+
216
+ <div class="postbox">
217
+ <h3><label for="title"><?php _e('Save the current .htaccess file', 'aiowpsecurity'); ?></label></h3>
218
+ <div class="inside">
219
+ <form action="" method="POST">
220
+ <?php wp_nonce_field('aiowpsec-save-htaccess-nonce'); ?>
221
+ <p class="description"><?php _e('Click the button below to backup and save the currently active .htaccess file.', 'aiowpsecurity'); ?></p>
222
+ <input type="submit" name="aiowps_save_htaccess" value="<?php _e('Backup .htaccess File', 'aiowpsecurity')?>" class="button-primary" />
223
+ </form>
224
+ </div></div>
225
+ <div class="postbox">
226
+ <h3><label for="title"><?php _e('Restore from a backed up .htaccess file', 'aiowpsecurity'); ?></label></h3>
227
+ <div class="inside">
228
+ <form action="" method="POST">
229
+ <?php wp_nonce_field('aiowpsec-restore-htaccess-nonce'); ?>
230
+ <table class="form-table">
231
+ <tr valign="top">
232
+ <th scope="row"><?php _e('.htaccess file to restore from', 'aiowpsecurity')?>:</th>
233
+ <td>
234
+ <input type="button" id="aiowps_htaccess_file_button" name="aiowps_htaccess_file_button" class="button rbutton" value="Select Your htaccess File" />
235
+ <input name="aiowps_htaccess_file" type="text" id="aiowps_htaccess_file" value="" size="80" />
236
+ <p class="description">
237
+ <?php
238
+ _e('After selecting your file, click the button below to restore your site using the backed up htaccess file (htaccess_backup.txt).', 'aiowpsecurity');
239
+ ?>
240
+ </p>
241
+ </td>
242
+ </tr>
243
+ </table>
244
+ <input type="submit" name="aiowps_restore_htaccess_button" value="<?php _e('Restore .htaccess File', 'aiowpsecurity')?>" class="button-primary" />
245
+ </form>
246
+ </div></div>
247
+ <div class="postbox">
248
+ <h3><label for="title"><?php _e('View Contents of the currently active .htaccess file', 'aiowpsecurity'); ?></label></h3>
249
+ <div class="inside">
250
+ <?php
251
+ $ht_file = ABSPATH . '.htaccess';
252
+ $ht_contents = AIOWPSecurity_Utility_File::get_file_contents($ht_file);
253
+ //echo $ht_contents;
254
+ ?>
255
+ <textarea class="aio_text_area_file_output aio_half_width aio_spacer_10_tb" rows="15" readonly><?php echo $ht_contents; ?></textarea>
256
+ </div></div>
257
+
258
+ <?php
259
+ }
260
+
261
+ function render_tab3()
262
+ {
263
+ global $aio_wp_security;
264
+
265
+ if(isset($_POST['aiowps_save_wp_config']))//Do form submission tasks
266
+ {
267
+ $nonce=$_REQUEST['_wpnonce'];
268
+ if (!wp_verify_nonce($nonce, 'aiowpsec-save-wp-config-nonce'))
269
+ {
270
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on wp_config file save!",4);
271
+ die("Nonce check failed on wp_config file save!");
272
+ }
273
+ $wp_config_path = ABSPATH . 'wp-config.php';
274
+ $result = AIOWPSecurity_Utility_File::backup_a_file($wp_config_path); //Backup the wp_config.php file
275
+
276
+ if ($result)
277
+ {
278
+ if (rename(ABSPATH.'wp-config.php.backup', ABSPATH.'wp-config.php.backup.txt'))
279
+ {
280
+ $backup_file_url = AIOWPSEC_WP_URL . '/wp-config.php.backup.txt';
281
+ echo '<div id="message" class="updated fade"><p>';
282
+ _e('Your wp-config.php file was successfully backed up! Right click on the following file name and save the backup to your computer.','aiowpsecurity');
283
+ echo '<p>';
284
+ _e('Your wp-config.php File: ');
285
+ echo '<a href="'.$backup_file_url.'" target="_blank">'.$backup_file_url.'</a>';
286
+ echo '</p>';
287
+ echo '</p></div>';
288
+ }
289
+ else
290
+ {
291
+ $aio_wp_security->debug_logger->log_debug("wp-config.php file rename failed during backup!",4);
292
+ $this->show_msg_error(__('wp-config.php file rename failed during backup. Please check your root directory for the backup file using FTP.','aiowpsecurity'));
293
+ }
294
+ }
295
+ else
296
+ {
297
+ $aio_wp_security->debug_logger->log_debug("wp-config.php - Backup operation failed!",4);
298
+ $this->show_msg_error(__('wp-config.php backup failed.','aiowpsecurity'));
299
+ }
300
+ }
301
+
302
+ if(isset($_POST['aiowps_restore_wp_config_button']))//Do form submission tasks
303
+ {
304
+ $nonce=$_REQUEST['_wpnonce'];
305
+ if (!wp_verify_nonce($nonce, 'aiowpsec-restore-wp-config-nonce'))
306
+ {
307
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on wp-config file restore!",4);
308
+ die("Nonce check failed on wp-config file restore!");
309
+ }
310
+
311
+ if (empty($_POST['aiowps_wp_config_file']))
312
+ {
313
+ $this->show_msg_error(__('Please choose a wp-config.php file to restore from.', 'aiowpsecurity'));
314
+ }
315
+ else
316
+ {
317
+ //Let's copy the uploaded wp-config.php file into the active root file
318
+ $new_wp_config_file_path = trim($_POST['aiowps_wp_config_file']);
319
+ //TODO
320
+ //Verify that file chosen has contents which are relevant to .htaccess file
321
+ $is_wp_config = $this->check_if_wp_config_contents($new_wp_config_file_path); //TODO - write the function
322
+ if ($is_wp_config == 1)
323
+ {
324
+ $active_root_wp_config = ABSPATH.'wp-config.php';
325
+ if (!copy($new_wp_config_file_path, $active_root_wp_config))
326
+ {
327
+ //Failed to make a backup copy
328
+ $aio_wp_security->debug_logger->log_debug("wp-config.php - Restore from backed up wp-config operation failed!",4);
329
+ $this->show_msg_error(__('wp-config.php file restore failed. Please attempt to restore this file manually using FTP.','aiowpsecurity'));
330
+ }
331
+ else
332
+ {
333
+ $this->show_msg_updated(__('Your wp-config.php file has successfully been restored!', 'aiowpsecurity'));
334
+ }
335
+ }
336
+ else
337
+ {
338
+ $aio_wp_security->debug_logger->log_debug("wp-config.php restore failed - Contents of restore file appear invalid!",4);
339
+ $this->show_msg_error(__('wp-config.php Restore operation failed! Please check the contents of the file you are trying to restore from.','aiowpsecurity'));
340
+ }
341
+ }
342
+ }
343
+
344
+ ?>
345
+ <h2><?php _e('wp-config.php File Operations', 'aiowpsecurity')?></h2>
346
+ <div class="aio_blue_box">
347
+ <?php
348
+ echo '<p>'.__('Your "wp-config.php" file is one of the most important in your WordPress installation. It is a primary configuration file and contains crucial things such as details of your database and other critical components.', 'aiowpsecurity').'
349
+ <br />'.__('This feature allows you to backup and save your currently active wp-config.php file should you need to re-use the the backed up file in the future.', 'aiowpsecurity').'
350
+ <br />'.__('You can also restore your site\'s wp-config.php settings using a backed up wp-config.php file.', 'aiowpsecurity').'
351
+ </p>';
352
+ ?>
353
+ </div>
354
+
355
+ <div class="postbox">
356
+ <h3><label for="title"><?php _e('Save the current wp-config.php file', 'aiowpsecurity'); ?></label></h3>
357
+ <div class="inside">
358
+ <form action="" method="POST">
359
+ <?php wp_nonce_field('aiowpsec-save-wp-config-nonce'); ?>
360
+ <p class="description"><?php _e('Click the button below to backup and save the currently active wp-config.php file.', 'aiowpsecurity'); ?></p>
361
+ <input type="submit" name="aiowps_save_wp_config" value="<?php _e('Backup wp-config.php File', 'aiowpsecurity')?>" class="button-primary" />
362
+ </form>
363
+ </div></div>
364
+ <div class="postbox">
365
+ <h3><label for="title"><?php _e('Restore from a backed up wp-config file', 'aiowpsecurity'); ?></label></h3>
366
+ <div class="inside">
367
+ <form action="" method="POST">
368
+ <?php wp_nonce_field('aiowpsec-restore-wp-config-nonce'); ?>
369
+ <table class="form-table">
370
+ <tr valign="top">
371
+ <th scope="row"><?php _e('wp-config file to restore from', 'aiowpsecurity')?>:</th>
372
+ <td>
373
+ <input type="button" id="aiowps_wp_config_file_button" name="aiowps_wp_config_file_button" class="button rbutton" value="Select Your wp-config File" />
374
+ <input name="aiowps_wp_config_file" type="text" id="aiowps_wp_config_file" value="" size="80" />
375
+ <p class="description">
376
+ <?php
377
+ _e('After selecting your file click the button below to restore your site using the backed up wp-config file (wp-config.php.backup.txt).', 'aiowpsecurity');
378
+ ?>
379
+ </p>
380
+ </td>
381
+ </tr>
382
+ </table>
383
+ <input type="submit" name="aiowps_restore_wp_config_button" value="<?php _e('Restore wp-config File', 'aiowpsecurity')?>" class="button-primary" />
384
+ </form>
385
+ </div></div>
386
+ <div class="postbox">
387
+ <h3><label for="title"><?php _e('View Contents of the currently active wp-config.php file', 'aiowpsecurity'); ?></label></h3>
388
+ <div class="inside">
389
+ <?php
390
+ $wp_config_file = ABSPATH . 'wp-config.php';
391
+ $wp_config_contents = AIOWPSecurity_Utility_File::get_file_contents($wp_config_file);
392
+ ?>
393
+ <textarea class="aio_text_area_file_output aio_width_80 aio_spacer_10_tb" rows="20" readonly><?php echo $wp_config_contents; ?></textarea>
394
+ </div></div>
395
+
396
+ <?php
397
+ }
398
+
399
+ function check_if_wp_config_contents($wp_file)
400
+ {
401
+ $is_wp_config = false;
402
+
403
+ $file_contents = file($wp_file);
404
+
405
+ if ($file_contents == '' || $file_contents == NULL || $file_contents == false)
406
+ {
407
+ return -1;
408
+ }
409
+ foreach ($file_contents as $line)
410
+ {
411
+ if ((strpos($line, "define('DB_NAME'") !== false))
412
+ {
413
+ $is_wp_config = true; //It appears that we have some sort of wp-config.php file
414
+ break;
415
+ }
416
+ else
417
+ {
418
+ //see if we're at the end of the section
419
+ $is_wp_config = false;
420
+ }
421
+ }
422
+ if ($is_wp_config)
423
+ {
424
+ return 1;
425
+ }
426
+ else
427
+ {
428
+ return -1;
429
+ }
430
+
431
+ }
432
+
433
+ } //end class
admin/wp-security-user-accounts-menu.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_User_Accounts_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_USER_ACCOUNTS_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'WP Username',
10
+ 'tab2' => 'Display Name'
11
+ );
12
+ var $menu_tabs_handler = array(
13
+ 'tab1' => 'render_tab1',
14
+ 'tab2' => 'render_tab2',
15
+ );
16
+ function __construct()
17
+ {
18
+ $this->render_user_account_menu_page();
19
+ }
20
+
21
+ function get_current_tab()
22
+ {
23
+ $tab_keys = array_keys($this->menu_tabs);
24
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
25
+ return $tab;
26
+ }
27
+
28
+ /*
29
+ * Renders our tabs of this menu as nav items
30
+ */
31
+ function render_menu_tabs()
32
+ {
33
+ $current_tab = $this->get_current_tab();
34
+
35
+ echo '<h2 class="nav-tab-wrapper">';
36
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
37
+ {
38
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
39
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
40
+ }
41
+ echo '</h2>';
42
+ }
43
+
44
+ /*
45
+ * The menu rendering goes here
46
+ */
47
+ function render_user_account_menu_page()
48
+ {
49
+ $tab = $this->get_current_tab();
50
+ ?>
51
+ <div class="wrap">
52
+ <div id="poststuff"><div id="post-body">
53
+ <?php
54
+ $this->render_menu_tabs();
55
+ //$tab_keys = array_keys($this->menu_tabs);
56
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
57
+ ?>
58
+ </div></div>
59
+ </div><!-- end of wrap -->
60
+ <?php
61
+ }
62
+
63
+ function render_tab1()
64
+ {
65
+ if (isset($_POST['aiowps_change_admin_username']))//Do form submission tasks
66
+ {
67
+ echo $this->validate_change_username_form();
68
+ }
69
+ ?>
70
+ <h2><?php _e('Admin User Security', 'aiowpsecurity')?></h2>
71
+ <div class="aio_blue_box">
72
+ <?php
73
+ echo '<p>'.__('By default, WordPress sets the administrator username to "admin" at installation time.', 'aiowpsecurity').'
74
+ <br />'.__('A lot of hackers try to take advantage of this information by attempting "Brute Force Login Attacks" where they repeatedly try to guess the password by using "admin" for username.', 'aiowpsecurity').'
75
+ <br />'.__('From a security perspective, changing the default "admin" user name is one of the first and smartest things you should do on your site.', 'aiowpsecurity').'
76
+ <br /><br />'.__('This feature will allow you to change your default "admin" user name to a more secure name of your choosing.', 'aiowpsecurity').'
77
+ </p>';
78
+ ?>
79
+ </div>
80
+
81
+ <?php
82
+ //display a list of all administrator accounts for this site
83
+ $postbox_title = __('List of Administrator Accounts', 'aiowpsecurity');
84
+ //TODO: Multi-site: might need to put separate code for multi-site, ie, check if multi-site and then call get_all_admin_accounts($blog_id).
85
+ //if (is_multisite()) { //get admin accounts for current site
86
+ // $blog_id = get_current_blog_id();
87
+ // $this->postbox($postbox_title, $this->get_all_admin_accounts($blog_id));
88
+ //} else {
89
+ $this->postbox($postbox_title, $this->get_all_admin_accounts());
90
+ //}
91
+ ?>
92
+ <div class="postbox">
93
+ <h3><label for="title"><?php _e('Change Admin Username', 'aiowpsecurity')?></label></h3>
94
+ <div class="inside">
95
+ <?php
96
+ global $aiowps_feature_mgr;
97
+ $aiowps_feature_mgr->output_feature_details_badge("user-accounts-change-admin-user");
98
+
99
+ if (AIOWPSecurity_Utility::check_user_exists('admin'))
100
+ {
101
+ echo '<div class="aio_red_box"><p>'.__('Your site currently has an account which uses the default "admin" username.
102
+ It is highly recommended that you change this name to something else.
103
+ Use the following field to change the admin username.', 'aiowpsecurity').'</p></div>';
104
+ ?>
105
+ <form action="" method="POST">
106
+ <?php wp_nonce_field('aiowpsec-change-admin-nonce'); ?>
107
+ <table class="form-table">
108
+ <tr valign="top">
109
+ <th scope="row"><label for="NewUserName"> <?php _e('New Admin Username', 'aiowpsecurity')?>:</label></th>
110
+ <td><input size="16" name="aiowps_new_user_name" />
111
+ <p class="description"><?php _e('Choose a new username for admin.', 'aiowpsecurity'); ?></p>
112
+ </td>
113
+ </tr>
114
+ </table>
115
+ <input type="submit" name="aiowps_change_admin_username" value="<?php _e('Change Username', 'aiowpsecurity')?>" class="button-primary" />
116
+ <div class="aio_spacer_15"></div>
117
+ <p class="description"><?php _e('NOTE: If you are currently logged in as "admin" you will be automatically logged out after changing your username and will be required to log back in.', 'aiowpsecurity')?></p>
118
+ </form>
119
+ <?php
120
+ }
121
+ else
122
+ {
123
+ echo '<div id="aios_message" class="aio_green_box"><p><strong>';
124
+ _e ('No action required! ', 'aiowpsecurity');
125
+ echo '</strong><br />';
126
+ _e ('Your site does not have any account which uses the default "admin" username. ', 'aiowpsecurity');
127
+ _e ('This is good security practice.', 'aiowpsecurity');
128
+ echo '</p></div>';
129
+ }
130
+ ?>
131
+ </div>
132
+ </div>
133
+ <?php
134
+ }
135
+
136
+ function render_tab2()
137
+ {
138
+ ?>
139
+ <h2><?php _e('Display Name Security', 'aiowpsecurity')?></h2>
140
+ <div class="aio_blue_box">
141
+ <?php
142
+ echo '<p>'.__('When you submit a post or answer a comment, WordPress will usually display your "nickname".', 'aiowpsecurity').'
143
+ <br />'.__('By default the nickname is set to the login (or user) name of your account.', 'aiowpsecurity').'
144
+ <br />'.__('From a security perspective, leaving your nickname the same as your user name is bad practice because it gives a hacker at least half of your account\'s login credentials.', 'aiowpsecurity').'
145
+ <br /><br />'.__('Therefore to further tighten your site\'s security you are advised to change your <strong>nickname</strong> and <strong>Display name</strong> to be different from your <strong>Username</strong>.', 'aiowpsecurity').'
146
+ </p>';
147
+ ?>
148
+ </div>
149
+
150
+ <div class="postbox">
151
+ <h3><label for="title"><?php _e('Modify Accounts With Identical Login Name & Display Name', 'aiowpsecurity')?></label></h3>
152
+ <div class="inside">
153
+ <?php
154
+ global $aiowps_feature_mgr;
155
+ $aiowps_feature_mgr->output_feature_details_badge("user-accounts-display-name");
156
+
157
+ //now let's find any accounts which have login name same as display name
158
+ $login_nick_name_accounts = AIOWPSecurity_Utility::check_identical_login_and_nick_names();
159
+ if ($login_nick_name_accounts) {
160
+ echo '<div class="aio_red_box"><p>'.__('Your site currently has the following accounts which have an identical login name and display name.', 'aiowpsecurity').'
161
+ <span class="description">('.__('Click on the link to edit the settings of that particular user account', 'aiowpsecurity').'</span></p></div>';
162
+ ?>
163
+ <table class="form-table">
164
+ <?php
165
+ $edit_user_page = get_option('siteurl').'/wp-admin/user-edit.php?user_id=';
166
+ foreach ($login_nick_name_accounts as $usr){
167
+ echo '<tr valign="top">';
168
+ // echo '<th scope="row"><label for="UserID'.$usr['ID'].'"> Login Name: </label></th>';
169
+ echo '<td><a href="'.$edit_user_page.$usr['ID'].'" target="_blank">'.$usr['user_login'].'</a>';
170
+ echo '</tr>';
171
+ }
172
+ ?>
173
+ </table>
174
+ <?php
175
+ } else {
176
+ echo '<div id="aios_message" class="aio_green_box"><p><strong>'.__('No action required.', 'aiowpsecurity').'</strong>
177
+ <br />'.__('Your site does not have a user account where the display name is identical to the username.', 'aiowpsecurity').'</p></div>';
178
+ }
179
+ ?>
180
+ </div>
181
+ </div>
182
+ <?php
183
+ }
184
+
185
+ function validate_change_username_form()
186
+ {
187
+ global $wpdb;
188
+ global $aio_wp_security;
189
+ $errors = '';
190
+ $nonce=$_REQUEST['_wpnonce'];
191
+ if (!wp_verify_nonce($nonce, 'aiowpsec-change-admin-nonce'))
192
+ {
193
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on admin username change operation!",4);
194
+ die(__('Nonce check failed on admin username change operation!','aiowpsecurity'));
195
+ }
196
+ if (!empty($_POST['aiowps_new_user_name'])) {
197
+ $new_username = sanitize_text_field($_POST['aiowps_new_user_name']);
198
+ if (validate_username($new_username))
199
+ {
200
+ if (AIOWPSecurity_Utility::check_user_exists($new_username)){
201
+ $errors .= __('Username ', 'aiowpsecurity').$new_username.__(' already exists. Please enter another value. ', 'aiowpsecurity');
202
+ }
203
+ else
204
+ {
205
+ //let's check if currently logged in username is 'admin'
206
+ global $user_login;
207
+ get_currentuserinfo();
208
+ if (strtolower($user_login) == 'admin'){
209
+ $username_is_admin = TRUE;
210
+ } else {
211
+ $username_is_admin = FALSE;
212
+ }
213
+ //Now let's change the username
214
+ $result = $wpdb->query("UPDATE `" . $wpdb->users . "` SET user_login = '" . $wpdb->escape($new_username) . "' WHERE user_login='admin';");
215
+ if (!$result) {
216
+ //There was an error updating the users table
217
+ $user_update_error = __('The database update operation of the user account failed!', 'aiowpsecurity');
218
+ //TODO## - add error logging here
219
+ $return_msg = '<div id="message" class="updated fade"><p>'.$user_update_error.'</p></div>';
220
+ return $return_msg;
221
+ }
222
+
223
+ //If user is logged in with username "admin" then log user out and send to login page so they can login again
224
+ if ($username_is_admin) {
225
+ //Lets logout the user
226
+ $aio_wp_security->debug_logger->log_debug("Logging User Out with login ".$user_login. " because they changed their username.");
227
+ $after_logout_url = AIOWPSecurity_Utility::get_current_page_url();
228
+ $after_logout_payload = 'redirect_to='.$after_logout_url.'&msg='.$aio_wp_security->user_login_obj->key_login_msg.'=admin_user_changed';//Place the handle for the login screen message in the URL
229
+ $encrypted_payload = base64_encode($after_logout_payload);
230
+ $logout_url = AIOWPSEC_WP_URL.'?aiowpsec_do_log_out=1';
231
+ $logout_url = AIOWPSecurity_Utility::add_query_data_to_url($logout_url, 'al_additional_data', $encrypted_payload);
232
+ AIOWPSecurity_Utility::redirect_to_url($logout_url);
233
+ }
234
+
235
+ //TODO - multisite considerations
236
+ // if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation
237
+ // $oldAdmins = $wpdb->get_var( "SELECT meta_value FROM `" . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" );
238
+ // $newAdmins = str_replace( '5:"admin"', strlen( $newuser ) . ':"' . $wpdb->escape( $new_username ) . '"', $oldAdmins );
239
+ // $wpdb->query( "UPDATE `" . $wpdb->sitemeta . "` SET meta_value = '" . $wpdb->escape( $newAdmins ) . "' WHERE meta_key = 'site_admins'" );
240
+ // }
241
+ }
242
+ }
243
+ else {//An invalid username was entered
244
+ $errors .= __('You entered an invalid username. Please enter another value. ', 'aiowpsecurity');
245
+ }
246
+ }
247
+ else {//No username value was entered
248
+ $errors .= __('Please enter a value for your username. ', 'aiowpsecurity');
249
+ }
250
+
251
+ if (strlen($errors)> 0){//We have some validation or other error
252
+ $return_msg = '<div id="message" class="error"><p>' . $errors . '</p></div>';
253
+ }
254
+ else{
255
+ $return_msg = '<div id="message" class="updated fade"><p>'.__('Username Successfully Changed!', 'aiowpsecurity').'</p></div>';
256
+ }
257
+ return $return_msg;
258
+ }
259
+
260
+
261
+ /*
262
+ * This function will retrieve all user accounts which have 'administrator' role and will return html code with results in a table
263
+ */
264
+ function get_all_admin_accounts($blog_id='') {
265
+ //TODO: Have included the "blog_id" variable for future use for cases where people want to search particular blog (eg, multi-site)
266
+ if ($blog_id) {
267
+ $admin_users = get_users('blog_id='.$blog_id.'orderby=login&role=administrator');
268
+ } else {
269
+ $admin_users = get_users('orderby=login&role=administrator');
270
+ }
271
+ //now let's put the results in an HTML table
272
+ $account_output = "";
273
+ if ($admin_users != NULL) {
274
+ $account_output .= '<table>';
275
+ $account_output .= '<tr><th>'.__('Account Login Name', 'aiowpsecurity').'</th></tr>';
276
+ foreach ($admin_users as $entry) {
277
+ $account_output .= '<tr>';
278
+ if ($entry->user_login == 'admin') {
279
+ $account_output .= '<td style="color:red; font-weight: bold;">'.$entry->user_login.'</td>';
280
+ }else {
281
+ $account_output .= '<td>'.$entry->user_login.'</td>';
282
+ }
283
+ $account_output .= '</tr>';
284
+ }
285
+ $account_output .= '</table>';
286
+ }
287
+ return $account_output;
288
+ }
289
+ } //end class
admin/wp-security-user-login-menu.php ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_User_Login_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_USER_LOGIN_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'Login Lockdown',
10
+ 'tab2' => 'Failed Login Records',
11
+ 'tab3' => 'Force Logout',
12
+ 'tab4' => 'Account Activity',
13
+ );
14
+ var $menu_tabs_handler = array(
15
+ 'tab1' => 'render_tab1',
16
+ 'tab2' => 'render_tab2',
17
+ 'tab3' => 'render_tab3',
18
+ 'tab4' => 'render_tab4',
19
+ );
20
+
21
+ function __construct()
22
+ {
23
+ $this->render_user_login_menu_page();
24
+ }
25
+
26
+ function get_current_tab()
27
+ {
28
+ $tab_keys = array_keys($this->menu_tabs);
29
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
30
+ return $tab;
31
+ }
32
+
33
+ /*
34
+ * Renders our tabs of this menu as nav items
35
+ */
36
+ function render_menu_tabs()
37
+ {
38
+ $current_tab = $this->get_current_tab();
39
+
40
+ echo '<h2 class="nav-tab-wrapper">';
41
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
42
+ {
43
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
44
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
45
+ }
46
+ echo '</h2>';
47
+ }
48
+
49
+ /*
50
+ * The menu rendering goes here
51
+ */
52
+ function render_user_login_menu_page()
53
+ {
54
+ $tab = $this->get_current_tab();
55
+ ?>
56
+ <div class="wrap">
57
+ <div id="poststuff"><div id="post-body">
58
+ <?php
59
+ $this->render_menu_tabs();
60
+ //$tab_keys = array_keys($this->menu_tabs);
61
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
62
+ ?>
63
+ </div></div>
64
+ </div><!-- end of wrap -->
65
+ <?php
66
+ }
67
+
68
+ function render_tab1()
69
+ {
70
+ global $aio_wp_security;
71
+ include_once 'wp-security-list-locked-ip.php'; //For rendering the AIOWPSecurity_List_Table in tab1
72
+ $locked_ip_list = new AIOWPSecurity_List_Locked_IP(); //For rendering the AIOWPSecurity_List_Table in tab1
73
+
74
+ if(isset($_POST['aiowps_login_lockdown']))//Do form submission tasks
75
+ {
76
+ $error = '';
77
+ $nonce=$_REQUEST['_wpnonce'];
78
+ if (!wp_verify_nonce($nonce, 'aiowpsec-login-lockdown-nonce'))
79
+ {
80
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on login lockdown options save!",4);
81
+ die("Nonce check failed on login lockdown options save!");
82
+ }
83
+
84
+ $max_login_attempt_val = sanitize_text_field($_POST['aiowps_max_login_attempts']);
85
+ if(!is_numeric($max_login_attempt_val))
86
+ {
87
+ $error .= '<br />'.__('You entered a non numeric value for the max login attempts field. It has been set to the default value.','aiowpsecurity');
88
+ $max_login_attempt_val = '3';//Set it to the default value for this field
89
+ }
90
+
91
+ $login_retry_time_period = sanitize_text_field($_POST['aiowps_retry_time_period']);
92
+ if(!is_numeric($login_retry_time_period))
93
+ {
94
+ $error .= '<br />'.__('You entered a non numeric value for the login retry time period field. It has been set to the default value.','aiowpsecurity');
95
+ $login_retry_time_period = '5';//Set it to the default value for this field
96
+ }
97
+
98
+ $lockout_time_length = sanitize_text_field($_POST['aiowps_lockout_time_length']);
99
+ if(!is_numeric($lockout_time_length))
100
+ {
101
+ $error .= '<br />'.__('You entered a non numeric value for the lockout time length field. It has been set to the default value.','aiowpsecurity');
102
+ $lockout_time_length = '60';//Set it to the default value for this field
103
+ }
104
+
105
+ $email_address = sanitize_email($_POST['aiowps_email_address']);
106
+ if(!is_email($email_address))
107
+ {
108
+ $error .= '<br />'.__('You have entered an incorrect email address format. It has been set to your WordPress admin email as default.','aiowpsecurity');
109
+ $email_address = get_bloginfo('admin_email'); //Set the default value to the blog admin email
110
+ }
111
+
112
+ if($error)
113
+ {
114
+ $this->show_msg_error(__('Attention!','aiowpsecurity').$error);
115
+ }
116
+
117
+ //Save all the form values to the options
118
+ $aio_wp_security->configs->set_value('aiowps_enable_login_lockdown',isset($_POST["aiowps_enable_login_lockdown"])?'1':'');
119
+ $aio_wp_security->configs->set_value('aiowps_max_login_attempts',absint($max_login_attempt_val));
120
+ $aio_wp_security->configs->set_value('aiowps_retry_time_period',absint($login_retry_time_period));
121
+ $aio_wp_security->configs->set_value('aiowps_lockout_time_length',absint($lockout_time_length));
122
+ $aio_wp_security->configs->set_value('aiowps_set_generic_login_msg',isset($_POST["aiowps_set_generic_login_msg"])?'1':'');
123
+ $aio_wp_security->configs->set_value('aiowps_enable_email_notify',isset($_POST["aiowps_enable_email_notify"])?'1':'');
124
+ $aio_wp_security->configs->set_value('aiowps_email_address',$email_address);
125
+ $aio_wp_security->configs->save_config();
126
+ $this->show_msg_settings_updated();
127
+ }
128
+
129
+
130
+ if(isset($_REQUEST['action'])) //Do list table form row action tasks
131
+ {
132
+ if($_REQUEST['action'] == 'delete_blocked_ip'){ //Delete link was clicked for a row in list table
133
+ $locked_ip_list->delete_lockdown_records(strip_tags($_REQUEST['lockdown_id']));
134
+ }
135
+
136
+ if($_REQUEST['action'] == 'unlock_ip'){ //Unlock link was clicked for a row in list table
137
+ $locked_ip_list->unlock_ip_range(strip_tags($_REQUEST['lockdown_id']));
138
+ }
139
+ }
140
+ ?>
141
+ <h2><?php _e('Login Lockdown Configuration', 'aiowpsecurity')?></h2>
142
+ <div class="aio_blue_box">
143
+ <?php
144
+ echo '<p>'.__('One of the ways hackers try to compromise sites is via a ', 'aiowpsecurity').'<strong>'.__('Brute Force Login Attack', 'aiowpsecurity').'</strong>.
145
+ <br />'.__('This is where attackers use repeated login attempts until they guess the password.', 'aiowpsecurity').'
146
+ <br />'.__('Apart from choosing strong passwords, monitoring and blocking IP addresses which are involved in repeated login failures in a short period of time is a very effective way to stop these types of attacks.', 'aiowpsecurity').'
147
+ </p>';
148
+ ?>
149
+ </div>
150
+
151
+ <div class="postbox">
152
+ <h3><label for="title"><?php _e('Login Lockdown Options', 'aiowpsecurity'); ?></label></h3>
153
+ <div class="inside">
154
+ <?php
155
+ //Display security info badge
156
+ global $aiowps_feature_mgr;
157
+ $aiowps_feature_mgr->output_feature_details_badge("user-login-login-lockdown");
158
+ ?>
159
+
160
+ <form action="" method="POST">
161
+ <?php wp_nonce_field('aiowpsec-login-lockdown-nonce'); ?>
162
+ <table class="form-table">
163
+ <tr valign="top">
164
+ <th scope="row"><?php _e('Enable Login Lockdown Feature', 'aiowpsecurity')?>:</th>
165
+ <td>
166
+ <input name="aiowps_enable_login_lockdown" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_login_lockdown')=='1') echo ' checked="checked"'; ?> value="1"/>
167
+ <span class="description"><?php _e('Check this if you want to enable the login lockdown feature and apply the settings below', 'aiowpsecurity'); ?></span>
168
+ </td>
169
+ </tr>
170
+ <tr valign="top">
171
+ <th scope="row"><?php _e('Max Login Attempts', 'aiowpsecurity')?>:</th>
172
+ <td><input size="5" name="aiowps_max_login_attempts" value="<?php echo $aio_wp_security->configs->get_value('aiowps_max_login_attempts'); ?>" />
173
+ <span class="description"><?php _e('Set the value for the maximum login retries before IP address is locked out', 'aiowpsecurity'); ?></span>
174
+ </td>
175
+ </tr>
176
+ <tr valign="top">
177
+ <th scope="row"><?php _e('Login Retry Time Period (min)', 'aiowpsecurity')?>:</th>
178
+ <td><input size="5" name="aiowps_retry_time_period" value="<?php echo $aio_wp_security->configs->get_value('aiowps_retry_time_period'); ?>" />
179
+ <span class="description"><?php _e('If the maximum number of failed login attempts for a particular IP address occur within this time period the plugin will lock out that address', 'aiowpsecurity'); ?></span>
180
+ </td>
181
+ </tr>
182
+ <tr valign="top">
183
+ <th scope="row"><?php _e('Time Length of Lockout (min)', 'aiowpsecurity')?>:</th>
184
+ <td><input size="5" name="aiowps_lockout_time_length" value="<?php echo $aio_wp_security->configs->get_value('aiowps_lockout_time_length'); ?>" />
185
+ <span class="description"><?php _e('Set the length of time for which a particular IP address will be prevented from logging in', 'aiowpsecurity'); ?></span>
186
+ </td>
187
+ </tr>
188
+ <tr valign="top">
189
+ <th scope="row"><?php _e('Display Generic Error Message', 'aiowpsecurity')?>:</th>
190
+ <td>
191
+ <input name="aiowps_set_generic_login_msg" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_set_generic_login_msg')=='1') echo ' checked="checked"'; ?> value="1"/>
192
+ <span class="description"><?php _e('Check this if you want to show a generic error message when a login attempt fails', 'aiowpsecurity'); ?></span>
193
+ </td>
194
+ </tr>
195
+ <tr valign="top">
196
+ <th scope="row"><?php _e('Notify By Email', 'aiowpsecurity')?>:</th>
197
+ <td>
198
+ <input name="aiowps_enable_email_notify" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_email_notify')=='1') echo ' checked="checked"'; ?> value="1"/>
199
+ <span class="description"><?php _e('Check this if you want to receive an email when someone has been locked out due to maximum failed login attempts', 'aiowpsecurity'); ?></span>
200
+ <br /><input size="30" name="aiowps_email_address" value="<?php echo $aio_wp_security->configs->get_value('aiowps_email_address'); ?>" />
201
+ <span class="description"><?php _e('Enter an email address', 'aiowpsecurity'); ?></span>
202
+ </td>
203
+ </tr>
204
+ </table>
205
+ <input type="submit" name="aiowps_login_lockdown" value="<?php _e('Save Settings', 'aiowpsecurity')?>" class="button-primary" />
206
+ </form>
207
+ </div></div>
208
+ <div class="postbox">
209
+ <h3><label for="title"><?php _e('Currently Locked Out IP Address Ranges', 'aiowpsecurity'); ?></label></h3>
210
+ <div class="inside">
211
+ <?php
212
+ //Fetch, prepare, sort, and filter our data...
213
+ $locked_ip_list->prepare_items();
214
+ //echo "put table of locked entries here";
215
+ ?>
216
+ <form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
217
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
218
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
219
+ <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab']; ?>" />
220
+ <!-- Now we can render the completed list table -->
221
+ <?php $locked_ip_list->display(); ?>
222
+ </form>
223
+ </div></div>
224
+ <?php
225
+ }
226
+
227
+ function render_tab2()
228
+ {
229
+ include_once 'wp-security-list-login-fails.php'; //For rendering the AIOWPSecurity_List_Table in tab2
230
+ $failed_login_list = new AIOWPSecurity_List_Login_Failed_Attempts(); //For rendering the AIOWPSecurity_List_Table in tab2
231
+ if(isset($_REQUEST['action'])) //Do row action tasks for list table form for failed logins
232
+ {
233
+ if($_REQUEST['action'] == 'delete_failed_login_rec'){ //Delete link was clicked for a row in list table
234
+ $failed_login_list->delete_login_failed_records(strip_tags($_REQUEST['failed_login_id']));
235
+ }
236
+ }
237
+ ?>
238
+ <div class="aio_blue_box">
239
+ <?php
240
+ echo '<p>'.__('This tab displays the failed login attempts for your site.', 'aiowpsecurity').'
241
+ <br />'.__('The information below can be handy if you need to do security investigations because it will show you the IP range, username and ID (if applicable) and the time/date of the failed login attempt.', 'aiowpsecurity').'
242
+ </p>';
243
+ ?>
244
+ </div>
245
+ <div class="postbox">
246
+ <h3><label for="title"><?php _e('Failed Login Records', 'aiowpsecurity'); ?></label></h3>
247
+ <div class="inside">
248
+ <?php
249
+ //Fetch, prepare, sort, and filter our data...
250
+ $failed_login_list->prepare_items();
251
+ //echo "put table of locked entries here";
252
+ ?>
253
+ <form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
254
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
255
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
256
+ <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab']; ?>" />
257
+ <!-- Now we can render the completed list table -->
258
+ <?php $failed_login_list->display(); ?>
259
+ </form>
260
+ </div></div>
261
+ <?php
262
+ }
263
+
264
+ function render_tab3()
265
+ {
266
+ global $aio_wp_security;
267
+ if(isset($_POST['aiowpsec_save_force_logout_settings']))//Do form submission tasks
268
+ {
269
+ $error = '';
270
+ $nonce=$_REQUEST['_wpnonce'];
271
+ if (!wp_verify_nonce($nonce, 'aiowpsec-force-logout-settings-nonce'))
272
+ {
273
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on force logout options save!",4);
274
+ die("Nonce check failed on force logout options save!");
275
+ }
276
+
277
+ $logout_time_period = sanitize_text_field($_POST['aiowps_logout_time_period']);
278
+ if(!is_numeric($logout_time_period))
279
+ {
280
+ $error .= '<br />'.__('You entered a non numeric value for the logout time period field. It has been set to the default value.','aiowpsecurity');
281
+ $logout_time_period = '1';//Set it to the default value for this field
282
+ }
283
+
284
+ if($error)
285
+ {
286
+ $this->show_msg_error(__('Attention!','aiowpsecurity').$error);
287
+ }
288
+
289
+ //Save all the form values to the options
290
+ $aio_wp_security->configs->set_value('aiowps_logout_time_period',absint($logout_time_period));
291
+ $aio_wp_security->configs->set_value('aiowps_enable_forced_logout',isset($_POST["aiowps_enable_forced_logout"])?'1':'');
292
+ $aio_wp_security->configs->save_config();
293
+ $this->show_msg_settings_updated();
294
+ }
295
+ ?>
296
+ <div class="aio_blue_box">
297
+ <?php
298
+ echo '<p>'.__('Setting an expiry period for your WP administration session is a simple way to protect against unauthorized access to your site from your computer.', 'aiowpsecurity').'
299
+ <br />'.__('This feature allows you to specify a time period in minutes after which the admin session will expire and the user will be forced to log back in.', 'aiowpsecurity').'
300
+ </p>';
301
+ ?>
302
+ </div>
303
+ <div class="postbox">
304
+ <h3><label for="title"><?php _e('Force User Logout Options', 'aiowpsecurity'); ?></label></h3>
305
+ <div class="inside">
306
+ <?php
307
+ //Display security info badge
308
+ global $aiowps_feature_mgr;
309
+ $aiowps_feature_mgr->output_feature_details_badge("user-login-force-logout");
310
+ ?>
311
+
312
+ <form action="" method="POST">
313
+ <?php wp_nonce_field('aiowpsec-force-logout-settings-nonce'); ?>
314
+ <table class="form-table">
315
+ <tr valign="top">
316
+ <th scope="row"><?php _e('Enable Force WP User Logout', 'aiowpsecurity')?>:</th>
317
+ <td>
318
+ <input name="aiowps_enable_forced_logout" type="checkbox"<?php if($aio_wp_security->configs->get_value('aiowps_enable_forced_logout')=='1') echo ' checked="checked"'; ?> value="1"/>
319
+ <span class="description"><?php _e('Check this if you want to force a wp user to be logged out after a configured amount of time', 'aiowpsecurity'); ?></span>
320
+ </td>
321
+ </tr>
322
+ <tr valign="top">
323
+ <th scope="row"><?php _e('Logout the WP User After XX Minutes', 'aiowpsecurity')?>:</th>
324
+ <td><input size="5" name="aiowps_logout_time_period" value="<?php echo $aio_wp_security->configs->get_value('aiowps_logout_time_period'); ?>" />
325
+ <span class="description"><?php _e('(Minutes) The user will be forced to log back in after this time period has elapased.', 'aiowpsecurity'); ?></span>
326
+ </td>
327
+ </tr>
328
+ </table>
329
+ <input type="submit" name="aiowpsec_save_force_logout_settings" value="<?php _e('Save Settings', 'aiowpsecurity')?>" class="button-primary" />
330
+ </form>
331
+ </div></div>
332
+ <?php
333
+ }
334
+
335
+ function render_tab4()
336
+ {
337
+ //TODO - needs completing...
338
+ include_once 'wp-security-list-acct-activity.php'; //For rendering the AIOWPSecurity_List_Table in tab4
339
+ $acct_activity_list = new AIOWPSecurity_List_Account_Activity(); //For rendering the AIOWPSecurity_List_Table in tab2
340
+ if(isset($_REQUEST['action'])) //Do row action tasks for list table form for login activity display
341
+ {
342
+ if($_REQUEST['action'] == 'delete_acct_activity_rec'){ //Delete link was clicked for a row in list table
343
+ $acct_activity_list->delete_login_activity_records(strip_tags($_REQUEST['activity_login_rec']));
344
+ }
345
+ }
346
+ ?>
347
+ <div class="aio_blue_box">
348
+ <?php
349
+ echo '<p>'.__('This tab displays the login activity for WordPress admin accounts registered with your site.', 'aiowpsecurity').'
350
+ <br />'.__('The information below can be handy if you need to do security investigations because it will show you the last 50 recent login events by username, IP address and time/date.', 'aiowpsecurity').'
351
+ </p>';
352
+ ?>
353
+ </div>
354
+ <div class="postbox">
355
+ <h3><label for="title"><?php _e('Account Activity Logs', 'aiowpsecurity'); ?></label></h3>
356
+ <div class="inside">
357
+ <?php
358
+ //Fetch, prepare, sort, and filter our data...
359
+ $acct_activity_list->prepare_items();
360
+ //echo "put table of locked entries here";
361
+ ?>
362
+ <form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
363
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
364
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page']; ?>" />
365
+ <input type="hidden" name="tab" value="<?php echo $_REQUEST['tab']; ?>" />
366
+ <!-- Now we can render the completed list table -->
367
+ <?php $acct_activity_list->display(); ?>
368
+ </form>
369
+ </div></div>
370
+ <?php
371
+ }
372
+
373
+
374
+ /*
375
+ * This function will unlock an IP range by modifying the "release_date" column of a record in the "login_lockdown" table
376
+ */
377
+ function unlock_ip_range($entries)
378
+ {
379
+ global $wpdb, $aio_wp_security;
380
+ $lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
381
+ if (is_array($entries))
382
+ {
383
+ //Unlock multiple records
384
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
385
+ $unlock_command = "UPDATE ".$lockdown_table." SET release_date = now() WHERE ID IN ".$id_list;
386
+ $result = $wpdb->query($unlock_command);
387
+ if($result != NULL)
388
+ {
389
+ $this->show_msg_updated(__('The selected IP ranges were unlocked successfully!','aiowpsecurity'));
390
+ }
391
+ } elseif ($entries != NULL)
392
+ {
393
+ //Delete single record
394
+ $unlock_command = "UPDATE ".$lockdown_table." SET release_date = now() WHERE ID = '".absint($entries)."'";
395
+ $result = $wpdb->query($unlock_command);
396
+ if($result != NULL)
397
+ {
398
+ $this->show_msg_updated(__('The selected IP range was unlocked successfully!','aiowpsecurity'));
399
+ }
400
+ }
401
+ //$aio_wp_security->debug_logger->log_debug("IP range unlocked from login_lockdown table - lockdown ID: ".$lockdown_id,0);
402
+ }
403
+
404
+ /*
405
+ * This function will delete selected records from the "login_lockdown" table.
406
+ * The function accepts either an array of IDs or a single ID
407
+ */
408
+ function delete_lockdown_records($entries)
409
+ {
410
+ global $wpdb, $aio_wp_security;
411
+ $lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
412
+ if (is_array($entries))
413
+ {
414
+ //Delete multiple records
415
+ $id_list = "(" .implode(",",$entries) .")"; //Create comma separate list for DB operation
416
+ $delete_command = "DELETE FROM ".$lockdown_table." WHERE ID IN ".$id_list;
417
+ $result = $wpdb->query($delete_command);
418
+ if($result != NULL)
419
+ {
420
+ $this->show_msg_updated(__('The selected records were deleted successfully!','aiowpsecurity'));
421
+ }
422
+ } elseif ($entries != NULL)
423
+ {
424
+ //Delete single record
425
+ $delete_command = "DELETE FROM ".$lockdown_table." WHERE ID = '".absint($entries)."'";
426
+ $result = $wpdb->query($delete_command);
427
+ if($result != NULL)
428
+ {
429
+ $this->show_msg_updated(__('The selected record was deleted successfully!','aiowpsecurity'));
430
+ }
431
+ //$aio_wp_security->debug_logger->log_debug("Record deleted from login_lockdown table - lockdown ID: ".$entries,0);
432
+ }
433
+ }
434
+
435
+ } //end class
admin/wp-security-whois-menu.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_WhoIs_Menu extends AIOWPSecurity_Admin_Menu
4
+ {
5
+ var $menu_page_slug = AIOWPSEC_WHOIS_MENU_SLUG;
6
+
7
+ /* Specify all the tabs of this menu in the following array */
8
+ var $menu_tabs = array(
9
+ 'tab1' => 'WhoIS Lookup',
10
+ );
11
+
12
+ var $menu_tabs_handler = array(
13
+ 'tab1' => 'render_tab1',
14
+ );
15
+
16
+ function __construct()
17
+ {
18
+ $this->render_menu_page();
19
+ }
20
+
21
+ function get_current_tab()
22
+ {
23
+ $tab_keys = array_keys($this->menu_tabs);
24
+ $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : $tab_keys[0];
25
+ return $tab;
26
+ }
27
+
28
+ /*
29
+ * Renders our tabs of this menu as nav items
30
+ */
31
+ function render_menu_tabs()
32
+ {
33
+ $current_tab = $this->get_current_tab();
34
+
35
+ echo '<h2 class="nav-tab-wrapper">';
36
+ foreach ( $this->menu_tabs as $tab_key => $tab_caption )
37
+ {
38
+ $active = $current_tab == $tab_key ? 'nav-tab-active' : '';
39
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
40
+ }
41
+ echo '</h2>';
42
+ }
43
+
44
+ /*
45
+ * The menu rendering goes here
46
+ */
47
+ function render_menu_page()
48
+ {
49
+ $tab = $this->get_current_tab();
50
+ ?>
51
+ <div class="wrap">
52
+ <div id="poststuff"><div id="post-body">
53
+ <?php
54
+ $this->render_menu_tabs();
55
+ //$tab_keys = array_keys($this->menu_tabs);
56
+ call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
57
+ ?>
58
+ </div></div>
59
+ </div><!-- end of wrap -->
60
+ <?php
61
+ }
62
+
63
+ function render_tab1()
64
+ {
65
+ global $aio_wp_security;
66
+
67
+ ?>
68
+ <h2><?php _e('WHOIS Lookup Information', 'aiowpsecurity')?></h2>
69
+ <div class="aio_blue_box">
70
+ <?php
71
+ echo '<p>'.__('This feature allows you to look up more detailed information about an IP address or domain name by querying the WHOIS API.', 'aiowpsecurity').'
72
+ </p>';
73
+ ?>
74
+ </div>
75
+
76
+ <div class="postbox">
77
+ <h3><label for="title"><?php _e('Perform a WHOIS Lookup for an IP or Domain Name', 'aiowpsecurity'); ?></label></h3>
78
+ <div class="inside">
79
+ <p>Please click the button below to view the latest system logs:</p>
80
+ <form action="" method="POST">
81
+ <?php wp_nonce_field('aiowpsec-whois-lookup-nonce'); ?>
82
+ <table class="form-table">
83
+ <tr valign="top">
84
+ <th scope="row"><?php _e('Enter IP Address or Domain Name', 'aiowpsecurity')?>:</th>
85
+ <td><input size="20" name="aiowps_whois_lookup_field" value="<?php //echo $aio_wp_security->configs->get_value('aiowps_whois_lookup_field'); ?>" />
86
+ <span class="description"><?php _e('Enter an IP address or domain name. Example: 111.11.12.13 OR some-domain-name.com', 'aiowpsecurity'); ?></span>
87
+ </td>
88
+ </tr>
89
+ </table>
90
+ <input type="submit" name="aiowps_whois_lookup" value="<?php _e('Perform IP or Domain Lookup', 'aiowpsecurity')?>" class="button-primary ip-domain-lookup" />
91
+ </form>
92
+ </div></div>
93
+ <?php
94
+ if (isset($_POST['aiowps_whois_lookup']))
95
+ {
96
+ $nonce=$_REQUEST['_wpnonce'];
97
+ if (!wp_verify_nonce($nonce, 'aiowpsec-whois-lookup-nonce'))
98
+ {
99
+ $aio_wp_security->debug_logger->log_debug("Nonce check failed on WHOIS lookup!",4);
100
+ die("Nonce check failed on WHOIS lookup!");
101
+ }
102
+
103
+ require_once(AIO_WP_SECURITY_LIB_PATH.'/whois/whois.main.php');
104
+ require_once(AIO_WP_SECURITY_LIB_PATH.'/whois/whois.utils.php');
105
+ $input_val = trim($_POST['aiowps_whois_lookup_field']);
106
+ if (filter_var($input_val, FILTER_VALIDATE_IP) || filter_var(gethostbyname($input_val), FILTER_VALIDATE_IP))
107
+ {
108
+ //$info_msg_string = '<p class="aio_info_with_icon">'.sprintf( __('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity')).'</p>';
109
+ //echo ($info_msg_string);
110
+ $this->show_msg_updated(__('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity'));
111
+ $whois = new Whois();
112
+ $result = $whois->Lookup($input_val);
113
+ if (!empty($result['rawdata']))
114
+ {
115
+ $utils = new utils;
116
+ $winfo = $utils->showHTML($result);
117
+ echo $winfo;
118
+ }
119
+ }
120
+ else
121
+ {
122
+ $this->show_msg_error(__('You have entered an incorrectly formatted IP address or domain name. Please try again.','aiowpsecurity'));
123
+ }
124
+ }
125
+ }
126
+ } //end class
classes/grade-system/wp-security-feature-item-manager.php ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Feature_Item_Manager
4
+ {
5
+ var $feature_items;
6
+ var $total_points = 0;
7
+ var $total_achievable_points = 0;
8
+
9
+ var $feature_point_1 = "5";
10
+ var $feature_point_2 = "10";
11
+ var $feature_point_3 = "15";
12
+ var $feature_point_4 = "20";
13
+ var $sec_level_basic = "1";
14
+ var $sec_level_inter = "2";
15
+ var $sec_level_advanced = "3";
16
+ var $feature_active = "active";
17
+ var $feature_inactive = "inactive";
18
+ var $feature_partial = "partial";
19
+
20
+ function __construct(){
21
+
22
+ }
23
+
24
+ function initialize_features()
25
+ {
26
+ $this->feature_items = array();
27
+
28
+ //User Accounts Menu Features
29
+ //Change Admin Username
30
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-accounts-change-admin-user", "Change Admin Username", $this->feature_point_3, $this->sec_level_basic);
31
+ //Change Display Name
32
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-accounts-display-name", "Change Display Name", $this->feature_point_1, $this->sec_level_basic);
33
+
34
+ //User Login Menu Features
35
+ //Locking Lockdown
36
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-login-login-lockdown", "Login Lockdown", $this->feature_point_4, $this->sec_level_basic);
37
+ //Force Logout
38
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("user-login-force-logout", "Force Logout", $this->feature_point_1, $this->sec_level_basic);
39
+
40
+ //Database Security Menu Features
41
+ //DB Prefix
42
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("db-security-db-prefix", "DB Prefix", $this->feature_point_2, $this->sec_level_inter);
43
+ //DB Backup
44
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("db-security-db-backup", "DB Backup", $this->feature_point_4, $this->sec_level_basic);
45
+
46
+ //File System Security Menu Features
47
+ //File Permissions
48
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("filesystem-file-permissions", "File Permissions", $this->feature_point_4, $this->sec_level_basic);
49
+ //PHP File Editing
50
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("filesystem-file-editing", "File Editing", $this->feature_point_2, $this->sec_level_basic);
51
+
52
+ //Blacklist Manager Menu Features
53
+ //IP and user agent blacklisting
54
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("blacklist-manager-ip-user-agent-blacklisting", "IP and User Agent Blacklisting", $this->feature_point_3, $this->sec_level_inter);
55
+
56
+ //Firewall Menu Features
57
+ //Basic firewall
58
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-basic-rules", "Enable Basic Firewall", $this->feature_point_3, $this->sec_level_basic);
59
+ //Advanced firewall
60
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-disable-trace-track", "Disable Trace and Track", $this->feature_point_2, $this->sec_level_advanced);
61
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-forbid-proxy-comments", "Forbid Proxy Comments", $this->feature_point_2, $this->sec_level_advanced);
62
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-deny-bad-queries", "Deny Bad Queries", $this->feature_point_3, $this->sec_level_advanced);
63
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-advanced-character-string-filter", "Advanced Character String Filter", $this->feature_point_3, $this->sec_level_advanced);
64
+ $this->feature_items[] = new AIOWPSecurity_Feature_Item("firewall-enable-5g-blacklist", "5G Blacklist", $this->feature_point_4, $this->sec_level_advanced);
65
+
66
+ }
67
+
68
+ function get_feature_item_by_id($feature_id)
69
+ {
70
+ foreach($this->feature_items as $item)
71
+ {
72
+ if($item->feature_id == $feature_id)
73
+ {
74
+ return $item;
75
+ }
76
+ }
77
+ return "";
78
+ }
79
+
80
+ function output_feature_details_badge($feature_id)
81
+ {
82
+ $cau_feature_item = $this->get_feature_item_by_id($feature_id);
83
+ $cau_security_level = $cau_feature_item->security_level;
84
+ $cau_security_points = $cau_feature_item->item_points;
85
+ $cau_your_points = 0;
86
+ if($cau_feature_item->feature_status == $this->feature_active){
87
+ $cau_your_points = $cau_security_points;
88
+ }
89
+ $level_str = $cau_feature_item->get_security_level_string($cau_security_level);
90
+ ?>
91
+ <div class="aiowps_feature_details_badge">
92
+ <div class="aiowps_feature_details_badge_difficulty" title="Feature Difficulty">
93
+ <span class="aiowps_feature_details_badge_difficulty_text"><?php _e($level_str, 'aiowpsecurity'); ?></span>
94
+ </div>
95
+ <div class="aiowps_feature_details_badge_points" title="Security Points">
96
+ <span class="aiowps_feature_details_badge_points_text"><?php echo $cau_your_points .'/'. $cau_security_points; ?></span>
97
+ </div>
98
+ </div>
99
+ <?php
100
+ }
101
+
102
+ function check_and_set_feature_status()
103
+ {
104
+ foreach($this->feature_items as $item)
105
+ {
106
+ if($item->feature_id == "user-accounts-change-admin-user")
107
+ {
108
+ $this->check_user_accounts_change_admin_user_feature($item);
109
+ }
110
+ if($item->feature_id == "user-accounts-display-name")
111
+ {
112
+ $this->check_user_accounts_display_name_feature($item);
113
+ }
114
+
115
+ if($item->feature_id == "db-security-db-prefix")
116
+ {
117
+ $this->check_db_security_db_prefix_feature($item);
118
+ }
119
+ if($item->feature_id == "db-security-db-backup")
120
+ {
121
+ $this->check_db_security_db_backup_feature($item);
122
+ }
123
+
124
+ if($item->feature_id == "user-login-login-lockdown")
125
+ {
126
+ $this->check_login_lockdown_feature($item);
127
+ }
128
+ if($item->feature_id == "user-login-force-logout")
129
+ {
130
+ $this->check_force_logout_feature($item);
131
+ }
132
+
133
+ if($item->feature_id == "filesystem-file-permissions")
134
+ {
135
+ $this->check_filesystem_permissions_feature($item);
136
+ }
137
+ if($item->feature_id == "filesystem-file-editing")
138
+ {
139
+ $this->check_filesystem_file_editing_feature($item);
140
+ }
141
+
142
+ if($item->feature_id == "blacklist-manager-ip-user-agent-blacklisting")
143
+ {
144
+ $this->check_enable_ip_useragent_blacklist_feature($item);
145
+ }
146
+
147
+ if($item->feature_id == "firewall-basic-rules")
148
+ {
149
+ $this->check_enable_basic_firewall_feature($item);
150
+ }
151
+ if($item->feature_id == "firewall-disable-trace-track")
152
+ {
153
+ $this->check_disable_trace_track_firewall_feature($item);
154
+ }
155
+ if($item->feature_id == "firewall-forbid-proxy-comments")
156
+ {
157
+ $this->check_forbid_proxy_comments_firewall_feature($item);
158
+ }
159
+ if($item->feature_id == "firewall-deny-bad-queries")
160
+ {
161
+ $this->check_deny_bad_queries_firewall_feature($item);
162
+ }
163
+ if($item->feature_id == "firewall-advanced-character-string-filter")
164
+ {
165
+ $this->check_advanced_char_string_filter_firewall_feature($item);
166
+ }
167
+ if($item->feature_id == "firewall-enable-5g-blacklist")
168
+ {
169
+ $this->check_enable_5G_blacklist_firewall_feature($item);
170
+ }
171
+
172
+ }
173
+ }
174
+
175
+ function calculate_total_points()
176
+ {
177
+ foreach($this->feature_items as $item)
178
+ {
179
+ if($item->feature_status == "active")
180
+ {
181
+ $this->total_points = $this->total_points + intval($item->item_points);
182
+ }
183
+ }
184
+ }
185
+
186
+ function get_total_site_points()
187
+ {
188
+ return $this->total_points;
189
+ }
190
+
191
+ function get_total_achievable_points()
192
+ {
193
+ foreach($this->feature_items as $item)
194
+ {
195
+ $this->total_achievable_points = $this->total_achievable_points + intval($item->item_points);
196
+ }
197
+ return $this->total_achievable_points;
198
+ }
199
+
200
+ function check_user_accounts_change_admin_user_feature($item)
201
+ {
202
+ if (AIOWPSecurity_Utility::check_user_exists('admin')) {
203
+ $item->set_feature_status($this->feature_inactive);
204
+ }
205
+ else
206
+ {
207
+ $item->set_feature_status($this->feature_active);
208
+ }
209
+ }
210
+
211
+ function check_user_accounts_display_name_feature($item)
212
+ {
213
+ if (AIOWPSecurity_Utility::check_identical_login_and_nick_names()) {
214
+ $item->set_feature_status($this->feature_inactive);
215
+ }
216
+ else
217
+ {
218
+ $item->set_feature_status($this->feature_active);
219
+ }
220
+ }
221
+
222
+ function check_login_lockdown_feature($item)
223
+ {
224
+ global $aio_wp_security;
225
+ if ($aio_wp_security->configs->get_value('aiowps_enable_login_lockdown') == '1') {
226
+ $item->set_feature_status($this->feature_active);
227
+ }
228
+ else
229
+ {
230
+ $item->set_feature_status($this->feature_inactive);
231
+ }
232
+ }
233
+
234
+ function check_force_logout_feature($item)
235
+ {
236
+ global $aio_wp_security;
237
+ if ($aio_wp_security->configs->get_value('aiowps_enable_forced_logout') == '1') {
238
+ $item->set_feature_status($this->feature_active);
239
+ }
240
+ else
241
+ {
242
+ $item->set_feature_status($this->feature_inactive);
243
+ }
244
+ }
245
+
246
+ function check_db_security_db_prefix_feature($item)
247
+ {
248
+ global $wpdb;
249
+ if ($wpdb->prefix == 'wp_') {
250
+ $item->set_feature_status($this->feature_inactive);
251
+ }
252
+ else
253
+ {
254
+ $item->set_feature_status($this->feature_active);
255
+ }
256
+ }
257
+
258
+ function check_db_security_db_backup_feature($item)
259
+ {
260
+ global $aio_wp_security;
261
+ if ($aio_wp_security->configs->get_value('aiowps_enable_automated_backups') == '1') {
262
+ $item->set_feature_status($this->feature_active);
263
+ }
264
+ else
265
+ {
266
+ $item->set_feature_status($this->feature_inactive);
267
+ }
268
+ }
269
+
270
+ function check_filesystem_permissions_feature($item)
271
+ {
272
+ //TODO
273
+ $is_secure = 1;
274
+ $util = new AIOWPSecurity_Utility_File;
275
+ $files_dirs_to_check = $util->files_and_dirs_to_check;
276
+ foreach ($files_dirs_to_check as $file_or_dir)
277
+ {
278
+ $actual_perm = AIOWPSecurity_Utility_File::get_file_permission($file_or_dir['path']);
279
+ $is_secure = $is_secure*AIOWPSecurity_Utility_File::is_file_permission_secure($file_or_dir['permissions'], $actual_perm);
280
+ }
281
+
282
+ //Only if all of the files' permissions are deemed secure give this a thumbs up
283
+ if ($is_secure == 1)
284
+ {
285
+ $item->set_feature_status($this->feature_active);
286
+ }
287
+ else
288
+ {
289
+ $item->set_feature_status($this->feature_inactive);
290
+ }
291
+ }
292
+
293
+ function check_filesystem_file_editing_feature($item)
294
+ {
295
+ global $aio_wp_security;
296
+ if ($aio_wp_security->configs->get_value('aiowps_disable_file_editing') == '1') {
297
+ $item->set_feature_status($this->feature_active);
298
+ }
299
+ else
300
+ {
301
+ $item->set_feature_status($this->feature_inactive);
302
+ }
303
+ }
304
+
305
+ function check_enable_ip_useragent_blacklist_feature($item)
306
+ {
307
+ global $aio_wp_security;
308
+ if ($aio_wp_security->configs->get_value('aiowps_enable_blacklisting') == '1') {
309
+ $item->set_feature_status($this->feature_active);
310
+ }
311
+ else
312
+ {
313
+ $item->set_feature_status($this->feature_inactive);
314
+ }
315
+ }
316
+
317
+ function check_enable_basic_firewall_feature($item)
318
+ {
319
+ global $aio_wp_security;
320
+ if ($aio_wp_security->configs->get_value('aiowps_enable_basic_firewall') == '1') {
321
+ $item->set_feature_status($this->feature_active);
322
+ }
323
+ else
324
+ {
325
+ $item->set_feature_status($this->feature_inactive);
326
+ }
327
+ }
328
+
329
+ function check_disable_trace_track_firewall_feature($item)
330
+ {
331
+ global $aio_wp_security;
332
+ if ($aio_wp_security->configs->get_value('aiowps_disable_trace_and_track') == '1') {
333
+ $item->set_feature_status($this->feature_active);
334
+ }
335
+ else
336
+ {
337
+ $item->set_feature_status($this->feature_inactive);
338
+ }
339
+ }
340
+ function check_forbid_proxy_comments_firewall_feature($item)
341
+ {
342
+ global $aio_wp_security;
343
+ if ($aio_wp_security->configs->get_value('aiowps_forbid_proxy_comments') == '1') {
344
+ $item->set_feature_status($this->feature_active);
345
+ }
346
+ else
347
+ {
348
+ $item->set_feature_status($this->feature_inactive);
349
+ }
350
+ }
351
+
352
+ function check_deny_bad_queries_firewall_feature($item)
353
+ {
354
+ global $aio_wp_security;
355
+ if ($aio_wp_security->configs->get_value('aiowps_deny_bad_query_strings') == '1') {
356
+ $item->set_feature_status($this->feature_active);
357
+ }
358
+ else
359
+ {
360
+ $item->set_feature_status($this->feature_inactive);
361
+ }
362
+ }
363
+
364
+ function check_advanced_char_string_filter_firewall_feature($item)
365
+ {
366
+ global $aio_wp_security;
367
+ if ($aio_wp_security->configs->get_value('aiowps_advanced_char_string_filter') == '1') {
368
+ $item->set_feature_status($this->feature_active);
369
+ }
370
+ else
371
+ {
372
+ $item->set_feature_status($this->feature_inactive);
373
+ }
374
+ }
375
+
376
+ function check_enable_5G_blacklist_firewall_feature($item)
377
+ {
378
+ global $aio_wp_security;
379
+ if ($aio_wp_security->configs->get_value('aiowps_enable_5g_firewall') == '1') {
380
+ $item->set_feature_status($this->feature_active);
381
+ }
382
+ else
383
+ {
384
+ $item->set_feature_status($this->feature_inactive);
385
+ }
386
+ }
387
+
388
+ }
classes/grade-system/wp-security-feature-item.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Feature_Item
4
+ {
5
+ var $feature_id;//Example "user-accounts-tab1-change-admin-user"
6
+ var $feature_name;
7
+ var $item_points;
8
+ var $security_level;//1, 2 or 3
9
+
10
+ var $feature_status;//active, inactive, partial
11
+
12
+ function __construct($feature_id,$feature_name,$item_points,$security_level){
13
+ $this->feature_id = $feature_id;
14
+ $this->feature_name = $feature_name;
15
+ $this->item_points = $item_points;
16
+ $this->security_level = $security_level;
17
+ }
18
+
19
+ function set_feature_status($status)
20
+ {
21
+ $this->feature_status = $status;
22
+ }
23
+
24
+ function get_security_level_string($level)
25
+ {
26
+ $level_string = "";
27
+ if($level == "1"){
28
+ $level_string = "Basic";
29
+ }
30
+ else if($level == "2"){
31
+ $level_string = "Intermediate";
32
+ }
33
+ else if($level == "3"){
34
+ $level_string = "Advanced";
35
+ }
36
+ return $level_string;
37
+ }
38
+
39
+ }
40
+
classes/index.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Do not modify the files in this folder.
5
+ */
classes/wp-security-backup.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_Backup
3
+ {
4
+ var $last_backup_file_name;//Stores the name of the last backup file when execute_backup function is called
5
+ var $last_backup_file_path;
6
+
7
+ function __construct()
8
+ {
9
+ add_action('aiowps_perform_scheduled_backup_tasks', array(&$this, 'aiowps_scheduled_backup_handler')); //TODO - this action never gets fired - need to investigate
10
+ }
11
+
12
+ /**
13
+ * This function will perform a database backup
14
+ */
15
+ function execute_backup()
16
+ {
17
+ global $wpdb, $aio_wp_security;
18
+
19
+ @ini_set( 'auto_detect_line_endings', true );
20
+
21
+ //get all of the tables
22
+ $tables = $wpdb->get_results( 'SHOW TABLES', ARRAY_N );
23
+ $return = '';
24
+
25
+ //cycle through each table
26
+ foreach($tables as $table)
27
+ {
28
+ $result = $wpdb->get_results( 'SELECT * FROM `' . $table[0] . '`;', ARRAY_N );
29
+ $num_fields = sizeof( $wpdb->get_results( 'DESCRIBE `' . $table[0] . '`;' ) );
30
+
31
+ $return.= 'DROP TABLE IF EXISTS `' . $table[0] . '`;';
32
+ $row2 = $wpdb->get_row( 'SHOW CREATE TABLE `' . $table[0] . '`;', ARRAY_N );
33
+ $return.= PHP_EOL . PHP_EOL . $row2[1] . ";" . PHP_EOL . PHP_EOL;
34
+
35
+ foreach( $result as $row )
36
+ {
37
+ $return .= 'INSERT INTO `' . $table[0] . '` VALUES(';
38
+
39
+ for( $j=0; $j < $num_fields; $j++ ) {
40
+
41
+ $row[$j] = addslashes( $row[$j] );
42
+ $row[$j] = ereg_replace( PHP_EOL, "\n", $row[$j] );
43
+
44
+ if ( isset( $row[$j] ) ) {
45
+ $return .= '"' . $row[$j] . '"' ;
46
+ } else {
47
+ $return.= '""';
48
+ }
49
+
50
+ if ( $j < ( $num_fields - 1 ) ) {
51
+ $return .= ',';
52
+ }
53
+
54
+ }
55
+ $return .= ");" . PHP_EOL;
56
+ }
57
+ $return .= PHP_EOL . PHP_EOL;
58
+ }
59
+ $return .= PHP_EOL . PHP_EOL;
60
+
61
+ //save file
62
+ $file = 'database-backup-' . current_time( 'timestamp' );
63
+ $handle = @fopen( AIO_WP_SECURITY_BACKUPS_PATH . '/' . $file . '.sql', 'w+' );
64
+ $fw_res = @fwrite( $handle, $return );
65
+ if (!$fw_res)
66
+ {
67
+ return false;
68
+ }
69
+ @fclose( $handle );
70
+
71
+ //zip the file
72
+ if ( class_exists( 'ZipArchive' ) )
73
+ {
74
+ $zip = new ZipArchive();
75
+ $archive = $zip->open(AIO_WP_SECURITY_BACKUPS_PATH . '/' . $file . '.zip', ZipArchive::CREATE);
76
+ $zip->addFile(AIO_WP_SECURITY_BACKUPS_PATH . '/' . $file . '.sql', $file . '.sql' );
77
+ $zip->close();
78
+
79
+ //delete .sql and keep zip
80
+ @unlink( AIO_WP_SECURITY_BACKUPS_PATH . '/' . $file . '.sql' );
81
+ $fileext = '.zip';
82
+ } else
83
+ {
84
+ $fileext = '.sql';
85
+ }
86
+ $this->last_backup_file_name = $file . $fileext;//database-backup-1367644822.zip or database-backup-1367644822.sql
87
+ $this->last_backup_file_path = AIO_WP_SECURITY_BACKUPS_PATH. '/' . $file . $fileext;
88
+
89
+ $this->aiowps_send_backup_email(); //Send backup file via email if applicable
90
+ $this->aiowps_delete_backup_files();
91
+ return true;
92
+ }
93
+
94
+ function aiowps_send_backup_email()
95
+ {
96
+ global $aio_wp_security;
97
+ if ( $aio_wp_security->configs->get_value('aiowps_send_backup_email_address') == '1' )
98
+ {
99
+ //Get the right email address.
100
+ if ( is_email( $aio_wp_security->configs->get_value('aiowps_send_backup_email_address') ) )
101
+ {
102
+ $toaddress = $aio_wp_security->configs->get_value('aiowps_send_backup_email_address');
103
+ } else
104
+ {
105
+ $toaddress = get_site_option( 'admin_email' );
106
+ }
107
+
108
+ $to = $toaddress;
109
+ $headers = 'From: ' . get_option( 'blogname' ) . ' <' . $to . '>' . PHP_EOL;
110
+ $subject = __( 'All In One WP Security - Site Database Backup', 'aiowpsecurity' ) . ' ' . date( 'l, F jS, Y \a\\t g:i a', current_time( 'timestamp' ) );
111
+ $attachment = array( $this->last_backup_file_path );
112
+ $message = __( 'Attached is your latest DB backup file for site URL', 'aiowpsecurity' ) . ' ' . get_option( 'siteurl' ) . __( ' generated on', 'aiowpsecurity' ) . ' ' . date( 'l, F jS, Y \a\\t g:i a', current_time( 'timestamp' ) );
113
+
114
+ wp_mail( $to, $subject, $message, $headers, $attachment );
115
+ }
116
+ }
117
+
118
+ function aiowps_delete_backup_files()
119
+ {
120
+ global $aio_wp_security;
121
+ if ( $aio_wp_security->configs->get_value('aiowps_backup_files_stored') > 0 )
122
+ {
123
+ $files = scandir( AIO_WP_SECURITY_BACKUPS_PATH. '/', 1 );
124
+
125
+ $count = 0;
126
+
127
+ foreach ( $files as $file )
128
+ {
129
+ if ( strstr( $file, 'database-backup' ) )
130
+ {
131
+ if ( $count >= $aio_wp_security->configs->get_value('aiowps_backup_files_stored') )
132
+ {
133
+ @unlink( AIO_WP_SECURITY_BACKUPS_PATH. '/' . $file );
134
+ }
135
+ $count++;
136
+ }
137
+
138
+ }
139
+ }
140
+ }
141
+
142
+ function aiowps_scheduled_backup_handler()
143
+ {
144
+ global $aio_wp_security;
145
+ if($aio_wp_security->configs->get_value('aiowps_enable_automated_backups')=='1')
146
+ {
147
+ $aio_wp_security->debug_logger->log_debug_cron("DB Backup - Scheduled backup is enabled. Checking if a backup needs to be done now...");
148
+ $current_time = strtotime(current_time('mysql'));
149
+ $backup_frequency = $aio_wp_security->configs->get_value('aiowps_db_backup_frequency'); //Number of hours or days or months interval per backup
150
+ $interval_setting = $aio_wp_security->configs->get_value('aiowps_db_backup_interval'); //Hours/Days/Months
151
+ switch($interval_setting)
152
+ {
153
+ case '0':
154
+ $interval = 'hours';
155
+ break;
156
+ case '1':
157
+ $interval = 'days';
158
+ break;
159
+ case '2':
160
+ $interval = 'weeks';
161
+ break;
162
+ }
163
+ $last_backup_time = $aio_wp_security->configs->get_value('aiowps_last_backup_time');
164
+ if ($last_backup_time != NULL)
165
+ {
166
+ $last_backup_time = strtotime($aio_wp_security->configs->get_value('aiowps_last_backup_time'));
167
+ $next_backup_time = strtotime("+".abs($backup_frequency).$interval, $last_backup_time);
168
+ if ($next_backup_time <= $current_time)
169
+ {
170
+ //It's time to do a backup
171
+ $result = $this->execute_backup();
172
+ if ($result)
173
+ {
174
+ $aio_wp_security->configs->set_value('aiowps_last_backup_time', current_time('mysql'));
175
+ $aio_wp_security->debug_logger->log_debug_cron("DB Backup - Scheduled backup was successfully completed.");
176
+ }
177
+ else
178
+ {
179
+ $aio_wp_security->debug_logger->log_debug_cron("DB Backup - Scheduled backup operation failed!",4);
180
+ }
181
+ }
182
+ }
183
+ else
184
+ {
185
+ //Set the last backup time to now so it can trigger for the next scheduled period
186
+ $aio_wp_security->configs->set_value('aiowps_last_backup_time', current_time('mysql'));
187
+ $aio_wp_security->configs->save_config();
188
+ }
189
+ }
190
+ }
191
+ }
classes/wp-security-config.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_Config{
3
+ var $configs;
4
+ var $message_stack;
5
+ static $_this;
6
+
7
+ function __construct(){
8
+ $this->message_stack = new stdClass();
9
+ }
10
+
11
+ function load_config(){
12
+ $this->configs = get_option('aio_wp_security_configs');
13
+ }
14
+
15
+ function get_value($key){
16
+ return isset($this->configs[$key])?$this->configs[$key] : '';
17
+ }
18
+
19
+ function set_value($key, $value){
20
+ $this->configs[$key] = $value;
21
+ }
22
+
23
+ function add_value($key, $value){
24
+ if (array_key_exists($key, $this->configs)){
25
+ //Don't update the value for this key
26
+ }
27
+ else{//It is safe to update the value for this key
28
+ $this->configs[$key] = $value;
29
+ }
30
+ }
31
+
32
+ function save_config(){
33
+ update_option('aio_wp_security_configs', $this->configs);
34
+ }
35
+
36
+ function get_stacked_message($key){
37
+ if(isset($this->message_stack->{$key}))
38
+ return $this->message_stack->{$key};
39
+ return "";
40
+ }
41
+
42
+ function set_stacked_message($key,$value){
43
+ $this->message_stack->{$key} = $value;
44
+ }
45
+
46
+ static function get_instance(){
47
+ if(empty(self::$_this)){
48
+ self::$_this = new AIOWPSecurity_Config();
49
+ self::$_this->load_config();
50
+ return self::$_this;
51
+ }
52
+ return self::$_this;
53
+ }
54
+ }
classes/wp-security-configure-settings.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Configure_Settings
4
+ {
5
+ function __construct(){
6
+
7
+ }
8
+
9
+ static function set_default_settings()
10
+ {
11
+ global $aio_wp_security;
12
+ //User password feature
13
+
14
+ //Lockdown feature
15
+ $aio_wp_security->configs->set_value('aiowps_enable_login_lockdown','');//Checkbox
16
+ $aio_wp_security->configs->set_value('aiowps_max_login_attempts','3');
17
+ $aio_wp_security->configs->set_value('aiowps_retry_time_period','5');
18
+ $aio_wp_security->configs->set_value('aiowps_lockout_time_length','60');
19
+ $aio_wp_security->configs->set_value('aiowps_set_generic_login_msg','');//Checkbox
20
+ $aio_wp_security->configs->set_value('aiowps_enable_email_notify','');//Checkbox
21
+ //$aio_wp_security->configs->set_value('aiowps_email_address','');//text field
22
+ $aio_wp_security->configs->set_value('aiowps_enable_forced_logout','');//Checkbox
23
+ $aio_wp_security->configs->set_value('aiowps_logout_time_period','60');
24
+
25
+ //DB Security feature
26
+ //$aio_wp_security->configs->set_value('aiowps_new_manual_db_pefix',''); //text field
27
+ $aio_wp_security->configs->set_value('aiowps_enable_random_prefix','');//Checkbox
28
+ $aio_wp_security->configs->set_value('aiowps_enable_automated_backups','');//Checkbox
29
+ $aio_wp_security->configs->set_value('aiowps_db_backup_frequency','4');
30
+ $aio_wp_security->configs->set_value('aiowps_db_backup_interval','2'); //Dropdown box where (0,1,2) => (hours,days,weeks)
31
+ $aio_wp_security->configs->set_value('aiowps_backup_files_stored','2');
32
+ $aio_wp_security->configs->set_value('aiowps_send_backup_email_address','');//Checkbox
33
+ $aio_wp_security->configs->set_value('aiowps_backup_email_address','');
34
+
35
+ //Filesystem Security feature
36
+ $aio_wp_security->configs->set_value('aiowps_disable_file_editing','');//Checkbox
37
+
38
+ //Blacklist feature
39
+ $aio_wp_security->configs->set_value('aiowps_enable_blacklisting','');//Checkbox
40
+ $aio_wp_security->configs->set_value('aiowps_banned_ip_addresses','');
41
+
42
+ //Firewall features
43
+ $aio_wp_security->configs->set_value('aiowps_enable_basic_firewall','');//Checkbox
44
+ $aio_wp_security->configs->set_value('aiowps_disable_trace_and_track','');//Checkbox
45
+ $aio_wp_security->configs->set_value('aiowps_forbid_proxy_comments','');//Checkbox
46
+ $aio_wp_security->configs->set_value('aiowps_deny_bad_query_strings','');//Checkbox
47
+ $aio_wp_security->configs->set_value('aiowps_advanced_char_string_filter','');//Checkbox
48
+ $aio_wp_security->configs->set_value('aiowps_enable_5g_firewall','');//Checkbox
49
+
50
+ //TODO - keep adding default opitons for any fields that require it
51
+
52
+ //Save it
53
+ $aio_wp_security->configs->save_config();
54
+ }
55
+
56
+ static function turn_off_all_security_features()
57
+ {
58
+ AIOWPSecurity_Configure_Settings::set_default_settings();
59
+ }
60
+
61
+ static function restore_to_factory_default()
62
+ {
63
+ //TOOD - complete the implementation
64
+ //restore wp_config_file();//TODO - //TODO - write implementation in the utility class
65
+ //restore site_htaccess_file();//TODO - write implementation in the utility class
66
+ //AIOWPSecurity_Configure_Settings::set_default_settings();
67
+ //Maybe allow them to revert the DB Prefix too?
68
+ //File permissions
69
+ }
70
+ }
classes/wp-security-cronjob-handler.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Cronjob_Handler {
4
+ function __construct()
5
+ {
6
+ add_action ('aiowps_hourly_cron_event', array(&$this, 'aiowps_hourly_cron_event_handler'));
7
+ //add_action ('aiowps_daily_cron_event', array(&$this, 'aiowps_daily_cron_event_handler'));
8
+ }
9
+
10
+ function aiowps_hourly_cron_event_handler()
11
+ {
12
+ //Do stuff that needs checking every hours
13
+ global $aio_wp_security;
14
+ $aio_wp_security->debug_logger->log_debug_cron("Cronjob_Handler - Hourly cron handler got fired.");
15
+
16
+ //do_action('aiowps_force_logout_check');
17
+ //do_action('aiowps_check_password_stuff');
18
+ do_action('aiowps_perform_scheduled_backup_tasks');
19
+ }
20
+
21
+ // function aiowps_daily_cron_event_handler()
22
+ // {
23
+ //
24
+ // }
25
+
26
+ }
27
+
classes/wp-security-debug-logger.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Logs debug data to a file. Here is an example usage
4
+ * global $aio_wp_security;
5
+ * $aio_wp_security->debug_logger->log_debug("Log messaged goes here");
6
+ */
7
+ class AIOWPSecurity_Logger
8
+ {
9
+ var $log_folder_path;
10
+ var $default_log_file = 'wp-security-log.txt';
11
+ var $default_log_file_cron = 'wp-security-log-cron-job.txt';
12
+ var $debug_enabled = false;
13
+ var $debug_status = array('SUCCESS','STATUS','NOTICE','WARNING','FAILURE','CRITICAL');
14
+ var $section_break_marker = "\n----------------------------------------------------------\n\n";
15
+ var $log_reset_marker = "-------- Log File Reset --------\n";
16
+
17
+ function __construct()
18
+ {
19
+ $this->log_folder_path = AIO_WP_SECURITY_PATH . '/logs';
20
+ //TODO - check config and if debug is enabled then set the enabled flag to true
21
+ $this->debug_enabled = true;
22
+ }
23
+
24
+ function get_debug_timestamp()
25
+ {
26
+ return '['.date('m/d/Y g:i A').'] - ';
27
+ }
28
+
29
+ function get_debug_status($level)
30
+ {
31
+ $size = count($this->debug_status);
32
+ if($level >= $size){
33
+ return 'UNKNOWN';
34
+ }
35
+ else{
36
+ return $this->debug_status[$level];
37
+ }
38
+ }
39
+
40
+ function get_section_break($section_break)
41
+ {
42
+ if ($section_break) {
43
+ return $this->section_break_marker;
44
+ }
45
+ return "";
46
+ }
47
+
48
+ function append_to_file($content,$file_name)
49
+ {
50
+ if(empty($file_name))$file_name = $this->default_log_file;
51
+ $debug_log_file = $this->log_folder_path.'/'.$file_name;
52
+ $fp=fopen($debug_log_file,'a');
53
+ fwrite($fp, $content);
54
+ fclose($fp);
55
+ }
56
+
57
+ function reset_log_file($file_name='')
58
+ {
59
+ if(empty($file_name))$file_name = $this->default_log_file;
60
+ $debug_log_file = $this->log_folder_path.'/'.$file_name;
61
+ $content = $this->get_debug_timestamp().$this->log_reset_marker;
62
+ $fp=fopen($debug_log_file,'w');
63
+ fwrite($fp, $content);
64
+ fclose($fp);
65
+ }
66
+
67
+ function log_debug($message,$level=0,$section_break=false,$file_name='')
68
+ {
69
+ if (!$this->debug_enabled) return;
70
+ $content = $this->get_debug_timestamp();//Timestamp
71
+ $content .= $this->get_debug_status($level);//Debug status
72
+ $content .= ' : ';
73
+ $content .= $message . "\n";
74
+ $content .= $this->get_section_break($section_break);
75
+ $this->append_to_file($content, $file_name);
76
+ }
77
+
78
+ function log_debug_cron($message,$level=0,$section_break=false)
79
+ {
80
+ if (!$this->debug_enabled) return;
81
+ $content = $this->get_debug_timestamp();//Timestamp
82
+ $content .= $this->get_debug_status($level);//Debug status
83
+ $content .= ' : ';
84
+ $content .= $message . "\n";
85
+ $content .= $this->get_section_break($section_break);
86
+ //$file_name = $this->default_log_file_cron;
87
+ $this->append_to_file($content, $this->default_log_file_cron);
88
+ }
89
+
90
+ //TODO - this function need to be completed
91
+ static function log_debug_st($message,$level=0,$section_break=false,$file_name='')
92
+ {
93
+ $content = "\n". $message . "\n";
94
+ $debug_log_file = 'wp-security-log-static.txt';
95
+ //$debug_log_file = AIO_WP_SECURITY_PATH .'/wp-security-log.txt';
96
+ $fp=fopen($debug_log_file,'a');
97
+ fwrite($fp, $content);
98
+ fclose($fp);
99
+ }
100
+ }
classes/wp-security-installer.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Installer
4
+ {
5
+ static function run_installer()
6
+ {
7
+ global $wpdb;
8
+ if (function_exists('is_multisite') && is_multisite())
9
+ {
10
+ // check if it is a network activation - if so, run the activation function for each blog id
11
+ if (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1))
12
+ {
13
+ $old_blog = $wpdb->blogid;
14
+ // Get all blog ids
15
+ $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
16
+ foreach ($blogids as $blog_id) {
17
+ switch_to_blog($blog_id);
18
+ AIOWPSecurity_Installer::create_db_tables();
19
+ }
20
+ switch_to_blog($old_blog);
21
+ return;
22
+ }
23
+ }
24
+ AIOWPSecurity_Installer::create_db_tables();
25
+ }
26
+
27
+ static function create_db_tables()
28
+ {
29
+ //global $wpdb;
30
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
31
+
32
+ //"User Login" related tables
33
+ $lockdown_tbl_name = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
34
+ $failed_login_tbl_name = AIOWPSEC_TBL_FAILED_LOGINS;
35
+ $user_login_activity_tbl_name = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
36
+
37
+ $ld_tbl_sql = "CREATE TABLE " . $lockdown_tbl_name . " (
38
+ id bigint(20) NOT NULL AUTO_INCREMENT,
39
+ user_id bigint(20) NOT NULL,
40
+ user_login VARCHAR(150) NOT NULL,
41
+ lockdown_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
42
+ release_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
43
+ failed_login_ip varchar(100) NOT NULL DEFAULT '',
44
+ PRIMARY KEY (id)
45
+ )ENGINE=MyISAM DEFAULT CHARSET=utf8;";
46
+ dbDelta($ld_tbl_sql);
47
+
48
+ $fl_tbl_sql = "CREATE TABLE " . $failed_login_tbl_name . " (
49
+ id bigint(20) NOT NULL AUTO_INCREMENT,
50
+ user_id bigint(20) NOT NULL,
51
+ user_login VARCHAR(150) NOT NULL,
52
+ failed_login_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
53
+ login_attempt_ip varchar(100) NOT NULL DEFAULT '',
54
+ PRIMARY KEY (id)
55
+ )ENGINE=MyISAM DEFAULT CHARSET=utf8;";
56
+ dbDelta($fl_tbl_sql);
57
+
58
+ $ula_tbl_sql = "CREATE TABLE " . $user_login_activity_tbl_name . " (
59
+ id bigint(20) NOT NULL AUTO_INCREMENT,
60
+ user_id bigint(20) NOT NULL,
61
+ user_login VARCHAR(150) NOT NULL,
62
+ login_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
63
+ logout_date datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
64
+ login_ip varchar(100) NOT NULL DEFAULT '',
65
+ login_country varchar(150) NOT NULL DEFAULT '',
66
+ browser_type varchar(150) NOT NULL DEFAULT '',
67
+ PRIMARY KEY (id)
68
+ )ENGINE=MyISAM DEFAULT CHARSET=utf8;";
69
+ dbDelta($ula_tbl_sql);
70
+
71
+ update_option("aiowpsec_db_version", AIO_WP_SECURITY_DB_VERSION);
72
+ }
73
+ }
classes/wp-security-user-login.php ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AIOWPSecurity_User_Login
3
+ {
4
+ /**
5
+ * This will store a URI query string key for passing messages to the login form
6
+ * @var string
7
+ */
8
+ var $key_login_msg;
9
+
10
+ function __construct()
11
+ {
12
+ $this->initialize();
13
+ remove_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
14
+ add_filter('authenticate', array(&$this, 'aiowp_auth_login'), 10, 3);
15
+ add_action('aiowps_force_logout_check', array(&$this, 'aiowps_force_logout_action_handler'));
16
+ //add_action('wp_login', array(&$this, 'wp_login_action_handler'), 10, 2);
17
+ add_action('clear_auth_cookie', array(&$this, 'wp_logout_action_handler'));
18
+ add_filter('login_message', array(&$this, 'aiowps_login_message')); //WP filter to add or modify messages on the login page
19
+ }
20
+
21
+ protected function initialize()
22
+ {
23
+ $this->key_login_msg = 'aiowps_login_msg_id';
24
+ }
25
+
26
+
27
+ /*
28
+ * This function will take care of the authentication operations
29
+ * It will return a WP_User object if successful or WP_Error if not
30
+ */
31
+ function aiowp_auth_login($user, $username, $password)
32
+ {
33
+ global $aio_wp_security;
34
+ $login_attempts_permitted = $aio_wp_security->configs->get_value('aiowps_max_login_attempts');
35
+
36
+ $user_locked = $this->check_locked_user();
37
+ if ($user_locked != NULL) {
38
+ $aio_wp_security->debug_logger->log_debug("Login attempt from blocked IP range - ".$user_locked['failed_login_IP'],2);
39
+ return new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Login failed because your IP address has been blocked due to too many failed login attempts.
40
+ Please contact the administrator.', 'aiowpsecurity'));
41
+ }
42
+
43
+ if ( is_a($user, 'WP_User') ) { return $user; } //Existing WP core code
44
+
45
+ if ( empty($username) || empty($password) ) { //Existing WP core code
46
+ $error = new WP_Error();
47
+ if (empty($username)){
48
+ $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.', 'aiowpsecurity'));
49
+ }
50
+
51
+ if (empty($password)){
52
+ $error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.', 'aiowpsecurity'));
53
+ }
54
+ return $error;
55
+ }
56
+
57
+ $userdata = get_user_by('login',$username);
58
+ if (!$userdata)
59
+ {
60
+ //This means an unknown username is being used for login
61
+ $this->increment_failed_logins($username);
62
+ if($login_attempts_permitted <= $this->get_login_fail_count())
63
+ {
64
+ $this->lock_the_user(__('unknown','aiowpsecurity'));
65
+ }
66
+ if($aio_wp_security->configs->get_value('aiowps_set_generic_login_msg')=='1')
67
+ {
68
+ //Return generic error message if configured
69
+ return new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid login credentials.', 'aiowpsecurity'));
70
+ } else
71
+ {
72
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid username.', 'aiowpsecurity'));
73
+ }
74
+ }
75
+
76
+ $userdata = apply_filters('wp_authenticate_user', $userdata, $password); //Existing WP core code
77
+ if ( is_wp_error($userdata) ) { //Existing WP core code
78
+ return $userdata;
79
+ }
80
+
81
+ if ( !wp_check_password($password, $userdata->user_pass, $userdata->ID) )
82
+ {
83
+ //This means wrong password was entered
84
+ $this->increment_failed_logins($username);
85
+ if($login_attempts_permitted <= $this->get_login_fail_count())
86
+ {
87
+ $this->lock_the_user($username);
88
+ }
89
+ if($aio_wp_security->configs->get_value('aiowps_set_generic_login_msg')=='1')
90
+ {
91
+ //Return generic error message if configured
92
+ return new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid login credentials.', 'aiowpsecurity'));
93
+ } else
94
+ {
95
+ return new WP_Error('incorrect_password', sprintf(__('<strong>ERROR</strong>: Incorrect password. <a href="%s" title="Password Lost and Found">Lost your password</a>?', 'aiowpsecurity'), site_url('wp-login.php?action=lostpassword', 'login')));
96
+ }
97
+ }
98
+
99
+ $user = new WP_User($userdata->ID);
100
+ return $user;
101
+ }
102
+
103
+ /*
104
+ * This function queries the aiowps_login_lockdown table.
105
+ * If the release_date has not expired AND the current visitor IP addr matches
106
+ * it will return a record
107
+ */
108
+ function check_locked_user()
109
+ {
110
+ global $wpdb;
111
+ $login_lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
112
+ $ip_range = $this->get_sanitized_ip_range(); //Get the IP range of the current user
113
+ $locked_user = $wpdb->get_var("SELECT user_id FROM $login_lockdown_table " .
114
+ "WHERE release_date > now() AND " .
115
+ "failed_login_IP LIKE '" . $wpdb->escape($ip_range) . "%'");
116
+ return $locked_user;
117
+ }
118
+
119
+ /*
120
+ * This function queries the aiowps_failed_logins table and returns the number of failures for current IP range within allowed failure period
121
+ */
122
+ function get_login_fail_count()
123
+ {
124
+ global $wpdb, $aio_wp_security;
125
+ $failed_logins_table = AIOWPSEC_TBL_FAILED_LOGINS;
126
+ $login_retry_interval = $aio_wp_security->configs->get_value('aiowps_retry_time_period');
127
+
128
+ $ip_range = $this->get_sanitized_ip_range(); //Get the IP range of the current user
129
+ $login_failures = $wpdb->get_var("SELECT COUNT(ID) FROM $failed_logins_table " .
130
+ "WHERE failed_login_date + INTERVAL " .
131
+ $login_retry_interval . " MINUTE > now() AND " .
132
+ "login_attempt_ip LIKE '" . $wpdb->escape($ip_range) . "%'");
133
+ return $login_failures;
134
+ }
135
+
136
+ /*
137
+ * Adds an entry to the aiowps_lockdowns table
138
+ */
139
+ function lock_the_user($username='')
140
+ {
141
+ global $wpdb, $aio_wp_security;
142
+ $login_lockdown_table = AIOWPSEC_TBL_LOGIN_LOCKDOWN;
143
+ $lockout_time_length = $aio_wp_security->configs->get_value('aiowps_lockout_time_length');
144
+
145
+ $ip_range = $this->get_sanitized_ip_range(); //Get the IP range of the current user
146
+ $username = sanitize_user($username);
147
+ $user = get_user_by('login',$username); //Returns WP_User object if exists
148
+ if ($user)
149
+ {
150
+ //If the login attempt was made using a valid user set variables for DB storage later on
151
+ $user_id = $user->ID;
152
+ } else {
153
+ //If the login attempt was made using a non-existent user then let's set user_id to blank and record the attempted user login name for DB storage later on
154
+ $user_id = '';
155
+ }
156
+
157
+ $insert = "INSERT INTO " . $login_lockdown_table . " (user_id, user_login, lockdown_date, release_date, failed_login_IP) " .
158
+ "VALUES ('" . $user_id . "', '" . $username . "', now(), date_add(now(), INTERVAL " .
159
+ $lockout_time_length . " MINUTE), '" . $wpdb->escape($ip_range) . "')";
160
+ $result = $wpdb->query($insert);
161
+ if ($result > 0)
162
+ {
163
+ do_action('aiowps_lockdown_event', $ip_range, $username);
164
+ $this->send_notification_email($username, $ip_range);
165
+ $aio_wp_security->debug_logger->log_debug("The following IP address range has been locked out for exceeding the maximum login attempts: ".$ip_range,2);//Log the lockdown event
166
+ }
167
+ else if ($result == FALSE)
168
+ {
169
+ $aio_wp_security->debug_logger->log_debug("Error inserting record into ".$login_lockdown_table,4);//Log the highly unlikely event of DB error
170
+ }
171
+ }
172
+
173
+ /*
174
+ * Adds an entry to the aiowps_failed_logins table
175
+ */
176
+ function increment_failed_logins($username='')
177
+ {
178
+ global $wpdb, $aio_wp_security;
179
+ //$login_attempts_permitted = $aio_wp_security->configs->get_value('aiowps_max_login_attempts');
180
+ //$lockout_time_length = $aio_wp_security->configs->get_value('aiowps_lockout_time_length');
181
+ $login_fails_table = AIOWPSEC_TBL_FAILED_LOGINS;
182
+ $ip_range = $this->get_sanitized_ip_range(); //Get the IP range of the current user
183
+
184
+ $username = sanitize_user($username);
185
+ $user = get_user_by('login',$username); //Returns WP_User object if it exists
186
+ if ($user)
187
+ {
188
+ //If the login attempt was made using a valid user set variables for DB storage later on
189
+ $user_id = $user->ID;
190
+ } else {
191
+ //If the login attempt was made using a non-existent user then let's set user_id to blank and record the attempted user login name for DB storage later on
192
+ $user_id = '';
193
+ }
194
+ $insert = "INSERT INTO " . $login_fails_table . " (user_id, user_login, failed_login_date, login_attempt_ip) " .
195
+ "VALUES ('" . $user_id . "', '" . $username . "', now(), '" . $wpdb->escape($ip_range) . "')";
196
+ $result = $wpdb->query($insert);
197
+ if ($result == FALSE)
198
+ {
199
+ $aio_wp_security->debug_logger->log_debug("Error inserting record into ".$login_fails_table,4);//Log the highly unlikely event of DB error
200
+ }
201
+
202
+ }
203
+
204
+ /*
205
+ * Returns the first three octets of a sanitized IP address so it can used as an IP address range
206
+ */
207
+ function get_sanitized_ip_range()
208
+ {
209
+ global $aio_wp_security;
210
+ $ip = AIOWPSecurity_Utility_IP::get_user_ip_address(); //Get the IP address of user
211
+ $ip_range = '';
212
+ $valid_ip = filter_var($ip, FILTER_VALIDATE_IP); //Sanitize the IP address
213
+ if ($valid_ip)
214
+ {
215
+ $ip_range = substr($valid_ip, 0 , strrpos ($valid_ip, ".")); //strip last portion of address to leave an IP range
216
+ }
217
+ else
218
+ {
219
+ //Write log if the 'REMOTE_ADDR' contains something which is not an IP
220
+ $aio_wp_security->debug_logger->log_debug("AIOWPSecurity_User_Login - Invalid IP received ".$ip,4);
221
+ }
222
+ return $ip_range;
223
+ }
224
+
225
+ /*
226
+ * This function queries the aiowps_failed_logins table and returns the number of failures for current IP range within allowed failure period
227
+ */
228
+ function send_notification_email($username, $ip_range)
229
+ {
230
+ global $aio_wp_security;
231
+ $email_notification_enabled = $aio_wp_security->configs->get_value('aiowps_enable_email_notify');
232
+ $to_email_address = $aio_wp_security->configs->get_value('aiowps_email_address');
233
+ $email_msg = '';
234
+ if ($email_notification_enabled == 1)
235
+ {
236
+ $subject = '['.get_option('siteurl').'] '. __('Site Lockout Notification','aiowpsecurity');
237
+ $email_msg .= __('A lockdown event has occurred due to too many failed login attempts with the following user details','aiowpsecurity')."\n";
238
+ $email_msg .= __('Username: '.($username?$username:"Unknown"),'aiowpsecurity')."\n";
239
+ $email_msg .= __('IP Range: '.$ip_range,'aiowpsecurity')."\n\n";
240
+ $email_msg .= __('Log into your site\'s WordPress administration panel to see the duration of the lockout or to unlock the user.','aiowpsecurity')."\n";
241
+ $email_header = 'From: '.get_bloginfo( 'name' ).' <'.get_bloginfo('admin_email').'>' . "\r\n\\";
242
+ $sendMail = wp_mail($to_email_address, $subject, $email_msg, $email_header);
243
+ }
244
+ }
245
+
246
+
247
+ /*
248
+ * This function will check the settings and log the user after the configured time period
249
+ */
250
+ function aiowps_force_logout_action_handler()
251
+ {
252
+ global $aio_wp_security;
253
+ //$aio_wp_security->debug_logger->log_debug("Force Logout - Checking if any user need to be logged out...");
254
+ if($aio_wp_security->configs->get_value('aiowps_enable_forced_logout')=='1') //if this feature is enabled then do something
255
+ {
256
+ if(is_user_logged_in())
257
+ {
258
+ $current_user = wp_get_current_user();
259
+ $user_id = $current_user->ID;
260
+ $current_time = current_time('mysql');
261
+ $login_time = $this->get_wp_user_last_login_time($user_id);
262
+ $diff = strtotime($current_time) - strtotime($login_time);
263
+ $logout_time_interval_value = $aio_wp_security->configs->get_value('aiowps_logout_time_period');
264
+ $logout_time_interval_val_seconds = $logout_time_interval_value * 60;
265
+ if($diff > $logout_time_interval_val_seconds)
266
+ {
267
+ $aio_wp_security->debug_logger->log_debug("Force Logout - This user logged in more than (".$logout_time_interval_value.") minutes ago. Doing a force log out for the user with username: ".$current_user->user_login);
268
+ $this->wp_logout_action_handler(); //this will register the logout time/date in the logout_date column
269
+
270
+ $curr_page_url = AIOWPSecurity_Utility::get_current_page_url();
271
+ $after_logout_payload = 'redirect_to='.$curr_page_url.'&msg='.$this->key_login_msg.'=session_expired';
272
+ $encrypted_payload = base64_encode($after_logout_payload);
273
+ $logout_url = AIOWPSEC_WP_URL.'?aiowpsec_do_log_out=1';
274
+ $logout_url = AIOWPSecurity_Utility::add_query_data_to_url($logout_url, 'al_additional_data', $encrypted_payload);
275
+ AIOWPSecurity_Utility::redirect_to_url($logout_url);
276
+ }
277
+ }
278
+ }
279
+ }
280
+
281
+ function get_wp_user_last_login_time($user_id)
282
+ {
283
+ $last_login = get_user_meta($user_id, 'last_login_time', true);
284
+ return $last_login;
285
+ }
286
+
287
+ function wp_login_action_handler($user_login, $user)
288
+ {
289
+ global $wpdb, $aio_wp_security;
290
+ $login_activity_table = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
291
+ $login_date_time = current_time('mysql');
292
+ update_user_meta($user->ID, 'last_login_time', $login_date_time); //store last login time in meta table
293
+ $curr_ip_address = AIOWPSecurity_Utility_IP::get_user_ip_address();
294
+ $insert = "INSERT INTO " . $login_activity_table . " (user_id, user_login, login_date, login_ip) " .
295
+ "VALUES ('" . $user->ID . "', '" . $user_login . "', '" . $login_date_time . "', '" . $curr_ip_address . "')";
296
+ $result = $wpdb->query($insert);
297
+ if ($result == FALSE)
298
+ {
299
+ $aio_wp_security->debug_logger->log_debug("Error inserting record into ".$login_activity_table,4);//Log the highly unlikely event of DB error
300
+ }
301
+
302
+ }
303
+
304
+ /**
305
+ * The handler for logout events, ie, uses the WP "clear_auth_cookies" action.
306
+
307
+ * Modifies the login activity record for the current user by registering the logout time/date in the logout_date column.
308
+ * (NOTE: Because of the way we are doing a force logout, the "clear_auth_cookies" hook does not fire.
309
+ * upon auto logout. The current workaround is to call this function directly from the aiowps_force_logout_action_handler() when
310
+ * an auto logout occurs due to the "force logout" feature).
311
+ *
312
+ */
313
+ function wp_logout_action_handler()
314
+ {
315
+ global $wpdb, $aio_wp_security;
316
+ $current_user = wp_get_current_user();
317
+ $ip_addr = AIOWPSecurity_Utility_IP::get_user_ip_address();
318
+ $user_id = $current_user->ID;
319
+ $login_activity_table = AIOWPSEC_TBL_USER_LOGIN_ACTIVITY;
320
+ $logout_date_time = current_time('mysql');
321
+ $data = array('logout_date' => $logout_date_time);
322
+ $where = array('user_id' => $user_id,
323
+ 'login_ip' => $ip_addr,
324
+ 'logout_date' => '0000-00-00 00:00:00');
325
+ $result = $wpdb->update($login_activity_table, $data, $where);
326
+ if ($result == FALSE)
327
+ {
328
+ $aio_wp_security->debug_logger->log_debug("Error inserting record into ".$login_activity_table,4);//Log the highly unlikely event of DB error
329
+ }
330
+ }
331
+
332
+ /**
333
+ * The handler for the WP "login_message" filter
334
+ * Adds custom messages to the other messages that appear above the login form.
335
+ *
336
+ * NOTE: This method is automatically called by WordPress for displaying
337
+ * text above the login form.
338
+ *
339
+ * @param string $message the output from earlier login_message filters
340
+ * @return string
341
+ *
342
+ */
343
+ function aiowps_login_message($message = '')
344
+ {
345
+ global $aio_wp_security;
346
+ $msg = '';
347
+ if(isset($_GET[$this->key_login_msg]) && !empty($_GET[$this->key_login_msg]))
348
+ {
349
+ $logout_msg = strip_tags($_GET[$this->key_login_msg]);
350
+ }
351
+ if (!empty($logout_msg))
352
+ {
353
+ switch ($logout_msg) {
354
+ case 'session_expired':
355
+ $msg = sprintf(__('Your session has expired because it has been over %d minutes since your last login.', 'aiowpsecurity'), $aio_wp_security->configs->get_value('aiowps_logout_time_period'));
356
+ $msg .= ' ' . __('Please log back in to continue.', 'aiowpsecurity');
357
+ break;
358
+ case 'admin_user_changed':
359
+ $msg = __('You were logged out because you just changed the "admin" username.', 'aiowpsecurity');
360
+ $msg .= ' ' . __('Please log back in to continue.', 'aiowpsecurity');
361
+ break;
362
+ default:
363
+ }
364
+ }
365
+ if (!empty($msg))
366
+ {
367
+ $msg = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8');
368
+ $message .= '<p class="login message">'. $msg . '</p>';
369
+ }
370
+ return $message;
371
+ }
372
+
373
+ }
classes/wp-security-utility-file.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Utility_File
4
+ {
5
+
6
+ /* This variable will be an array which will contain all of the files and/or directories we wish to check permissions for */
7
+ public $files_and_dirs_to_check;
8
+
9
+ function __construct(){
10
+ /* Let's initiliaze our class variable array with all of the files and/or directories we wish to check permissions for.
11
+ * NOTE: we can add to this list in future if we wish
12
+ */
13
+ $this->files_and_dirs_to_check = array(
14
+ array('name'=>'root directory','path'=>ABSPATH,'permissions'=>'0755'),
15
+ array('name'=>'wp-includes/','path'=>ABSPATH."wp-includes",'permissions'=>'0755'),
16
+ array('name'=>'.htaccess','path'=>ABSPATH.".htaccess",'permissions'=>'0644'),
17
+ array('name'=>'wp-admin/index.php','path'=>ABSPATH."wp-admin/index.php",'permissions'=>'0644'),
18
+ array('name'=>'wp-admin/js/','path'=>ABSPATH."wp-admin/js/",'permissions'=>'0755'),
19
+ array('name'=>'wp-content/themes/','path'=>ABSPATH."wp-content/themes",'permissions'=>'0755'),
20
+ array('name'=>'wp-content/plugins/','path'=>ABSPATH."wp-content/plugins",'permissions'=>'0755'),
21
+ array('name'=>'wp-admin/','path'=>ABSPATH."wp-admin",'permissions'=>'0755'),
22
+ array('name'=>'wp-content/','path'=>ABSPATH."wp-content",'permissions'=>'0755'),
23
+ array('name'=>'wp-config.php','path'=>ABSPATH."wp-config.php",'permissions'=>'0644')
24
+ //Add as many files or dirs as needed by following the convention above
25
+ );
26
+
27
+ }
28
+
29
+ static function write_content_to_file($file_path, $new_contents)
30
+ {
31
+ @chmod($file_path, 0777);
32
+ if (is_writeable($file_path))
33
+ {
34
+ $handle = fopen($file_path, 'w');
35
+ foreach( $new_contents as $line ) {
36
+ fwrite($handle, $line);
37
+ }
38
+ fclose($handle);
39
+ @chmod($file_path, 0644); //Let's change the file back to a secure permission setting
40
+ return true;
41
+ } else {
42
+ return false;
43
+ }
44
+ }
45
+
46
+ static function backup_a_file($src_file_path, $suffix = 'backup')
47
+ {
48
+ $backup_file_path = $src_file_path . '.' . $suffix;
49
+ if (!copy($src_file_path, $backup_file_path)) {
50
+ //Failed to make a backup copy
51
+ return false;
52
+ }
53
+ return true;
54
+ }
55
+
56
+ static function recursive_file_search($pattern='*', $flags = 0, $path='')
57
+ {
58
+ $paths=glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
59
+ $files=glob($path.$pattern, $flags);
60
+ foreach ($paths as $path) { $files=array_merge($files,AIOWPSecurity_Utility_File::recursive_file_search($pattern, $flags, $path)); }
61
+ return $files;
62
+ }
63
+
64
+ /*
65
+ * Useful when wanting to echo file contents to screen with <br /> tags
66
+ */
67
+ static function get_file_contents_with_br($src_file)
68
+ {
69
+ $file_contents = file_get_contents($src_file);
70
+ return nl2br($file_contents);
71
+ }
72
+
73
+ /*
74
+ * Useful when wanting to echo file contents inside textarea
75
+ */
76
+ static function get_file_contents($src_file)
77
+ {
78
+ $file_contents = file_get_contents($src_file);
79
+ return $file_contents;
80
+ }
81
+
82
+ /*
83
+ * Returns the file's permission value eg, "0755"
84
+ */
85
+ static function get_file_permission($filepath)
86
+ {
87
+ if (!function_exists('fileperms'))
88
+ {
89
+ $perms = '-1';
90
+ }
91
+ else
92
+ {
93
+ clearstatcache();
94
+ $perms = substr(sprintf("%o", @fileperms($filepath)), -4);
95
+ }
96
+ return $perms;
97
+ }
98
+
99
+ /*
100
+ * This function will compare the current permission value for a file or dir with the recommended value.
101
+ * It will compare the individual "execute", "write" and "read" bits for the "public", "group" and "owner" permissions.
102
+ * If the permissions for an actual bit value are greater than the recommended value it returns '0' (=less secure)
103
+ * Otherwise it returns '1' which means it is secure
104
+ * Accepts permission value parameters in octal, ie, "0777" or "777"
105
+ */
106
+ static function is_file_permission_secure($recommended, $actual)
107
+ {
108
+ $result = 1; //initialize return result
109
+
110
+ //Check "public" permissions
111
+ $public_value_actual = substr($actual,-1,1); //get dec value for actual public permission
112
+ $public_value_rec = substr($recommended,-1,1); //get dec value for recommended public permission
113
+
114
+ $pva_bin = decbin($public_value_actual); //Convert value to binary
115
+ $pvr_bin = decbin($public_value_rec); //Convert value to binary
116
+ //Compare the "executable" bit values for the public actual versus the recommended
117
+ if (substr($pva_bin,-1,1)<=substr($pvr_bin,-1,1))
118
+ {
119
+ //The "execute" bit is the same or less as the recommended value
120
+ $result = 1*$result;
121
+ }else
122
+ {
123
+ //The "execute" bit is switched on for the actual value - meaning it is less secure
124
+ $result = 0*$result;
125
+ }
126
+
127
+ //Compare the "write" bit values for the public actual versus the recommended
128
+ if (substr($pva_bin,-2,1)<=substr($pvr_bin,-2,1))
129
+ {
130
+ //The "write" bit is the same or less as the recommended value
131
+ $result = 1*$result;
132
+ }else
133
+ {
134
+ //The "write" bit is switched on for the actual value - meaning it is less secure
135
+ $result = 0*$result;
136
+ }
137
+
138
+ //Compare the "read" bit values for the public actual versus the recommended
139
+ if (substr($pva_bin,-3,1)<=substr($pvr_bin,-3,1))
140
+ {
141
+ //The "read" bit is the same or less as the recommended value
142
+ $result = 1*$result;
143
+ }else
144
+ {
145
+ //The "read" bit is switched on for the actual value - meaning it is less secure
146
+ $result = 0*$result;
147
+ }
148
+
149
+ //Check "group" permissions
150
+ $group_value_actual = substr($actual,-2,1);
151
+ $group_value_rec = substr($recommended,-2,1);
152
+ $gva_bin = decbin($group_value_actual); //Convert value to binary
153
+ $gvr_bin = decbin($group_value_rec); //Convert value to binary
154
+
155
+ //Compare the "executable" bit values for the group actual versus the recommended
156
+ if (substr($gva_bin,-1,1)<=substr($gvr_bin,-1,1))
157
+ {
158
+ //The "execute" bit is the same or less as the recommended value
159
+ $result = 1*$result;
160
+ }else
161
+ {
162
+ //The "execute" bit is switched on for the actual value - meaning it is less secure
163
+ $result = 0*$result;
164
+ }
165
+
166
+ //Compare the "write" bit values for the public actual versus the recommended
167
+ if (substr($gva_bin,-2,1)<=substr($gvr_bin,-2,1))
168
+ {
169
+ //The "write" bit is the same or less as the recommended value
170
+ $result = 1*$result;
171
+ }else
172
+ {
173
+ //The "write" bit is switched on for the actual value - meaning it is less secure
174
+ $result = 0*$result;
175
+ }
176
+
177
+ //Compare the "read" bit values for the public actual versus the recommended
178
+ if (substr($gva_bin,-3,1)<=substr($gvr_bin,-3,1))
179
+ {
180
+ //The "read" bit is the same or less as the recommended value
181
+ $result = 1*$result;
182
+ }else
183
+ {
184
+ //The "read" bit is switched on for the actual value - meaning it is less secure
185
+ $result = 0*$result;
186
+ }
187
+
188
+ //Check "owner" permissions
189
+ $owner_value_actual = substr($actual,-3,1);
190
+ $owner_value_rec = substr($recommended,-3,1);
191
+ $ova_bin = decbin($owner_value_actual); //Convert value to binary
192
+ $ovr_bin = decbin($owner_value_rec); //Convert value to binary
193
+
194
+ //Compare the "executable" bit values for the group actual versus the recommended
195
+ if (substr($ova_bin,-1,1)<=substr($ovr_bin,-1,1))
196
+ {
197
+ //The "execute" bit is the same or less as the recommended value
198
+ $result = 1*$result;
199
+ }else
200
+ {
201
+ //The "execute" bit is switched on for the actual value - meaning it is less secure
202
+ $result = 0*$result;
203
+ }
204
+
205
+ //Compare the "write" bit values for the public actual versus the recommended
206
+ if (substr($ova_bin,-2,1)<=substr($ovr_bin,-2,1))
207
+ {
208
+ //The "write" bit is the same or less as the recommended value
209
+ $result = 1*$result;
210
+ }else
211
+ {
212
+ //The "write" bit is switched on for the actual value - meaning it is less secure
213
+ $result = 0*$result;
214
+ }
215
+
216
+ //Compare the "read" bit values for the public actual versus the recommended
217
+ if (substr($ova_bin,-3,1)<=substr($ovr_bin,-3,1))
218
+ {
219
+ //The "read" bit is the same or less as the recommended value
220
+ $result = 1*$result;
221
+ }else
222
+ {
223
+ //The "read" bit is switched on for the actual value - meaning it is less secure
224
+ $result = 0*$result;
225
+ }
226
+
227
+ return $result;
228
+ }
229
+
230
+ }
classes/wp-security-utility-htaccess.php ADDED
@@ -0,0 +1,783 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Utility_Htaccess
4
+ {
5
+ //The following variables will store the comment markers for each of features added to the .htacces file
6
+ //This will make it easy to locate the blocks of code for deletion if someone disables a feature
7
+ public static $ip_blacklist_marker_start = '#AIOWPS_IP_BLACKLIST_START';
8
+ public static $ip_blacklist_marker_end = '#AIOWPS_IP_BLACKLIST_END';
9
+
10
+ public static $basic_htaccess_rules_marker_start = '#AIOWPS_BASIC_HTACCESS_RULES_START';
11
+ public static $basic_htaccess_rules_marker_end = '#AIOWPS_BASIC_HTACCESS_RULES_END';
12
+
13
+ public static $user_agent_blacklist_marker_start = '#AIOWPS_USER_AGENT_BLACKLIST_START';
14
+ public static $user_agent_blacklist_marker_end = '#AIOWPS_USER_AGENT_BLACKLIST_END';
15
+
16
+ public static $disable_trace_track_marker_start = '#AIOWPS_DISABLE_TRACE_TRACK_START';
17
+ public static $disable_trace_track_marker_end = '#AIOWPS_DISABLE_TRACE_TRACK_END';
18
+
19
+ public static $forbid_proxy_comments_marker_start = '#AIOWPS_FORBID_PROXY_COMMENTS_START';
20
+ public static $forbid_proxy_comments_marker_end = '#AIOWPS_FORBID_PROXY_COMMENTS_END';
21
+
22
+ public static $deny_bad_query_strings_marker_start = '#AIOWPS_DENY_BAD_QUERY_STRINGS_START';
23
+ public static $deny_bad_query_strings_marker_end = '#AIOWPS_DENY_BAD_QUERY_STRINGS_END';
24
+
25
+ public static $advanced_char_string_filter_marker_start = '#AIOWPS_ADVANCED_CHAR_STRING_FILTER_START';
26
+ public static $advanced_char_string_filter_marker_end = '#AIOWPS_ADVANCED_CHAR_STRING_FILTER_END';
27
+
28
+ public static $five_g_blacklist_marker_start = '#AIOWPS_FIVE_G_BLACKLIST_START';
29
+ public static $five_g_blacklist_marker_end = '#AIOWPS_FIVE_G_BLACKLIST_END';
30
+
31
+ // TODO - enter more markers as new .htaccess features are added
32
+
33
+ function __construct(){
34
+ //NOP
35
+ }
36
+
37
+ static function write_to_htaccess()
38
+ {
39
+ //clean up old rules first
40
+ if (AIOWPSecurity_Utility_Htaccess::delete_from_htaccess() == -1)
41
+ {
42
+ return -1; //unable to write to the file
43
+ }
44
+
45
+ $htaccess = ABSPATH . '.htaccess';
46
+ //get the subdirectory if it is installed in one
47
+ $siteurl = explode( '/', get_option( 'siteurl' ) );
48
+ if (isset($siteurl[3]))
49
+ {
50
+ $dir = '/' . $siteurl[3] . '/';
51
+ }
52
+ else
53
+ {
54
+ $dir = '/';
55
+ }
56
+
57
+ if (!$f = @fopen($htaccess, 'a+'))
58
+ {
59
+ @chmod( $htaccess, 0644 );
60
+ if (!$f = @fopen( $htaccess, 'a+'))
61
+ {
62
+ return -1;
63
+ }
64
+ }
65
+ AIOWPSecurity_Utility_File::backup_a_file($htaccess); //TODO - we dont want to continually be backing up the htaccess file
66
+ @ini_set( 'auto_detect_line_endings', true );
67
+ $ht = explode( PHP_EOL, implode( '', file( $htaccess ) ) ); //parse each line of file into array
68
+
69
+ $rules = AIOWPSecurity_Utility_Htaccess::getrules();
70
+ if ($rules == -1)
71
+ {
72
+ return -1;
73
+ }
74
+
75
+ $rulesarray = explode( PHP_EOL, $rules );
76
+ $contents = array_merge( $rulesarray, $ht );
77
+
78
+ if (!$f = @fopen($htaccess, 'w+'))
79
+ {
80
+ return -1; //we can't write to the file
81
+ }
82
+
83
+ $blank = false;
84
+
85
+ //write each line to file
86
+ foreach ( $contents as $insertline )
87
+ {
88
+ if ( trim( $insertline ) == '' )
89
+ {
90
+ if ( $blank == false )
91
+ {
92
+ fwrite( $f, PHP_EOL . trim( $insertline ) );
93
+ }
94
+ $blank = true;
95
+ }
96
+ else
97
+ {
98
+ $blank = false;
99
+ fwrite( $f, PHP_EOL . trim( $insertline ) );
100
+ }
101
+ }
102
+ @fclose( $f );
103
+ return 1; //success
104
+ }
105
+
106
+ /*
107
+ * This function will delete the code which has been added to the .htaccess file by this plugin
108
+ * It will try to find the comment markers "# BEGIN All In One WP Security" and "# END All In One WP Security" and delete contents in between
109
+ */
110
+ function delete_from_htaccess($section = 'All In One WP Security')
111
+ {
112
+ //TODO
113
+ $htaccess = ABSPATH . '.htaccess';
114
+
115
+ @ini_set('auto_detect_line_endings', true);
116
+ if (!file_exists($htaccess))
117
+ {
118
+ $ht = @fopen($htaccess, 'a+');
119
+ @fclose($ht);
120
+ }
121
+ $ht_contents = explode(PHP_EOL, implode('', file($htaccess))); //parse each line of file into array
122
+ if ($ht_contents)
123
+ { //as long as there are lines in the file
124
+ $state = true;
125
+ if (!$f = @fopen($htaccess, 'w+'))
126
+ {
127
+ @chmod( $htaccess, 0644 );
128
+ if (!$f = @fopen( $htaccess, 'w+'))
129
+ {
130
+ return -1;
131
+ }
132
+ }
133
+
134
+ foreach ( $ht_contents as $n => $markerline )
135
+ { //for each line in the file
136
+ if (strpos($markerline, '# BEGIN ' . $section) !== false)
137
+ { //if we're at the beginning of the section
138
+ $state = false;
139
+ }
140
+ if ($state == true)
141
+ { //as long as we're not in the section keep writing
142
+ fwrite($f, trim($markerline) . PHP_EOL);
143
+ }
144
+ if (strpos($markerline, '# END ' . $section) !== false)
145
+ { //see if we're at the end of the section
146
+ $state = true;
147
+ }
148
+ }
149
+ @fclose($f);
150
+ return 1;
151
+ }
152
+ return 1;
153
+ }
154
+
155
+ static function getrules()
156
+ {
157
+ $rules = "";
158
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_basic_htaccess();
159
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_blacklist();
160
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_disable_trace_and_track();
161
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_forbid_proxy_comment_posting();
162
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_deny_bad_query_strings();
163
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_advanced_character_string_filter();
164
+ $rules .= AIOWPSecurity_Utility_Htaccess::getrules_5g_blacklist();
165
+ //TODO: The following utility functions are ready to use when we write the menu pages for these features
166
+
167
+ //Add more functions for features as needed
168
+ //$rules .= AIOWPSecurity_Utility_Htaccess::getrules_somefeature();
169
+
170
+ //Add outer markers if we have rules
171
+ if ($rules != '')
172
+ {
173
+ $rules = "# BEGIN All In One WP Security" . PHP_EOL . $rules . "# END All In One WP Security" . PHP_EOL;
174
+ }
175
+
176
+ return $rules;
177
+ }
178
+
179
+ static function getrules_blacklist()
180
+ {
181
+ global $aio_wp_security;
182
+ @ini_set( 'auto_detect_line_endings', true );
183
+
184
+ //figure out what server they're using
185
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
186
+ {
187
+ $aiowps_server = 'apache';
188
+ }
189
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
190
+ {
191
+ $aiowps_server = 'nginx';
192
+ }
193
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
194
+ {
195
+ $aiowps_server = 'litespeed';
196
+ }
197
+ else
198
+ { //unsupported server
199
+ return -1;
200
+ }
201
+
202
+ $rules = '';
203
+ if($aio_wp_security->configs->get_value('aiowps_enable_blacklisting')=='1')
204
+ {
205
+ //Let's do the list of blacklisted IPs first
206
+ $hosts = explode(PHP_EOL, $aio_wp_security->configs->get_value('aiowps_banned_ip_addresses'));
207
+ if (!empty($hosts) && !(sizeof($hosts) == 1 && trim($hosts[0]) == ''))
208
+ {
209
+ if ( $aiowps_server == 'apache' || $aiowps_server == 'litespeed' )
210
+ {
211
+ $rules .= AIOWPSecurity_Utility_Htaccess::$ip_blacklist_marker_start . PHP_EOL; //Add feature marker start
212
+ $rules .= "Order allow,deny" . PHP_EOL .
213
+ "Allow from all" . PHP_EOL;
214
+ }
215
+ $phosts = array();
216
+ foreach ($hosts as $host)
217
+ {
218
+ $host = trim($host);
219
+ if (!in_array($host, $phosts))
220
+ {
221
+ if (strstr($host, '*'))
222
+ {
223
+ $parts = array_reverse (explode('.', $host));
224
+ $netmask = 32;
225
+ foreach ($parts as $part)
226
+ {
227
+ if (strstr(trim($part), '*'))
228
+ {
229
+ $netmask = $netmask - 8;
230
+
231
+ }
232
+ }
233
+ $dhost = trim( str_replace('*', '0', implode( '.', array_reverse( $parts ) ) ) . '/' . $netmask );
234
+ if (strlen($dhost) > 4)
235
+ {
236
+ if ($aiowps_server == 'apache' || $aiowps_server == 'litespeed')
237
+ {
238
+ $trule = "Deny from " . $dhost . PHP_EOL;
239
+ if (trim($trule) != 'Deny From')
240
+ {
241
+ $rules .= $trule;
242
+ }
243
+ }
244
+ else
245
+ {
246
+ $rules .= "\tdeny " . $dhost . ';' . PHP_EOL;
247
+ }
248
+ }
249
+ }
250
+ else
251
+ {
252
+ $dhost = trim( $host );
253
+ if (strlen($dhost) > 4)
254
+ {
255
+ if ($aiowps_server == 'apache' || $aiowps_server == 'litespeed' )
256
+ {
257
+ $rules .= "Deny from " . $dhost . PHP_EOL;
258
+ }
259
+ else
260
+ {
261
+ $rules .= "\tdeny " . $dhost. ";" . PHP_EOL;
262
+ }
263
+ }
264
+ }
265
+ }
266
+ $phosts[] = $host;
267
+ }
268
+ $rules .= AIOWPSecurity_Utility_Htaccess::$ip_blacklist_marker_end . PHP_EOL; //Add feature marker end
269
+ }
270
+ //Now let's do the user agent list
271
+ $user_agents = explode(PHP_EOL, $aio_wp_security->configs->get_value('aiowps_banned_user_agents'));
272
+ if (!empty($user_agents) && !(sizeof($user_agents) == 1 && trim($user_agents[0]) == ''))
273
+ {
274
+ if ($aiowps_server == 'apache' || $aiowps_server == 'litespeed')
275
+ {
276
+ $rules .= AIOWPSecurity_Utility_Htaccess::$user_agent_blacklist_marker_start . PHP_EOL; //Add feature marker start
277
+ //Start mod_rewrite rules
278
+ $rules .= "<IfModule mod_rewrite.c>" . PHP_EOL . "RewriteEngine On" . PHP_EOL . PHP_EOL;
279
+ $count = 1;
280
+ foreach ( $user_agents as $agent )
281
+ {
282
+ $rules .= "RewriteCond %{HTTP_USER_AGENT} ^" . trim( $agent );
283
+ if ( $count < sizeof( $user_agents ) )
284
+ {
285
+ $rules .= " [NC,OR]" . PHP_EOL;
286
+ $count++;
287
+ }
288
+ else
289
+ {
290
+ $rules .= " [NC]" . PHP_EOL;
291
+ }
292
+
293
+ }
294
+ $rules .= "RewriteRule ^(.*)$ - [F,L]" . PHP_EOL . PHP_EOL;
295
+ }
296
+ else
297
+ {
298
+ $count = 1;
299
+ $alist = '';
300
+ foreach ( $user_agents as $agent )
301
+ {
302
+ $alist .= trim( $agent );
303
+ if ( $count < sizeof( $user_agents ) )
304
+ {
305
+ $alist .= '|';
306
+ $count++;
307
+ }
308
+ }
309
+ $rules .= "\tif (\$http_user_agent ~* " . $alist . ") { return 403; }" . PHP_EOL;
310
+ }
311
+ }
312
+
313
+ //close mod_rewrite
314
+ if (strlen($aio_wp_security->configs->get_value('aiowps_banned_user_agents')) > 0)
315
+ {
316
+ if (($aiowps_server == 'apache' || $aiowps_server == 'litespeed'))
317
+ {
318
+ $rules .= "</IfModule>" . PHP_EOL;
319
+ $rules .= AIOWPSecurity_Utility_Htaccess::$user_agent_blacklist_marker_end . PHP_EOL; //Add feature marker end
320
+ }
321
+ }
322
+ }
323
+
324
+ return implode( PHP_EOL, array_diff( explode( PHP_EOL, $rules ), array( 'Deny from ', 'Deny from' ) ) );
325
+ }
326
+
327
+ /*
328
+ * TODO - info
329
+ */
330
+ static function getrules_basic_htaccess()
331
+ {
332
+ global $aio_wp_security;
333
+ @ini_set( 'auto_detect_line_endings', true );
334
+
335
+ //figure out what server they're using
336
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
337
+ {
338
+ $aiowps_server = 'apache';
339
+ }
340
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
341
+ {
342
+ $aiowps_server = 'nginx';
343
+ }
344
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
345
+ {
346
+ $aiowps_server = 'litespeed';
347
+ }
348
+ else
349
+ { //unsupported server
350
+ return -1;
351
+ }
352
+
353
+ $rules = '';
354
+ if($aio_wp_security->configs->get_value('aiowps_enable_basic_firewall')=='1')
355
+ {
356
+ $rules .= AIOWPSecurity_Utility_Htaccess::$basic_htaccess_rules_marker_start . PHP_EOL; //Add feature marker start
357
+ //limit indexing of directories
358
+ $rules .= 'Options All -Indexes' . PHP_EOL;
359
+ //protect the htaccess file - this is done by default with apache config file but we are including it here for good measure
360
+ $rules .= '<files .htaccess>' . PHP_EOL;
361
+ $rules .= 'order allow,deny' . PHP_EOL;
362
+ $rules .= 'deny from all' . PHP_EOL;
363
+ $rules .= '</files>' . PHP_EOL;
364
+
365
+ //disable the server signature
366
+ $rules .= 'ServerSignature Off' . PHP_EOL;
367
+
368
+ //limit file uploads to 10mb
369
+ $rules .= 'LimitRequestBody 10240000' . PHP_EOL;
370
+
371
+ // protect wpconfig.php.
372
+ $rules .= '<files wp-config.php>' . PHP_EOL;
373
+ $rules .= 'order allow,deny' . PHP_EOL;
374
+ $rules .= 'deny from all' . PHP_EOL;
375
+ $rules .= '</files>' . PHP_EOL;
376
+
377
+ $rules .= AIOWPSecurity_Utility_Htaccess::$basic_htaccess_rules_marker_end . PHP_EOL; //Add feature marker end
378
+ }
379
+ return $rules;
380
+ }
381
+
382
+ /*
383
+ * This function will write rules to disable trace and track.
384
+ * HTTP Trace attack (XST) can be used to return header requests
385
+ * and grab cookies and other information and is used along with
386
+ * a cross site scripting attacks (XSS)
387
+ */
388
+ static function getrules_disable_trace_and_track()
389
+ {
390
+ global $aio_wp_security;
391
+ @ini_set( 'auto_detect_line_endings', true );
392
+
393
+ //figure out what server they're using
394
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
395
+ {
396
+ $aiowps_server = 'apache';
397
+ }
398
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
399
+ {
400
+ $aiowps_server = 'nginx';
401
+ }
402
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
403
+ {
404
+ $aiowps_server = 'litespeed';
405
+ }
406
+ else
407
+ { //unsupported server
408
+ return -1;
409
+ }
410
+
411
+ $rules = '';
412
+ if($aio_wp_security->configs->get_value('aiowps_disable_trace_and_track')=='1')
413
+ {
414
+ $rules .= AIOWPSecurity_Utility_Htaccess::$disable_trace_track_marker_start . PHP_EOL; //Add feature marker start
415
+ $rules .= 'RewriteEngine On' . PHP_EOL;
416
+ $rules .= 'RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)' . PHP_EOL;
417
+ $rules .= 'RewriteRule .* - [F]' . PHP_EOL;
418
+ $rules .= AIOWPSecurity_Utility_Htaccess::$disable_trace_track_marker_end . PHP_EOL; //Add feature marker end
419
+ }
420
+
421
+ return $rules;
422
+ }
423
+
424
+ /*
425
+ * This function will write rules to prevent proxy comment posting.
426
+ * This will deny any requests that use a proxy server when posting
427
+ * to comments eliminating some spam and proxy requests, script
428
+ * courtesy of perishablepress.com
429
+ */
430
+ static function getrules_forbid_proxy_comment_posting()
431
+ {
432
+ global $aio_wp_security;
433
+ @ini_set( 'auto_detect_line_endings', true );
434
+
435
+ //figure out what server they're using
436
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
437
+ {
438
+ $aiowps_server = 'apache';
439
+ }
440
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
441
+ {
442
+ $aiowps_server = 'nginx';
443
+ }
444
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
445
+ {
446
+ $aiowps_server = 'litespeed';
447
+ }
448
+ else
449
+ { //unsupported server
450
+ return -1;
451
+ }
452
+
453
+ $rules = '';
454
+ if($aio_wp_security->configs->get_value('aiowps_forbid_proxy_comments')=='1')
455
+ {
456
+ $rules .= AIOWPSecurity_Utility_Htaccess::$forbid_proxy_comments_marker_start . PHP_EOL; //Add feature marker start
457
+ $rules .= 'RewriteCond %{REQUEST_METHOD} =POST' . PHP_EOL;
458
+ $rules .= 'RewriteCond %{HTTP:VIA}%{HTTP:FORWARDED}%{HTTP:USERAGENT_VIA}%{HTTP:X_FORWARDED_FOR}%{HTTP:PROXY_CONNECTION} !^$ [OR]' . PHP_EOL;
459
+ $rules .= 'RewriteCond %{HTTP:XPROXY_CONNECTION}%{HTTP:HTTP_PC_REMOTE_ADDR}%{HTTP:HTTP_CLIENT_IP} !^$' . PHP_EOL;
460
+ $rules .= 'RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]' . PHP_EOL;
461
+ $rules .= 'RewriteRule .* - [F,NS,L]' . PHP_EOL;
462
+ $rules .= AIOWPSecurity_Utility_Htaccess::$forbid_proxy_comments_marker_end . PHP_EOL; //Add feature marker end
463
+ }
464
+
465
+ return $rules;
466
+ }
467
+
468
+ /*
469
+ * This function will write rules to prevent malicious string attacks on your site using XSS.
470
+ * NOTE: Some of these strings might be used for plugins or themes and doing so will disable the functionality.
471
+ * This script is from perishablepress and is fairly safe to use and should not break anything important
472
+ */
473
+ //TODO - the currently commented out rules (see function below) break the site - need to investigate why or if we can tweak the rules a bit
474
+ static function getrules_deny_bad_query_strings()
475
+ {
476
+ global $aio_wp_security;
477
+ @ini_set( 'auto_detect_line_endings', true );
478
+
479
+ //figure out what server they're using
480
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
481
+ {
482
+ $aiowps_server = 'apache';
483
+ }
484
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
485
+ {
486
+ $aiowps_server = 'nginx';
487
+ }
488
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
489
+ {
490
+ $aiowps_server = 'litespeed';
491
+ }
492
+ else
493
+ { //unsupported server
494
+ return -1;
495
+ }
496
+
497
+ $rules = '';
498
+ if($aio_wp_security->configs->get_value('aiowps_deny_bad_query_strings')=='1')
499
+ {
500
+ $rules .= AIOWPSecurity_Utility_Htaccess::$deny_bad_query_strings_marker_start . PHP_EOL; //Add feature marker start
501
+ $rules .= 'RewriteCond %{QUERY_STRING} ../ [NC,OR]' . PHP_EOL;
502
+ //$rules .= 'RewriteCond %{QUERY_STRING} boot.ini [NC,OR]' . PHP_EOL;
503
+ $rules .= 'RewriteCond %{QUERY_STRING} tag= [NC,OR]' . PHP_EOL;
504
+ $rules .= 'RewriteCond %{QUERY_STRING} ftp: [NC,OR]' . PHP_EOL;
505
+ $rules .= 'RewriteCond %{QUERY_STRING} http: [NC,OR]' . PHP_EOL;
506
+ $rules .= 'RewriteCond %{QUERY_STRING} https: [NC,OR]' . PHP_EOL;
507
+ $rules .= 'RewriteCond %{QUERY_STRING} mosConfig [NC,OR]' . PHP_EOL;
508
+ //$rules .= 'RewriteCond %{QUERY_STRING} ^.*([|]|(|)||\'|"|;|?|*).* [NC,OR]' . PHP_EOL;
509
+ //$rules .= 'RewriteCond %{QUERY_STRING} ^.*(%22|%27|%3C|%3E|%5C|%7B|%7C).* [NC,OR]' . PHP_EOL;
510
+ //$rules .= 'RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127.0).* [NC,OR]' . PHP_EOL;
511
+ $rules .= 'RewriteCond %{QUERY_STRING} ^.*(globals|encode|config|localhost|loopback).* [NC,OR]' . PHP_EOL;
512
+ $rules .= 'RewriteCond %{QUERY_STRING} ^.*(request|select|insert|union|declare|drop).* [NC]' . PHP_EOL;
513
+ $rules .= 'RewriteRule ^(.*)$ - [F,L]' . PHP_EOL;
514
+ $rules .= AIOWPSecurity_Utility_Htaccess::$deny_bad_query_strings_marker_end . PHP_EOL; //Add feature marker end
515
+ }
516
+
517
+ return $rules;
518
+ }
519
+
520
+ /*
521
+ * This function will write rules to produce an advanced character string filter to prevent malicious string attacks from Cross Site Scripting (XSS)
522
+ * NOTE: Some of these strings might be used for plugins or themes and doing so will disable the functionality.
523
+ * This script is from perishablepress and is fairly safe to use and should not break anything important
524
+ */
525
+ //TODO - the rules below break the site - need to investigate why or if we can tweak the rules a bit
526
+ //RedirectMatch 403 ^
527
+ //RedirectMatch 403 $
528
+ //RedirectMatch 403 |
529
+ //RedirectMatch 403 ..
530
+ //Redirectmatch 403 select(
531
+ //Redirectmatch 403 convert(
532
+ //RedirectMatch 403 .inc
533
+ //RedirectMatch 403 include.
534
+
535
+
536
+
537
+
538
+ static function getrules_advanced_character_string_filter()
539
+ {
540
+ global $aio_wp_security;
541
+ @ini_set( 'auto_detect_line_endings', true );
542
+
543
+ //figure out what server they're using
544
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
545
+ {
546
+ $aiowps_server = 'apache';
547
+ }
548
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
549
+ {
550
+ $aiowps_server = 'nginx';
551
+ }
552
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
553
+ {
554
+ $aiowps_server = 'litespeed';
555
+ }
556
+ else
557
+ { //unsupported server
558
+ return -1;
559
+ }
560
+
561
+ $rules = '';
562
+ if($aio_wp_security->configs->get_value('aiowps_advanced_char_string_filter')=='1')
563
+ {
564
+ $rules .= AIOWPSecurity_Utility_Htaccess::$advanced_char_string_filter_marker_start . PHP_EOL; //Add feature marker start
565
+
566
+ $rules .= '<IfModule mod_alias.c>
567
+ RedirectMatch 403 `
568
+ RedirectMatch 403 {
569
+ RedirectMatch 403 }
570
+ RedirectMatch 403 ~
571
+ RedirectMatch 403 &quot;
572
+ RedirectMatch 403 &lt;
573
+ RedirectMatch 403 &gt;
574
+ RedirectMatch 403 //
575
+ RedirectMatch 403 %0
576
+ RedirectMatch 403 %A
577
+ RedirectMatch 403 %B
578
+ RedirectMatch 403 %C
579
+ RedirectMatch 403 %D
580
+ RedirectMatch 403 %E
581
+ RedirectMatch 403 %F
582
+ RedirectMatch 403 %22
583
+ RedirectMatch 403 %27
584
+ RedirectMatch 403 %28
585
+ RedirectMatch 403 %29
586
+ RedirectMatch 403 %3C
587
+ RedirectMatch 403 %3E
588
+ RedirectMatch 403 %3F
589
+ RedirectMatch 403 %5B
590
+ RedirectMatch 403 %5C
591
+ RedirectMatch 403 %5D
592
+ RedirectMatch 403 %7B
593
+ RedirectMatch 403 %7C
594
+ RedirectMatch 403 %7D
595
+ # COMMON PATTERNS
596
+ Redirectmatch 403 _vpi
597
+ Redirectmatch 403 xAou6
598
+ Redirectmatch 403 db_name
599
+ Redirectmatch 403 /query/
600
+ RedirectMatch 403 ImpEvData
601
+ Redirectmatch 403 .XMLHTTP
602
+ Redirectmatch 403 proxydeny
603
+ RedirectMatch 403 function.
604
+ Redirectmatch 403 remoteFile
605
+ Redirectmatch 403 servername
606
+ Redirectmatch 403 &amp;rptmode=
607
+ Redirectmatch 403 sys_cpanel
608
+ RedirectMatch 403 db_connect
609
+ RedirectMatch 403 doeditconfig
610
+ RedirectMatch 403 check_proxy
611
+ Redirectmatch 403 system_user
612
+ Redirectmatch 403 /(null)/
613
+ Redirectmatch 403 clientrequest
614
+ Redirectmatch 403 option_value
615
+ RedirectMatch 403 ref.outcontrol
616
+ # SPECIFIC EXPLOITS
617
+ RedirectMatch 403 errors.
618
+ RedirectMatch 403 config.
619
+ RedirectMatch 403 display.
620
+ RedirectMatch 403 register.
621
+ Redirectmatch 403 password.
622
+ RedirectMatch 403 maincore.
623
+ RedirectMatch 403 authorize.
624
+ Redirectmatch 403 macromates.
625
+ RedirectMatch 403 head_auth.
626
+ RedirectMatch 403 submit_links.
627
+ RedirectMatch 403 change_action.
628
+ Redirectmatch 403 com_facileforms/
629
+ RedirectMatch 403 admin_db_utilities.
630
+ RedirectMatch 403 admin.webring.docs.
631
+ Redirectmatch 403 Table/Latest/index.
632
+ </IfModule>' . PHP_EOL;
633
+ $rules .= AIOWPSecurity_Utility_Htaccess::$advanced_char_string_filter_marker_end . PHP_EOL; //Add feature marker end
634
+ }
635
+
636
+ return $rules;
637
+ }
638
+
639
+ /*
640
+ * This function contains the rules for the 5G blacklist produced by Jeff Starr from perishablepress.com
641
+ * NOTE: Since Jeff regularly updates and evolves his blacklist rules, ie, 5G->6G->7G.... we will update this function to reflect the latest blacklist release
642
+ */
643
+
644
+
645
+ static function getrules_5g_blacklist()
646
+ {
647
+ global $aio_wp_security;
648
+ @ini_set( 'auto_detect_line_endings', true );
649
+
650
+ //figure out what server they're using
651
+ if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'apache'))
652
+ {
653
+ $aiowps_server = 'apache';
654
+ }
655
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'nginx'))
656
+ {
657
+ $aiowps_server = 'nginx';
658
+ }
659
+ else if (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'], FILTER_SANITIZE_STRING)), 'litespeed'))
660
+ {
661
+ $aiowps_server = 'litespeed';
662
+ }
663
+ else
664
+ { //unsupported server
665
+ return -1;
666
+ }
667
+
668
+ $rules = '';
669
+ if($aio_wp_security->configs->get_value('aiowps_enable_5g_firewall')=='1')
670
+ {
671
+ $rules .= AIOWPSecurity_Utility_Htaccess::$five_g_blacklist_marker_start . PHP_EOL; //Add feature marker start
672
+
673
+ $rules .= '# 5G BLACKLIST/FIREWALL (2013)
674
+ # @ http://perishablepress.com/5g-blacklist-2013/
675
+
676
+ # 5G:[QUERY STRINGS]
677
+ <IfModule mod_rewrite.c>
678
+ RewriteEngine On
679
+ RewriteBase /
680
+ RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
681
+ RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
682
+ RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
683
+ RewriteCond %{QUERY_STRING} (\\|\.\./|`|=\'$|=%27$) [NC,OR]
684
+ RewriteCond %{QUERY_STRING} (\;|\'|\"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR]
685
+ RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR]
686
+ RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR]
687
+ RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC]
688
+ RewriteRule .* - [F]
689
+ </IfModule>
690
+
691
+ # 5G:[USER AGENTS]
692
+ <IfModule mod_setenvif.c>
693
+ # SetEnvIfNoCase User-Agent ^$ keep_out
694
+ SetEnvIfNoCase User-Agent (binlar|casper|cmsworldmap|comodo|diavol|dotbot|feedfinder|flicky|ia_archiver|jakarta|kmccrew|nutch|planetwork|purebot|pycurl|skygrid|sucker|turnit|vikspider|zmeu) keep_out
695
+ <limit GET POST PUT>
696
+ Order Allow,Deny
697
+ Allow from all
698
+ Deny from env=keep_out
699
+ </limit>
700
+ </IfModule>
701
+
702
+ # 5G:[REQUEST STRINGS]
703
+ <IfModule mod_alias.c>
704
+ RedirectMatch 403 (https?|ftp|php)\://
705
+ RedirectMatch 403 /(https?|ima|ucp)/
706
+ RedirectMatch 403 /(Permanent|Better)$
707
+ RedirectMatch 403 (\=\\\'|\=\\%27|/\\\'/?|\)\.css\()$
708
+ RedirectMatch 403 (\,|\)\+|/\,/|\{0\}|\(/\(|\.\.\.|\+\+\+|\||\\\"\\\")
709
+ RedirectMatch 403 \.(cgi|asp|aspx|cfg|dll|exe|jsp|mdb|sql|ini|rar)$
710
+ RedirectMatch 403 /(contac|fpw|install|pingserver|register)\.php$
711
+ RedirectMatch 403 (base64|crossdomain|localhost|wwwroot|e107\_)
712
+ RedirectMatch 403 (eval\(|\_vti\_|\(null\)|echo.*kae|config\.xml)
713
+ RedirectMatch 403 \.well\-known/host\-meta
714
+ RedirectMatch 403 /function\.array\-rand
715
+ RedirectMatch 403 \)\;\$\(this\)\.html\(
716
+ RedirectMatch 403 proc/self/environ
717
+ RedirectMatch 403 msnbot\.htm\)\.\_
718
+ RedirectMatch 403 /ref\.outcontrol
719
+ RedirectMatch 403 com\_cropimage
720
+ RedirectMatch 403 indonesia\.htm
721
+ RedirectMatch 403 \{\$itemURL\}
722
+ RedirectMatch 403 function\(\)
723
+ RedirectMatch 403 labels\.rdf
724
+ RedirectMatch 403 /playing.php
725
+ RedirectMatch 403 muieblackcat
726
+ </IfModule>
727
+
728
+ # 5G:[REQUEST METHOD]
729
+ <ifModule mod_rewrite.c>
730
+ RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
731
+ RewriteRule .* - [F]
732
+ </IfModule>
733
+
734
+ # 5G:[BAD IPS]
735
+ <limit GET POST PUT>
736
+ Order Allow,Deny
737
+ Allow from all
738
+ # uncomment/edit/repeat next line to block IPs
739
+ # Deny from 123.456.789
740
+ </limit>' . PHP_EOL;
741
+ $rules .= AIOWPSecurity_Utility_Htaccess::$five_g_blacklist_marker_end . PHP_EOL; //Add feature marker end
742
+ }
743
+
744
+ return $rules;
745
+ }
746
+
747
+ /*
748
+ * This function will do a quick check to see if a file's contents are actually .htaccess specific.
749
+ * At the moment it will look for the following tag somewhere in the file - "# BEGIN WordPress"
750
+ * If it finds the tag it will deem the file as being .htaccess specific.
751
+ * This was written to supplement the .htaccess restore functionality
752
+ */
753
+
754
+ static function check_if_htaccess_contents($file)
755
+ {
756
+ $is_htaccess = false;
757
+ $file_contents = file_get_contents($file);
758
+
759
+ if (!$file_contents || $file_contents == 0)
760
+ {
761
+ return -1;
762
+ }
763
+
764
+ if ((strpos($file_contents, '# BEGIN WordPress') !== false) || (strpos($file_contents, '# BEGIN') !== false))
765
+ {
766
+ $is_htaccess = true; //It appears that we have some sort of .htacces file
767
+ }
768
+ else
769
+ {
770
+ //see if we're at the end of the section
771
+ $is_htaccess = false;
772
+ }
773
+
774
+ if ($is_htaccess)
775
+ {
776
+ return 1;
777
+ }
778
+ else
779
+ {
780
+ return -1;
781
+ }
782
+ }
783
+ }
classes/wp-security-utility-ip-address.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Utility_IP
4
+ {
5
+ function __construct(){
6
+ //NOP
7
+ }
8
+
9
+ static function get_user_ip_address()
10
+ {
11
+ //Let's try getting the headers if possible
12
+ if ( function_exists( 'apache_request_headers' ) ) {
13
+ $headers = apache_request_headers();
14
+ } else {
15
+ $headers = $_SERVER;
16
+ }
17
+
18
+ //Get the forwarded IP if it exists
19
+ if (array_key_exists( 'X-Forwarded-For', $headers) ) {
20
+ $userIP = $headers['X-Forwarded-For'];
21
+ } else {
22
+ $userIP = $_SERVER['REMOTE_ADDR'];
23
+ }
24
+ return $userIP;
25
+ }
26
+
27
+ static function create_ip_list_array_from_string_with_newline($ip_addresses)
28
+ {
29
+ $ip_list_array = explode(PHP_EOL, $ip_addresses);
30
+ return $ip_list_array;
31
+ }
32
+
33
+ static function validate_ip_list($ip_list_array)
34
+ {
35
+ @ini_set('auto_detect_line_endings', true);
36
+ $errors = '';
37
+
38
+ //validate list
39
+ $submitted_ips = $ip_list_array;
40
+ $list = array();
41
+
42
+ if(!empty($submitted_ips))
43
+ {
44
+ foreach($submitted_ips as $item)
45
+ {
46
+ $item = filter_var($item, FILTER_SANITIZE_STRING);
47
+ if (strlen( $item ) > 0)
48
+ {
49
+ $ipParts = explode('.', $item);
50
+ $isIP = 0;
51
+ $partcount = 1;
52
+ $goodip = true;
53
+ $foundwild = false;
54
+
55
+ if (count($ipParts) < 2)
56
+ {
57
+ $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'aiowpsecurity').'</p>';
58
+ continue;
59
+ }
60
+
61
+ foreach ($ipParts as $part)
62
+ {
63
+ if ($goodip == true)
64
+ {
65
+ if ((is_numeric(trim($part)) && trim($part) <= 255 && trim($part) >= 0) || trim($part) == '*')
66
+ {
67
+ $isIP++;
68
+ }
69
+
70
+ switch ($partcount)
71
+ {
72
+ case 1:
73
+ if (trim($part) == '*')
74
+ {
75
+ $goodip = false;
76
+ $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'aiowpsecurity').'</p>';
77
+ }
78
+ break;
79
+ case 2:
80
+ if (trim($part) == '*')
81
+ {
82
+ $foundwild = true;
83
+ }
84
+ break;
85
+ default:
86
+ if (trim($part) != '*')
87
+ {
88
+ if ($foundwild == true)
89
+ {
90
+ $goodip = false;
91
+ $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'aiowpsecurity').'</p>';
92
+ }
93
+ }
94
+ else
95
+ {
96
+ $foundwild = true;
97
+ }
98
+ break;
99
+ }
100
+
101
+ $partcount++;
102
+ }
103
+ }
104
+ if (ip2long(trim(str_replace('*', '0', $item))) == false)
105
+ { //invalid ip
106
+ $errors .= '<p>'.$item.__(' is not a valid ip address format.', 'aiowpsecurity').'</p>';
107
+ }
108
+ elseif (strlen($item > 4 && !in_array($item, $list)))
109
+ {
110
+ $current_user_ip = AIOWPSecurity_Utility_IP::get_user_ip_address();
111
+ if ($current_user_ip == $item)
112
+ {
113
+ //You can't ban your own IP
114
+ $errors .= '<p>'.__('You cannot ban your own IP address: ', 'aiowpsecurity').$item.'</p>';
115
+ }
116
+ else
117
+ {
118
+ $list[] = trim($item);
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ else{
125
+ //This function was called with an empty IP address array list
126
+ }
127
+
128
+ if (strlen($errors)> 0)
129
+ {
130
+ $return_payload = array(-1, array($errors));
131
+ return $return_payload;
132
+ }
133
+
134
+ if (sizeof($list) >= 1)
135
+ {
136
+ sort($list);
137
+ $list = array_unique($list, SORT_STRING);
138
+
139
+ $return_payload = array(1, $list);
140
+ return $return_payload;
141
+ }
142
+
143
+ $return_payload = array(1, array());
144
+ return $return_payload;
145
+ }
146
+ }
classes/wp-security-utility.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AIOWPSecurity_Utility
4
+ {
5
+ function __construct(){
6
+ //NOP
7
+ }
8
+
9
+ static function get_current_page_url()
10
+ {
11
+ $pageURL = 'http';
12
+ if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
13
+ $pageURL .= "://";
14
+ if ($_SERVER["SERVER_PORT"] != "80") {
15
+ $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
16
+ }
17
+ else{
18
+ $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
19
+ }
20
+ return $pageURL;
21
+ }
22
+
23
+ static function redirect_to_url($url,$delay='0',$exit='1')
24
+ {
25
+ if(empty($url)){
26
+ echo "<br /><strong>Error! The URL value is empty. Please specify a correct URL value to redirect to!</strong>";
27
+ exit;
28
+ }
29
+ if (!headers_sent()){
30
+ header('Location: ' . $url);
31
+ }
32
+ else{
33
+ echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'" />';
34
+ }
35
+ if($exit == '1'){
36
+ exit;
37
+ }
38
+ }
39
+
40
+ static function get_logout_url_with_after_logout_url_value($after_logout_url)
41
+ {
42
+ return AIOWPSEC_WP_URL.'?aiowpsec_do_log_out=1&after_logout='.$after_logout_url;
43
+ }
44
+
45
+ /*
46
+ * Checks if a particular username exists in the WP Users table
47
+ */
48
+ static function check_user_exists($username)
49
+ {
50
+ global $wpdb;
51
+
52
+ //if username is empty just return false
53
+ if ( $username == '' ) {
54
+ return false;
55
+ }
56
+
57
+ //check users table
58
+ $user = $wpdb->get_var( "SELECT user_login FROM `" . $wpdb->users . "` WHERE user_login='" . sanitize_text_field( $username ) . "';" );
59
+ $userid = $wpdb->get_var( "SELECT ID FROM `" . $wpdb->users . "` WHERE ID='" . sanitize_text_field( $username ) . "';" );
60
+
61
+ if ( $user == $username || $userid == $username ) {
62
+ return true;
63
+ } else {
64
+ return false;
65
+ }
66
+ }
67
+
68
+ /*
69
+ * This function will return a list of user accounts which have login and nick names which are identical
70
+ */
71
+ static function check_identical_login_and_nick_names() {
72
+ global $wpdb;
73
+ $accounts_found = $wpdb->get_results( "SELECT ID,user_login FROM `" . $wpdb->users . "` WHERE user_login<=>display_name;", ARRAY_A);
74
+ return $accounts_found;
75
+ }
76
+
77
+
78
+ static function add_query_data_to_url($url, $name, $value)
79
+ {
80
+ if (strpos($url, '?') === false) {
81
+ $url .= '?';
82
+ } else {
83
+ $url .= '&';
84
+ }
85
+ $url .= $name . '='. $value;
86
+ return $url;
87
+ }
88
+
89
+
90
+ /*
91
+ * Generates a random alpha-numeric number
92
+ */
93
+ static function generate_alpha_numeric_random_string($string_length)
94
+ {
95
+ //Charecters present in table prefix
96
+ $allowed_chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
97
+ $string = '';
98
+ //Generate random string
99
+ for ($i = 0; $i < $string_length; $i++) {
100
+ $string .= $allowed_chars[rand(0, strlen($allowed_chars) - 1)];
101
+ }
102
+ return $string;
103
+ }
104
+
105
+ }
css/wp-security-admin-styles.css ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .aio_half_width{width: 50%;}
2
+ .aio_one_third_width{width: 33%;}
3
+ .aio_width_80{width: 80%;}
4
+ .aio_max_500{max-width: 500px;}
5
+ .aio_spacer_15{margin-top:15px;}
6
+ .aio_spacer_10_tb{margin:10px 0;}
7
+ .aio_spacer_10_tblr{margin:10px;}
8
+ .aio_clear_float{clear: both;}
9
+ .aio_float_left{float: left;}
10
+
11
+ .aiowps_admin_ul_grp1{
12
+ list-style: circle;
13
+ padding: 0 0 0 30px;
14
+ }
15
+
16
+ .aio_grey_box{
17
+ margin: 10px 0 15px;
18
+ background-color: #ECECEC;
19
+ border: 1px solid #CFCFCF;
20
+ padding: 0 0 0 1em;
21
+ }
22
+
23
+ .aio_yellow_box{
24
+ margin: 10px 0 15px;
25
+ background-color: #FFFFE0;
26
+ border-color: #E6DB55;
27
+ border-radius: 3px 3px 3px 3px;
28
+ border-style: solid;
29
+ border-width: 1px;
30
+ padding: 0 0 0 1em;
31
+ }
32
+
33
+ .aio_blue_box{
34
+ margin: 10px 0 15px;
35
+ background-color: #F0F9FF;
36
+ border-color: #1166BB;
37
+ color: #1166BB;
38
+ border-radius: 3px 3px 3px 3px;
39
+ border-style: solid;
40
+ border-width: 1px;
41
+ padding: 0 0 0 1em;
42
+ line-height: 20px;
43
+ }
44
+
45
+ .aio_green_box {
46
+ margin: 10px 0 15px;
47
+ background-color: #CCF4D6;
48
+ border-color: #059B53;
49
+ color: #043B14;
50
+ border-radius: 3px 3px 3px 3px;
51
+ border-style: solid;
52
+ border-width: 1px;
53
+ padding: 0 0 0 1em;
54
+ }
55
+
56
+ .aio_red_box {
57
+ margin: 10px 0 15px;
58
+ background-color: #FFEBE8;
59
+ border-color: #CC0000;
60
+ color: #333333;
61
+ border-radius: 3px 3px 3px 3px;
62
+ border-style: solid;
63
+ border-width: 1px;
64
+ padding: 0 0 0 1em;
65
+ }
66
+
67
+ .aio_success_with_icon {
68
+ background-image: url("../images/success.png");
69
+ background-repeat: no-repeat;
70
+ color: #529901;
71
+ padding-left: 20px;
72
+ font-size: 14px;
73
+ }
74
+ .aio_error_with_icon {
75
+ color: #ff0000;
76
+ background-image: url("../images/error.png");
77
+ background-repeat: no-repeat;
78
+ padding-left: 20px;
79
+ font-size: 14px;
80
+ }
81
+ .aio_info_with_icon {
82
+ background-image: url("../images/info-icon.png");
83
+ background-repeat: no-repeat;
84
+ color: #1166BB;
85
+ padding-left: 20px;
86
+ font-size: 14px;
87
+ }
88
+
89
+ .file_permission_table{
90
+ margin: 20px 0;
91
+ }
92
+ .file_permission_table thead tr th{
93
+ background:#CCCCCC;
94
+ }
95
+ .file_permission_table td{
96
+ padding: 7px;
97
+ font-family: "Courier 10 Pitch",Courier,monospace;
98
+ color: #262626;
99
+ border-bottom: 1px solid #F2F2F2;
100
+ border-top:none;
101
+ }
102
+ .aio_table_row_red{
103
+ background-color:#FD6D73;
104
+ }
105
+ .aio_table_row_yellow{
106
+ background-color:#F5E679;
107
+ }
108
+ .aio_table_row_green{
109
+ background-color:#C8F18B;
110
+ }
111
+
112
+ .aiowps_loading_1{
113
+ margin:0 5px;
114
+ }
115
+
116
+ .aio_text_area_file_output{
117
+ background: none repeat scroll 0 0 #F9F9F9;
118
+ font-family: Consolas,Monaco,monospace;
119
+ font-size: 12px;
120
+ outline: 0 none;
121
+ }
122
+
123
+ .aiowps_more_info_anchor{
124
+ background-color: #D9D9D9;
125
+ color: #21759B;
126
+ font: 0.9em/1.455em "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
127
+ text-decoration: none;
128
+ padding: 3px 5px;
129
+ }
130
+ .aiowps_more_info_anchor:hover {
131
+ color: #333333;
132
+ cursor: pointer;
133
+ }
134
+ .aiowps_more_info_toggle_char {
135
+ display: inline-block;
136
+ margin-right: 3px;
137
+ padding: 0 3px;
138
+ text-align: center;
139
+ background-color: #EDEDED;
140
+ width: 10px;
141
+ }
142
+ .aiowps_more_info_body{
143
+ margin: 10px 0 15px;
144
+ background-color: #FFFFE0;
145
+ border-color: #E6DB55;
146
+ border-radius: 3px 3px 3px 3px;
147
+ border-style: solid;
148
+ border-width: 1px;
149
+ padding: 0 0 0 1em;
150
+ }
151
+
152
+ .aiowps_dashboard_box_small{
153
+ float:left;
154
+ max-width:350px;
155
+ margin-right:15px;
156
+ }
157
+ .aiowps_dashboard_widget_footer{
158
+ background-color: #E6E6E6;
159
+ padding: 10px;
160
+ }
161
+
162
+ .aiowps_feature_status_container{
163
+ display:block;
164
+ margin: 10px 0;
165
+ }
166
+ .aiowps_feature_status_name{
167
+ width:50%;
168
+ font-weight: bold;
169
+ float:left;
170
+ padding: 5px 10px 5px 0;
171
+ }
172
+ .aiowps_feature_status_bar{
173
+ display:block;
174
+ float:left;
175
+ width: 120px;
176
+ height: 26px;
177
+ position: relative;
178
+ background: rgba(0, 0, 0, 0.25);
179
+ border-radius: 3px;
180
+ -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
181
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
182
+ }
183
+ .aiowps_feature_status_label{
184
+ display: block;
185
+ float: left;
186
+ padding: 4px;
187
+ text-align: center;
188
+ width: 52px;
189
+ color:#F7F7F7;
190
+ font-weight:bold;
191
+ text-transform: uppercase;
192
+ }
193
+ .aiowps_feature_status_on{
194
+ color: #043B14;
195
+ background: #65bd63;
196
+ border-radius: 3px;
197
+ background-image: -webkit-linear-gradient(top, #9dd993, #65bd63);
198
+ background-image: -moz-linear-gradient(top, #9dd993, #65bd63);
199
+ background-image: -o-linear-gradient(top, #9dd993, #65bd63);
200
+ background-image: linear-gradient(to bottom, #9dd993, #65bd63);
201
+ -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
202
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
203
+ }
204
+ .aiowps_feature_status_off{
205
+ color: #4D0000;
206
+ background: #BD6363;
207
+ border-radius: 3px;
208
+ background-image: -webkit-linear-gradient(top, #D99393, #BD6363);
209
+ background-image: -moz-linear-gradient(top, #D99393, #BD6363);
210
+ background-image: -o-linear-gradient(top, #D99393, #BD6363);
211
+ background-image: linear-gradient(top bottom, #D99393, #BD6363);
212
+ -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
213
+ box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
214
+ }
215
+
216
+ .aiowps_feature_details_badge{
217
+
218
+ }
219
+ .aiowps_feature_details_badge_difficulty{
220
+ display: inline-block;
221
+ background: url('../images/feature-difficulty-badge-bg.png') no-repeat;
222
+ width:150px;
223
+ height:65px;
224
+ }
225
+ .aiowps_feature_details_badge_difficulty_text{
226
+ display: inline-block;
227
+ height:36px;
228
+ width: 105px;
229
+ margin: 8px 0 0 36px;
230
+ color: #595170;
231
+ font-size:14px;
232
+ font-family: helvetica;
233
+ font-weight: bold;
234
+ text-align: center;
235
+ padding-top:7px;
236
+ }
237
+ .aiowps_feature_details_badge_points{
238
+ display: inline-block;
239
+ background: url('../images/feature-points-badge-bg.png') no-repeat;
240
+ width:150px;
241
+ height:65px;
242
+ margin-left: 10px;
243
+ }
244
+ .aiowps_feature_details_badge_points_text{
245
+ display: inline-block;
246
+ height:36px;
247
+ width: 105px;
248
+ margin: 8px 0 0 36px;
249
+ color: #545B5C;
250
+ font-size:20px;
251
+ font-family: georgia;
252
+ font-weight: bold;
253
+ text-align: center;
254
+ padding-top:5px;
255
+ }
images/error.png ADDED
Binary file
images/feature-difficulty-badge-bg.png ADDED
Binary file
images/feature-points-badge-bg.png ADDED
Binary file
images/info-icon.png ADDED
Binary file
images/loading.gif ADDED
Binary file
images/plugin-icon.png ADDED
Binary file
images/plugin-icon2.png ADDED
Binary file
images/shield-info-icon-36.png ADDED
Binary file
images/shield-security-icon-36.png ADDED
Binary file
images/success.png ADDED
Binary file
js/wp-security-admin-script.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ //Add Generic Admin Dashboard JS Code in this file
3
+
4
+ //Media Uploader - start
5
+ function aiowps_attach_media_uploader(key) {
6
+ jQuery('#' + key + '_button').click(function() {
7
+ text_element = jQuery('#' + key).attr('name');
8
+ button_element = jQuery('#' + key + '_button').attr('name');
9
+ tb_show('All In One Security - Please Select a File', 'media-upload.php?referer=aiowpsec&amp;TB_iframe=true&amp;post_id=0width=640&amp;height=485');
10
+ return false;
11
+ });
12
+ window.send_to_editor = function(html) {
13
+ var self_element = text_element;
14
+ fileurl = jQuery(html).attr('href');
15
+ jQuery('#' + self_element).val(fileurl);
16
+ tb_remove();
17
+ };
18
+ }
19
+ aiowps_attach_media_uploader('aiowps_htaccess_file');
20
+ aiowps_attach_media_uploader('aiowps_wp_config_file');
21
+ aiowps_attach_media_uploader('aiowps_db_file'); //TODO - for future use when we implement DB restore
22
+ //End of Media Uploader
23
+
24
+ //Triggers the more info toggle link
25
+ $(".aiowps_more_info_body").hide();//hide the more info on page load
26
+ $(".aiowps_more_info_anchor").click(function(){
27
+ $(this).next(".aiowps_more_info_body").animate({ "height": "toggle"});
28
+ var toogle_char_ref = $(this).find(".aiowps_more_info_toggle_char");
29
+ var toggle_char_value = toogle_char_ref.text();
30
+ if(toggle_char_value === "+"){
31
+ toogle_char_ref.text("-");
32
+ }
33
+ else{
34
+ toogle_char_ref.text("+");
35
+ }
36
+ });
37
+ //End of more info toggle
38
+
39
+ });
lib/whois/LICENSE ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Library General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License
307
+ along with this program; if not, write to the Free Software
308
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
309
+
310
+
311
+ Also add information on how to contact you by electronic and paper mail.
312
+
313
+ If the program is interactive, make it output a short notice like this
314
+ when it starts in an interactive mode:
315
+
316
+ Gnomovision version 69, Copyright (C) year name of author
317
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
+ This is free software, and you are welcome to redistribute it
319
+ under certain conditions; type `show c' for details.
320
+
321
+ The hypothetical commands `show w' and `show c' should show the appropriate
322
+ parts of the General Public License. Of course, the commands you use may
323
+ be called something other than `show w' and `show c'; they could even be
324
+ mouse-clicks or menu items--whatever suits your program.
325
+
326
+ You should also get your employer (if you work as a programmer) or your
327
+ school, if any, to sign a "copyright disclaimer" for the program, if
328
+ necessary. Here is a sample; alter the names:
329
+
330
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
+
333
+ <signature of Ty Coon>, 1 April 1989
334
+ Ty Coon, President of Vice
335
+
336
+ This General Public License does not permit incorporating your program into
337
+ proprietary programs. If your program is a subroutine library, you may
338
+ consider it more useful to permit linking proprietary applications with the
339
+ library. If this is what you want to do, use the GNU Library General
340
+ Public License instead of this License.
lib/whois/handler.template.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__XX_HANDLER__'))
29
+ define('__XX_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class xx_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ return $r;
38
+ }
39
+ }
40
+ ?>
lib/whois/npdata.ser ADDED
@@ -0,0 +1 @@
 
1
+ a:6:{s:11:"map_nothing";a:27:{i:0;i:173;i:1;i:847;i:2;i:6150;i:3;i:6155;i:4;i:6156;i:5;i:6157;i:6;i:8203;i:7;i:8204;i:8;i:8205;i:9;i:8288;i:10;i:65024;i:11;i:65025;i:12;i:65026;i:13;i:65027;i:14;i:65028;i:15;i:65029;i:16;i:65030;i:17;i:65031;i:18;i:65032;i:19;i:65033;i:20;i:65034;i:21;i:65035;i:22;i:65036;i:23;i:65037;i:24;i:65038;i:25;i:65039;i:26;i:65279;}s:18:"general_prohibited";a:64:{i:0;i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;i:9;i:9;i:10;i:10;i:11;i:11;i:12;i:12;i:13;i:13;i:14;i:14;i:15;i:15;i:16;i:16;i:17;i:17;i:18;i:18;i:19;i:19;i:20;i:20;i:21;i:21;i:22;i:22;i:23;i:23;i:24;i:24;i:25;i:25;i:26;i:26;i:27;i:27;i:28;i:28;i:29;i:29;i:30;i:30;i:31;i:31;i:32;i:32;i:33;i:33;i:34;i:34;i:35;i:35;i:36;i:36;i:37;i:37;i:38;i:38;i:39;i:39;i:40;i:40;i:41;i:41;i:42;i:42;i:43;i:43;i:44;i:44;i:45;i:47;i:46;i:59;i:47;i:60;i:48;i:61;i:49;i:62;i:50;i:63;i:51;i:64;i:52;i:91;i:53;i:92;i:54;i:93;i:55;i:94;i:56;i:95;i:57;i:96;i:58;i:123;i:59;i:124;i:60;i:125;i:61;i:126;i:62;i:127;i:63;i:12290;}s:8:"prohibit";a:84:{i:0;i:160;i:1;i:5760;i:2;i:8192;i:3;i:8193;i:4;i:8194;i:5;i:8195;i:6;i:8196;i:7;i:8197;i:8;i:8198;i:9;i:8199;i:10;i:8200;i:11;i:8201;i:12;i:8202;i:13;i:8203;i:14;i:8239;i:15;i:8287;i:16;i:12288;i:17;i:1757;i:18;i:1807;i:19;i:6158;i:20;i:8204;i:21;i:8205;i:22;i:8232;i:23;i:8233;i:24;i:65279;i:25;i:65529;i:26;i:65530;i:27;i:65531;i:28;i:65532;i:29;i:65534;i:30;i:65535;i:31;i:131070;i:32;i:131071;i:33;i:196606;i:34;i:196607;i:35;i:262142;i:36;i:262143;i:37;i:327678;i:38;i:327679;i:39;i:393214;i:40;i:393215;i:41;i:458750;i:42;i:458751;i:43;i:524286;i:44;i:524287;i:45;i:589822;i:46;i:589823;i:47;i:655358;i:48;i:655359;i:49;i:720894;i:50;i:720895;i:51;i:786430;i:52;i:786431;i:53;i:851966;i:54;i:851967;i:55;i:917502;i:56;i:917503;i:57;i:983038;i:58;i:983039;i:59;i:1048574;i:60;i:1048575;i:61;i:1114110;i:62;i:1114111;i:63;i:65529;i:64;i:65530;i:65;i:65531;i:66;i:65532;i:67;i:65533;i:68;i:832;i:69;i:833;i:70;i:8206;i:71;i:8207;i:72;i:8234;i:73;i:8235;i:74;i:8236;i:75;i:8237;i:76;i:8238;i:77;i:8298;i:78;i:8299;i:79;i:8300;i:80;i:8301;i:81;i:8302;i:82;i:8303;i:83;i:917505;}s:15:"prohibit_ranges";a:10:{i:0;a:2:{i:0;i:128;i:1;i:159;}i:1;a:2:{i:0;i:8288;i:1;i:8303;}i:2;a:2:{i:0;i:119155;i:1;i:119162;}i:3;a:2:{i:0;i:57344;i:1;i:63743;}i:4;a:2:{i:0;i:983040;i:1;i:1048573;}i:5;a:2:{i:0;i:1048576;i:1;i:1114109;}i:6;a:2:{i:0;i:64976;i:1;i:65007;}i:7;a:2:{i:0;i:55296;i:1;i:57343;}i:8;a:2:{i:0;i:12272;i:1;i:12283;}i:9;a:2:{i:0;i:917536;i:1;i:917631;}}s:11:"replacemaps";a:1401:{i:65;a:1:{i:0;i:97;}i:66;a:1:{i:0;i:98;}i:67;a:1:{i:0;i:99;}i:68;a:1:{i:0;i:100;}i:69;a:1:{i:0;i:101;}i:70;a:1:{i:0;i:102;}i:71;a:1:{i:0;i:103;}i:72;a:1:{i:0;i:104;}i:73;a:1:{i:0;i:105;}i:74;a:1:{i:0;i:106;}i:75;a:1:{i:0;i:107;}i:76;a:1:{i:0;i:108;}i:77;a:1:{i:0;i:109;}i:78;a:1:{i:0;i:110;}i:79;a:1:{i:0;i:111;}i:80;a:1:{i:0;i:112;}i:81;a:1:{i:0;i:113;}i:82;a:1:{i:0;i:114;}i:83;a:1:{i:0;i:115;}i:84;a:1:{i:0;i:116;}i:85;a:1:{i:0;i:117;}i:86;a:1:{i:0;i:118;}i:87;a:1:{i:0;i:119;}i:88;a:1:{i:0;i:120;}i:89;a:1:{i:0;i:121;}i:90;a:1:{i:0;i:122;}i:181;a:1:{i:0;i:956;}i:192;a:1:{i:0;i:224;}i:193;a:1:{i:0;i:225;}i:194;a:1:{i:0;i:226;}i:195;a:1:{i:0;i:227;}i:196;a:1:{i:0;i:228;}i:197;a:1:{i:0;i:229;}i:198;a:1:{i:0;i:230;}i:199;a:1:{i:0;i:231;}i:200;a:1:{i:0;i:232;}i:201;a:1:{i:0;i:233;}i:202;a:1:{i:0;i:234;}i:203;a:1:{i:0;i:235;}i:204;a:1:{i:0;i:236;}i:205;a:1:{i:0;i:237;}i:206;a:1:{i:0;i:238;}i:207;a:1:{i:0;i:239;}i:208;a:1:{i:0;i:240;}i:209;a:1:{i:0;i:241;}i:210;a:1:{i:0;i:242;}i:211;a:1:{i:0;i:243;}i:212;a:1:{i:0;i:244;}i:213;a:1:{i:0;i:245;}i:214;a:1:{i:0;i:246;}i:216;a:1:{i:0;i:248;}i:217;a:1:{i:0;i:249;}i:218;a:1:{i:0;i:250;}i:219;a:1:{i:0;i:251;}i:220;a:1:{i:0;i:252;}i:221;a:1:{i:0;i:253;}i:222;a:1:{i:0;i:254;}i:223;a:2:{i:0;i:115;i:1;i:115;}i:256;a:1:{i:0;i:257;}i:258;a:1:{i:0;i:259;}i:260;a:1:{i:0;i:261;}i:262;a:1:{i:0;i:263;}i:264;a:1:{i:0;i:265;}i:266;a:1:{i:0;i:267;}i:268;a:1:{i:0;i:269;}i:270;a:1:{i:0;i:271;}i:272;a:1:{i:0;i:273;}i:274;a:1:{i:0;i:275;}i:276;a:1:{i:0;i:277;}i:278;a:1:{i:0;i:279;}i:280;a:1:{i:0;i:281;}i:282;a:1:{i:0;i:283;}i:284;a:1:{i:0;i:285;}i:286;a:1:{i:0;i:287;}i:288;a:1:{i:0;i:289;}i:290;a:1:{i:0;i:291;}i:292;a:1:{i:0;i:293;}i:294;a:1:{i:0;i:295;}i:296;a:1:{i:0;i:297;}i:298;a:1:{i:0;i:299;}i:300;a:1:{i:0;i:301;}i:302;a:1:{i:0;i:303;}i:304;a:2:{i:0;i:105;i:1;i:775;}i:306;a:1:{i:0;i:307;}i:308;a:1:{i:0;i:309;}i:310;a:1:{i:0;i:311;}i:313;a:1:{i:0;i:314;}i:315;a:1:{i:0;i:316;}i:317;a:1:{i:0;i:318;}i:319;a:1:{i:0;i:320;}i:321;a:1:{i:0;i:322;}i:323;a:1:{i:0;i:324;}i:325;a:1:{i:0;i:326;}i:327;a:1:{i:0;i:328;}i:329;a:2:{i:0;i:700;i:1;i:110;}i:330;a:1:{i:0;i:331;}i:332;a:1:{i:0;i:333;}i:334;a:1:{i:0;i:335;}i:336;a:1:{i:0;i:337;}i:338;a:1:{i:0;i:339;}i:340;a:1:{i:0;i:341;}i:342;a:1:{i:0;i:343;}i:344;a:1:{i:0;i:345;}i:346;a:1:{i:0;i:347;}i:348;a:1:{i:0;i:349;}i:350;a:1:{i:0;i:351;}i:352;a:1:{i:0;i:353;}i:354;a:1:{i:0;i:355;}i:356;a:1:{i:0;i:357;}i:358;a:1:{i:0;i:359;}i:360;a:1:{i:0;i:361;}i:362;a:1:{i:0;i:363;}i:364;a:1:{i:0;i:365;}i:366;a:1:{i:0;i:367;}i:368;a:1:{i:0;i:369;}i:370;a:1:{i:0;i:371;}i:372;a:1:{i:0;i:373;}i:374;a:1:{i:0;i:375;}i:376;a:1:{i:0;i:255;}i:377;a:1:{i:0;i:378;}i:379;a:1:{i:0;i:380;}i:381;a:1:{i:0;i:382;}i:383;a:1:{i:0;i:115;}i:385;a:1:{i:0;i:595;}i:386;a:1:{i:0;i:387;}i:388;a:1:{i:0;i:389;}i:390;a:1:{i:0;i:596;}i:391;a:1:{i:0;i:392;}i:393;a:1:{i:0;i:598;}i:394;a:1:{i:0;i:599;}i:395;a:1:{i:0;i:396;}i:398;a:1:{i:0;i:477;}i:399;a:1:{i:0;i:601;}i:400;a:1:{i:0;i:603;}i:401;a:1:{i:0;i:402;}i:403;a:1:{i:0;i:608;}i:404;a:1:{i:0;i:611;}i:406;a:1:{i:0;i:617;}i:407;a:1:{i:0;i:616;}i:408;a:1:{i:0;i:409;}i:412;a:1:{i:0;i:623;}i:413;a:1:{i:0;i:626;}i:415;a:1:{i:0;i:629;}i:416;a:1:{i:0;i:417;}i:418;a:1:{i:0;i:419;}i:420;a:1:{i:0;i:421;}i:422;a:1:{i:0;i:640;}i:423;a:1:{i:0;i:424;}i:425;a:1:{i:0;i:643;}i:428;a:1:{i:0;i:429;}i:430;a:1:{i:0;i:648;}i:431;a:1:{i:0;i:432;}i:433;a:1:{i:0;i:650;}i:434;a:1:{i:0;i:651;}i:435;a:1:{i:0;i:436;}i:437;a:1:{i:0;i:438;}i:439;a:1:{i:0;i:658;}i:440;a:1:{i:0;i:441;}i:444;a:1:{i:0;i:445;}i:452;a:1:{i:0;i:454;}i:453;a:1:{i:0;i:454;}i:455;a:1:{i:0;i:457;}i:456;a:1:{i:0;i:457;}i:458;a:1:{i:0;i:460;}i:459;a:1:{i:0;i:460;}i:461;a:1:{i:0;i:462;}i:463;a:1:{i:0;i:464;}i:465;a:1:{i:0;i:466;}i:467;a:1:{i:0;i:468;}i:469;a:1:{i:0;i:470;}i:471;a:1:{i:0;i:472;}i:473;a:1:{i:0;i:474;}i:475;a:1:{i:0;i:476;}i:478;a:1:{i:0;i:479;}i:480;a:1:{i:0;i:481;}i:482;a:1:{i:0;i:483;}i:484;a:1:{i:0;i:485;}i:486;a:1:{i:0;i:487;}i:488;a:1:{i:0;i:489;}i:490;a:1:{i:0;i:491;}i:492;a:1:{i:0;i:493;}i:494;a:1:{i:0;i:495;}i:496;a:2:{i:0;i:106;i:1;i:780;}i:497;a:1:{i:0;i:499;}i:498;a:1:{i:0;i:499;}i:500;a:1:{i:0;i:501;}i:502;a:1:{i:0;i:405;}i:503;a:1:{i:0;i:447;}i:504;a:1:{i:0;i:505;}i:506;a:1:{i:0;i:507;}i:508;a:1:{i:0;i:509;}i:510;a:1:{i:0;i:511;}i:512;a:1:{i:0;i:513;}i:514;a:1:{i:0;i:515;}i:516;a:1:{i:0;i:517;}i:518;a:1:{i:0;i:519;}i:520;a:1:{i:0;i:521;}i:522;a:1:{i:0;i:523;}i:524;a:1:{i:0;i:525;}i:526;a:1:{i:0;i:527;}i:528;a:1:{i:0;i:529;}i:530;a:1:{i:0;i:531;}i:532;a:1:{i:0;i:533;}i:534;a:1:{i:0;i:535;}i:536;a:1:{i:0;i:537;}i:538;a:1:{i:0;i:539;}i:540;a:1:{i:0;i:541;}i:542;a:1:{i:0;i:543;}i:544;a:1:{i:0;i:414;}i:546;a:1:{i:0;i:547;}i:548;a:1:{i:0;i:549;}i:550;a:1:{i:0;i:551;}i:552;a:1:{i:0;i:553;}i:554;a:1:{i:0;i:555;}i:556;a:1:{i:0;i:557;}i:558;a:1:{i:0;i:559;}i:560;a:1:{i:0;i:561;}i:562;a:1:{i:0;i:563;}i:837;a:1:{i:0;i:953;}i:890;a:2:{i:0;i:32;i:1;i:953;}i:902;a:1:{i:0;i:940;}i:904;a:1:{i:0;i:941;}i:905;a:1:{i:0;i:942;}i:906;a:1:{i:0;i:943;}i:908;a:1:{i:0;i:972;}i:910;a:1:{i:0;i:973;}i:911;a:1:{i:0;i:974;}i:912;a:3:{i:0;i:953;i:1;i:776;i:2;i:769;}i:913;a:1:{i:0;i:945;}i:914;a:1:{i:0;i:946;}i:915;a:1:{i:0;i:947;}i:916;a:1:{i:0;i:948;}i:917;a:1:{i:0;i:949;}i:918;a:1:{i:0;i:950;}i:919;a:1:{i:0;i:951;}i:920;a:1:{i:0;i:952;}i:921;a:1:{i:0;i:953;}i:922;a:1:{i:0;i:954;}i:923;a:1:{i:0;i:955;}i:924;a:1:{i:0;i:956;}i:925;a:1:{i:0;i:957;}i:926;a:1:{i:0;i:958;}i:927;a:1:{i:0;i:959;}i:928;a:1:{i:0;i:960;}i:929;a:1:{i:0;i:961;}i:931;a:1:{i:0;i:963;}i:932;a:1:{i:0;i:964;}i:933;a:1:{i:0;i:965;}i:934;a:1:{i:0;i:966;}i:935;a:1:{i:0;i:967;}i:936;a:1:{i:0;i:968;}i:937;a:1:{i:0;i:969;}i:938;a:1:{i:0;i:970;}i:939;a:1:{i:0;i:971;}i:944;a:3:{i:0;i:965;i:1;i:776;i:2;i:769;}i:962;a:1:{i:0;i:963;}i:976;a:1:{i:0;i:946;}i:977;a:1:{i:0;i:952;}i:978;a:1:{i:0;i:965;}i:979;a:1:{i:0;i:973;}i:980;a:1:{i:0;i:971;}i:981;a:1:{i:0;i:966;}i:982;a:1:{i:0;i:960;}i:984;a:1:{i:0;i:985;}i:986;a:1:{i:0;i:987;}i:988;a:1:{i:0;i:989;}i:990;a:1:{i:0;i:991;}i:992;a:1:{i:0;i:993;}i:994;a:1:{i:0;i:995;}i:996;a:1:{i:0;i:997;}i:998;a:1:{i:0;i:999;}i:1000;a:1:{i:0;i:1001;}i:1002;a:1:{i:0;i:1003;}i:1004;a:1:{i:0;i:1005;}i:1006;a:1:{i:0;i:1007;}i:1008;a:1:{i:0;i:954;}i:1009;a:1:{i:0;i:961;}i:1010;a:1:{i:0;i:963;}i:1012;a:1:{i:0;i:952;}i:1013;a:1:{i:0;i:949;}i:1024;a:1:{i:0;i:1104;}i:1025;a:1:{i:0;i:1105;}i:1026;a:1:{i:0;i:1106;}i:1027;a:1:{i:0;i:1107;}i:1028;a:1:{i:0;i:1108;}i:1029;a:1:{i:0;i:1109;}i:1030;a:1:{i:0;i:1110;}i:1031;a:1:{i:0;i:1111;}i:1032;a:1:{i:0;i:1112;}i:1033;a:1:{i:0;i:1113;}i:1034;a:1:{i:0;i:1114;}i:1035;a:1:{i:0;i:1115;}i:1036;a:1:{i:0;i:1116;}i:1037;a:1:{i:0;i:1117;}i:1038;a:1:{i:0;i:1118;}i:1039;a:1:{i:0;i:1119;}i:1040;a:1:{i:0;i:1072;}i:1041;a:1:{i:0;i:1073;}i:1042;a:1:{i:0;i:1074;}i:1043;a:1:{i:0;i:1075;}i:1044;a:1:{i:0;i:1076;}i:1045;a:1:{i:0;i:1077;}i:1046;a:1:{i:0;i:1078;}i:1047;a:1:{i:0;i:1079;}i:1048;a:1:{i:0;i:1080;}i:1049;a:1:{i:0;i:1081;}i:1050;a:1:{i:0;i:1082;}i:1051;a:1:{i:0;i:1083;}i:1052;a:1:{i:0;i:1084;}i:1053;a:1:{i:0;i:1085;}i:1054;a:1:{i:0;i:1086;}i:1055;a:1:{i:0;i:1087;}i:1056;a:1:{i:0;i:1088;}i:1057;a:1:{i:0;i:1089;}i:1058;a:1:{i:0;i:1090;}i:1059;a:1:{i:0;i:1091;}i:1060;a:1:{i:0;i:1092;}i:1061;a:1:{i:0;i:1093;}i:1062;a:1:{i:0;i:1094;}i:1063;a:1:{i:0;i:1095;}i:1064;a:1:{i:0;i:1096;}i:1065;a:1:{i:0;i:1097;}i:1066;a:1:{i:0;i:1098;}i:1067;a:1:{i:0;i:1099;}i:1068;a:1:{i:0;i:1100;}i:1069;a:1:{i:0;i:1101;}i:1070;a:1:{i:0;i:1102;}i:1071;a:1:{i:0;i:1103;}i:1120;a:1:{i:0;i:1121;}i:1122;a:1:{i:0;i:1123;}i:1124;a:1:{i:0;i:1125;}i:1126;a:1:{i:0;i:1127;}i:1128;a:1:{i:0;i:1129;}i:1130;a:1:{i:0;i:1131;}i:1132;a:1:{i:0;i:1133;}i:1134;a:1:{i:0;i:1135;}i:1136;a:1:{i:0;i:1137;}i:1138;a:1:{i:0;i:1139;}i:1140;a:1:{i:0;i:1141;}i:1142;a:1:{i:0;i:1143;}i:1144;a:1:{i:0;i:1145;}i:1146;a:1:{i:0;i:1147;}i:1148;a:1:{i:0;i:1149;}i:1150;a:1:{i:0;i:1151;}i:1152;a:1:{i:0;i:1153;}i:1162;a:1:{i:0;i:1163;}i:1164;a:1:{i:0;i:1165;}i:1166;a:1:{i:0;i:1167;}i:1168;a:1:{i:0;i:1169;}i:1170;a:1:{i:0;i:1171;}i:1172;a:1:{i:0;i:1173;}i:1174;a:1:{i:0;i:1175;}i:1176;a:1:{i:0;i:1177;}i:1178;a:1:{i:0;i:1179;}i:1180;a:1:{i:0;i:1181;}i:1182;a:1:{i:0;i:1183;}i:1184;a:1:{i:0;i:1185;}i:1186;a:1:{i:0;i:1187;}i:1188;a:1:{i:0;i:1189;}i:1190;a:1:{i:0;i:1191;}i:1192;a:1:{i:0;i:1193;}i:1194;a:1:{i:0;i:1195;}i:1196;a:1:{i:0;i:1197;}i:1198;a:1:{i:0;i:1199;}i:1200;a:1:{i:0;i:1201;}i:1202;a:1:{i:0;i:1203;}i:1204;a:1:{i:0;i:1205;}i:1206;a:1:{i:0;i:1207;}i:1208;a:1:{i:0;i:1209;}i:1210;a:1:{i:0;i:1211;}i:1212;a:1:{i:0;i:1213;}i:1214;a:1:{i:0;i:1215;}i:1217;a:1:{i:0;i:1218;}i:1219;a:1:{i:0;i:1220;}i:1221;a:1:{i:0;i:1222;}i:1223;a:1:{i:0;i:1224;}i:1225;a:1:{i:0;i:1226;}i:1227;a:1:{i:0;i:1228;}i:1229;a:1:{i:0;i:1230;}i:1232;a:1:{i:0;i:1233;}i:1234;a:1:{i:0;i:1235;}i:1236;a:1:{i:0;i:1237;}i:1238;a:1:{i:0;i:1239;}i:1240;a:1:{i:0;i:1241;}i:1242;a:1:{i:0;i:1243;}i:1244;a:1:{i:0;i:1245;}i:1246;a:1:{i:0;i:1247;}i:1248;a:1:{i:0;i:1249;}i:1250;a:1:{i:0;i:1251;}i:1252;a:1:{i:0;i:1253;}i:1254;a:1:{i:0;i:1255;}i:1256;a:1:{i:0;i:1257;}i:1258;a:1:{i:0;i:1259;}i:1260;a:1:{i:0;i:1261;}i:1262;a:1:{i:0;i:1263;}i:1264;a:1:{i:0;i:1265;}i:1266;a:1:{i:0;i:1267;}i:1268;a:1:{i:0;i:1269;}i:1272;a:1:{i:0;i:1273;}i:1280;a:1:{i:0;i:1281;}i:1282;a:1:{i:0;i:1283;}i:1284;a:1:{i:0;i:1285;}i:1286;a:1:{i:0;i:1287;}i:1288;a:1:{i:0;i:1289;}i:1290;a:1:{i:0;i:1291;}i:1292;a:1:{i:0;i:1293;}i:1294;a:1:{i:0;i:1295;}i:1329;a:1:{i:0;i:1377;}i:1330;a:1:{i:0;i:1378;}i:1331;a:1:{i:0;i:1379;}i:1332;a:1:{i:0;i:1380;}i:1333;a:1:{i:0;i:1381;}i:1334;a:1:{i:0;i:1382;}i:1335;a:1:{i:0;i:1383;}i:1336;a:1:{i:0;i:1384;}i:1337;a:1:{i:0;i:1385;}i:1338;a:1:{i:0;i:1386;}i:1339;a:1:{i:0;i:1387;}i:1340;a:1:{i:0;i:1388;}i:1341;a:1:{i:0;i:1389;}i:1342;a:1:{i:0;i:1390;}i:1343;a:1:{i:0;i:1391;}i:1344;a:1:{i:0;i:1392;}i:1345;a:1:{i:0;i:1393;}i:1346;a:1:{i:0;i:1394;}i:1347;a:1:{i:0;i:1395;}i:1348;a:1:{i:0;i:1396;}i:1349;a:1:{i:0;i:1397;}i:1350;a:1:{i:0;i:1398;}i:1351;a:1:{i:0;i:1399;}i:1352;a:1:{i:0;i:1400;}i:1353;a:1:{i:0;i:1401;}i:1354;a:1:{i:0;i:1402;}i:1355;a:1:{i:0;i:1403;}i:1356;a:1:{i:0;i:1404;}i:1357;a:1:{i:0;i:1405;}i:1358;a:1:{i:0;i:1406;}i:1359;a:1:{i:0;i:1407;}i:1360;a:1:{i:0;i:1408;}i:1361;a:1:{i:0;i:1409;}i:1362;a:1:{i:0;i:1410;}i:1363;a:1:{i:0;i:1411;}i:1364;a:1:{i:0;i:1412;}i:1365;a:1:{i:0;i:1413;}i:1366;a:1:{i:0;i:1414;}i:1415;a:2:{i:0;i:1381;i:1;i:1410;}i:7680;a:1:{i:0;i:7681;}i:7682;a:1:{i:0;i:7683;}i:7684;a:1:{i:0;i:7685;}i:7686;a:1:{i:0;i:7687;}i:7688;a:1:{i:0;i:7689;}i:7690;a:1:{i:0;i:7691;}i:7692;a:1:{i:0;i:7693;}i:7694;a:1:{i:0;i:7695;}i:7696;a:1:{i:0;i:7697;}i:7698;a:1:{i:0;i:7699;}i:7700;a:1:{i:0;i:7701;}i:7702;a:1:{i:0;i:7703;}i:7704;a:1:{i:0;i:7705;}i:7706;a:1:{i:0;i:7707;}i:7708;a:1:{i:0;i:7709;}i:7710;a:1:{i:0;i:7711;}i:7712;a:1:{i:0;i:7713;}i:7714;a:1:{i:0;i:7715;}i:7716;a:1:{i:0;i:7717;}i:7718;a:1:{i:0;i:7719;}i:7720;a:1:{i:0;i:7721;}i:7722;a:1:{i:0;i:7723;}i:7724;a:1:{i:0;i:7725;}i:7726;a:1:{i:0;i:7727;}i:7728;a:1:{i:0;i:7729;}i:7730;a:1:{i:0;i:7731;}i:7732;a:1:{i:0;i:7733;}i:7734;a:1:{i:0;i:7735;}i:7736;a:1:{i:0;i:7737;}i:7738;a:1:{i:0;i:7739;}i:7740;a:1:{i:0;i:7741;}i:7742;a:1:{i:0;i:7743;}i:7744;a:1:{i:0;i:7745;}i:7746;a:1:{i:0;i:7747;}i:7748;a:1:{i:0;i:7749;}i:7750;a:1:{i:0;i:7751;}i:7752;a:1:{i:0;i:7753;}i:7754;a:1:{i:0;i:7755;}i:7756;a:1:{i:0;i:7757;}i:7758;a:1:{i:0;i:7759;}i:7760;a:1:{i:0;i:7761;}i:7762;a:1:{i:0;i:7763;}i:7764;a:1:{i:0;i:7765;}i:7766;a:1:{i:0;i:7767;}i:7768;a:1:{i:0;i:7769;}i:7770;a:1:{i:0;i:7771;}i:7772;a:1:{i:0;i:7773;}i:7774;a:1:{i:0;i:7775;}i:7776;a:1:{i:0;i:7777;}i:7778;a:1:{i:0;i:7779;}i:7780;a:1:{i:0;i:7781;}i:7782;a:1:{i:0;i:7783;}i:7784;a:1:{i:0;i:7785;}i:7786;a:1:{i:0;i:7787;}i:7788;a:1:{i:0;i:7789;}i:7790;a:1:{i:0;i:7791;}i:7792;a:1:{i:0;i:7793;}i:7794;a:1:{i:0;i:7795;}i:7796;a:1:{i:0;i:7797;}i:7798;a:1:{i:0;i:7799;}i:7800;a:1:{i:0;i:7801;}i:7802;a:1:{i:0;i:7803;}i:7804;a:1:{i:0;i:7805;}i:7806;a:1:{i:0;i:7807;}i:7808;a:1:{i:0;i:7809;}i:7810;a:1:{i:0;i:7811;}i:7812;a:1:{i:0;i:7813;}i:7814;a:1:{i:0;i:7815;}i:7816;a:1:{i:0;i:7817;}i:7818;a:1:{i:0;i:7819;}i:7820;a:1:{i:0;i:7821;}i:7822;a:1:{i:0;i:7823;}i:7824;a:1:{i:0;i:7825;}i:7826;a:1:{i:0;i:7827;}i:7828;a:1:{i:0;i:7829;}i:7830;a:2:{i:0;i:104;i:1;i:817;}i:7831;a:2:{i:0;i:116;i:1;i:776;}i:7832;a:2:{i:0;i:119;i:1;i:778;}i:7833;a:2:{i:0;i:121;i:1;i:778;}i:7834;a:2:{i:0;i:97;i:1;i:702;}i:7835;a:1:{i:0;i:7777;}i:7840;a:1:{i:0;i:7841;}i:7842;a:1:{i:0;i:7843;}i:7844;a:1:{i:0;i:7845;}i:7846;a:1:{i:0;i:7847;}i:7848;a:1:{i:0;i:7849;}i:7850;a:1:{i:0;i:7851;}i:7852;a:1:{i:0;i:7853;}i:7854;a:1:{i:0;i:7855;}i:7856;a:1:{i:0;i:7857;}i:7858;a:1:{i:0;i:7859;}i:7860;a:1:{i:0;i:7861;}i:7862;a:1:{i:0;i:7863;}i:7864;a:1:{i:0;i:7865;}i:7866;a:1:{i:0;i:7867;}i:7868;a:1:{i:0;i:7869;}i:7870;a:1:{i:0;i:7871;}i:7872;a:1:{i:0;i:7873;}i:7874;a:1:{i:0;i:7875;}i:7876;a:1:{i:0;i:7877;}i:7878;a:1:{i:0;i:7879;}i:7880;a:1:{i:0;i:7881;}i:7882;a:1:{i:0;i:7883;}i:7884;a:1:{i:0;i:7885;}i:7886;a:1:{i:0;i:7887;}i:7888;a:1:{i:0;i:7889;}i:7890;a:1:{i:0;i:7891;}i:7892;a:1:{i:0;i:7893;}i:7894;a:1:{i:0;i:7895;}i:7896;a:1:{i:0;i:7897;}i:7898;a:1:{i:0;i:7899;}i:7900;a:1:{i:0;i:7901;}i:7902;a:1:{i:0;i:7903;}i:7904;a:1:{i:0;i:7905;}i:7906;a:1:{i:0;i:7907;}i:7908;a:1:{i:0;i:7909;}i:7910;a:1:{i:0;i:7911;}i:7912;a:1:{i:0;i:7913;}i:7914;a:1:{i:0;i:7915;}i:7916;a:1:{i:0;i:7917;}i:7918;a:1:{i:0;i:7919;}i:7920;a:1:{i:0;i:7921;}i:7922;a:1:{i:0;i:7923;}i:7924;a:1:{i:0;i:7925;}i:7926;a:1:{i:0;i:7927;}i:7928;a:1:{i:0;i:7929;}i:7944;a:1:{i:0;i:7936;}i:7945;a:1:{i:0;i:7937;}i:7946;a:1:{i:0;i:7938;}i:7947;a:1:{i:0;i:7939;}i:7948;a:1:{i:0;i:7940;}i:7949;a:1:{i:0;i:7941;}i:7950;a:1:{i:0;i:7942;}i:7951;a:1:{i:0;i:7943;}i:7960;a:1:{i:0;i:7952;}i:7961;a:1:{i:0;i:7953;}i:7962;a:1:{i:0;i:7954;}i:7963;a:1:{i:0;i:7955;}i:7964;a:1:{i:0;i:7956;}i:7965;a:1:{i:0;i:7957;}i:7976;a:1:{i:0;i:7968;}i:7977;a:1:{i:0;i:7969;}i:7978;a:1:{i:0;i:7970;}i:7979;a:1:{i:0;i:7971;}i:7980;a:1:{i:0;i:7972;}i:7981;a:1:{i:0;i:7973;}i:7982;a:1:{i:0;i:7974;}i:7983;a:1:{i:0;i:7975;}i:7992;a:1:{i:0;i:7984;}i:7993;a:1:{i:0;i:7985;}i:7994;a:1:{i:0;i:7986;}i:7995;a:1:{i:0;i:7987;}i:7996;a:1:{i:0;i:7988;}i:7997;a:1:{i:0;i:7989;}i:7998;a:1:{i:0;i:7990;}i:7999;a:1:{i:0;i:7991;}i:8008;a:1:{i:0;i:8000;}i:8009;a:1:{i:0;i:8001;}i:8010;a:1:{i:0;i:8002;}i:8011;a:1:{i:0;i:8003;}i:8012;a:1:{i:0;i:8004;}i:8013;a:1:{i:0;i:8005;}i:8016;a:2:{i:0;i:965;i:1;i:787;}i:8018;a:3:{i:0;i:965;i:1;i:787;i:2;i:768;}i:8020;a:3:{i:0;i:965;i:1;i:787;i:2;i:769;}i:8022;a:3:{i:0;i:965;i:1;i:787;i:2;i:834;}i:8025;a:1:{i:0;i:8017;}i:8027;a:1:{i:0;i:8019;}i:8029;a:1:{i:0;i:8021;}i:8031;a:1:{i:0;i:8023;}i:8040;a:1:{i:0;i:8032;}i:8041;a:1:{i:0;i:8033;}i:8042;a:1:{i:0;i:8034;}i:8043;a:1:{i:0;i:8035;}i:8044;a:1:{i:0;i:8036;}i:8045;a:1:{i:0;i:8037;}i:8046;a:1:{i:0;i:8038;}i:8047;a:1:{i:0;i:8039;}i:8064;a:2:{i:0;i:7936;i:1;i:953;}i:8065;a:2:{i:0;i:7937;i:1;i:953;}i:8066;a:2:{i:0;i:7938;i:1;i:953;}i:8067;a:2:{i:0;i:7939;i:1;i:953;}i:8068;a:2:{i:0;i:7940;i:1;i:953;}i:8069;a:2:{i:0;i:7941;i:1;i:953;}i:8070;a:2:{i:0;i:7942;i:1;i:953;}i:8071;a:2:{i:0;i:7943;i:1;i:953;}i:8072;a:2:{i:0;i:7936;i:1;i:953;}i:8073;a:2:{i:0;i:7937;i:1;i:953;}i:8074;a:2:{i:0;i:7938;i:1;i:953;}i:8075;a:2:{i:0;i:7939;i:1;i:953;}i:8076;a:2:{i:0;i:7940;i:1;i:953;}i:8077;a:2:{i:0;i:7941;i:1;i:953;}i:8078;a:2:{i:0;i:7942;i:1;i:953;}i:8079;a:2:{i:0;i:7943;i:1;i:953;}i:8080;a:2:{i:0;i:7968;i:1;i:953;}i:8081;a:2:{i:0;i:7969;i:1;i:953;}i:8082;a:2:{i:0;i:7970;i:1;i:953;}i:8083;a:2:{i:0;i:7971;i:1;i:953;}i:8084;a:2:{i:0;i:7972;i:1;i:953;}i:8085;a:2:{i:0;i:7973;i:1;i:953;}i:8086;a:2:{i:0;i:7974;i:1;i:953;}i:8087;a:2:{i:0;i:7975;i:1;i:953;}i:8088;a:2:{i:0;i:7968;i:1;i:953;}i:8089;a:2:{i:0;i:7969;i:1;i:953;}i:8090;a:2:{i:0;i:7970;i:1;i:953;}i:8091;a:2:{i:0;i:7971;i:1;i:953;}i:8092;a:2:{i:0;i:7972;i:1;i:953;}i:8093;a:2:{i:0;i:7973;i:1;i:953;}i:8094;a:2:{i:0;i:7974;i:1;i:953;}i:8095;a:2:{i:0;i:7975;i:1;i:953;}i:8096;a:2:{i:0;i:8032;i:1;i:953;}i:8097;a:2:{i:0;i:8033;i:1;i:953;}i:8098;a:2:{i:0;i:8034;i:1;i:953;}i:8099;a:2:{i:0;i:8035;i:1;i:953;}i:8100;a:2:{i:0;i:8036;i:1;i:953;}i:8101;a:2:{i:0;i:8037;i:1;i:953;}i:8102;a:2:{i:0;i:8038;i:1;i:953;}i:8103;a:2:{i:0;i:8039;i:1;i:953;}i:8104;a:2:{i:0;i:8032;i:1;i:953;}i:8105;a:2:{i:0;i:8033;i:1;i:953;}i:8106;a:2:{i:0;i:8034;i:1;i:953;}i:8107;a:2:{i:0;i:8035;i:1;i:953;}i:8108;a:2:{i:0;i:8036;i:1;i:953;}i:8109;a:2:{i:0;i:8037;i:1;i:953;}i:8110;a:2:{i:0;i:8038;i:1;i:953;}i:8111;a:2:{i:0;i:8039;i:1;i:953;}i:8114;a:2:{i:0;i:8048;i:1;i:953;}i:8115;a:2:{i:0;i:945;i:1;i:953;}i:8116;a:2:{i:0;i:940;i:1;i:953;}i:8118;a:2:{i:0;i:945;i:1;i:834;}i:8119;a:3:{i:0;i:945;i:1;i:834;i:2;i:953;}i:8120;a:1:{i:0;i:8112;}i:8121;a:1:{i:0;i:8113;}i:8122;a:1:{i:0;i:8048;}i:8123;a:1:{i:0;i:8049;}i:8124;a:2:{i:0;i:945;i:1;i:953;}i:8126;a:1:{i:0;i:953;}i:8130;a:2:{i:0;i:8052;i:1;i:953;}i:8131;a:2:{i:0;i:951;i:1;i:953;}i:8132;a:2:{i:0;i:942;i:1;i:953;}i:8134;a:2:{i:0;i:951;i:1;i:834;}i:8135;a:3:{i:0;i:951;i:1;i:834;i:2;i:953;}i:8136;a:1:{i:0;i:8050;}i:8137;a:1:{i:0;i:8051;}i:8138;a:1:{i:0;i:8052;}i:8139;a:1:{i:0;i:8053;}i:8140;a:2:{i:0;i:951;i:1;i:953;}i:8146;a:3:{i:0;i:953;i:1;i:776;i:2;i:768;}i:8147;a:3:{i:0;i:953;i:1;i:776;i:2;i:769;}i:8150;a:2:{i:0;i:953;i:1;i:834;}i:8151;a:3:{i:0;i:953;i:1;i:776;i:2;i:834;}i:8152;a:1:{i:0;i:8144;}i:8153;a:1:{i:0;i:8145;}i:8154;a:1:{i:0;i:8054;}i:8155;a:1:{i:0;i:8055;}i:8162;a:3:{i:0;i:965;i:1;i:776;i:2;i:768;}i:8163;a:3:{i:0;i:965;i:1;i:776;i:2;i:769;}i:8164;a:2:{i:0;i:961;i:1;i:787;}i:8166;a:2:{i:0;i:965;i:1;i:834;}i:8167;a:3:{i:0;i:965;i:1;i:776;i:2;i:834;}i:8168;a:1:{i:0;i:8160;}i:8169;a:1:{i:0;i:8161;}i:8170;a:1:{i:0;i:8058;}i:8171;a:1:{i:0;i:8059;}i:8172;a:1:{i:0;i:8165;}i:8178;a:2:{i:0;i:8060;i:1;i:953;}i:8179;a:2:{i:0;i:969;i:1;i:953;}i:8180;a:2:{i:0;i:974;i:1;i:953;}i:8182;a:2:{i:0;i:969;i:1;i:834;}i:8183;a:3:{i:0;i:969;i:1;i:834;i:2;i:953;}i:8184;a:1:{i:0;i:8056;}i:8185;a:1:{i:0;i:8057;}i:8186;a:1:{i:0;i:8060;}i:8187;a:1:{i:0;i:8061;}i:8188;a:2:{i:0;i:969;i:1;i:953;}i:8360;a:2:{i:0;i:114;i:1;i:115;}i:8450;a:1:{i:0;i:99;}i:8451;a:2:{i:0;i:176;i:1;i:99;}i:8455;a:1:{i:0;i:603;}i:8457;a:2:{i:0;i:176;i:1;i:102;}i:8459;a:1:{i:0;i:104;}i:8460;a:1:{i:0;i:104;}i:8461;a:1:{i:0;i:104;}i:8464;a:1:{i:0;i:105;}i:8465;a:1:{i:0;i:105;}i:8466;a:1:{i:0;i:108;}i:8469;a:1:{i:0;i:110;}i:8470;a:2:{i:0;i:110;i:1;i:111;}i:8473;a:1:{i:0;i:112;}i:8474;a:1:{i:0;i:113;}i:8475;a:1:{i:0;i:114;}i:8476;a:1:{i:0;i:114;}i:8477;a:1:{i:0;i:114;}i:8480;a:2:{i:0;i:115;i:1;i:109;}i:8481;a:3:{i:0;i:116;i:1;i:101;i:2;i:108;}i:8482;a:2:{i:0;i:116;i:1;i:109;}i:8484;a:1:{i:0;i:122;}i:8486;a:1:{i:0;i:969;}i:8488;a:1:{i:0;i:122;}i:8490;a:1:{i:0;i:107;}i:8491;a:1:{i:0;i:229;}i:8492;a:1:{i:0;i:98;}i:8493;a:1:{i:0;i:99;}i:8496;a:1:{i:0;i:101;}i:8497;a:1:{i:0;i:102;}i:8499;a:1:{i:0;i:109;}i:8510;a:1:{i:0;i:947;}i:8511;a:1:{i:0;i:960;}i:8517;a:1:{i:0;i:100;}i:8544;a:1:{i:0;i:8560;}i:8545;a:1:{i:0;i:8561;}i:8546;a:1:{i:0;i:8562;}i:8547;a:1:{i:0;i:8563;}i:8548;a:1:{i:0;i:8564;}i:8549;a:1:{i:0;i:8565;}i:8550;a:1:{i:0;i:8566;}i:8551;a:1:{i:0;i:8567;}i:8552;a:1:{i:0;i:8568;}i:8553;a:1:{i:0;i:8569;}i:8554;a:1:{i:0;i:8570;}i:8555;a:1:{i:0;i:8571;}i:8556;a:1:{i:0;i:8572;}i:8557;a:1:{i:0;i:8573;}i:8558;a:1:{i:0;i:8574;}i:8559;a:1:{i:0;i:8575;}i:9398;a:1:{i:0;i:9424;}i:9399;a:1:{i:0;i:9425;}i:9400;a:1:{i:0;i:9426;}i:9401;a:1:{i:0;i:9427;}i:9402;a:1:{i:0;i:9428;}i:9403;a:1:{i:0;i:9429;}i:9404;a:1:{i:0;i:9430;}i:9405;a:1:{i:0;i:9431;}i:9406;a:1:{i:0;i:9432;}i:9407;a:1:{i:0;i:9433;}i:9408;a:1:{i:0;i:9434;}i:9409;a:1:{i:0;i:9435;}i:9410;a:1:{i:0;i:9436;}i:9411;a:1:{i:0;i:9437;}i:9412;a:1:{i:0;i:9438;}i:9413;a:1:{i:0;i:9439;}i:9414;a:1:{i:0;i:9440;}i:9415;a:1:{i:0;i:9441;}i:9416;a:1:{i:0;i:9442;}i:9417;a:1:{i:0;i:9443;}i:9418;a:1:{i:0;i:9444;}i:9419;a:1:{i:0;i:9445;}i:9420;a:1:{i:0;i:9446;}i:9421;a:1:{i:0;i:9447;}i:9422;a:1:{i:0;i:9448;}i:9423;a:1:{i:0;i:9449;}i:13169;a:3:{i:0;i:104;i:1;i:112;i:2;i:97;}i:13171;a:2:{i:0;i:97;i:1;i:117;}i:13173;a:2:{i:0;i:111;i:1;i:118;}i:13184;a:2:{i:0;i:112;i:1;i:97;}i:13185;a:2:{i:0;i:110;i:1;i:97;}i:13186;a:2:{i:0;i:956;i:1;i:97;}i:13187;a:2:{i:0;i:109;i:1;i:97;}i:13188;a:2:{i:0;i:107;i:1;i:97;}i:13189;a:2:{i:0;i:107;i:1;i:98;}i:13190;a:2:{i:0;i:109;i:1;i:98;}i:13191;a:2:{i:0;i:103;i:1;i:98;}i:13194;a:2:{i:0;i:112;i:1;i:102;}i:13195;a:2:{i:0;i:110;i:1;i:102;}i:13196;a:2:{i:0;i:956;i:1;i:102;}i:13200;a:2:{i:0;i:104;i:1;i:122;}i:13201;a:3:{i:0;i:107;i:1;i:104;i:2;i:122;}i:13202;a:3:{i:0;i:109;i:1;i:104;i:2;i:122;}i:13203;a:3:{i:0;i:103;i:1;i:104;i:2;i:122;}i:13204;a:3:{i:0;i:116;i:1;i:104;i:2;i:122;}i:13225;a:2:{i:0;i:112;i:1;i:97;}i:13226;a:3:{i:0;i:107;i:1;i:112;i:2;i:97;}i:13227;a:3:{i:0;i:109;i:1;i:112;i:2;i:97;}i:13228;a:3:{i:0;i:103;i:1;i:112;i:2;i:97;}i:13236;a:2:{i:0;i:112;i:1;i:118;}i:13237;a:2:{i:0;i:110;i:1;i:118;}i:13238;a:2:{i:0;i:956;i:1;i:118;}i:13239;a:2:{i:0;i:109;i:1;i:118;}i:13240;a:2:{i:0;i:107;i:1;i:118;}i:13241;a:2:{i:0;i:109;i:1;i:118;}i:13242;a:2:{i:0;i:112;i:1;i:119;}i:13243;a:2:{i:0;i:110;i:1;i:119;}i:13244;a:2:{i:0;i:956;i:1;i:119;}i:13245;a:2:{i:0;i:109;i:1;i:119;}i:13246;a:2:{i:0;i:107;i:1;i:119;}i:13247;a:2:{i:0;i:109;i:1;i:119;}i:13248;a:2:{i:0;i:107;i:1;i:969;}i:13249;a:2:{i:0;i:109;i:1;i:969;}i:13251;a:2:{i:0;i:98;i:1;i:113;}i:13254;a:4:{i:0;i:99;i:1;i:8725;i:2;i:107;i:3;i:103;}i:13255;a:3:{i:0;i:99;i:1;i:111;i:2;i:46;}i:13256;a:2:{i:0;i:100;i:1;i:98;}i:13257;a:2:{i:0;i:103;i:1;i:121;}i:13259;a:2:{i:0;i:104;i:1;i:112;}i:13261;a:2:{i:0;i:107;i:1;i:107;}i:13262;a:2:{i:0;i:107;i:1;i:109;}i:13271;a:2:{i:0;i:112;i:1;i:104;}i:13273;a:3:{i:0;i:112;i:1;i:112;i:2;i:109;}i:13274;a:2:{i:0;i:112;i:1;i:114;}i:13276;a:2:{i:0;i:115;i:1;i:118;}i:13277;a:2:{i:0;i:119;i:1;i:98;}i:64256;a:2:{i:0;i:102;i:1;i:102;}i:64257;a:2:{i:0;i:102;i:1;i:105;}i:64258;a:2:{i:0;i:102;i:1;i:108;}i:64259;a:3:{i:0;i:102;i:1;i:102;i:2;i:105;}i:64260;a:3:{i:0;i:102;i:1;i:102;i:2;i:108;}i:64261;a:2:{i:0;i:115;i:1;i:116;}i:64262;a:2:{i:0;i:115;i:1;i:116;}i:64275;a:2:{i:0;i:1396;i:1;i:1398;}i:64276;a:2:{i:0;i:1396;i:1;i:1381;}i:64277;a:2:{i:0;i:1396;i:1;i:1387;}i:64278;a:2:{i:0;i:1406;i:1;i:1398;}i:64279;a:2:{i:0;i:1396;i:1;i:1389;}i:65313;a:1:{i:0;i:65345;}i:65314;a:1:{i:0;i:65346;}i:65315;a:1:{i:0;i:65347;}i:65316;a:1:{i:0;i:65348;}i:65317;a:1:{i:0;i:65349;}i:65318;a:1:{i:0;i:65350;}i:65319;a:1:{i:0;i:65351;}i:65320;a:1:{i:0;i:65352;}i:65321;a:1:{i:0;i:65353;}i:65322;a:1:{i:0;i:65354;}i:65323;a:1:{i:0;i:65355;}i:65324;a:1:{i:0;i:65356;}i:65325;a:1:{i:0;i:65357;}i:65326;a:1:{i:0;i:65358;}i:65327;a:1:{i:0;i:65359;}i:65328;a:1:{i:0;i:65360;}i:65329;a:1:{i:0;i:65361;}i:65330;a:1:{i:0;i:65362;}i:65331;a:1:{i:0;i:65363;}i:65332;a:1:{i:0;i:65364;}i:65333;a:1:{i:0;i:65365;}i:65334;a:1:{i:0;i:65366;}i:65335;a:1:{i:0;i:65367;}i:65336;a:1:{i:0;i:65368;}i:65337;a:1:{i:0;i:65369;}i:65338;a:1:{i:0;i:65370;}i:66560;a:1:{i:0;i:66600;}i:66561;a:1:{i:0;i:66601;}i:66562;a:1:{i:0;i:66602;}i:66563;a:1:{i:0;i:66603;}i:66564;a:1:{i:0;i:66604;}i:66565;a:1:{i:0;i:66605;}i:66566;a:1:{i:0;i:66606;}i:66567;a:1:{i:0;i:66607;}i:66568;a:1:{i:0;i:66608;}i:66569;a:1:{i:0;i:66609;}i:66570;a:1:{i:0;i:66610;}i:66571;a:1:{i:0;i:66611;}i:66572;a:1:{i:0;i:66612;}i:66573;a:1:{i:0;i:66613;}i:66574;a:1:{i:0;i:66614;}i:66575;a:1:{i:0;i:66615;}i:66576;a:1:{i:0;i:66616;}i:66577;a:1:{i:0;i:66617;}i:66578;a:1:{i:0;i:66618;}i:66579;a:1:{i:0;i:66619;}i:66580;a:1:{i:0;i:66620;}i:66581;a:1:{i:0;i:66621;}i:66582;a:1:{i:0;i:66622;}i:66583;a:1:{i:0;i:66623;}i:66584;a:1:{i:0;i:66624;}i:66585;a:1:{i:0;i:66625;}i:66586;a:1:{i:0;i:66626;}i:66587;a:1:{i:0;i:66627;}i:66588;a:1:{i:0;i:66628;}i:66589;a:1:{i:0;i:66629;}i:66590;a:1:{i:0;i:66630;}i:66591;a:1:{i:0;i:66631;}i:66592;a:1:{i:0;i:66632;}i:66593;a:1:{i:0;i:66633;}i:66594;a:1:{i:0;i:66634;}i:66595;a:1:{i:0;i:66635;}i:66596;a:1:{i:0;i:66636;}i:66597;a:1:{i:0;i:66637;}i:119808;a:1:{i:0;i:97;}i:119809;a:1:{i:0;i:98;}i:119810;a:1:{i:0;i:99;}i:119811;a:1:{i:0;i:100;}i:119812;a:1:{i:0;i:101;}i:119813;a:1:{i:0;i:102;}i:119814;a:1:{i:0;i:103;}i:119815;a:1:{i:0;i:104;}i:119816;a:1:{i:0;i:105;}i:119817;a:1:{i:0;i:106;}i:119818;a:1:{i:0;i:107;}i:119819;a:1:{i:0;i:108;}i:119820;a:1:{i:0;i:109;}i:119821;a:1:{i:0;i:110;}i:119822;a:1:{i:0;i:111;}i:119823;a:1:{i:0;i:112;}i:119824;a:1:{i:0;i:113;}i:119825;a:1:{i:0;i:114;}i:119826;a:1:{i:0;i:115;}i:119827;a:1:{i:0;i:116;}i:119828;a:1:{i:0;i:117;}i:119829;a:1:{i:0;i:118;}i:119830;a:1:{i:0;i:119;}i:119831;a:1:{i:0;i:120;}i:119832;a:1:{i:0;i:121;}i:119833;a:1:{i:0;i:122;}i:119860;a:1:{i:0;i:97;}i:119861;a:1:{i:0;i:98;}i:119862;a:1:{i:0;i:99;}i:119863;a:1:{i:0;i:100;}i:119864;a:1:{i:0;i:101;}i:119865;a:1:{i:0;i:102;}i:119866;a:1:{i:0;i:103;}i:119867;a:1:{i:0;i:104;}i:119868;a:1:{i:0;i:105;}i:119869;a:1:{i:0;i:106;}i:119870;a:1:{i:0;i:107;}i:119871;a:1:{i:0;i:108;}i:119872;a:1:{i:0;i:109;}i:119873;a:1:{i:0;i:110;}i:119874;a:1:{i:0;i:111;}i:119875;a:1:{i:0;i:112;}i:119876;a:1:{i:0;i:113;}i:119877;a:1:{i:0;i:114;}i:119878;a:1:{i:0;i:115;}i:119879;a:1:{i:0;i:116;}i:119880;a:1:{i:0;i:117;}i:119881;a:1:{i:0;i:118;}i:119882;a:1:{i:0;i:119;}i:119883;a:1:{i:0;i:120;}i:119884;a:1:{i:0;i:121;}i:119885;a:1:{i:0;i:122;}i:119912;a:1:{i:0;i:97;}i:119913;a:1:{i:0;i:98;}i:119914;a:1:{i:0;i:99;}i:119915;a:1:{i:0;i:100;}i:119916;a:1:{i:0;i:101;}i:119917;a:1:{i:0;i:102;}i:119918;a:1:{i:0;i:103;}i:119919;a:1:{i:0;i:104;}i:119920;a:1:{i:0;i:105;}i:119921;a:1:{i:0;i:106;}i:119922;a:1:{i:0;i:107;}i:119923;a:1:{i:0;i:108;}i:119924;a:1:{i:0;i:109;}i:119925;a:1:{i:0;i:110;}i:119926;a:1:{i:0;i:111;}i:119927;a:1:{i:0;i:112;}i:119928;a:1:{i:0;i:113;}i:119929;a:1:{i:0;i:114;}i:119930;a:1:{i:0;i:115;}i:119931;a:1:{i:0;i:116;}i:119932;a:1:{i:0;i:117;}i:119933;a:1:{i:0;i:118;}i:119934;a:1:{i:0;i:119;}i:119935;a:1:{i:0;i:120;}i:119936;a:1:{i:0;i:121;}i:119937;a:1:{i:0;i:122;}i:119964;a:1:{i:0;i:97;}i:119966;a:1:{i:0;i:99;}i:119967;a:1:{i:0;i:100;}i:119970;a:1:{i:0;i:103;}i:119973;a:1:{i:0;i:106;}i:119974;a:1:{i:0;i:107;}i:119977;a:1:{i:0;i:110;}i:119978;a:1:{i:0;i:111;}i:119979;a:1:{i:0;i:112;}i:119980;a:1:{i:0;i:113;}i:119982;a:1:{i:0;i:115;}i:119983;a:1:{i:0;i:116;}i:119984;a:1:{i:0;i:117;}i:119985;a:1:{i:0;i:118;}i:119986;a:1:{i:0;i:119;}i:119987;a:1:{i:0;i:120;}i:119988;a:1:{i:0;i:121;}i:119989;a:1:{i:0;i:122;}i:120016;a:1:{i:0;i:97;}i:120017;a:1:{i:0;i:98;}i:120018;a:1:{i:0;i:99;}i:120019;a:1:{i:0;i:100;}i:120020;a:1:{i:0;i:101;}i:120021;a:1:{i:0;i:102;}i:120022;a:1:{i:0;i:103;}i:120023;a:1:{i:0;i:104;}i:120024;a:1:{i:0;i:105;}i:120025;a:1:{i:0;i:106;}i:120026;a:1:{i:0;i:107;}i:120027;a:1:{i:0;i:108;}i:120028;a:1:{i:0;i:109;}i:120029;a:1:{i:0;i:110;}i:120030;a:1:{i:0;i:111;}i:120031;a:1:{i:0;i:112;}i:120032;a:1:{i:0;i:113;}i:120033;a:1:{i:0;i:114;}i:120034;a:1:{i:0;i:115;}i:120035;a:1:{i:0;i:116;}i:120036;a:1:{i:0;i:117;}i:120037;a:1:{i:0;i:118;}i:120038;a:1:{i:0;i:119;}i:120039;a:1:{i:0;i:120;}i:120040;a:1:{i:0;i:121;}i:120041;a:1:{i:0;i:122;}i:120068;a:1:{i:0;i:97;}i:120069;a:1:{i:0;i:98;}i:120071;a:1:{i:0;i:100;}i:120072;a:1:{i:0;i:101;}i:120073;a:1:{i:0;i:102;}i:120074;a:1:{i:0;i:103;}i:120077;a:1:{i:0;i:106;}i:120078;a:1:{i:0;i:107;}i:120079;a:1:{i:0;i:108;}i:120080;a:1:{i:0;i:109;}i:120081;a:1:{i:0;i:110;}i:120082;a:1:{i:0;i:111;}i:120083;a:1:{i:0;i:112;}i:120084;a:1:{i:0;i:113;}i:120086;a:1:{i:0;i:115;}i:120087;a:1:{i:0;i:116;}i:120088;a:1:{i:0;i:117;}i:120089;a:1:{i:0;i:118;}i:120090;a:1:{i:0;i:119;}i:120091;a:1:{i:0;i:120;}i:120092;a:1:{i:0;i:121;}i:120120;a:1:{i:0;i:97;}i:120121;a:1:{i:0;i:98;}i:120123;a:1:{i:0;i:100;}i:120124;a:1:{i:0;i:101;}i:120125;a:1:{i:0;i:102;}i:120126;a:1:{i:0;i:103;}i:120128;a:1:{i:0;i:105;}i:120129;a:1:{i:0;i:106;}i:120130;a:1:{i:0;i:107;}i:120131;a:1:{i:0;i:108;}i:120132;a:1:{i:0;i:109;}i:120134;a:1:{i:0;i:111;}i:120138;a:1:{i:0;i:115;}i:120139;a:1:{i:0;i:116;}i:120140;a:1:{i:0;i:117;}i:120141;a:1:{i:0;i:118;}i:120142;a:1:{i:0;i:119;}i:120143;a:1:{i:0;i:120;}i:120144;a:1:{i:0;i:121;}i:120172;a:1:{i:0;i:97;}i:120173;a:1:{i:0;i:98;}i:120174;a:1:{i:0;i:99;}i:120175;a:1:{i:0;i:100;}i:120176;a:1:{i:0;i:101;}i:120177;a:1:{i:0;i:102;}i:120178;a:1:{i:0;i:103;}i:120179;a:1:{i:0;i:104;}i:120180;a:1:{i:0;i:105;}i:120181;a:1:{i:0;i:106;}i:120182;a:1:{i:0;i:107;}i:120183;a:1:{i:0;i:108;}i:120184;a:1:{i:0;i:109;}i:120185;a:1:{i:0;i:110;}i:120186;a:1:{i:0;i:111;}i:120187;a:1:{i:0;i:112;}i:120188;a:1:{i:0;i:113;}i:120189;a:1:{i:0;i:114;}i:120190;a:1:{i:0;i:115;}i:120191;a:1:{i:0;i:116;}i:120192;a:1:{i:0;i:117;}i:120193;a:1:{i:0;i:118;}i:120194;a:1:{i:0;i:119;}i:120195;a:1:{i:0;i:120;}i:120196;a:1:{i:0;i:121;}i:120197;a:1:{i:0;i:122;}i:120224;a:1:{i:0;i:97;}i:120225;a:1:{i:0;i:98;}i:120226;a:1:{i:0;i:99;}i:120227;a:1:{i:0;i:100;}i:120228;a:1:{i:0;i:101;}i:120229;a:1:{i:0;i:102;}i:120230;a:1:{i:0;i:103;}i:120231;a:1:{i:0;i:104;}i:120232;a:1:{i:0;i:105;}i:120233;a:1:{i:0;i:106;}i:120234;a:1:{i:0;i:107;}i:120235;a:1:{i:0;i:108;}i:120236;a:1:{i:0;i:109;}i:120237;a:1:{i:0;i:110;}i:120238;a:1:{i:0;i:111;}i:120239;a:1:{i:0;i:112;}i:120240;a:1:{i:0;i:113;}i:120241;a:1:{i:0;i:114;}i:120242;a:1:{i:0;i:115;}i:120243;a:1:{i:0;i:116;}i:120244;a:1:{i:0;i:117;}i:120245;a:1:{i:0;i:118;}i:120246;a:1:{i:0;i:119;}i:120247;a:1:{i:0;i:120;}i:120248;a:1:{i:0;i:121;}i:120249;a:1:{i:0;i:122;}i:120276;a:1:{i:0;i:97;}i:120277;a:1:{i:0;i:98;}i:120278;a:1:{i:0;i:99;}i:120279;a:1:{i:0;i:100;}i:120280;a:1:{i:0;i:101;}i:120281;a:1:{i:0;i:102;}i:120282;a:1:{i:0;i:103;}i:120283;a:1:{i:0;i:104;}i:120284;a:1:{i:0;i:105;}i:120285;a:1:{i:0;i:106;}i:120286;a:1:{i:0;i:107;}i:120287;a:1:{i:0;i:108;}i:120288;a:1:{i:0;i:109;}i:120289;a:1:{i:0;i:110;}i:120290;a:1:{i:0;i:111;}i:120291;a:1:{i:0;i:112;}i:120292;a:1:{i:0;i:113;}i:120293;a:1:{i:0;i:114;}i:120294;a:1:{i:0;i:115;}i:120295;a:1:{i:0;i:116;}i:120296;a:1:{i:0;i:117;}i:120297;a:1:{i:0;i:118;}i:120298;a:1:{i:0;i:119;}i:120299;a:1:{i:0;i:120;}i:120300;a:1:{i:0;i:121;}i:120301;a:1:{i:0;i:122;}i:120328;a:1:{i:0;i:97;}i:120329;a:1:{i:0;i:98;}i:120330;a:1:{i:0;i:99;}i:120331;a:1:{i:0;i:100;}i:120332;a:1:{i:0;i:101;}i:120333;a:1:{i:0;i:102;}i:120334;a:1:{i:0;i:103;}i:120335;a:1:{i:0;i:104;}i:120336;a:1:{i:0;i:105;}i:120337;a:1:{i:0;i:106;}i:120338;a:1:{i:0;i:107;}i:120339;a:1:{i:0;i:108;}i:120340;a:1:{i:0;i:109;}i:120341;a:1:{i:0;i:110;}i:120342;a:1:{i:0;i:111;}i:120343;a:1:{i:0;i:112;}i:120344;a:1:{i:0;i:113;}i:120345;a:1:{i:0;i:114;}i:120346;a:1:{i:0;i:115;}i:120347;a:1:{i:0;i:116;}i:120348;a:1:{i:0;i:117;}i:120349;a:1:{i:0;i:118;}i:120350;a:1:{i:0;i:119;}i:120351;a:1:{i:0;i:120;}i:120352;a:1:{i:0;i:121;}i:120353;a:1:{i:0;i:122;}i:120380;a:1:{i:0;i:97;}i:120381;a:1:{i:0;i:98;}i:120382;a:1:{i:0;i:99;}i:120383;a:1:{i:0;i:100;}i:120384;a:1:{i:0;i:101;}i:120385;a:1:{i:0;i:102;}i:120386;a:1:{i:0;i:103;}i:120387;a:1:{i:0;i:104;}i:120388;a:1:{i:0;i:105;}i:120389;a:1:{i:0;i:106;}i:120390;a:1:{i:0;i:107;}i:120391;a:1:{i:0;i:108;}i:120392;a:1:{i:0;i:109;}i:120393;a:1:{i:0;i:110;}i:120394;a:1:{i:0;i:111;}i:120395;a:1:{i:0;i:112;}i:120396;a:1:{i:0;i:113;}i:120397;a:1:{i:0;i:114;}i:120398;a:1:{i:0;i:115;}i:120399;a:1:{i:0;i:116;}i:120400;a:1:{i:0;i:117;}i:120401;a:1:{i:0;i:118;}i:120402;a:1:{i:0;i:119;}i:120403;a:1:{i:0;i:120;}i:120404;a:1:{i:0;i:121;}i:120405;a:1:{i:0;i:122;}i:120432;a:1:{i:0;i:97;}i:120433;a:1:{i:0;i:98;}i:120434;a:1:{i:0;i:99;}i:120435;a:1:{i:0;i:100;}i:120436;a:1:{i:0;i:101;}i:120437;a:1:{i:0;i:102;}i:120438;a:1:{i:0;i:103;}i:120439;a:1:{i:0;i:104;}i:120440;a:1:{i:0;i:105;}i:120441;a:1:{i:0;i:106;}i:120442;a:1:{i:0;i:107;}i:120443;a:1:{i:0;i:108;}i:120444;a:1:{i:0;i:109;}i:120445;a:1:{i:0;i:110;}i:120446;a:1:{i:0;i:111;}i:120447;a:1:{i:0;i:112;}i:120448;a:1:{i:0;i:113;}i:120449;a:1:{i:0;i:114;}i:120450;a:1:{i:0;i:115;}i:120451;a:1:{i:0;i:116;}i:120452;a:1:{i:0;i:117;}i:120453;a:1:{i:0;i:118;}i:120454;a:1:{i:0;i:119;}i:120455;a:1:{i:0;i:120;}i:120456;a:1:{i:0;i:121;}i:120457;a:1:{i:0;i:122;}i:120488;a:1:{i:0;i:945;}i:120489;a:1:{i:0;i:946;}i:120490;a:1:{i:0;i:947;}i:120491;a:1:{i:0;i:948;}i:120492;a:1:{i:0;i:949;}i:120493;a:1:{i:0;i:950;}i:120494;a:1:{i:0;i:951;}i:120495;a:1:{i:0;i:952;}i:120496;a:1:{i:0;i:953;}i:120497;a:1:{i:0;i:954;}i:120498;a:1:{i:0;i:955;}i:120499;a:1:{i:0;i:956;}i:120500;a:1:{i:0;i:957;}i:120501;a:1:{i:0;i:958;}i:120502;a:1:{i:0;i:959;}i:120503;a:1:{i:0;i:960;}i:120504;a:1:{i:0;i:961;}i:120505;a:1:{i:0;i:952;}i:120506;a:1:{i:0;i:963;}i:120507;a:1:{i:0;i:964;}i:120508;a:1:{i:0;i:965;}i:120509;a:1:{i:0;i:966;}i:120510;a:1:{i:0;i:967;}i:120511;a:1:{i:0;i:968;}i:120512;a:1:{i:0;i:969;}i:120531;a:1:{i:0;i:963;}i:120546;a:1:{i:0;i:945;}i:120547;a:1:{i:0;i:946;}i:120548;a:1:{i:0;i:947;}i:120549;a:1:{i:0;i:948;}i:120550;a:1:{i:0;i:949;}i:120551;a:1:{i:0;i:950;}i:120552;a:1:{i:0;i:951;}i:120553;a:1:{i:0;i:952;}i:120554;a:1:{i:0;i:953;}i:120555;a:1:{i:0;i:954;}i:120556;a:1:{i:0;i:955;}i:120557;a:1:{i:0;i:956;}i:120558;a:1:{i:0;i:957;}i:120559;a:1:{i:0;i:958;}i:120560;a:1:{i:0;i:959;}i:120561;a:1:{i:0;i:960;}i:120562;a:1:{i:0;i:961;}i:120563;a:1:{i:0;i:952;}i:120564;a:1:{i:0;i:963;}i:120565;a:1:{i:0;i:964;}i:120566;a:1:{i:0;i:965;}i:120567;a:1:{i:0;i:966;}i:120568;a:1:{i:0;i:967;}i:120569;a:1:{i:0;i:968;}i:120570;a:1:{i:0;i:969;}i:120589;a:1:{i:0;i:963;}i:120604;a:1:{i:0;i:945;}i:120605;a:1:{i:0;i:946;}i:120606;a:1:{i:0;i:947;}i:120607;a:1:{i:0;i:948;}i:120608;a:1:{i:0;i:949;}i:120609;a:1:{i:0;i:950;}i:120610;a:1:{i:0;i:951;}i:120611;a:1:{i:0;i:952;}i:120612;a:1:{i:0;i:953;}i:120613;a:1:{i:0;i:954;}i:120614;a:1:{i:0;i:955;}i:120615;a:1:{i:0;i:956;}i:120616;a:1:{i:0;i:957;}i:120617;a:1:{i:0;i:958;}i:120618;a:1:{i:0;i:959;}i:120619;a:1:{i:0;i:960;}i:120620;a:1:{i:0;i:961;}i:120621;a:1:{i:0;i:952;}i:120622;a:1:{i:0;i:963;}i:120623;a:1:{i:0;i:964;}i:120624;a:1:{i:0;i:965;}i:120625;a:1:{i:0;i:966;}i:120626;a:1:{i:0;i:967;}i:120627;a:1:{i:0;i:968;}i:120628;a:1:{i:0;i:969;}i:120647;a:1:{i:0;i:963;}i:120662;a:1:{i:0;i:945;}i:120663;a:1:{i:0;i:946;}i:120664;a:1:{i:0;i:947;}i:120665;a:1:{i:0;i:948;}i:120666;a:1:{i:0;i:949;}i:120667;a:1:{i:0;i:950;}i:120668;a:1:{i:0;i:951;}i:120669;a:1:{i:0;i:952;}i:120670;a:1:{i:0;i:953;}i:120671;a:1:{i:0;i:954;}i:120672;a:1:{i:0;i:955;}i:120673;a:1:{i:0;i:956;}i:120674;a:1:{i:0;i:957;}i:120675;a:1:{i:0;i:958;}i:120676;a:1:{i:0;i:959;}i:120677;a:1:{i:0;i:960;}i:120678;a:1:{i:0;i:961;}i:120679;a:1:{i:0;i:952;}i:120680;a:1:{i:0;i:963;}i:120681;a:1:{i:0;i:964;}i:120682;a:1:{i:0;i:965;}i:120683;a:1:{i:0;i:966;}i:120684;a:1:{i:0;i:967;}i:120685;a:1:{i:0;i:968;}i:120686;a:1:{i:0;i:969;}i:120705;a:1:{i:0;i:963;}i:120720;a:1:{i:0;i:945;}i:120721;a:1:{i:0;i:946;}i:120722;a:1:{i:0;i:947;}i:120723;a:1:{i:0;i:948;}i:120724;a:1:{i:0;i:949;}i:120725;a:1:{i:0;i:950;}i:120726;a:1:{i:0;i:951;}i:120727;a:1:{i:0;i:952;}i:120728;a:1:{i:0;i:953;}i:120729;a:1:{i:0;i:954;}i:120730;a:1:{i:0;i:955;}i:120731;a:1:{i:0;i:956;}i:120732;a:1:{i:0;i:957;}i:120733;a:1:{i:0;i:958;}i:120734;a:1:{i:0;i:959;}i:120735;a:1:{i:0;i:960;}i:120736;a:1:{i:0;i:961;}i:120737;a:1:{i:0;i:952;}i:120738;a:1:{i:0;i:963;}i:120739;a:1:{i:0;i:964;}i:120740;a:1:{i:0;i:965;}i:120741;a:1:{i:0;i:966;}i:120742;a:1:{i:0;i:967;}i:120743;a:1:{i:0;i:968;}i:120744;a:1:{i:0;i:969;}i:120763;a:1:{i:0;i:963;}i:1017;a:1:{i:0;i:963;}i:7468;a:1:{i:0;i:97;}i:7469;a:1:{i:0;i:230;}i:7470;a:1:{i:0;i:98;}i:7472;a:1:{i:0;i:100;}i:7473;a:1:{i:0;i:101;}i:7474;a:1:{i:0;i:477;}i:7475;a:1:{i:0;i:103;}i:7476;a:1:{i:0;i:104;}i:7477;a:1:{i:0;i:105;}i:7478;a:1:{i:0;i:106;}i:7479;a:1:{i:0;i:107;}i:7480;a:1:{i:0;i:108;}i:7481;a:1:{i:0;i:109;}i:7482;a:1:{i:0;i:110;}i:7484;a:1:{i:0;i:111;}i:7485;a:1:{i:0;i:547;}i:7486;a:1:{i:0;i:112;}i:7487;a:1:{i:0;i:114;}i:7488;a:1:{i:0;i:116;}i:7489;a:1:{i:0;i:117;}i:7490;a:1:{i:0;i:119;}i:8507;a:3:{i:0;i:102;i:1;i:97;i:2;i:120;}i:12880;a:3:{i:0;i:112;i:1;i:116;i:2;i:101;}i:13004;a:2:{i:0;i:104;i:1;i:103;}i:13006;a:2:{i:0;i:101;i:1;i:118;}i:13007;a:3:{i:0;i:108;i:1;i:116;i:2;i:100;}i:13178;a:2:{i:0;i:105;i:1;i:117;}i:13278;a:3:{i:0;i:118;i:1;i:8725;i:2;i:109;}i:13279;a:3:{i:0;i:97;i:1;i:8725;i:2;i:109;}}s:12:"norm_combcls";a:341:{i:820;i:1;i:821;i:1;i:822;i:1;i:823;i:1;i:824;i:1;i:2364;i:7;i:2492;i:7;i:2620;i:7;i:2748;i:7;i:2876;i:7;i:3260;i:7;i:4151;i:7;i:12441;i:8;i:12442;i:8;i:2381;i:9;i:2509;i:9;i:2637;i:9;i:2765;i:9;i:2893;i:9;i:3021;i:9;i:3149;i:9;i:3277;i:9;i:3405;i:9;i:3530;i:9;i:3642;i:9;i:3972;i:9;i:4153;i:9;i:5908;i:9;i:5940;i:9;i:6098;i:9;i:1456;i:10;i:1457;i:11;i:1458;i:12;i:1459;i:13;i:1460;i:14;i:1461;i:15;i:1462;i:16;i:1463;i:17;i:1464;i:18;i:1465;i:19;i:1467;i:20;i:1468;i:21;i:1469;i:22;i:1471;i:23;i:1473;i:24;i:1474;i:25;i:64286;i:26;i:1611;i:27;i:1612;i:28;i:1613;i:29;i:1614;i:30;i:1615;i:31;i:1616;i:32;i:1617;i:33;i:1618;i:34;i:1648;i:35;i:1809;i:36;i:3157;i:84;i:3158;i:91;i:3640;i:103;i:3641;i:103;i:3656;i:107;i:3657;i:107;i:3658;i:107;i:3659;i:107;i:3768;i:118;i:3769;i:118;i:3784;i:122;i:3785;i:122;i:3786;i:122;i:3787;i:122;i:3953;i:129;i:3954;i:130;i:3962;i:130;i:3963;i:130;i:3964;i:130;i:3965;i:130;i:3968;i:130;i:3956;i:132;i:801;i:202;i:802;i:202;i:807;i:202;i:808;i:202;i:795;i:216;i:3897;i:216;i:119141;i:216;i:119142;i:216;i:119150;i:216;i:119151;i:216;i:119152;i:216;i:119153;i:216;i:119154;i:216;i:12330;i:218;i:790;i:220;i:791;i:220;i:792;i:220;i:793;i:220;i:796;i:220;i:797;i:220;i:798;i:220;i:799;i:220;i:800;i:220;i:803;i:220;i:804;i:220;i:805;i:220;i:806;i:220;i:809;i:220;i:810;i:220;i:811;i:220;i:812;i:220;i:813;i:220;i:814;i:220;i:815;i:220;i:816;i:220;i:817;i:220;i:818;i:220;i:819;i:220;i:825;i:220;i:826;i:220;i:827;i:220;i:828;i:220;i:839;i:220;i:840;i:220;i:841;i:220;i:845;i:220;i:846;i:220;i:851;i:220;i:852;i:220;i:853;i:220;i:854;i:220;i:1425;i:220;i:1430;i:220;i:1435;i:220;i:1443;i:220;i:1444;i:220;i:1445;i:220;i:1446;i:220;i:1447;i:220;i:1450;i:220;i:1621;i:220;i:1622;i:220;i:1763;i:220;i:1770;i:220;i:1773;i:220;i:1841;i:220;i:1844;i:220;i:1847;i:220;i:1848;i:220;i:1849;i:220;i:1851;i:220;i:1852;i:220;i:1854;i:220;i:1858;i:220;i:1860;i:220;i:1862;i:220;i:1864;i:220;i:2386;i:220;i:3864;i:220;i:3865;i:220;i:3893;i:220;i:3895;i:220;i:4038;i:220;i:6459;i:220;i:8424;i:220;i:119163;i:220;i:119164;i:220;i:119165;i:220;i:119166;i:220;i:119167;i:220;i:119168;i:220;i:119169;i:220;i:119170;i:220;i:119178;i:220;i:119179;i:220;i:1434;i:222;i:1453;i:222;i:6441;i:222;i:12333;i:222;i:12334;i:224;i:12335;i:224;i:119149;i:226;i:1454;i:228;i:6313;i:228;i:12331;i:228;i:768;i:230;i:769;i:230;i:770;i:230;i:771;i:230;i:772;i:230;i:773;i:230;i:774;i:230;i:775;i:230;i:776;i:230;i:777;i:230;i:778;i:230;i:779;i:230;i:780;i:230;i:781;i:230;i:782;i:230;i:783;i:230;i:784;i:230;i:785;i:230;i:786;i:230;i:787;i:230;i:788;i:230;i:829;i:230;i:830;i:230;i:831;i:230;i:832;i:230;i:833;i:230;i:834;i:230;i:835;i:230;i:836;i:230;i:838;i:230;i:842;i:230;i:843;i:230;i:844;i:230;i:848;i:230;i:849;i:230;i:850;i:230;i:855;i:230;i:867;i:230;i:868;i:230;i:869;i:230;i:870;i:230;i:871;i:230;i:872;i:230;i:873;i:230;i:874;i:230;i:875;i:230;i:876;i:230;i:877;i:230;i:878;i:230;i:879;i:230;i:1155;i:230;i:1156;i:230;i:1157;i:230;i:1158;i:230;i:1426;i:230;i:1427;i:230;i:1428;i:230;i:1429;i:230;i:1431;i:230;i:1432;i:230;i:1433;i:230;i:1436;i:230;i:1437;i:230;i:1438;i:230;i:1439;i:230;i:1440;i:230;i:1441;i:230;i:1448;i:230;i:1449;i:230;i:1451;i:230;i:1452;i:230;i:1455;i:230;i:1476;i:230;i:1552;i:230;i:1553;i:230;i:1554;i:230;i:1555;i:230;i:1556;i:230;i:1557;i:230;i:1619;i:230;i:1620;i:230;i:1623;i:230;i:1624;i:230;i:1750;i:230;i:1751;i:230;i:1752;i:230;i:1753;i:230;i:1754;i:230;i:1755;i:230;i:1756;i:230;i:1759;i:230;i:1760;i:230;i:1761;i:230;i:1762;i:230;i:1764;i:230;i:1767;i:230;i:1768;i:230;i:1771;i:230;i:1772;i:230;i:1840;i:230;i:1842;i:230;i:1843;i:230;i:1845;i:230;i:1846;i:230;i:1850;i:230;i:1853;i:230;i:1855;i:230;i:1856;i:230;i:1857;i:230;i:1859;i:230;i:1861;i:230;i:1863;i:230;i:1865;i:230;i:1866;i:230;i:2385;i:230;i:2387;i:230;i:2388;i:230;i:3970;i:230;i:3971;i:230;i:3974;i:230;i:3975;i:230;i:5901;i:230;i:6458;i:230;i:8400;i:230;i:8401;i:230;i:8404;i:230;i:8405;i:230;i:8406;i:230;i:8407;i:230;i:8411;i:230;i:8412;i:230;i:8417;i:230;i:8423;i:230;i:8425;i:230;i:65056;i:230;i:65057;i:230;i:65058;i:230;i:65059;i:230;i:119173;i:230;i:119174;i:230;i:119175;i:230;i:119177;i:230;i:119176;i:230;i:119210;i:230;i:119211;i:230;i:119212;i:230;i:119213;i:230;i:789;i:232;i:794;i:232;i:12332;i:232;i:863;i:233;i:866;i:233;i:861;i:234;i:862;i:234;i:864;i:234;i:865;i:234;i:837;i:240;}}
lib/whois/whois.ae.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AE_HANDLER__'))
29
+ define('__AE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ae_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'Domain Name:' => 'domain.name',
39
+ 'Registrar Name:' => 'domain.sponsor',
40
+ 'Status:' => 'domain.status',
41
+ 'Registrant Contact ID:' => 'owner.handle',
42
+ 'Registrant Contact Name:' => 'owner.name',
43
+ 'Tech Contact Name:' => 'tech.name',
44
+ 'Tech Contact ID:' => 'tech.handle',
45
+ 'Name Server:' => 'domain.nserver.'
46
+ );
47
+
48
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'ymd');
49
+
50
+ $r['regyinfo'] = array(
51
+ 'referrer' => 'http://www.nic.ae',
52
+ 'registrar' => 'UAENIC'
53
+ );
54
+
55
+ return $r;
56
+ }
57
+ }
58
+ ?>
lib/whois/whois.aero.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AERO_HANDLER__'))
29
+ define('__AERO_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class aero_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, 'ymd');
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.nic.aero',
40
+ 'registrar' => 'Societe Internationale de Telecommunications Aeronautiques SC'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.ag.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AG_HANDLER__'))
29
+ define('__AG_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ag_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.nic.ag',
40
+ 'registrar' => 'Nic AG'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.asia.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if(!defined('__ASIA_HANDLER__')) define('__ASIA_HANDLER__',1);
29
+
30
+ require_once('whois.parser.php');
31
+
32
+ class asia_handler
33
+ {
34
+ function parse ($data_str, $query)
35
+ {
36
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
37
+ $r['regyinfo'] = array(
38
+ 'referrer'=>'http://www.dotasia.org/',
39
+ 'registrar' => 'DotAsia'
40
+ );
41
+ return $r;
42
+ }
43
+ }
44
+ ?>
lib/whois/whois.at.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AT_HANDLER__'))
29
+ define('__AT_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class at_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'person' => 'name',
42
+ 'personname' => 'name',
43
+ 'street address' => 'address.street',
44
+ 'city' => 'address.city',
45
+ 'postal code' => 'address.pcode',
46
+ 'country' => 'address.country'
47
+ );
48
+
49
+ $contacts = array(
50
+ 'registrant' => 'owner',
51
+ 'admin-c' => 'admin',
52
+ 'tech-c' => 'tech',
53
+ 'billing-c' => 'billing',
54
+ 'zone-c' => 'zone'
55
+ );
56
+
57
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
58
+
59
+ if (isset($reg['domain']['remarks']))
60
+ unset($reg['domain']['remarks']);
61
+
62
+ if (isset($reg['domain']['descr']))
63
+ {
64
+ while (list($key, $val) = each($reg['domain']['descr']))
65
+ {
66
+ $v = trim(substr(strstr($val, ':'), 1));
67
+ if (strstr($val, '[organization]:'))
68
+ {
69
+ $reg['owner']['organization'] = $v;
70
+ continue;
71
+ }
72
+ if (strstr($val, '[phone]:'))
73
+ {
74
+ $reg['owner']['phone'] = $v;
75
+ continue;
76
+ }
77
+ if (strstr($val, '[fax-no]:'))
78
+ {
79
+ $reg['owner']['fax'] = $v;
80
+ continue;
81
+ }
82
+ if (strstr($val, '[e-mail]:'))
83
+ {
84
+ $reg['owner']['email'] = $v;
85
+ continue;
86
+ }
87
+
88
+ $reg['owner']['address'][$key] = $v;
89
+ }
90
+
91
+ if (isset($reg['domain']['descr'])) unset($reg['domain']['descr']);
92
+ }
93
+
94
+ $r['regrinfo'] = $reg;
95
+ $r['regyinfo'] = array(
96
+ 'referrer' => 'http://www.nic.at',
97
+ 'registrar' => 'NIC-AT'
98
+ );
99
+ return $r;
100
+ }
101
+ }
102
+ ?>
lib/whois/whois.au.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AU_HANDLER__'))
29
+ define('__AU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class au_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+
38
+ $items = array(
39
+ 'Domain Name:' => 'domain.name',
40
+ 'Last Modified:' => 'domain.changed',
41
+ 'Registrar Name:' => 'domain.sponsor',
42
+ 'Status:' => 'domain.status',
43
+ 'Domain ROID:' => 'domain.handle',
44
+ 'Registrant:' => 'owner.organization',
45
+ 'Registrant Contact ID:' => 'owner.handle',
46
+ 'Registrant Contact Email:' => 'owner.email',
47
+ 'Registrant Contact Name:' => 'owner.name',
48
+ 'Tech Contact Name:' => 'tech.name',
49
+ 'Tech Contact Email:' => 'tech.email',
50
+ 'Tech Contact ID:' => 'tech.handle',
51
+ 'Name Server:' => 'domain.nserver.'
52
+ );
53
+
54
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items);
55
+ $r['regyinfo'] = array(
56
+ 'referrer' => 'http://www.aunic.net',
57
+ 'registrar' => 'AU-NIC'
58
+ );
59
+ return $r;
60
+ }
61
+ }
62
+
63
+ ?>
lib/whois/whois.be.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__BE_HANDLER__'))
31
+ define('__BE_HANDLER__', 1);
32
+
33
+ class be_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.name' => 'Domain:',
39
+ 'domain.status' => 'Status:',
40
+ 'domain.nserver' => 'Nameservers:',
41
+ 'domain.created' => 'Registered:',
42
+ 'owner' => 'Licensee:',
43
+ 'admin' => 'Onsite Contacts:',
44
+ 'tech' => 'Agent Technical Contacts:',
45
+ 'agent' => 'Agent:'
46
+ );
47
+
48
+ $trans = array(
49
+ 'company name2:' => ''
50
+ );
51
+
52
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
53
+
54
+ if ($r['regrinfo']['domain']['status'] == 'REGISTERED')
55
+ {
56
+ $r['regrinfo']['registered'] = 'yes';
57
+ $r['regrinfo'] = get_contacts($r['regrinfo'],$trans);
58
+
59
+ if (isset($r['regrinfo']['agent']))
60
+ {
61
+ $sponsor = get_contact($r['regrinfo']['agent'],$trans);
62
+ unset($r['regrinfo']['agent']);
63
+ $r['regrinfo']['domain']['sponsor'] = $sponsor['name'];
64
+ }
65
+
66
+ $r = format_dates($r, '-mdy');
67
+ }
68
+ else
69
+ $r['regrinfo']['registered'] = 'no';
70
+
71
+ $r['regyinfo']['referrer'] = 'http://www.domain-registry.nl';
72
+ $r['regyinfo']['registrar'] = 'DNS Belgium';
73
+ return $r;
74
+ }
75
+ }
76
+ ?>
lib/whois/whois.biz.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__BIZ_HANDLER__'))
29
+ define('__BIZ_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class biz_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, '-md--y');
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.neulevel.biz',
40
+ 'registrar' => 'NEULEVEL'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.br.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__BR_HANDLER__'))
31
+ define('__BR_HANDLER__', 1);
32
+
33
+ class br_handler
34
+ {
35
+
36
+ function parse($data_str, $query)
37
+ {
38
+ $translate = array(
39
+ 'fax-no' => 'fax',
40
+ 'e-mail' => 'email',
41
+ 'nic-hdl-br' => 'handle',
42
+ 'person' => 'name',
43
+ 'netname' => 'name',
44
+ 'domain' => 'name',
45
+ 'updated' => ''
46
+ );
47
+
48
+ $contacts = array(
49
+ 'owner-c' => 'owner',
50
+ 'tech-c' => 'tech',
51
+ 'admin-c' => 'admin',
52
+ 'billing-c' => 'billing'
53
+ );
54
+
55
+ $r = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
56
+
57
+ if (in_array('Permission denied.', $r['disclaimer']))
58
+ {
59
+ $r['registered'] = 'unknown';
60
+ return $r;
61
+ }
62
+
63
+ if (isset($r['domain']['nsstat'])) unset($r['domain']['nsstat']);
64
+ if (isset($r['domain']['nslastaa'])) unset($r['domain']['nslastaa']);
65
+
66
+ if (isset($r['domain']['owner']))
67
+ {
68
+ $r['owner']['organization'] = $r['domain']['owner'];
69
+ unset($r['domain']['owner']);
70
+ }
71
+
72
+ if (isset($r['domain']['responsible'])) unset($r['domain']['responsible']);
73
+ if (isset($r['domain']['address'])) unset($r['domain']['address']);
74
+ if (isset($r['domain']['phone'])) unset($r['domain']['phone']);
75
+
76
+ $a['regrinfo'] = $r;
77
+ $a['regyinfo'] = array(
78
+ 'registrar' => 'BR-NIC',
79
+ 'referrer' => 'http://www.nic.br'
80
+ );
81
+ return $a;
82
+ }
83
+ }
84
+ ?>
lib/whois/whois.ca.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CA_HANDLER__'))
29
+ define('__CA_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ca_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative contact:',
40
+ 'tech' => 'Technical contact:',
41
+ 'domain.sponsor' => 'Registrar:',
42
+ 'domain.nserver' => 'Name servers:',
43
+ 'domain.status' => 'Domain status:',
44
+ 'domain.created' => 'Creation date:',
45
+ 'domain.expires' => 'Expiry date:',
46
+ 'domain.changed' => 'Updated date:'
47
+ );
48
+
49
+ $extra = array(
50
+ 'postal address:' => 'address.0',
51
+ 'job title:' => '',
52
+ 'number:' => 'handle',
53
+ 'description:' => 'organization'
54
+ );
55
+
56
+ $r['regrinfo'] = easy_parser($data_str['rawdata'],$items,'ymd',$extra);
57
+
58
+ if (!empty($r['regrinfo']['domain']['sponsor']))
59
+ {
60
+ list($v,$reg) = explode(':',$r['regrinfo']['domain']['sponsor'][0]);
61
+ $r['regrinfo']['domain']['sponsor'] = trim($reg);
62
+ }
63
+
64
+ if (empty($r['regrinfo']['domain']['status']) || $r['regrinfo']['domain']['status'] == 'available')
65
+ $r['regrinfo']['registered'] = 'no';
66
+ else
67
+ $r['regrinfo']['registered'] = 'yes';
68
+
69
+ $r['regyinfo'] = array(
70
+ 'registrar' => 'CIRA',
71
+ 'referrer' => 'http://www.cira.ca/'
72
+ );
73
+ return $r;
74
+ }
75
+ }
76
+ ?>
lib/whois/whois.cat.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CAT_HANDLER__'))
29
+ define('__CAT_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class cat_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+
39
+ if (!isset($r['regrinfo']['domain']['name']))
40
+ $r['regrinfo']['registered'] = 'no';
41
+
42
+ $r['regyinfo']['referrer'] = 'http://www.domini.cat/';
43
+ $r['regyinfo']['registrar'] = 'Domini punt CAT';
44
+ return $r;
45
+ }
46
+ }
47
+ ?>
lib/whois/whois.ch.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__CH_HANDLER__'))
31
+ define('__CH_HANDLER__', 1);
32
+
33
+ class ch_handler
34
+ {
35
+
36
+ function parse($data_str, $query)
37
+ {
38
+
39
+ $items = array(
40
+ 'owner' => 'Holder of domain name:',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.created' => 'Date of last registration:',
43
+ 'domain.changed' => 'Date of last modification:',
44
+ 'tech' => 'Technical contact:',
45
+ 'domain.nserver' => 'Name servers:',
46
+ 'domain.dnssec' => 'DNSSEC:'
47
+ );
48
+
49
+ $trans = array(
50
+ 'contractual language:' => 'language'
51
+ );
52
+
53
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
54
+
55
+ if (!empty($r['regrinfo']['domain']['name']))
56
+ {
57
+ $r['regrinfo'] = get_contacts($r['regrinfo'],$trans);
58
+
59
+ $r['regrinfo']['domain']['name'] = $r['regrinfo']['domain']['name'][0];
60
+
61
+ if (isset($r['regrinfo']['domain']['changed'][0]))
62
+ $r['regrinfo']['domain']['changed'] = get_date($r['regrinfo']['domain']['changed'][0], 'dmy');
63
+
64
+ if (isset($r['regrinfo']['domain']['created'][0]))
65
+ $r['regrinfo']['domain']['created'] = get_date($r['regrinfo']['domain']['created'][0], 'dmy');
66
+
67
+ $r['regrinfo']['registered'] = 'yes';
68
+ }
69
+ else
70
+ {
71
+ $r = '';
72
+ $r['regrinfo']['registered'] = 'no';
73
+ }
74
+
75
+ $r['regyinfo'] = array(
76
+ 'referrer' => 'http://www.nic.ch',
77
+ 'registrar' => 'SWITCH Domain Name Registration'
78
+ );
79
+ return $r;
80
+ }
81
+ }
82
+ ?>
lib/whois/whois.cl.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CL_HANDLER__'))
29
+ define('__CL_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class cl_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'admin' => '(Administrative Contact)',
39
+ 'tech' => 'Contacto Técnico (Technical Contact):',
40
+ 'domain.nserver' => 'Servidores de nombre (Domain servers):',
41
+ 'domain.changed' => '(Database last updated on):'
42
+ );
43
+
44
+ $trans = array(
45
+ 'organización:' => 'organization',
46
+ 'nombre :' => 'name');
47
+
48
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'd-m-y', $trans);
49
+ $r['regyinfo'] = array(
50
+ 'referrer' => 'http://www.nic.cl',
51
+ 'registrar' => 'NIC Chile'
52
+ );
53
+ return $r;
54
+ }
55
+ }
56
+ ?>
lib/whois/whois.client.php ADDED
@@ -0,0 +1,595 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.ip.lib.php');
29
+
30
+ class WhoisClient {
31
+
32
+ // Recursion allowed ?
33
+ var $gtld_recurse = false;
34
+
35
+ // Default WHOIS port
36
+ var $PORT = 43;
37
+
38
+ // Maximum number of retries on connection failure
39
+ var $RETRY = 0;
40
+
41
+ // Time to wait between retries
42
+ var $SLEEP = 2;
43
+
44
+ // Read buffer size (0 == char by char)
45
+ var $BUFFER = 1024;
46
+
47
+ // Communications timeout
48
+ var $STIMEOUT = 10;
49
+
50
+ // List of servers and handlers (loaded from servers.whois)
51
+ var $DATA = array();
52
+
53
+ // Array to contain all query variables
54
+ var $Query = array(
55
+ 'tld' => '',
56
+ 'type' => 'domain',
57
+ 'query' => '',
58
+ 'status',
59
+ 'server'
60
+ );
61
+
62
+ // This release of the package
63
+ var $CODE_VERSION = '4.2.2';
64
+
65
+ // Full code and data version string (e.g. 'Whois2.php v3.01:16')
66
+ var $VERSION;
67
+
68
+ /*
69
+ * Constructor function
70
+ */
71
+ function WhoisClient () {
72
+ // Load DATA array
73
+ @require('whois.servers.php');
74
+
75
+ // Set version
76
+ $this->VERSION = sprintf("phpWhois v%s-%s", $this->CODE_VERSION, $this->DATA_VERSION);
77
+ }
78
+
79
+ /*
80
+ * Perform lookup
81
+ */
82
+
83
+ function GetRawData ($query) {
84
+
85
+ $this->Query['query'] = $query;
86
+
87
+ // clear error description
88
+ if (isset($this->Query['errstr'])) unset($this->Query['errstr']);
89
+
90
+ if (!isset($this->Query['server'])) {
91
+ $this->Query['status'] = 'error';
92
+ $this->Query['errstr'][] = 'No server specified';
93
+ return(array());
94
+ }
95
+
96
+ // Check if protocol is http
97
+
98
+ if (substr($this->Query['server'],0,7)=='http://' ||
99
+ substr($this->Query['server'],0,8)=='https://')
100
+ {
101
+ $output = $this->httpQuery($this->Query['server']);
102
+
103
+ if (!$output)
104
+ {
105
+ $this->Query['status'] = 'error';
106
+ $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
107
+ return(array());
108
+ }
109
+
110
+ $this->Query['args'] = substr(strchr($this->Query['server'],'?'),1);
111
+ $this->Query['server'] = strtok($this->Query['server'],'?');
112
+
113
+ if (substr($this->Query['server'],0,7)=='http://')
114
+ $this->Query['server_port'] = 80;
115
+ else
116
+ $this->Query['server_port'] = 483;
117
+ }
118
+ else
119
+ {
120
+ // Get args
121
+
122
+ if (strpos($this->Query['server'],'?'))
123
+ {
124
+ $parts = explode('?',$this->Query['server']);
125
+ $this->Query['server'] = trim($parts[0]);
126
+ $query_args = trim($parts[1]);
127
+
128
+ // replace substitution parameters
129
+ $query_args = str_replace('{query}', $query, $query_args);
130
+ $query_args = str_replace('{version}', 'phpWhois'.$this->CODE_VERSION, $query_args);
131
+
132
+ if (strpos($query_args,'{ip}')!==false)
133
+ {
134
+ $query_args = str_replace('{ip}', phpwhois_getclientip(), $query_args);
135
+ }
136
+
137
+ if (strpos($query_args,'{hname}')!==false)
138
+ {
139
+ $query_args = str_replace('{hname}', gethostbyaddr(phpwhois_getclientip()), $query_args);
140
+ }
141
+ }
142
+ else
143
+ {
144
+ if (empty($this->Query['args']))
145
+ $query_args = $query;
146
+ else
147
+ $query_args = $this->Query['args'];
148
+ }
149
+
150
+ $this->Query['args'] = $query_args;
151
+
152
+ if (substr($this->Query['server'],0,9) == 'rwhois://')
153
+ {
154
+ $this->Query['server'] = substr($this->Query['server'],9);
155
+ }
156
+
157
+ if (substr($this->Query['server'],0,8) == 'whois://')
158
+ {
159
+ $this->Query['server'] = substr($this->Query['server'],8);
160
+ }
161
+
162
+ // Get port
163
+
164
+ if (strpos($this->Query['server'],':'))
165
+ {
166
+ $parts = explode(':',$this->Query['server']);
167
+ $this->Query['server'] = trim($parts[0]);
168
+ $this->Query['server_port'] = trim($parts[1]);
169
+ }
170
+ else
171
+ $this->Query['server_port'] = $this->PORT;
172
+
173
+ // Connect to whois server, or return if failed
174
+
175
+ $ptr = $this->Connect();
176
+
177
+ if($ptr < 0) {
178
+ $this->Query['status'] = 'error';
179
+ $this->Query['errstr'][] = 'Connect failed to: '.$this->Query['server'];
180
+ return array();
181
+ }
182
+
183
+ stream_set_timeout($ptr,$this->STIMEOUT);
184
+ stream_set_blocking($ptr,0);
185
+
186
+ // Send query
187
+ fputs($ptr, trim($query_args)."\r\n");
188
+
189
+ // Prepare to receive result
190
+ $raw = '';
191
+ $start = time();
192
+ $null = NULL;
193
+ $r = array($ptr);
194
+
195
+ while (!feof($ptr))
196
+ {
197
+ if (stream_select($r,$null,$null,$this->STIMEOUT))
198
+ {
199
+ $raw .= fgets($ptr, $this->BUFFER);
200
+ }
201
+
202
+ if (time()-$start > $this->STIMEOUT)
203
+ {
204
+ $this->Query['status'] = 'error';
205
+ $this->Query['errstr'][] = 'Timeout reading from '.$this->Query['server'];
206
+ return array();
207
+ }
208
+ }
209
+
210
+ if (array_key_exists($this->Query['server'],$this->NON_UTF8))
211
+ {
212
+ $raw = utf8_encode($raw);
213
+ }
214
+
215
+ $output = explode("\n", $raw);
216
+
217
+ // Drop empty last line (if it's empty! - saleck)
218
+ if (empty($output[count($output)-1]))
219
+ unset($output[count($output)-1]);
220
+ }
221
+
222
+ return $output;
223
+ }
224
+
225
+ /*
226
+ * Perform lookup. Returns an array. The 'rawdata' element contains an
227
+ * array of lines gathered from the whois query. If a top level domain
228
+ * handler class was found for the domain, other elements will have been
229
+ * populated too.
230
+ */
231
+
232
+ function GetData ($query='', $deep_whois=true) {
233
+
234
+ // If domain to query passed in, use it, otherwise use domain from initialisation
235
+ $query = !empty($query) ? $query : $this->Query['query'];
236
+
237
+ $output = $this->GetRawData($query);
238
+
239
+ // Create result and set 'rawdata'
240
+ $result = array( 'rawdata' => $output );
241
+ $result = $this->set_whois_info($result);
242
+
243
+ // Return now on error
244
+ if (empty($output)) return $result;
245
+
246
+ // If we have a handler, post-process it with it
247
+ if (isSet($this->Query['handler']))
248
+ {
249
+ // Keep server list
250
+ $servers = $result['regyinfo']['servers'];
251
+ unset($result['regyinfo']['servers']);
252
+
253
+ // Process data
254
+ $result = $this->Process($result,$deep_whois);
255
+
256
+ // Add new servers to the server list
257
+ if (isset($result['regyinfo']['servers']))
258
+ $result['regyinfo']['servers'] = array_merge($servers,$result['regyinfo']['servers']);
259
+ else
260
+ $result['regyinfo']['servers'] = $servers;
261
+
262
+ // Handler may forget to set rawdata
263
+ if (!isset($result['rawdata']))
264
+ $result['rawdata'] = $output;
265
+ }
266
+
267
+ // Type defaults to domain
268
+ if (!isset($result['regyinfo']['type']))
269
+ $result['regyinfo']['type'] = 'domain';
270
+
271
+ // Add error information if any
272
+ if (isset($this->Query['errstr']))
273
+ $result['errstr'] = $this->Query['errstr'];
274
+
275
+ // Fix/add nameserver information
276
+ if (method_exists($this,'FixResult') && $this->Query['tld'] != 'ip')
277
+ $this->FixResult($result,$query);
278
+
279
+ return($result);
280
+ }
281
+
282
+ /*
283
+ * Adds whois server query information to result
284
+ */
285
+
286
+ function set_whois_info ($result)
287
+ {
288
+ $info = array(
289
+ 'server'=> $this->Query['server'],
290
+ );
291
+
292
+ if (!empty($this->Query['args']))
293
+ $info['args'] = $this->Query['args'];
294
+ else
295
+ $info['args'] = $this->Query['query'];
296
+
297
+ if (!empty($this->Query['server_port']))
298
+ $info['port'] = $this->Query['server_port'];
299
+ else
300
+ $info['port'] = 43;
301
+
302
+ if (isset($result['regyinfo']['whois']))
303
+ unset($result['regyinfo']['whois']);
304
+
305
+ if (isset($result['regyinfo']['rwhois']))
306
+ unset($result['regyinfo']['rwhois']);
307
+
308
+ $result['regyinfo']['servers'][] = $info;
309
+
310
+ return $result;
311
+ }
312
+
313
+ /*
314
+ * Convert html output to plain text
315
+ */
316
+ function httpQuery ($query) {
317
+
318
+ //echo ini_get('allow_url_fopen');
319
+
320
+ //if (ini_get('allow_url_fopen'))
321
+ $lines = @file($this->Query['server']);
322
+
323
+ if (!$lines) return false;
324
+
325
+ $output = '';
326
+ $pre = '';
327
+
328
+ while (list($key, $val)=each($lines)) {
329
+ $val = trim($val);
330
+
331
+ $pos=strpos(strtoupper($val),'<PRE>');
332
+ if ($pos!==false) {
333
+ $pre = "\n";
334
+ $output.=substr($val,0,$pos)."\n";
335
+ $val = substr($val,$pos+5);
336
+ }
337
+ $pos=strpos(strtoupper($val),'</PRE>');
338
+ if ($pos!==false) {
339
+ $pre = '';
340
+ $output.=substr($val,0,$pos)."\n";
341
+ $val = substr($val,$pos+6);
342
+ }
343
+ $output.=$val.$pre;
344
+ }
345
+
346
+ $search = array (
347
+ '<BR>', '<P>', '</TITLE>',
348
+ '</H1>', '</H2>', '</H3>',
349
+ '<br>', '<p>', '</title>',
350
+ '</h1>', '</h2>', '</h3>' );
351
+
352
+ $output = str_replace($search,"\n",$output);
353
+ $output = str_replace('<TD',' <td',$output);
354
+ $output = str_replace('<td',' <td',$output);
355
+ $output = str_replace('<tr',"\n<tr",$output);
356
+ $output = str_replace('<TR',"\n<tr",$output);
357
+ $output = str_replace('&nbsp;',' ',$output);
358
+ $output = strip_tags($output);
359
+ $output = explode("\n",$output);
360
+
361
+ $rawdata = array();
362
+ $null = 0;
363
+
364
+ while (list($key, $val)=each($output)) {
365
+ $val=trim($val);
366
+ if ($val=='') {
367
+ if (++$null>2) continue;
368
+ }
369
+ else $null=0;
370
+ $rawdata[]=$val;
371
+ }
372
+ return $rawdata;
373
+ }
374
+
375
+ /*
376
+ * Open a socket to the whois server.
377
+ *
378
+ * Returns a socket connection pointer on success, or -1 on failure.
379
+ */
380
+ function Connect ($server = '') {
381
+
382
+ if ($server == '')
383
+ $server = $this->Query['server'];
384
+
385
+ // Fail if server not set
386
+ if($server == '')
387
+ return(-1);
388
+
389
+ // Get rid of protocol and/or get port
390
+ $port = $this->Query['server_port'];
391
+
392
+ $pos = strpos($server,'://');
393
+
394
+ if ($pos !== false)
395
+ $server = substr($server, $pos+3);
396
+
397
+ $pos = strpos($server,':');
398
+
399
+ if ($pos !== false)
400
+ {
401
+ $port = substr($server,$pos+1);
402
+ $server = substr($server,0,$pos);
403
+ }
404
+
405
+ // Enter connection attempt loop
406
+ $retry = 0;
407
+
408
+ while($retry <= $this->RETRY) {
409
+ // Set query status
410
+ $this->Query['status'] = 'ready';
411
+
412
+ // Connect to whois port
413
+ $ptr = @fsockopen($server, $port, $errno, $errstr, $this->STIMEOUT);
414
+
415
+ if($ptr > 0) {
416
+ $this->Query['status'] = 'ok';
417
+ return($ptr);
418
+ }
419
+
420
+ // Failed this attempt
421
+ $this->Query['status'] = 'error';
422
+ $this->Query['error'][] = $errstr;
423
+ $retry++;
424
+
425
+ // Sleep before retrying
426
+ sleep($this->SLEEP);
427
+ }
428
+
429
+ // If we get this far, it hasn't worked
430
+ return(-1);
431
+ }
432
+
433
+ /*
434
+ * Post-process result with handler class. On success, returns the result
435
+ * from the handler. On failure, returns passed result unaltered.
436
+ */
437
+ function Process (&$result, $deep_whois=true) {
438
+
439
+ $handler_name = str_replace('.','_',$this->Query['handler']);
440
+
441
+ // If the handler has not already been included somehow, include it now
442
+ $HANDLER_FLAG = sprintf("__%s_HANDLER__", strtoupper($handler_name));
443
+
444
+ if (!defined($HANDLER_FLAG))
445
+ include($this->Query['file']);
446
+
447
+ // If the handler has still not been included, append to query errors list and return
448
+ if (!defined($HANDLER_FLAG))
449
+ {
450
+ $this->Query['errstr'][] = "Can't find $handler_name handler: ".$this->Query['file'];
451
+ return($result);
452
+ }
453
+
454
+ if (!$this->gtld_recurse && $this->Query['file'] == 'whois.gtld.php')
455
+ return $result;
456
+
457
+ // Pass result to handler
458
+ $object = $handler_name.'_handler';
459
+
460
+ $handler = new $object('');
461
+
462
+ // If handler returned an error, append it to the query errors list
463
+ if(isSet($handler->Query['errstr']))
464
+ $this->Query['errstr'][] = $handler->Query['errstr'];
465
+
466
+ $handler->deep_whois = $deep_whois;
467
+
468
+ // Process
469
+ $res = $handler->parse($result,$this->Query['query']);
470
+
471
+ // Return the result
472
+ return $res;
473
+ }
474
+
475
+ /*
476
+ * Does more (deeper) whois ...
477
+ */
478
+
479
+ function DeepWhois ($query, $result) {
480
+
481
+ if (!isset($result['regyinfo']['whois'])) return $result;
482
+
483
+ $this->Query['server'] = $wserver = $result['regyinfo']['whois'];
484
+ unset($result['regyinfo']['whois']);
485
+ $subresult = $this->GetRawData($query);
486
+
487
+ if (!empty($subresult))
488
+ {
489
+ $result = $this->set_whois_info($result);
490
+ $result['rawdata'] = $subresult;
491
+
492
+ if (isset($this->WHOIS_GTLD_HANDLER[$wserver]))
493
+ $this->Query['handler'] = $this->WHOIS_GTLD_HANDLER[$wserver];
494
+ else
495
+ {
496
+ $parts = explode('.',$wserver);
497
+ $hname = strtolower($parts[1]);
498
+
499
+ if (($fp = @fopen('whois.gtld.'.$hname.'.php', 'r', 1)) and fclose($fp))
500
+ $this->Query['handler'] = $hname;
501
+ }
502
+
503
+ if (!empty($this->Query['handler']))
504
+ {
505
+ $this->Query['file'] = sprintf('whois.gtld.%s.php', $this->Query['handler']);
506
+ $regrinfo = $this->Process($subresult); //$result['rawdata']);
507
+ $result['regrinfo'] = $this->merge_results($result['regrinfo'], $regrinfo);
508
+ //$result['rawdata'] = $subresult;
509
+ }
510
+ }
511
+
512
+ return $result;
513
+ }
514
+
515
+ /*
516
+ * Merge results
517
+ */
518
+
519
+ function merge_results($a1, $a2) {
520
+
521
+ reset($a2);
522
+
523
+ while (list($key, $val) = each($a2))
524
+ {
525
+ if (isset($a1[$key]))
526
+ {
527
+ if (is_array($val))
528
+ {
529
+ if ($key != 'nserver')
530
+ $a1[$key] = $this->merge_results($a1[$key], $val);
531
+ }
532
+ else
533
+ {
534
+ $val = trim($val);
535
+ if ($val != '')
536
+ $a1[$key] = $val;
537
+ }
538
+ }
539
+ else
540
+ $a1[$key] = $val;
541
+ }
542
+
543
+ return $a1;
544
+ }
545
+
546
+ function FixNameServer($nserver)
547
+ {
548
+ $dns = array();
549
+
550
+ foreach($nserver as $val)
551
+ {
552
+ $val = str_replace( array('[',']','(',')'), '', trim($val));
553
+ $val = str_replace("\t", ' ', $val);
554
+ $parts = explode(' ', $val);
555
+ $host = '';
556
+ $ip = '';
557
+
558
+ foreach($parts as $p)
559
+ {
560
+ if (substr($p,-1) == '.') $p = substr($p,0,-1);
561
+
562
+ if ((ip2long($p) == - 1) or (ip2long($p) === false))
563
+ {
564
+ // Hostname ?
565
+ if ($host == '' && preg_match('/^[\w\-]+(\.[\w\-]+)+$/',$p))
566
+ {
567
+ $host = $p;
568
+ }
569
+ }
570
+ else
571
+ // IP Address
572
+ $ip = $p;
573
+ }
574
+
575
+ // Valid host name ?
576
+
577
+ if ($host == '') continue;
578
+
579
+ // Get ip address
580
+
581
+ if ($ip == '')
582
+ {
583
+ $ip = gethostbyname($host);
584
+ if ($ip == $host) $ip = '(DOES NOT EXIST)';
585
+ }
586
+
587
+ if (substr($host,-1,1) == '.') $host = substr($host,0,-1);
588
+
589
+ $dns[strtolower($host)] = $ip;
590
+ }
591
+
592
+ return $dns;
593
+ }
594
+ }
595
+ ?>
lib/whois/whois.cn.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CN_HANDLER__'))
29
+ define('__CN_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class cn_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'Domain Name:' => 'domain.name',
39
+ 'Domain Status:' => 'domain.status.',
40
+ 'ROID:' => 'domain.handle',
41
+ 'Name Server:' => 'domain.nserver.',
42
+ 'Registration Date:' => 'domain.created',
43
+ 'Expiration Date:' => 'domain.expires',
44
+ 'Sponsoring Registrar:' => 'domain.sponsor',
45
+ 'Registrant Name:' => 'owner.name',
46
+ 'Registrant Organization:' => 'owner.organization',
47
+ 'Registrant Address:' => 'owner.address.address',
48
+ 'Registrant Postal Code:' => 'owner.address.pcode',
49
+ 'Registrant City:' => 'owner.address.city',
50
+ 'Registrant Country Code:' => 'owner.address.country',
51
+ 'Registrant Email:' => 'owner.email',
52
+ 'Registrant Phone Number:' => 'owner.phone',
53
+ 'Registrant Fax:' => 'owner.fax',
54
+ 'Administrative Name:' => 'admin.name',
55
+ 'Administrative Organization:' => 'admin.organization',
56
+ 'Administrative Address:' => 'admin.address.address',
57
+ 'Administrative Postal Code:' => 'admin.address.pcode',
58
+ 'Administrative City:' => 'admin.address.city',
59
+ 'Administrative Country Code:' => 'admin.address.country',
60
+ 'Administrative Email:' => 'admin.email',
61
+ 'Administrative Phone Number:' => 'admin.phone',
62
+ 'Administrative Fax:' => 'admin.fax',
63
+ 'Technical Name:' => 'tech.name',
64
+ 'Technical Organization:' => 'tech.organization',
65
+ 'Technical Address:' => 'tech.address.address',
66
+ 'Technical Postal Code:' => 'tech.address.pcode',
67
+ 'Technical City:' => 'tech.address.city',
68
+ 'tec-country:' => 'tech.address.country',
69
+ 'Technical Email:' => 'tech.email',
70
+ 'Technical Phone Number:' => 'tech.phone',
71
+ 'Technical Fax:' => 'tech.fax',
72
+ 'Billing Name:' => 'billing.name',
73
+ 'Billing Organization:' => 'billing.organization',
74
+ 'Billing Address:' => 'billing.address.address',
75
+ 'Billing Postal Code:' => 'billing.address.pcode',
76
+ 'Billing City:' => 'billing.address.city',
77
+ 'Billing Country Code:' => 'billing.address.country',
78
+ 'Billing Email:' => 'billing.email',
79
+ 'Billing Phone Number:' => 'billing.phone',
80
+ 'Billing Fax:' => 'billing.fax'
81
+ );
82
+
83
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'ymd');
84
+ $r['regyinfo'] = array(
85
+ 'referrer' => 'http://www.cnnic.net.cn',
86
+ 'registrar' => 'China NIC'
87
+ );
88
+ return $r;
89
+ }
90
+ }
91
+ ?>
lib/whois/whois.co.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CO_HANDLER__'))
29
+ define('__CO_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class co_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, '-md--y');
38
+ $r['regyinfo']['referrer'] = 'http://www.cointernet.com.co/';
39
+ $r['regyinfo']['registrar'] = '.CO Internet, S.A.S.';
40
+ return $r;
41
+ }
42
+ }
43
+ ?>
lib/whois/whois.co.za.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CO_ZA_HANDLER__'))
29
+ define('__CO_ZA_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class co_Za_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ '0a. lastupdate :' => 'domain.changed',
39
+ '1a. domain :' => 'domain.name',
40
+ '2b. registrantpostaladdress:' => 'owner.address.address.0',
41
+ '2f. billingaccount :' => 'billing.name',
42
+ '2g. billingemail :' => 'billing.email',
43
+ '2i. invoiceaddress :' => 'billing.address',
44
+ '2j. registrantphone :' => 'owner.phone',
45
+ '2k. registrantfax :' => 'owner.fax',
46
+ '2l. registrantemail :' => 'owner.email',
47
+ '4a. admin :' => 'admin.name',
48
+ '4c. admincompany :' => 'admin.organization',
49
+ '4d. adminpostaladdr :' => 'admin.address',
50
+ '4e. adminphone :' => 'admin.phone',
51
+ '4f. adminfax :' => 'admin.fax',
52
+ '4g. adminemail :' => 'admin.email',
53
+ '5a. tec :' => 'tech.name',
54
+ '5c. teccompany :' => 'tech.organization',
55
+ '5d. tecpostaladdr :' => 'tech.address',
56
+ '5e. tecphone :' => 'tech.phone',
57
+ '5f. tecfax :' => 'tech.fax',
58
+ '5g. tecemail :' => 'tech.email',
59
+ '6a. primnsfqdn :' => 'domain.nserver.0',
60
+ '6e. secns1fqdn :' => 'domain.nserver.1',
61
+ '6i. secns2fqdn :' => 'domain.nserver.2',
62
+ '6m. secns3fqdn :' => 'domain.nserver.3',
63
+ '6q. secns4fqdn :' => 'domain.nserver.4'
64
+ );
65
+
66
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items);
67
+
68
+ $r['regyinfo']['referrer'] = 'http://www.co.za';
69
+ $r['regyinfo']['registrar'] = 'UniForum Association';
70
+ return $r;
71
+ }
72
+ }
73
+ ?>
lib/whois/whois.coop.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__COOP_HANDLER__'))
29
+ define('__COOP_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class coop_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+
38
+ $items = array (
39
+ 'owner' => 'Contact Type: registrant',
40
+ 'admin' => 'Contact Type: admin',
41
+ 'tech' => 'Contact Type: tech',
42
+ 'billing' => 'Contact Type: billing',
43
+ 'domain.name' => 'Domain Name:',
44
+ 'domain.handle' => 'Domain ID:',
45
+ 'domain.expires' => 'Expiry Date:',
46
+ 'domain.created' => 'Created:',
47
+ 'domain.changed' => 'Last updated:',
48
+ 'domain.status' => 'Domain Status:',
49
+ 'domain.sponsor' => 'Sponsoring registrar:',
50
+ 'domain.nserver.' => 'Host Name:'
51
+ );
52
+
53
+ $translate = array(
54
+ 'Contact ID:' => 'handle',
55
+ 'Name:' => 'name',
56
+ 'Organisation:' => 'organization',
57
+ 'Street 1:' => 'address.street.0',
58
+ 'Street 2:' => 'address.street.1',
59
+ 'Street 3:' => 'address.street.2',
60
+ 'City:' => 'address.city',
61
+ 'State/Province:' => 'address.state',
62
+ 'Postal code:' => 'address.pcode',
63
+ 'Country:' => 'address.country',
64
+ 'Voice:' => 'phone',
65
+ 'Fax:' => 'fax',
66
+ 'Email:' => 'email'
67
+ );
68
+
69
+ $blocks = get_blocks($data_str['rawdata'],$items);
70
+
71
+ $r=array();
72
+
73
+ if (isset($blocks['domain']))
74
+ {
75
+ $r['regrinfo']['domain'] = format_dates($blocks['domain'],'dmy');
76
+ $r['regrinfo']['registered'] = 'yes';
77
+
78
+ if (isset($blocks['owner']))
79
+ {
80
+ $r['regrinfo']['owner'] = generic_parser_b($blocks['owner'],$translate,'dmy',false);
81
+
82
+ if (isset($blocks['tech']))
83
+ $r['regrinfo']['tech'] = generic_parser_b($blocks['tech'],$translate,'dmy',false);
84
+
85
+ if (isset($blocks['admin']))
86
+ $r['regrinfo']['admin'] = generic_parser_b($blocks['admin'],$translate,'dmy',false);
87
+
88
+ if (isset($blocks['billing']))
89
+ $r['regrinfo']['billing'] = generic_parser_b($blocks['billing'],$translate,'dmy',false);
90
+ }
91
+ else
92
+ {
93
+ $r['regrinfo']['owner'] = generic_parser_b($data_str['rawdata'],$translate,'dmy',false);
94
+ }
95
+ }
96
+ else
97
+ $r['regrinfo']['registered'] = 'no';
98
+
99
+ $r['regyinfo'] = array(
100
+ 'referrer' => 'http://www.nic.coop',
101
+ 'registrar' => '.coop registry'
102
+ );
103
+ return $r;
104
+ }
105
+ }
106
+ ?>
lib/whois/whois.cz.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CZ_HANDLER__'))
29
+ define('__CZ_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class cz_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'expire' => 'expires',
39
+ 'registered' => 'created',
40
+ 'nserver' => 'nserver',
41
+ 'domain' => 'name',
42
+ 'contact' => 'handle',
43
+ 'reg-c' => '',
44
+ 'descr' => 'desc',
45
+ 'e-mail' => 'email',
46
+ 'person' => 'name',
47
+ 'org' => 'organization',
48
+ 'fax-no' => 'fax'
49
+ );
50
+
51
+ $contacts = array(
52
+ 'admin-c' => 'admin',
53
+ 'tech-c' => 'tech',
54
+ 'bill-c' => 'billing',
55
+ 'registrant' => 'owner'
56
+ );
57
+
58
+ $r['regrinfo'] = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'dmy');
59
+
60
+ $r['regyinfo'] = array(
61
+ 'referrer' => 'http://www.nic.cz',
62
+ 'registrar' => 'CZ-NIC'
63
+ );
64
+
65
+ if ($data_str['rawdata'][0] == 'Your connection limit exceeded. Please slow down and try again later.')
66
+ {
67
+ $r['regrinfo']['registered'] = 'unknown';
68
+ }
69
+
70
+ return $r;
71
+ }
72
+ }
73
+ ?>
lib/whois/whois.de.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DE_HANDLER__'))
29
+ define('__DE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class de_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.name' => 'Domain:',
39
+ 'domain.nserver.' =>'Nserver:',
40
+ 'domain.nserver.#' =>'Nsentry:',
41
+ 'domain.status' => 'Status:',
42
+ 'domain.changed' => 'Changed:',
43
+ 'domain.desc.' => 'Descr:',
44
+ 'owner' => '[Holder]',
45
+ 'admin' => '[Admin-C]',
46
+ 'tech' => '[Tech-C]',
47
+ 'zone' => '[Zone-C]'
48
+ );
49
+
50
+ $extra = array(
51
+ 'city:' => 'address.city',
52
+ 'postalcode:' => 'address.pcode',
53
+ 'countrycode:' => 'address.country',
54
+ 'remarks:' => '',
55
+ 'sip:' => 'sip',
56
+ 'type:' => ''
57
+ );
58
+
59
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'ymd',$extra);
60
+
61
+ $r['regyinfo'] = array(
62
+ 'registrar' => 'DENIC eG',
63
+ 'referrer' => 'http://www.denic.de/'
64
+ );
65
+
66
+ if (!isset($r['regrinfo']['domain']['status']) || $r['regrinfo']['domain']['status'] == "free")
67
+ {
68
+ $r['regrinfo']['registered'] = 'no';
69
+ }
70
+ else
71
+ {
72
+ $r['regrinfo']['domain']['changed'] = substr($r['regrinfo']['domain']['changed'], 0, 10);
73
+ $r['regrinfo']['registered'] = 'yes';
74
+ }
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.edu.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__EDU_HANDLER__'))
29
+ define('__EDU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class edu_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.name' => 'Domain name:',
39
+ 'domain.sponsor' => 'Registrar:',
40
+ 'domain.nserver' => 'Name Servers:',
41
+ 'domain.changed' => 'Domain record last updated:',
42
+ 'domain.created' => 'Domain record activated:',
43
+ 'owner' => 'Registrant:',
44
+ 'admin' => 'Administrative Contact:',
45
+ 'tech' => 'Technical Contact:',
46
+ 'billing' => 'Billing Contact:'
47
+ );
48
+
49
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'dmy');
50
+
51
+ if (isset($b['tech']))
52
+ {
53
+ if ($r['regrinfo']['tech']['name'] == 'Same as above')
54
+ $r['regrinfo']['tech'] = $r['regrinfo']['admin'];
55
+ }
56
+
57
+ $r['regyinfo']['referrer'] = 'http://whois.educause.net';
58
+ $r['regyinfo']['registrar'] = 'EDUCASE';
59
+ return ($r);
60
+ }
61
+ }
62
+ ?>
lib/whois/whois.eu.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__EU_HANDLER__'))
31
+ define('__EU_HANDLER__', 1);
32
+
33
+ class eu_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+
38
+ $items = array(
39
+ 'domain.name' => 'Domain:',
40
+ 'domain.status' => 'Status:',
41
+ 'domain.nserver' => 'Name servers:',
42
+ 'domain.created' => 'Registered:',
43
+ 'domain.registrar' => 'Registrar:',
44
+ 'tech' => 'Registrar Technical Contacts:',
45
+ 'owner' => 'Registrant:',
46
+ '' => 'Please visit'
47
+ );
48
+
49
+ $extra = array(
50
+ 'organisation:' => 'organization',
51
+ 'website:' => 'url'
52
+ );
53
+
54
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
55
+
56
+ if (!empty($r['regrinfo']['domain']['status']))
57
+ switch ($r['regrinfo']['domain']['status'])
58
+ {
59
+ case 'FREE':
60
+ case 'AVAILABLE':
61
+ $r['regrinfo']['registered'] = 'no';
62
+ break;
63
+
64
+ case 'APPLICATION PENDING':
65
+ $r['regrinfo']['registered'] = 'pending';
66
+ break;
67
+
68
+ default:
69
+ $r['regrinfo']['registered'] = 'unknown';
70
+ }
71
+ else
72
+ $r['regrinfo']['registered'] = 'yes';
73
+
74
+ if (isset($r['regrinfo']['tech']))
75
+ $r['regrinfo']['tech'] = get_contact($r['regrinfo']['tech'],$extra);
76
+
77
+ if (isset($r['regrinfo']['domain']['registrar']))
78
+ $r['regrinfo']['domain']['registrar'] = get_contact($r['regrinfo']['domain']['registrar'],$extra);
79
+
80
+ $r['regyinfo']['referrer'] = 'http://www.eurid.eu';
81
+ $r['regyinfo']['registrar'] = 'EURID';
82
+ return $r;
83
+ }
84
+ }
85
+ ?>
lib/whois/whois.fi.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__FI_HANDLER__'))
29
+ define('__FI_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class fi_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain:' => 'domain.name',
39
+ 'created:' => 'domain.created',
40
+ 'expires:' => 'domain.expires',
41
+ 'status:' => 'domain.status',
42
+ 'nserver:' => 'domain.nserver.',
43
+ 'descr:' => 'owner.name.',
44
+ 'address:' => 'owner.address.',
45
+ 'phone:' => 'owner.phone',
46
+ );
47
+
48
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items);
49
+
50
+ $r['regyinfo'] = array(
51
+ 'referrer' => 'https://domain.ficora.fi/',
52
+ 'registrar' => 'Finnish Communications Regulatory Authority'
53
+ );
54
+ return $r;
55
+ }
56
+ }
57
+ ?>
lib/whois/whois.fj.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__FJ_HANDLER__'))
31
+ define('__FJ_HANDLER__', 1);
32
+
33
+ class fj_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'domain.status' => 'Status:',
40
+ 'domain.expires' => 'Expires:',
41
+ 'domain.nserver' => 'Domain servers:'
42
+ );
43
+
44
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
45
+
46
+ if (!empty($r['regrinfo']['domain']['status']))
47
+ {
48
+ $r['regrinfo'] = get_contacts($r['regrinfo']);
49
+
50
+ date_default_timezone_set("Pacific/Fiji");
51
+
52
+ if (isset($r['regrinfo']['domain']['expires']))
53
+ $r['regrinfo']['domain']['expires'] = strftime("%Y-%m-%d",strtotime($r['regrinfo']['domain']['expires']));
54
+
55
+ $r['regrinfo']['registered'] = 'yes';
56
+ }
57
+ else
58
+ $r['regrinfo']['registered'] = 'no';
59
+
60
+ $r['regyinfo'] = array(
61
+ 'referrer' => 'http://www.domains.fj',
62
+ 'registrar' => 'FJ Domain Name Registry'
63
+ );
64
+ return $r;
65
+ }
66
+ }
67
+ ?>
lib/whois/whois.fm.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__FM_HANDLER__'))
29
+ define('__FM_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class fm_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Admin',
40
+ 'tech' => 'Technical',
41
+ 'billing' => 'Billing',
42
+ 'domain.nserver' => 'Name Servers:',
43
+ 'domain.created' => 'Created:',
44
+ 'domain.expires' => 'Expires:',
45
+ 'domain.changed' => 'Modified:',
46
+ 'domain.status' => 'Status:',
47
+ 'domain.sponsor' => 'Registrar Name:'
48
+ );
49
+
50
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
51
+
52
+ $items = array(
53
+ 'phone number:' => 'phone',
54
+ 'email address:' => 'email',
55
+ 'fax number:' => 'fax',
56
+ 'organisation:' => 'organization'
57
+ );
58
+
59
+ if (!empty($r['regrinfo']['domain']['created']))
60
+ {
61
+ $r['regrinfo'] = get_contacts($r['regrinfo'],$items);
62
+
63
+ if (count($r['regrinfo']['billing']['address']) > 4)
64
+ $r['regrinfo']['billing']['address'] = array_slice($r['regrinfo']['billing']['address'],0,4);
65
+
66
+ $r['regrinfo']['registered'] = 'yes';
67
+ format_dates($r['regrinfo']['domain'],'dmY');
68
+ }
69
+ else
70
+ {
71
+ $r = '';
72
+ $r['regrinfo']['registered'] = 'no';
73
+ }
74
+
75
+ $r['regyinfo']['referrer'] = 'http://www.dot.dm';
76
+ $r['regyinfo']['registrar'] = 'dotFM';
77
+ return $r;
78
+ }
79
+ }
80
+ ?>
lib/whois/whois.fr.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__FR_HANDLER__'))
29
+ define('__FR_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class fr_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'ns-list' => 'handle',
42
+ 'person' => 'name',
43
+ 'address' => 'address.',
44
+ 'descr' => 'desc',
45
+ 'anniversary' => '',
46
+ 'domain' => '',
47
+ 'last-update' => 'changed',
48
+ 'registered' => 'created',
49
+ 'country' => 'address.country',
50
+ 'registrar' => 'sponsor',
51
+ 'role' => 'organization'
52
+ );
53
+
54
+ $contacts = array(
55
+ 'admin-c' => 'admin',
56
+ 'tech-c' => 'tech',
57
+ 'zone-c' => 'zone',
58
+ 'holder-c' => 'owner',
59
+ 'nsl-id' => 'nserver'
60
+ );
61
+
62
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','dmY');
63
+
64
+ if (isset($reg['nserver']))
65
+ {
66
+ $reg['domain'] = array_merge($reg['domain'],$reg['nserver']);
67
+ unset($reg['nserver']);
68
+ }
69
+
70
+ $r['regrinfo'] = $reg;
71
+ $r['regyinfo'] = array(
72
+ 'referrer' => 'http://www.nic.fr',
73
+ 'registrar' => 'AFNIC'
74
+ );
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.gtld.afternic.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__AFTERNIC_HANDLER__'))
29
+ define('__AFTERNIC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class afternic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'zone' => 'Zone Contact',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.changed' => 'Last updated on',
44
+ 'domain.created' => 'Domain created on',
45
+ 'domain.expires' => 'Domain expires on'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'dmy', false, false, true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.alldomains.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ALLDOMAINS_HANDLER__'))
29
+ define('__ALLDOMAINS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class alldomains_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative',
40
+ 'tech' => 'Technical',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.sponsor' => 'Registrar:',
43
+ 'domain.nserver.' => 'Domain servers in listed order:'
44
+ );
45
+
46
+ return easy_parser($data_str, $items, 'ymd');
47
+ }
48
+ }
49
+ ?>
lib/whois/whois.gtld.ascio.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ASCIO_HANDLER__'))
29
+ define('__ASCIO_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ascio_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative ',
40
+ 'tech' => 'Technical ',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.created' => 'Record created:',
44
+ 'domain.expires' => 'Record expires:',
45
+ 'domain.changed' => 'Record last updated:'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'ymd',false,false,true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.assorted.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ASSORTED_HANDLER__'))
29
+ define('__ASSORTED_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class assorted_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.created' => 'Record created on',
44
+ 'domain.expires' => 'Record expires on',
45
+ 'domain.changed' => 'Record last updated'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'ymd',false,false,true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.corporatedomains.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__CORPORATEDOMAINS_HANDLER__'))
29
+ define('__CORPORATEDOMAINS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class corporatedomains_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'zone' => 'Zone Contact',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.changed' => 'Last updated on',
44
+ 'domain.created' => 'Domain created on',
45
+ 'domain.expires' => 'Domain expires on',
46
+ 'domain.sponsor' => 'Registrar Name....:',
47
+ 'domain.nserver' => 'DNS Servers:'
48
+ );
49
+
50
+ return easy_parser($data_str, $items, 'dmy', false, false, true);
51
+ }
52
+ }
53
+ ?>
lib/whois/whois.gtld.directnic.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DIRECTNIC_HANDLER__'))
29
+ define('__DIRECTNIC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class directnic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.sponsor' => 'Registration Service Provider:',
43
+ 'domain.nserver' => 'Domain servers in listed order:',
44
+ 'domain.changed' => 'Record last updated ',
45
+ 'domain.created' => 'Record created on ',
46
+ 'domain.expires' => 'Record expires on ',
47
+ '' => 'By submitting a WHOIS query'
48
+ );
49
+
50
+ return easy_parser($data_str, $items, 'mdy',false,false,true);
51
+ }
52
+ }
53
+ ?>
lib/whois/whois.gtld.domaindiscover.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DOMAINDISCOVER_HANDLER__'))
29
+ define('__DOMAINDISCOVER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class domaindiscover_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'zone' => 'Zone Contact',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.changed' => 'Last updated on',
44
+ 'domain.created' => 'Domain created on',
45
+ 'domain.expires' => 'Domain expires on'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'dmy', false, false, true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.domainpeople.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DOMAINPEOPLE_HANDLER__'))
29
+ define('__DOMAINPEOPLE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class domainpeople_handler
34
+ {
35
+
36
+ function parse($data_str, $query)
37
+ {
38
+
39
+ $items = array(
40
+ 'owner' => 'Registrant Contact:',
41
+ 'admin' => 'Administrative Contact:',
42
+ 'tech' => 'Technical Contact:',
43
+ 'domain.name' => 'Domain name:',
44
+ 'domain.sponsor' => 'Registration Service Provided By:',
45
+ 'domain.referrer' => 'Contact:',
46
+ 'domain.nserver.' => 'Name Servers:',
47
+ 'domain.created' => 'Creation date:',
48
+ 'domain.expires' => 'Expiration date:',
49
+ // 'domain.changed' => 'Record last updated on',
50
+ 'domain.status' => 'Status:'
51
+ );
52
+
53
+ $r = easy_parser($data_str, $items, 'dmy', false, false, true);
54
+ if (isset($r['domain']['sponsor']) && is_array($r['domain']['sponsor']))
55
+ $r['domain']['sponsor'] = $r['domain']['sponsor'][0];
56
+ return $r;
57
+ }
58
+ }
59
+ ?>
lib/whois/whois.gtld.dotster.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DOTSTER_HANDLER__'))
29
+ define('__DOTSTER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class dotster_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative',
40
+ 'tech' => 'Technical',
41
+ 'domain.nserver' =>
42
+ 'Domain servers in listed order:',
43
+ 'domain.name' => 'Domain name:',
44
+ 'domain.created' => 'Created on:',
45
+ 'domain.expires' => 'Expires on:',
46
+ 'domain.changed' => 'Last Updated on:',
47
+ 'domain.sponsor' => 'Registrar:'
48
+ );
49
+
50
+ return easy_parser($data_str, $items, 'dmy');
51
+ }
52
+ }
53
+ ?>
lib/whois/whois.gtld.dreamhost.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__DREAMHOST_HANDLER__'))
29
+ define('__DREAMHOST_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class dreamhost_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant Contact:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'billing' => 'Billing Contact:',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.nserver' => 'Domain servers in listed order:',
44
+ 'domain.created' => 'Record created on',
45
+ 'domain.expires' => 'Record expires on'
46
+ );
47
+
48
+ $r = easy_parser($data_str, $items, 'dmy', false, false, true);
49
+ if (isset($r['domain']['sponsor']) && is_array($r['domain']['sponsor']))
50
+ $r['domain']['sponsor'] = $r['domain']['sponsor'][0];
51
+ return $r;
52
+ }
53
+ }
54
+ ?>
lib/whois/whois.gtld.enom.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ENOM_HANDLER__'))
29
+ define('__ENOM_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class enom_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner#0' => 'Registrant Contact',
39
+ 'owner#1' => 'REGISTRANT Contact:',
40
+ 'admin#0' => 'Administrative Contact',
41
+ 'admin#1' => 'ADMINISTRATIVE Contact:',
42
+ 'tech#0' => 'Technical Contact',
43
+ 'tech#1' => 'TECHNICAL Contact:',
44
+ 'billing#0' => 'Billing Contact',
45
+ 'billing#1' => 'BILLING Contact:',
46
+ 'domain.nserver' => 'Nameservers',
47
+ 'domain.name#0' => 'Domain name:',
48
+ 'domain.name#1' => 'Domain name-',
49
+ 'domain.sponsor' => 'Registration Service Provided By:',
50
+ 'domain.status' => 'Status:',
51
+ 'domain.created#0' => 'Creation date:',
52
+ 'domain.expires#0' => 'Expiration date:',
53
+ 'domain.created#1' => 'Created:',
54
+ 'domain.expires#1' => 'Expires:',
55
+ 'domain.created#2' => 'Start of registration-',
56
+ 'domain.expires#2' => 'Registered through-'
57
+ );
58
+
59
+ return easy_parser($data_str, $items, 'dmy', false, false, true);
60
+ }
61
+ }
62
+ ?>
lib/whois/whois.gtld.fabulous.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__FABULOUS_HANDLER__'))
29
+ define('__FABULOUS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class fabulous_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Domain '.$query.':',
39
+ 'admin' => 'Administrative contact:',
40
+ 'tech' => 'Technical contact:',
41
+ 'billing' => 'Billing contact:',
42
+ '' => 'Record dates:'
43
+ );
44
+
45
+ $r = easy_parser($data_str, $items, 'mdy',false,false,true);
46
+
47
+ if (!isset($r['tech'])) $r['tech'] = $r['billing'];
48
+
49
+ if (!isset($r['admin'])) $r['admin'] = $r['tech'];
50
+
51
+ return $r;
52
+ }
53
+ }
54
+ ?>
lib/whois/whois.gtld.fastdomain.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__FASTDOMAIN_HANDLER__'))
29
+ define('__FASTDOMAIN_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class fastdomain_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant Info:',
39
+ 'admin' => 'Administrative Info:',
40
+ 'tech' => 'Technical Info:',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.sponsor' => 'Provider Name....:',
43
+ 'domain.referrer' => 'Provider Homepage:',
44
+ 'domain.nserver' => 'Domain servers in listed order:',
45
+ 'domain.created' => 'Created on..............:',
46
+ 'domain.expires' => 'Expires on..............:',
47
+ 'domain.changed' => 'Last modified on........:',
48
+ 'domain.status' => 'Status:'
49
+ );
50
+
51
+ while (list($key, $val) = each($data_str))
52
+ {
53
+ $faststr = strpos($val, ' (FAST-');
54
+ if ($faststr)
55
+ $data_str[$key] = substr($val, 0, $faststr);
56
+ }
57
+
58
+ $r = easy_parser($data_str, $items, 'dmy', false, false, true);
59
+
60
+ if (isset($r['domain']['sponsor']) && is_array($r['domain']['sponsor']))
61
+
62
+ $r['domain']['sponsor'] = $r['domain']['sponsor'][0];
63
+
64
+ if (isset($r['domain']['nserver']))
65
+ {
66
+ reset($r['domain']['nserver']);
67
+ $endnserver = false;
68
+ while (list($key, $val) = each($r['domain']['nserver']))
69
+ {
70
+ if ($val == '=-=-=-=')
71
+ unset($r['domain']['nserver'][$key]);
72
+ }
73
+ }
74
+
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.gtld.gandi.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__GANDI_HANDLER__'))
29
+ define('__GANDI_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class gandi_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'owner-c',
39
+ 'admin' => 'admin-c',
40
+ 'tech' => 'tech-c',
41
+ 'billing' => 'bill-c'
42
+ );
43
+
44
+ $trans = array(
45
+ 'nic-hdl:' => 'handle',
46
+ 'person:' => 'name',
47
+ 'zipcode:' => 'address.pcode',
48
+ 'city:' => 'address.city',
49
+ 'lastupdated:' => 'changed',
50
+ 'owner-name:' => ''
51
+ );
52
+
53
+ return easy_parser($data_str, $items, 'dmy', $trans);
54
+ }
55
+ }
56
+ ?>
lib/whois/whois.gtld.genericb.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__GENERICB_HANDLER__'))
29
+ define('__GENERICB_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class genericb_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ return generic_parser_b($data_str);
38
+ }
39
+ }
40
+ ?>
lib/whois/whois.gtld.godaddy.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__GODADDY_HANDLER__'))
29
+ define('__GODADDY_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class godaddy_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.created' => 'Created on:',
44
+ 'domain.expires' => 'Expires on:',
45
+ 'domain.changed' => 'Last Updated on:',
46
+ 'domain.sponsor' => 'Registered through:'
47
+ );
48
+
49
+ $r = get_blocks($data_str, $items);
50
+ $r['owner'] = get_contact($r['owner']);
51
+ $r['admin'] = get_contact($r['admin'],false,true);
52
+ $r['tech'] = get_contact($r['tech'],false,true);
53
+ return format_dates($r, 'dmy');
54
+ }
55
+ }
56
+ ?>
lib/whois/whois.gtld.iana.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__IANA_HANDLER__'))
29
+ define('__IANA_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class iana_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'admin' => 'contact: administrative',
39
+ 'tech' => 'contact: technical',
40
+ 'domain.nserver.' => 'nserver:',
41
+ 'domain.created' => 'created:',
42
+ 'domain.changed' => 'changed:',
43
+ 'domain.source' => 'source:',
44
+ 'domain.name' => 'domain:',
45
+ 'disclaimer.' => '% '
46
+ );
47
+
48
+ return easy_parser($data_str,$items,'Ymd',false,false,false,'owner');
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.interdomain.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__INTERDOMAIN_HANDLER__'))
29
+ define('__INTERDOMAIN_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class interdomain_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'Domain Name................' => 'domain.name',
39
+ 'Creation Date............' => 'domain.created',
40
+ 'Expiry Date..............' => 'domain.expires',
41
+ 'Last Update Date.........' => 'domain.changed',
42
+ 'Name Server.............' => 'domain.nserver.',
43
+ 'Organization Name........' => 'owner.name',
44
+ 'Organization Org.........' => 'owner.organization',
45
+ 'Organization Street......' => 'owner.address.street',
46
+ 'Organization City........' => 'owner.address.city',
47
+ 'Organization State.......' => 'owner.address.state',
48
+ 'Organization PC..........' => 'owner.address.pcode',
49
+ 'Organization Country.....' => 'owner.address.country',
50
+ 'Organization Phone.......' => 'owner.phone',
51
+ 'Organization e-mail......' => 'owner.email',
52
+ 'Organization Contact Id....' => 'owner.handle',
53
+ 'Administrative Contact Id..' => 'admin.handle',
54
+ 'Administrative Name......' => 'admin.name',
55
+ 'Administrative Org.......' => 'admin.organization',
56
+ 'Administrative Street....' => 'admin.address.street',
57
+ 'Administrative City......' => 'admin.address.city',
58
+ 'Administrative State.....' => 'admin.address.state',
59
+ 'Administrative PC........' => 'admin.address.pcode',
60
+ 'Administrative Country...' => 'admin.address.country',
61
+ 'Administrative Phone.....' => 'admin.phone',
62
+ 'Administrative e-mail....' => 'admin.email',
63
+ 'Administrative Fax.......' => 'admin.fax',
64
+ 'Technical Contact Id.......' => 'tech.handle',
65
+ 'Technical Name...........' => 'tech.name',
66
+ 'Technical Org............' => 'tech.organization',
67
+ 'Technical Street.........' => 'tech.address.street',
68
+ 'Technical City...........' => 'tech.address.city',
69
+ 'Technical State..........' => 'tech.address.state',
70
+ 'Technical PC.............' => 'tech.address.pcode',
71
+ 'Technical Country........' => 'tech.address.country',
72
+ 'Technical Phone..........' => 'tech.phone',
73
+ 'Technical e-mail.........' => 'tech.email',
74
+ 'Technical Fax............' => 'tech.fax'
75
+ );
76
+
77
+ return generic_parser_b($data_str, $items, 'dmy');
78
+ }
79
+ }
80
+ ?>
lib/whois/whois.gtld.itsyourdomain.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ITSYOURDOMAIN_HANDLER__'))
29
+ define('__ITSYOURDOMAIN_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class itsyourdomain_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Administrative',
40
+ 'tech' => 'Technical',
41
+ 'billing' => 'Billing',
42
+ 'domain.name' => 'Domain:',
43
+ 'domain.nserver.' => 'Domain Name Servers:',
44
+ 'domain.created' => 'Record created on ',
45
+ 'domain.expires' => 'Record expires on ',
46
+ 'domain.changed' => 'Record last updated on '
47
+ );
48
+
49
+ return easy_parser($data_str, $items, 'mdy');
50
+ }
51
+ }
52
+ ?>
lib/whois/whois.gtld.joker.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__JOKER_HANDLER__'))
29
+ define('__JOKER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class joker_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'contact-hdl' => 'handle',
39
+ 'modified' => 'changed',
40
+ 'reseller' => 'sponsor',
41
+ 'address' => 'address.street',
42
+ 'postal-code' => 'address.pcode',
43
+ 'city' => 'address.city',
44
+ 'state' => 'address.state',
45
+ 'country' => 'address.country',
46
+ 'person' => 'name',
47
+ 'domain' => 'name'
48
+ );
49
+
50
+ $contacts = array(
51
+ 'admin-c' => 'admin',
52
+ 'tech-c' => 'tech',
53
+ 'billing-c' => 'billing'
54
+ );
55
+
56
+ $items = array(
57
+ 'owner' => 'name',
58
+ 'organization' => 'organization',
59
+ 'email' => 'email',
60
+ 'phone' => 'phone',
61
+ 'address' => 'address',
62
+ );
63
+
64
+ $r = generic_parser_a($data_str, $translate, $contacts, 'domain', 'Ymd');
65
+
66
+ foreach($items as $tag => $convert)
67
+ {
68
+ if (isset($r['domain'][$tag]))
69
+ {
70
+ $r['owner'][$convert] = $r['domain'][$tag];
71
+ unset($r['domain'][$tag]);
72
+ }
73
+ }
74
+
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.gtld.markmonitor.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__MARKMONITOR_HANDLER__'))
29
+ define('__MARKMONITOR_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class markmonitor_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact, Zone Contact:',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.sponsor' => 'Registrar Name:',
43
+ 'domain.nserver' => 'Domain servers in listed order:',
44
+ 'domain.created' => 'Created on..............:',
45
+ 'domain.expires' => 'Expires on..............:',
46
+ 'domain.changed' => 'Record last updated on..:'
47
+ );
48
+
49
+ $r = easy_parser($data_str, $items, 'dmy', false, false, true);
50
+ if (isset($r['domain']['sponsor']) && is_array($r['domain']['sponsor']))
51
+ $r['domain']['sponsor'] = $r['domain']['sponsor'][0];
52
+ return $r;
53
+ }
54
+ }
55
+ ?>
lib/whois/whois.gtld.melbourneit.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__MELBOURNEIT_HANDLER__'))
31
+ define('__MELBOURNEIT_HANDLER__', 1);
32
+
33
+ class melbourneit_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'Domain Name..........' => 'domain.name',
39
+ 'Registration Date....' => 'domain.created',
40
+ 'Expiry Date..........' => 'domain.expires',
41
+ 'Organisation Name....' => 'owner.name',
42
+ 'Organisation Address.' => 'owner.address.',
43
+ 'Admin Name...........' => 'admin.name',
44
+ 'Admin Address........' => 'admin.address.',
45
+ 'Admin Email..........' => 'admin.email',
46
+ 'Admin Phone..........' => 'admin.phone',
47
+ 'Admin Fax............' => 'admin.fax',
48
+ 'Tech Name............' => 'tech.name',
49
+ 'Tech Address.........' => 'tech.address.',
50
+ 'Tech Email...........' => 'tech.email',
51
+ 'Tech Phone...........' => 'tech.phone',
52
+ 'Tech Fax.............' => 'tech.fax',
53
+ 'Name Server..........' => 'domain.nserver.'
54
+ );
55
+
56
+ return generic_parser_b($data_str, $items, 'ymd');
57
+ }
58
+ }
59
+ ?>
lib/whois/whois.gtld.moniker.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__MONIKER_HANDLER__'))
29
+ define('__MONIKER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class moniker_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Administrative ',
40
+ 'tech' => 'Technical ',
41
+ 'billing' => 'Billing ',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.nserver.' => 'Domain servers in listed order:',
44
+ 'domain.created' => 'Record created on: ',
45
+ 'domain.expires' => 'Domain Expires on: ',
46
+ 'domain.changed' => 'Database last updated on: '
47
+ );
48
+
49
+ return easy_parser($data_str, $items, 'ymd');
50
+ }
51
+ }
52
+ ?>
lib/whois/whois.gtld.namejuice.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAMEJUICE_HANDLER__'))
29
+ define('__NAMEJUICE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class namejuice_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant Contact:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.nserver.' => 'Name Servers:',
43
+ 'domain.created' => 'Creation date:',
44
+ 'domain.expires' => 'Expiration date:',
45
+ 'domain.changed' => 'Update date:',
46
+ 'domain.status' => 'Status:',
47
+ 'domain.sponsor' => 'Registration Service Provided By:'
48
+ );
49
+
50
+ return easy_parser($data_str, $items, 'dmy', false, true, true);
51
+ }
52
+ }
53
+ ?>
lib/whois/whois.gtld.nameking.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAMEKING_HANDLER__'))
29
+ define('__NAMEKING_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nameking_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Admin Contact',
40
+ 'tech' => 'Tech Contact',
41
+ 'billing' => 'Billing Contact',
42
+ 'domain.sponsor' => 'Registration Provided By:',
43
+ 'domain.created' => 'Creation Date:',
44
+ 'domain.expires' => 'Expiration Date:',
45
+ );
46
+
47
+ $extra = array(
48
+ 'tel--' => 'phone',
49
+ 'tel:' => 'phone',
50
+ 'tel --:' => 'phone',
51
+ 'email-:' => 'email',
52
+ 'email:' => 'email',
53
+ 'mail:' => 'email',
54
+ 'name--' => 'name',
55
+ 'org:' => 'organization',
56
+ 'zipcode:' => 'address.pcode',
57
+ 'postcode:' => 'address.pcode',
58
+ 'address:' => 'address.street',
59
+ 'city:' => 'address.city',
60
+ 'province:' => 'address.city.',
61
+ ',province:' => '',
62
+ ',country:' => 'address.country',
63
+ 'organization:' => 'organization',
64
+ 'city, province, post code:' => 'address.city'
65
+ );
66
+
67
+ return easy_parser($data_str, $items, 'mdy', $extra, false, true);
68
+ }
69
+ }
70
+ ?>
lib/whois/whois.gtld.names4ever.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAMES4EVER_HANDLER__'))
29
+ define('__NAMES4EVER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class names4ever_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.sponsor' => 'Registrar Name....:',
43
+ 'domain.referrer' => 'Registrar Homepage:',
44
+ 'domain.nserver' => 'DNS Servers:',
45
+ 'domain.created' => 'Record created on',
46
+ 'domain.expires' => 'Record expires on',
47
+ 'domain.changed' => 'Record last updated on',
48
+ 'domain.status' => 'Domain status:'
49
+ );
50
+
51
+ return easy_parser($data_str, $items, 'dmy', false, false, true);
52
+ }
53
+ }
54
+ ?>
lib/whois/whois.gtld.namevault.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAMEVAULT_HANDLER__'))
29
+ define('__NAMEVAULT_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class namevault_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'billing' => 'Billing Contact:',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.nserver.' => 'Name Servers',
44
+ 'domain.created' => 'Creation Date:',
45
+ 'domain.expires' => 'Expiration Date:',
46
+ 'domain.status' => 'Status:'
47
+ );
48
+
49
+ return easy_parser($data_str, $items, 'dmy', false, true, true);
50
+ }
51
+ }
52
+ ?>
lib/whois/whois.gtld.networksolutions.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NETWORKSOLUTIONS_HANDLER__'))
29
+ define('__NETWORKSOLUTIONS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class networksolutions_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.created' => 'Record created on',
44
+ 'domain.expires' => 'Record expires on'
45
+ );
46
+
47
+ return easy_parser($data_str, $items, 'dmy',false,true,true);
48
+ }
49
+ }
50
+ ?>
lib/whois/whois.gtld.nicco.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NICCO_HANDLER__'))
29
+ define('__NICCO_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nicco_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Holder Contact',
39
+ 'admin' => 'Admin Contact',
40
+ 'tech' => 'Tech. Contact',
41
+ 'domain.nserver.' => 'Nameservers',
42
+ 'domain.created' => 'Creation Date:',
43
+ 'domain.expires' => 'Expiration Date:'
44
+ );
45
+
46
+ $translate = array(
47
+ 'city:' => 'address.city',
48
+ 'org. name:' => 'organization',
49
+ 'address1:' => 'address.street.',
50
+ 'address2:' => 'address.street.',
51
+ 'state:' => 'address.state',
52
+ 'postal code:' => 'address.zip'
53
+ );
54
+
55
+ $r = get_blocks($data_str, $items, true);
56
+ $r['owner'] = get_contact($r['owner'],$translate);
57
+ $r['admin'] = get_contact($r['admin'],$translate,true);
58
+ $r['tech'] = get_contact($r['tech'],$translate,true);
59
+ return format_dates($r, 'dmy');
60
+ }
61
+ }
62
+ ?>
lib/whois/whois.gtld.nicline.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NICLINE_HANDLER__'))
29
+ define('__NICLINE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nicline_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative contact:',
40
+ 'tech' => 'Technical contact:',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.created' => 'Created:',
44
+ 'domain.expires' => 'Expires:',
45
+ 'domain.changed' => 'Last updated:'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'dmy');
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.onlinenic.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ONLINENIC_HANDLER__'))
29
+ define('__ONLINENIC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class onlinenic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrator:',
40
+ 'tech' => 'Technical Contactor:',
41
+ 'billing' => 'Billing Contactor:',
42
+ 'domain.name' => 'Domain name:',
43
+ 'domain.name#' => 'Domain Name:',
44
+ 'domain.nserver' => 'Domain servers in listed order:',
45
+ 'domain.created' => 'Record created on ',
46
+ 'domain.expires' => 'Record expired on ',
47
+ 'domain.changed' => 'Record last updated at '
48
+ );
49
+
50
+ $extra = array(
51
+ 'tel--' => 'phone',
52
+ 'tel:' => 'phone',
53
+ 'tel --:' => 'phone',
54
+ 'email-:' => 'email',
55
+ 'email:' => 'email',
56
+ 'mail:' => 'email',
57
+ 'name--' => 'name',
58
+ 'org:' => 'organization',
59
+ 'zipcode:' => 'address.pcode',
60
+ 'postcode:' => 'address.pcode',
61
+ 'address:' => 'address.street',
62
+ 'city:' => 'address.city',
63
+ 'province:' => '',
64
+ ',province:' => '',
65
+ ',country:' => 'address.country'
66
+ );
67
+
68
+ $r = easy_parser($data_str, $items, 'mdy',$extra,false,true);
69
+
70
+ foreach($r as $key => $part)
71
+ if (isset($part['email']))
72
+ {
73
+ @list($email,$phone) = explode(' ',$part['email']);
74
+ $email = str_replace('(','',$email);
75
+ $email = str_replace(')','',$email);
76
+ $r[$key]['email'] = $email;
77
+ if ($phone != '') $r[$key]['phone'] = $phone;
78
+ }
79
+
80
+ return $r;
81
+ }
82
+ }
83
+ ?>
lib/whois/whois.gtld.opensrs.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__OPENSRS_HANDLER__'))
29
+ define('__OPENSRS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class opensrs_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain name:',
42
+ '' => 'Registration Service Provider:',
43
+ 'domain.nserver' => 'Domain servers in listed order:',
44
+ 'domain.changed' => 'Record last updated on',
45
+ 'domain.created' => 'Record created on',
46
+ 'domain.expires' => 'Record expires on',
47
+ 'domain.sponsor' => 'Registrar of Record:'
48
+ );
49
+
50
+ $r = easy_parser($data_str, $items, 'dmy', false, false, true);
51
+
52
+ if (isset($r['domain']['sponsor']) && is_array($r['domain']['sponsor']))
53
+ $r['domain']['sponsor'] = $r['domain']['sponsor'][0];
54
+
55
+ return $r;
56
+ }
57
+ }
58
+ ?>
lib/whois/whois.gtld.ovh.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__OVH_HANDLER__'))
29
+ define('__OVH_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ovh_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'billing' => 'Billing Contact:',
42
+ 'domain.sponsor' => 'Registrar of Record:',
43
+ 'domain.changed' => 'Record last updated on',
44
+ 'domain.expires' => 'Record expires on',
45
+ 'domain.created' => 'Record created on'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'mdy',false,false,true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__GTLD_HANDLER__'))
29
+ define('__GTLD_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class gtld_handler extends WhoisClient
34
+ {
35
+ var $HANDLER_VERSION = '1.1';
36
+
37
+ var $REG_FIELDS = array(
38
+ 'Domain Name:' => 'regrinfo.domain.name',
39
+ 'Registrar:' => 'regyinfo.registrar',
40
+ 'Whois Server:' => 'regyinfo.whois',
41
+ 'Referral URL:' => 'regyinfo.referrer',
42
+ 'Name Server:' => 'regrinfo.domain.nserver.', // identical descriptors
43
+ 'Updated Date:' => 'regrinfo.domain.changed',
44
+ 'Last Updated On:' => 'regrinfo.domain.changed',
45
+ 'EPP Status:' => 'regrinfo.domain.epp_status.',
46
+ 'Status:' => 'regrinfo.domain.status.',
47
+ 'Creation Date:' => 'regrinfo.domain.created',
48
+ 'Created On:' => 'regrinfo.domain.created',
49
+ 'Expiration Date:' => 'regrinfo.domain.expires',
50
+ 'Updated Date:' => 'regrinfo.domain.changed',
51
+ 'No match for ' => 'nodomain'
52
+ );
53
+
54
+ function parse($data, $query)
55
+ {
56
+ $this->Query = array();
57
+ $this->SUBVERSION = sprintf('%s-%s', $query['handler'], $this->HANDLER_VERSION);
58
+ $this->result = generic_parser_b($data['rawdata'], $this->REG_FIELDS, 'dmy');
59
+
60
+ unset($this->result['registered']);
61
+
62
+ if (isset($this->result['nodomain']))
63
+ {
64
+ unset($this->result['nodomain']);
65
+ $this->result['regrinfo']['registered'] = 'no';
66
+ return $this->result;
67
+ }
68
+
69
+ if ($this->deep_whois) $this->result = $this->DeepWhois($query,$this->result);
70
+
71
+ // Next server could fail to return data
72
+ if (empty($this->result['rawdata']) || count($this->result['rawdata']) < 3)
73
+ $this->result['rawdata'] = $data['rawdata'];
74
+
75
+ // Domain is registered no matter what next server says
76
+ $this->result['regrinfo']['registered'] = 'yes';
77
+
78
+ return $this->result;
79
+ }
80
+ }
81
+ ?>
lib/whois/whois.gtld.psiusa.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__PSIUSA_HANDLER__'))
29
+ define('__PSIUSA_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class psiusa_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'created:' => 'domain.created',
39
+ 'last-changed:' => 'domain.changed',
40
+ 'status:' => 'domain.status',
41
+ '[owner-c] fname:' => 'owner.name.first',
42
+ '[owner-c] lname:' => 'owner.name.last',
43
+ '[owner-c] org:' => 'owner.organization',
44
+ '[owner-c] address:' => 'owner.address.street',
45
+ '[owner-c] city:' => 'owner.address.city',
46
+ '[owner-c] pcode:' => 'owner.address.pcode',
47
+ '[owner-c] country:' => 'owner.address.country',
48
+ '[owner-c] state:' => 'owner.address.state',
49
+ '[owner-c] phone:' => 'owner.phone',
50
+ '[owner-c] fax:' => 'owner.fax',
51
+ '[owner-c] email:' => 'owner.email',
52
+ '[admin-c] fname:' => 'admin.name.first',
53
+ '[admin-c] lname:' => 'admin.name.last',
54
+ '[admin-c] org:' => 'admin.organization',
55
+ '[admin-c] address:' => 'admin.address.street',
56
+ '[admin-c] city:' => 'admin.address.city',
57
+ '[admin-c] pcode:' => 'admin.address.pcode',
58
+ '[admin-c] country:' => 'admin.address.country',
59
+ '[admin-c] state:' => 'admin.address.state',
60
+ '[admin-c] phone:' => 'admin.phone',
61
+ '[admin-c] fax:' => 'admin.fax',
62
+ '[admin-c] email:' => 'admin.email',
63
+ '[tech-c] fname:' => 'tech.name.first',
64
+ '[tech-c] lname:' => 'tech.name.last',
65
+ '[tech-c] org:' => 'tech.organization',
66
+ '[tech-c] address:' => 'tech.address.street',
67
+ '[tech-c] city:' => 'tech.address.city',
68
+ '[tech-c] pcode:' => 'tech.address.pcode',
69
+ '[tech-c] country:' => 'tech.address.country',
70
+ '[tech-c] state:' => 'tech.address.state',
71
+ '[tech-c] phone:' => 'tech.phone',
72
+ '[tech-c] fax:' => 'tech.fax',
73
+ '[tech-c] email:' => 'tech.email',
74
+ '[zone-c] fname:' => 'zone.name.first',
75
+ '[zone-c] lname:' => 'zone.name.last',
76
+ '[zone-c] org:' => 'zone.organization',
77
+ '[zone-c] address:' => 'zone.address.street',
78
+ '[zone-c] city:' => 'zone.address.city',
79
+ '[zone-c] pcode:' => 'zone.address.pcode',
80
+ '[zone-c] country:' => 'zone.address.country',
81
+ '[zone-c] state:' => 'zone.address.state',
82
+ '[zone-c] phone:' => 'zone.phone',
83
+ '[zone-c] fax:' => 'zone.fax',
84
+ '[zone-c] email:' => 'zone.email',
85
+ );
86
+
87
+ return generic_parser_b($data_str, $items);
88
+ }
89
+ }
90
+ ?>
lib/whois/whois.gtld.publicdomainregistry.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__PUBLICDOMAINREGISTRY_HANDLER__'))
29
+ define('__PUBLICDOMAINREGISTRY_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class publicdomainregistry_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'owner#' => '(Registrant):',
40
+ 'admin' => 'Administrative Contact',
41
+ 'tech' => 'Technical Contact',
42
+ 'billing' => 'Billing Contact',
43
+ 'domain.name' => 'Domain name:',
44
+ 'domain.sponsor' => 'Registration Service Provided By:',
45
+ 'domain.nserver' => 'Domain servers in listed order:',
46
+ 'domain.changed' => 'Record last updated ',
47
+ 'domain.created' => 'Record created on',
48
+ 'domain.created#' => 'Creation Date:',
49
+ 'domain.expires' => 'Record expires on',
50
+ 'domain.expires#' => 'Expiration Date:',
51
+ 'domain.status' => 'Status:'
52
+ );
53
+
54
+ return easy_parser($data_str, $items, 'mdy', false, true, true);
55
+ }
56
+ }
57
+ ?>
lib/whois/whois.gtld.register.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__REGISTER_HANDLER__'))
29
+ define('__REGISTER_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class register_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner#0' => 'Registrant Info:',
39
+ 'owner#1' => 'Organization:',
40
+ 'owner#2' => 'Registrant:',
41
+ 'owner#3' => 'Registrant Contact:',
42
+ 'admin' => 'Administrative',
43
+ 'tech' => 'Technical',
44
+ 'zone' => 'Zone',
45
+ 'domain.sponsor#0' => 'Registrar Name....:',
46
+ 'domain.sponsor#1' => 'Registration Service Provided By:',
47
+ 'domain.referrer' => 'Registrar Homepage:',
48
+ 'domain.nserver' => 'Domain servers in listed order:',
49
+ 'domain.nserver' => 'DNS Servers:',
50
+ 'domain.name' => 'Domain name:',
51
+ 'domain.created#0' => 'Created on..............:',
52
+ 'domain.created#1' => 'Creation date:',
53
+ 'domain.expires#0' => 'Expires on..............:',
54
+ 'domain.expires#1' => 'Expiration date:',
55
+ 'domain.changed' => 'Record last updated on..:',
56
+ 'domain.status' => 'Status:'
57
+ );
58
+
59
+ return easy_parser($data_str, $items, 'ymd');
60
+ }
61
+ }
62
+ ?>
lib/whois/whois.gtld.rrpproxy.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__RRPPROXY_HANDLER__'))
29
+ define('__RRPPROXY_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class rrpproxy_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'created-date:' => 'domain.created',
39
+ 'updated-date:' => 'domain.changed',
40
+ 'registration-expiration-date:' => 'domain.expires',
41
+ 'RSP:' => 'domain.sponsor',
42
+ 'URL:' => 'domain.referrer',
43
+ 'owner-nom.contact:' => 'owner.handle',
44
+ 'owner-fname:' => 'owner.name.first',
45
+ 'owner-lname:' => 'owner.name.last',
46
+ 'owner-organization:' => 'owner.organization',
47
+ 'owner-street:' => 'owner.address.street',
48
+ 'owner-city:' => 'owner.address.city',
49
+ 'owner-zip:' => 'owner.address.pcode',
50
+ 'owner-country:' => 'owner.address.country',
51
+ 'owner-phone:' => 'owner.phone',
52
+ 'owner-fax:' => 'owner.fax',
53
+ 'owner-email:' => 'owner.email',
54
+ 'admin-nom.contact:' => 'admin.handle',
55
+ 'admin-fname:' => 'admin.name.first',
56
+ 'admin-lname:' => 'admin.name.last',
57
+ 'admin-organization:' => 'admin.organization',
58
+ 'admin-street:' => 'admin.address.street',
59
+ 'admin-city:' => 'admin.address.city',
60
+ 'admin-zip:' => 'admin.address.pcode',
61
+ 'admin-country:' => 'admin.address.country',
62
+ 'admin-phone:' => 'admin.phone',
63
+ 'admin-fax:' => 'admin.fax',
64
+ 'admin-email:' => 'admin.email',
65
+ 'tech-nom.contact:' => 'tech.handle',
66
+ 'tech-fname:' => 'tech.name.first',
67
+ 'tech-lname:' => 'tech.name.last',
68
+ 'tech-organization:' => 'tech.organization',
69
+ 'tech-street:' => 'tech.address.street',
70
+ 'tech-city:' => 'tech.address.city',
71
+ 'tech-zip:' => 'tech.address.pcode',
72
+ 'tech-country:' => 'tech.address.country',
73
+ 'tech-phone:' => 'tech.phone',
74
+ 'tech-fax:' => 'tech.fax',
75
+ 'tech-email:' => 'tech.email',
76
+ 'billing-nom.contact:' => 'billing.handle',
77
+ 'billing-fname:' => 'billing.name.first',
78
+ 'billing-lname:' => 'billing.name.last',
79
+ 'billing-organization:' => 'billing.organization',
80
+ 'billing-street:' => 'billing.address.street',
81
+ 'billing-city:' => 'billing.address.city',
82
+ 'billing-zip:' => 'billing.address.pcode',
83
+ 'billing-country:' => 'billing.address.country',
84
+ 'billing-phone:' => 'billing.phone',
85
+ 'billing-fax:' => 'billing.fax',
86
+ 'billing-email:' => 'billing.email'
87
+ );
88
+
89
+ return generic_parser_b($data_str, $items);
90
+ }
91
+ }
92
+ ?>
lib/whois/whois.gtld.schlund.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SCHLUND_HANDLER__'))
29
+ define('__SCHLUND_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class schlund_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'created:' => 'domain.created',
39
+ 'last-changed:' => 'domain.changed',
40
+ 'status:' => 'domain.status',
41
+ 'registrant-firstname:' => 'owner.name.first',
42
+ 'registrant-lastname:' => 'owner.name.last',
43
+ 'registrant-organization:' => 'owner.organization',
44
+ 'registrant-street1:' => 'owner.address.street.',
45
+ 'registrant-street2:' => 'owner.address.street.',
46
+ 'registrant-pcode:' => 'owner.address.pcode',
47
+ 'registrant-city:' => 'owner.address.city',
48
+ 'registrant-ccode:' => 'owner.address.country',
49
+ 'registrant-phone:' => 'owner.phone',
50
+ 'registrant-email:' => 'owner.email',
51
+ 'admin-c-firstname:' => 'admin.name.first',
52
+ 'admin-c-lastname:' => 'admin.name.last',
53
+ 'admin-c-organization:' => 'admin.organization',
54
+ 'admin-c-street1:' => 'admin.address.street.',
55
+ 'admin-c-street2:' => 'admin.address.street.',
56
+ 'admin-c-pcode:' => 'admin.address.pcode',
57
+ 'admin-c-city:' => 'admin.address.city',
58
+ 'admin-c-ccode:' => 'admin.address.country',
59
+ 'admin-c-phone:' => 'admin.phone',
60
+ 'admin-c-email:' => 'admin.email',
61
+ 'tech-c-firstname:' => 'tech.name.first',
62
+ 'tech-c-lastname:' => 'tech.name.last',
63
+ 'tech-c-organization:' => 'tech.organization',
64
+ 'tech-c-street1:' => 'tech.address.street.',
65
+ 'tech-c-street2:' => 'tech.address.street.',
66
+ 'tech-c-pcode:' => 'tech.address.pcode',
67
+ 'tech-c-city:' => 'tech.address.city',
68
+ 'tech-c-ccode:' => 'tech.address.country',
69
+ 'tech-c-phone:' => 'tech.phone',
70
+ 'tech-c-email:' => 'tech.email',
71
+ 'bill-c-firstname:' => 'billing.name.first',
72
+ 'bill-c-lastname:' => 'billing.name.last',
73
+ 'bill-c-organization:' => 'billing.organization',
74
+ 'bill-c-street1:' => 'billing.address.street.',
75
+ 'bill-c-street2:' => 'billing.address.street.',
76
+ 'bill-c-pcode:' => 'billing.address.pcode',
77
+ 'bill-c-city:' => 'billing.address.city',
78
+ 'bill-c-ccode:' => 'billing.address.country',
79
+ 'bill-c-phone:' => 'billing.phone',
80
+ 'bill-c-email:' => 'billing.email'
81
+ );
82
+
83
+ return generic_parser_b($data_str, $items);
84
+ }
85
+ }
86
+ ?>
lib/whois/whois.gtld.srsplus.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SRSPLUS_HANDLER__'))
29
+ define('__SRSPLUS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class srsplus_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative',
40
+ 'tech' => 'Technical',
41
+ 'billing' => 'Billing',
42
+ 'domain.name' => 'Domain Name:',
43
+ 'domain.nserver' => 'Domain servers:',
44
+ 'domain.created' => 'Record created on',
45
+ 'domain.expires' => 'Record expires on'
46
+ );
47
+
48
+ return easy_parser($data_str, $items, 'ymd',false,true,true);
49
+ }
50
+ }
51
+ ?>
lib/whois/whois.gtld.tmagnic.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__TMAGNIC_HANDLER__'))
29
+ define('__TMAGNIC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class tmagnic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Owner Contact:',
39
+ 'admin' => 'Admin Contact',
40
+ 'tech' => 'Technical Contact',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.nserver.' => 'Domain servers in listed order:',
43
+ 'domain.expires' => 'Record expires on: ',
44
+ 'domain.changed' => 'Record last updated on: ',
45
+ '' => 'Zone Contact',
46
+ '#' => 'Punycode Name:'
47
+ );
48
+
49
+ return easy_parser($data_str, $items, 'ymd',false,false,true);
50
+ }
51
+ }
52
+ ?>
lib/whois/whois.gtld.tvcorp.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__TVCORP_HANDLER__'))
29
+ define('__TVCORP_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class tvcorp_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant',
39
+ 'admin' => 'Admin',
40
+ 'tech' => 'Technical',
41
+ 'billing' => 'Billing',
42
+ 'domain.nserver.' => 'Domain servers:',
43
+ 'domain.created' => 'Record created on',
44
+ 'domain.expires' => 'Record expires on'
45
+ );
46
+
47
+ return easy_parser($data_str, $items, 'mdy');
48
+ }
49
+ }
50
+ ?>
lib/whois/whois.gtld.wildwestdomains.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__WILDWESTDOMAINS_HANDLER__'))
29
+ define('__WILDWESTDOMAINS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class wildwestdomains_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'domain.name' => 'Domain name:',
42
+ 'domain.sponsor'=> 'Registered through:',
43
+ 'domain.nserver' => 'Domain servers in listed order:',
44
+ 'domain.created' => 'Created on:',
45
+ 'domain.expires' => 'Expires on:',
46
+ 'domain.changed' => 'Last Updated on:'
47
+ );
48
+
49
+ return easy_parser($data_str, $items, 'mdy');
50
+ }
51
+ }
52
+ ?>
lib/whois/whois.hu.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if(!defined('__HU_HANDLER__'))
29
+ define('__HU_HANDLER__',1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class hu_handler
34
+ {
35
+ function parse ($data_str, $query)
36
+ {
37
+ $translate = array (
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'hun-id' => 'handle',
41
+ 'person' => 'name',
42
+ 'nameserver' => 'nserver',
43
+ 'person' => 'name',
44
+ 'org' => 'organization',
45
+ 'registered' => 'created'
46
+ );
47
+
48
+ $contacts = array (
49
+ 'registrar' => 'owner',
50
+ 'admin-c' => 'admin',
51
+ 'tech-c' => 'tech',
52
+ 'billing-c' => 'billing',
53
+ 'zone-c' => 'zone',
54
+ 'owner-hun-id' => 'owner'
55
+ );
56
+
57
+ // make those broken hungary comments standards-conforming
58
+ // replace first found hun-id with owner-hun-id (will be parsed later on)
59
+ // make output UTF-8
60
+
61
+ $comments = true;
62
+ $owner_id = true;
63
+
64
+ foreach ($data_str['rawdata'] as $i => $val)
65
+ {
66
+ if ($comments)
67
+ {
68
+ if (strpos($data_str['rawdata'][$i],'domain:') === false)
69
+ {
70
+ if ($i) $data_str['rawdata'][$i] = '% '.$data_str['rawdata'][$i];
71
+ }
72
+ else
73
+ $comments = false;
74
+ }
75
+ else
76
+ if ($owner_id && substr($data_str['rawdata'][$i],0,7) == 'hun-id:')
77
+ {
78
+ $data_str['rawdata'][$i] = 'owner-'.$data_str['rawdata'][$i];
79
+ $owner_id = false;
80
+ }
81
+ }
82
+
83
+ $reg = generic_parser_a($data_str['rawdata'],$translate,$contacts);
84
+
85
+ unset($reg['domain']['organization']);
86
+ unset($reg['domain']['address']);
87
+ unset($reg['domain']['phone']);
88
+ unset($reg['domain']['fax']);
89
+
90
+ $r['regrinfo'] = $reg;
91
+ $r['regyinfo'] = array('referrer'=>'http://www.nic.hu','registrar'=>'HUNIC');
92
+ return format_dates($r,'ymd');
93
+ }
94
+ }
95
+ ?>
lib/whois/whois.icon.png ADDED
Binary file
lib/whois/whois.idna.php ADDED
@@ -0,0 +1,969 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // {{{ license
3
+
4
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
5
+ //
6
+ // +----------------------------------------------------------------------+
7
+ // | This library is free software; you can redistribute it and/or modify |
8
+ // | it under the terms of the GNU Lesser General Public License as |
9
+ // | published by the Free Software Foundation; either version 2.1 of the |
10
+ // | License, or (at your option) any later version. |
11
+ // | |
12
+ // | This library is distributed in the hope that it will be useful, but |
13
+ // | WITHOUT ANY WARRANTY; without even the implied warranty of |
14
+ // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15
+ // | Lesser General Public License for more details. |
16
+ // | |
17
+ // | You should have received a copy of the GNU Lesser General Public |
18
+ // | License along with this library; if not, write to the Free Software |
19
+ // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20
+ // | USA. |
21
+ // +----------------------------------------------------------------------+
22
+ //
23
+
24
+ // }}}
25
+
26
+ /**
27
+ * Encode/decode Internationalized Domain Names.
28
+ *
29
+ * The class allows to convert internationalized domain names
30
+ * (see RFC 3490 for details) as they can be used with various registries worldwide
31
+ * to be translated between their original (localized) form and their encoded form
32
+ * as it will be used in the DNS (Domain Name System).
33
+ *
34
+ * The class provides two public methods, encode() and decode(), which do exactly
35
+ * what you would expect them to do. You are allowed to use complete domain names,
36
+ * simple strings and complete email addresses as well. That means, that you might
37
+ * use any of the following notations:
38
+ *
39
+ * - www.nörgler.com
40
+ * - xn--nrgler-wxa
41
+ * - xn--brse-5qa.xn--knrz-1ra.info
42
+ *
43
+ * Unicode input might be given as either UTF-8 string, UCS-4 string or UCS-4
44
+ * array. Unicode output is available in the same formats.
45
+ * You can select your preferred format via {@link set_paramter()}.
46
+ *
47
+ * ACE input and output is always expected to be ASCII.
48
+ *
49
+ * @author Matthias Sommerfeld <mso@phlylabs.de>
50
+ * @copyright 2004-2007 phlyLabs Berlin, http://phlylabs.de
51
+ * @version 0.5.1
52
+ *
53
+ */
54
+ class idna_convert
55
+ {
56
+ /**
57
+ * Holds all relevant mapping tables, loaded from a seperate file on construct
58
+ * See RFC3454 for details
59
+ *
60
+ * @var array
61
+ * @access private
62
+ */
63
+ var $NP = array();
64
+
65
+ // Internal settings, do not mess with them
66
+ var $_punycode_prefix = 'xn--';
67
+ var $_invalid_ucs = 0x80000000;
68
+ var $_max_ucs = 0x10FFFF;
69
+ var $_base = 36;
70
+ var $_tmin = 1;
71
+ var $_tmax = 26;
72
+ var $_skew = 38;
73
+ var $_damp = 700;
74
+ var $_initial_bias = 72;
75
+ var $_initial_n = 0x80;
76
+ var $_sbase = 0xAC00;
77
+ var $_lbase = 0x1100;
78
+ var $_vbase = 0x1161;
79
+ var $_tbase = 0x11A7;
80
+ var $_lcount = 19;
81
+ var $_vcount = 21;
82
+ var $_tcount = 28;
83
+ var $_ncount = 588; // _vcount * _tcount
84
+ var $_scount = 11172; // _lcount * _tcount * _vcount
85
+ var $_error = false;
86
+
87
+ // See {@link set_paramter()} for details of how to change the following
88
+ // settings from within your script / application
89
+ var $_api_encoding = 'utf8'; // Default input charset is UTF-8
90
+ var $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden
91
+ var $_strict_mode = false; // Behave strict or not
92
+
93
+ // The constructor
94
+ function idna_convert($options = false)
95
+ {
96
+ $this->slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount;
97
+ if (function_exists('file_get_contents')) {
98
+ $this->NP = unserialize(file_get_contents(dirname(__FILE__).'/npdata.ser'));
99
+ } else {
100
+ $this->NP = unserialize(join('', file(dirname(__FILE__).'/npdata.ser')));
101
+ }
102
+ // If parameters are given, pass these to the respective method
103
+ if (is_array($options)) {
104
+ return $this->set_parameter($options);
105
+ }
106
+ return true;
107
+ }
108
+
109
+ /**
110
+ * Sets a new option value. Available options and values:
111
+ * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8,
112
+ * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8]
113
+ * [overlong - Unicode does not allow unnecessarily long encodings of chars,
114
+ * to allow this, set this parameter to true, else to false;
115
+ * default is false.]
116
+ * [strict - true: strict mode, good for registration purposes - Causes errors
117
+ * on failures; false: loose mode, ideal for "wildlife" applications
118
+ * by silently ignoring errors and returning the original input instead
119
+ *
120
+ * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs)
121
+ * @param string Value to use (if parameter 1 is a string)
122
+ * @return boolean true on success, false otherwise
123
+ * @access public
124
+ */
125
+ function set_parameter($option, $value = false)
126
+ {
127
+ if (!is_array($option)) {
128
+ $option = array($option => $value);
129
+ }
130
+ foreach ($option as $k => $v) {
131
+ switch ($k) {
132
+ case 'encoding':
133
+ switch ($v) {
134
+ case 'utf8':
135
+ case 'ucs4_string':
136
+ case 'ucs4_array':
137
+ $this->_api_encoding = $v;
138
+ break;
139
+ default:
140
+ $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k);
141
+ return false;
142
+ }
143
+ break;
144
+ case 'overlong':
145
+ $this->_allow_overlong = ($v) ? true : false;
146
+ break;
147
+ case 'strict':
148
+ $this->_strict_mode = ($v) ? true : false;
149
+ break;
150
+ default:
151
+ $this->_error('Set Parameter: Unknown option '.$k);
152
+ return false;
153
+ }
154
+ }
155
+ return true;
156
+ }
157
+
158
+ /**
159
+ * Decode a given ACE domain name
160
+ * @param string Domain name (ACE string)
161
+ * [@param string Desired output encoding, see {@link set_parameter}]
162
+ * @return string Decoded Domain name (UTF-8 or UCS-4)
163
+ * @access public
164
+ */
165
+ function decode($input, $one_time_encoding = false)
166
+ {
167
+ // Optionally set
168
+ if ($one_time_encoding) {
169
+ switch ($one_time_encoding) {
170
+ case 'utf8':
171
+ case 'ucs4_string':
172
+ case 'ucs4_array':
173
+ break;
174
+ default:
175
+ $this->_error('Unknown encoding '.$one_time_encoding);
176
+ return false;
177
+ }
178
+ }
179
+ // Make sure to drop any newline characters around
180
+ $input = trim($input);
181
+
182
+ // Negotiate input and try to determine, whether it is a plain string,
183
+ // an email address or something like a complete URL
184
+ if (strpos($input, '@')) { // Maybe it is an email address
185
+ // No no in strict mode
186
+ if ($this->_strict_mode) {
187
+ $this->_error('Only simple domain name parts can be handled in strict mode');
188
+ return false;
189
+ }
190
+ list ($email_pref, $input) = explode('@', $input, 2);
191
+ $arr = explode('.', $input);
192
+ foreach ($arr as $k => $v) {
193
+ if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) {
194
+ $conv = $this->_decode($v);
195
+ if ($conv) $arr[$k] = $conv;
196
+ }
197
+ }
198
+ $input = join('.', $arr);
199
+ $arr = explode('.', $email_pref);
200
+ foreach ($arr as $k => $v) {
201
+ if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) {
202
+ $conv = $this->_decode($v);
203
+ if ($conv) $arr[$k] = $conv;
204
+ }
205
+ }
206
+ $email_pref = join('.', $arr);
207
+ $return = $email_pref . '@' . $input;
208
+ } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters)
209
+ // No no in strict mode
210
+ if ($this->_strict_mode) {
211
+ $this->_error('Only simple domain name parts can be handled in strict mode');
212
+ return false;
213
+ }
214
+ $parsed = parse_url($input);
215
+ if (isset($parsed['host'])) {
216
+ $arr = explode('.', $parsed['host']);
217
+ foreach ($arr as $k => $v) {
218
+ $conv = $this->_decode($v);
219
+ if ($conv) $arr[$k] = $conv;
220
+ }
221
+ $parsed['host'] = join('.', $arr);
222
+ $return =
223
+ (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://'))
224
+ .(empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@')
225
+ .$parsed['host']
226
+ .(empty($parsed['port']) ? '' : ':'.$parsed['port'])
227
+ .(empty($parsed['path']) ? '' : $parsed['path'])
228
+ .(empty($parsed['query']) ? '' : '?'.$parsed['query'])
229
+ .(empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']);
230
+ } else { // parse_url seems to have failed, try without it
231
+ $arr = explode('.', $input);
232
+ foreach ($arr as $k => $v) {
233
+ $conv = $this->_decode($v);
234
+ $arr[$k] = ($conv) ? $conv : $v;
235
+ }
236
+ $return = join('.', $arr);
237
+ }
238
+ } else { // Otherwise we consider it being a pure domain name string
239
+ $return = $this->_decode($input);
240
+ if (!$return) $return = $input;
241
+ }
242
+ // The output is UTF-8 by default, other output formats need conversion here
243
+ // If one time encoding is given, use this, else the objects property
244
+ switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) {
245
+ case 'utf8':
246
+ return $return;
247
+ break;
248
+ case 'ucs4_string':
249
+ return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return));
250
+ break;
251
+ case 'ucs4_array':
252
+ return $this->_utf8_to_ucs4($return);
253
+ break;
254
+ default:
255
+ $this->_error('Unsupported output format');
256
+ return false;
257
+ }
258
+ }
259
+
260
+ /**
261
+ * Encode a given UTF-8 domain name
262
+ * @param string Domain name (UTF-8 or UCS-4)
263
+ * [@param string Desired input encoding, see {@link set_parameter}]
264
+ * @return string Encoded Domain name (ACE string)
265
+ * @access public
266
+ */
267
+ function encode($decoded, $one_time_encoding = false)
268
+ {
269
+ // Forcing conversion of input to UCS4 array
270
+ // If one time encoding is given, use this, else the objects property
271
+ switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) {
272
+ case 'utf8':
273
+ $decoded = $this->_utf8_to_ucs4($decoded);
274
+ break;
275
+ case 'ucs4_string':
276
+ $decoded = $this->_ucs4_string_to_ucs4($decoded);
277
+ case 'ucs4_array':
278
+ break;
279
+ default:
280
+ $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding));
281
+ return false;
282
+ }
283
+
284
+ // No input, no output, what else did you expect?
285
+ if (empty($decoded)) return '';
286
+
287
+ // Anchors for iteration
288
+ $last_begin = 0;
289
+ // Output string
290
+ $output = '';
291
+ foreach ($decoded as $k => $v) {
292
+ // Make sure to use just the plain dot
293
+ switch($v) {
294
+ case 0x3002:
295
+ case 0xFF0E:
296
+ case 0xFF61:
297
+ $decoded[$k] = 0x2E;
298
+ // Right, no break here, the above are converted to dots anyway
299
+ // Stumbling across an anchoring character
300
+ case 0x2E:
301
+ case 0x2F:
302
+ case 0x3A:
303
+ case 0x3F:
304
+ case 0x40:
305
+ // Neither email addresses nor URLs allowed in strict mode
306
+ if ($this->_strict_mode) {
307
+ $this->_error('Neither email addresses nor URLs are allowed in strict mode.');
308
+ return false;
309
+ } else {
310
+ // Skip first char
311
+ if ($k) {
312
+ $encoded = '';
313
+ $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin)));
314
+ if ($encoded) {
315
+ $output .= $encoded;
316
+ } else {
317
+ $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin)));
318
+ }
319
+ $output .= chr($decoded[$k]);
320
+ }
321
+ $last_begin = $k + 1;
322
+ }
323
+ }
324
+ }
325
+ // Catch the rest of the string
326
+ if ($last_begin) {
327
+ $inp_len = sizeof($decoded);
328
+ $encoded = '';
329
+ $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
330
+ if ($encoded) {
331
+ $output .= $encoded;
332
+ } else {
333
+ $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin)));
334
+ }
335
+ return $output;
336
+ } else {
337
+ if ($output = $this->_encode($decoded)) {
338
+ return $output;
339
+ } else {
340
+ return $this->_ucs4_to_utf8($decoded);
341
+ }
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Use this method to get the last error ocurred
347
+ * @param void
348
+ * @return string The last error, that occured
349
+ * @access public
350
+ */
351
+ function get_last_error()
352
+ {
353
+ return $this->_error;
354
+ }
355
+
356
+ /**
357
+ * The actual decoding algorithm
358
+ * @access private
359
+ */
360
+ function _decode($encoded)
361
+ {
362
+ // We do need to find the Punycode prefix
363
+ if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) {
364
+ $this->_error('This is not a punycode string');
365
+ return false;
366
+ }
367
+ $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded);
368
+ // If nothing left after removing the prefix, it is hopeless
369
+ if (!$encode_test) {
370
+ $this->_error('The given encoded string was empty');
371
+ return false;
372
+ }
373
+ // Find last occurence of the delimiter
374
+ $delim_pos = strrpos($encoded, '-');
375
+ if ($delim_pos > strlen($this->_punycode_prefix)) {
376
+ for ($k = strlen($this->_punycode_prefix); $k < $delim_pos; ++$k) {
377
+ $decoded[] = ord($encoded{$k});
378
+ }
379
+ } else {
380
+ $decoded = array();
381
+ }
382
+ $deco_len = count($decoded);
383
+ $enco_len = strlen($encoded);
384
+
385
+ // Wandering through the strings; init
386
+ $is_first = true;
387
+ $bias = $this->_initial_bias;
388
+ $idx = 0;
389
+ $char = $this->_initial_n;
390
+
391
+ for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) {
392
+ for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) {
393
+ $digit = $this->_decode_digit($encoded{$enco_idx++});
394
+ $idx += $digit * $w;
395
+ $t = ($k <= $bias) ? $this->_tmin :
396
+ (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias));
397
+ if ($digit < $t) break;
398
+ $w = (int) ($w * ($this->_base - $t));
399
+ }
400
+ $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first);
401
+ $is_first = false;
402
+ $char += (int) ($idx / ($deco_len + 1));
403
+ $idx %= ($deco_len + 1);
404
+ if ($deco_len > 0) {
405
+ // Make room for the decoded char
406
+ for ($i = $deco_len; $i > $idx; $i--) {
407
+ $decoded[$i] = $decoded[($i - 1)];
408
+ }
409
+ }
410
+ $decoded[$idx++] = $char;
411
+ }
412
+ return $this->_ucs4_to_utf8($decoded);
413
+ }
414
+
415
+ /**
416
+ * The actual encoding algorithm
417
+ * @access private
418
+ */
419
+ function _encode($decoded)
420
+ {
421
+ // We cannot encode a domain name containing the Punycode prefix
422
+ $extract = strlen($this->_punycode_prefix);
423
+ $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix);
424
+ $check_deco = array_slice($decoded, 0, $extract);
425
+
426
+ if ($check_pref == $check_deco) {
427
+ $this->_error('This is already a punycode string');
428
+ return false;
429
+ }
430
+ // We will not try to encode strings consisting of basic code points only
431
+ $encodable = false;
432
+ foreach ($decoded as $k => $v) {
433
+ if ($v > 0x7a) {
434
+ $encodable = true;
435
+ break;
436
+ }
437
+ }
438
+ if (!$encodable) {
439
+ $this->_error('The given string does not contain encodable chars');
440
+ return false;
441
+ }
442
+
443
+ // Do NAMEPREP
444
+ $decoded = $this->_nameprep($decoded);
445
+ if (!$decoded || !is_array($decoded)) return false; // NAMEPREP failed
446
+
447
+ $deco_len = count($decoded);
448
+ if (!$deco_len) return false; // Empty array
449
+
450
+ $codecount = 0; // How many chars have been consumed
451
+
452
+ $encoded = '';
453
+ // Copy all basic code points to output
454
+ for ($i = 0; $i < $deco_len; ++$i) {
455
+ $test = $decoded[$i];
456
+ // Will match [-0-9a-zA-Z]
457
+ if ((0x2F < $test && $test < 0x40) || (0x40 < $test && $test < 0x5B)
458
+ || (0x60 < $test && $test <= 0x7B) || (0x2D == $test)) {
459
+ $encoded .= chr($decoded[$i]);
460
+ $codecount++;
461
+ }
462
+ }
463
+ if ($codecount == $deco_len) return $encoded; // All codepoints were basic ones
464
+
465
+ // Start with the prefix; copy it to output
466
+ $encoded = $this->_punycode_prefix.$encoded;
467
+
468
+ // If we have basic code points in output, add an hyphen to the end
469
+ if ($codecount) $encoded .= '-';
470
+
471
+ // Now find and encode all non-basic code points
472
+ $is_first = true;
473
+ $cur_code = $this->_initial_n;
474
+ $bias = $this->_initial_bias;
475
+ $delta = 0;
476
+ while ($codecount < $deco_len) {
477
+ // Find the smallest code point >= the current code point and
478
+ // remember the last ouccrence of it in the input
479
+ for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) {
480
+ if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) {
481
+ $next_code = $decoded[$i];
482
+ }
483
+ }
484
+
485
+ $delta += ($next_code - $cur_code) * ($codecount + 1);
486
+ $cur_code = $next_code;
487
+
488
+ // Scan input again and encode all characters whose code point is $cur_code
489
+ for ($i = 0; $i < $deco_len; $i++) {
490
+ if ($decoded[$i] < $cur_code) {
491
+ $delta++;
492
+ } elseif ($decoded[$i] == $cur_code) {
493
+ for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) {
494
+ $t = ($k <= $bias) ? $this->_tmin :
495
+ (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias);
496
+ if ($q < $t) break;
497
+ $encoded .= $this->_encode_digit(intval($t + (($q - $t) % ($this->_base - $t)))); //v0.4.5 Changed from ceil() to intval()
498
+ $q = (int) (($q - $t) / ($this->_base - $t));
499
+ }
500
+ $encoded .= $this->_encode_digit($q);
501
+ $bias = $this->_adapt($delta, $codecount+1, $is_first);
502
+ $codecount++;
503
+ $delta = 0;
504
+ $is_first = false;
505
+ }
506
+ }
507
+ $delta++;
508
+ $cur_code++;
509
+ }
510
+ return $encoded;
511
+ }
512
+
513
+ /**
514
+ * Adapt the bias according to the current code point and position
515
+ * @access private
516
+ */
517
+ function _adapt($delta, $npoints, $is_first)
518
+ {
519
+ $delta = intval($is_first ? ($delta / $this->_damp) : ($delta / 2));
520
+ $delta += intval($delta / $npoints);
521
+ for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) {
522
+ $delta = intval($delta / ($this->_base - $this->_tmin));
523
+ }
524
+ return intval($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew));
525
+ }
526
+
527
+ /**
528
+ * Encoding a certain digit
529
+ * @access private
530
+ */
531
+ function _encode_digit($d)
532
+ {
533
+ return chr($d + 22 + 75 * ($d < 26));
534
+ }
535
+
536
+ /**
537
+ * Decode a certain digit
538
+ * @access private
539
+ */
540
+ function _decode_digit($cp)
541
+ {
542
+ $cp = ord($cp);
543
+ return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base));
544
+ }
545
+
546
+ /**
547
+ * Internal error handling method
548
+ * @access private
549
+ */
550
+ function _error($error = '')
551
+ {
552
+ $this->_error = $error;
553
+ }
554
+
555
+ /**
556
+ * Do Nameprep according to RFC3491 and RFC3454
557
+ * @param array Unicode Characters
558
+ * @return string Unicode Characters, Nameprep'd
559
+ * @access private
560
+ */
561
+ function _nameprep($input)
562
+ {
563
+ $output = array();
564
+ $error = false;
565
+ //
566
+ // Mapping
567
+ // Walking through the input array, performing the required steps on each of
568
+ // the input chars and putting the result into the output array
569
+ // While mapping required chars we apply the cannonical ordering
570
+ foreach ($input as $v) {
571
+ // Map to nothing == skip that code point
572
+ if (in_array($v, $this->NP['map_nothing'])) continue;
573
+
574
+ // Try to find prohibited input
575
+ if (in_array($v, $this->NP['prohibit']) || in_array($v, $this->NP['general_prohibited'])) {
576
+ $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v));
577
+ return false;
578
+ }
579
+ foreach ($this->NP['prohibit_ranges'] as $range) {
580
+ if ($range[0] <= $v && $v <= $range[1]) {
581
+ $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v));
582
+ return false;
583
+ }
584
+ }
585
+ //
586
+ // Hangul syllable decomposition
587
+ if (0xAC00 <= $v && $v <= 0xD7AF) {
588
+ foreach ($this->_hangul_decompose($v) as $out) {
589
+ $output[] = (int) $out;
590
+ }
591
+ // There's a decomposition mapping for that code point
592
+ } elseif (isset($this->NP['replacemaps'][$v])) {
593
+ foreach ($this->_apply_cannonical_ordering($this->NP['replacemaps'][$v]) as $out) {
594
+ $output[] = (int) $out;
595
+ }
596
+ } else {
597
+ $output[] = (int) $v;
598
+ }
599
+ }
600
+ // Before applying any Combining, try to rearrange any Hangul syllables
601
+ $output = $this->_hangul_compose($output);
602
+ //
603
+ // Combine code points
604
+ //
605
+ $last_class = 0;
606
+ $last_starter = 0;
607
+ $out_len = count($output);
608
+ for ($i = 0; $i < $out_len; ++$i) {
609
+ $class = $this->_get_combining_class($output[$i]);
610
+ if ((!$last_class || $last_class > $class) && $class) {
611
+ // Try to match
612
+ $seq_len = $i - $last_starter;
613
+ $out = $this->_combine(array_slice($output, $last_starter, $seq_len));
614
+ // On match: Replace the last starter with the composed character and remove
615
+ // the now redundant non-starter(s)
616
+ if ($out) {
617
+ $output[$last_starter] = $out;
618
+ if (count($out) != $seq_len) {
619
+ for ($j = $i+1; $j < $out_len; ++$j) {
620
+ $output[$j-1] = $output[$j];
621
+ }
622
+ unset($output[$out_len]);
623
+ }
624
+ // Rewind the for loop by one, since there can be more possible compositions
625
+ $i--;
626
+ $out_len--;
627
+ $last_class = ($i == $last_starter) ? 0 : $this->_get_combining_class($output[$i-1]);
628
+ continue;
629
+ }
630
+ }
631
+ // The current class is 0
632
+ if (!$class) $last_starter = $i;
633
+ $last_class = $class;
634
+ }
635
+ return $output;
636
+ }
637
+
638
+ /**
639
+ * Decomposes a Hangul syllable
640
+ * (see http://www.unicode.org/unicode/reports/tr15/#Hangul
641
+ * @param integer 32bit UCS4 code point
642
+ * @return array Either Hangul Syllable decomposed or original 32bit value as one value array
643
+ * @access private
644
+ */
645
+ function _hangul_decompose($char)
646
+ {
647
+ $sindex = (int) $char - $this->_sbase;
648
+ if ($sindex < 0 || $sindex >= $this->_scount) {
649
+ return array($char);
650
+ }
651
+ $result = array();
652
+ $result[] = (int) $this->_lbase + $sindex / $this->_ncount;
653
+ $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount;
654
+ $T = intval($this->_tbase + $sindex % $this->_tcount);
655
+ if ($T != $this->_tbase) $result[] = $T;
656
+ return $result;
657
+ }
658
+ /**
659
+ * Ccomposes a Hangul syllable
660
+ * (see http://www.unicode.org/unicode/reports/tr15/#Hangul
661
+ * @param array Decomposed UCS4 sequence
662
+ * @return array UCS4 sequence with syllables composed
663
+ * @access private
664
+ */
665
+ function _hangul_compose($input)
666
+ {
667
+ $inp_len = count($input);
668
+ if (!$inp_len) return array();
669
+ $result = array();
670
+ $last = (int) $input[0];
671
+ $result[] = $last; // copy first char from input to output
672
+
673
+ for ($i = 1; $i < $inp_len; ++$i) {
674
+ $char = (int) $input[$i];
675
+ $sindex = $last - $this->_sbase;
676
+ $lindex = $last - $this->_lbase;
677
+ $vindex = $char - $this->_vbase;
678
+ $tindex = $char - $this->_tbase;
679
+ // Find out, whether two current characters are LV and T
680
+ if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount == 0)
681
+ && 0 <= $tindex && $tindex <= $this->_tcount) {
682
+ // create syllable of form LVT
683
+ $last += $tindex;
684
+ $result[(count($result) - 1)] = $last; // reset last
685
+ continue; // discard char
686
+ }
687
+ // Find out, whether two current characters form L and V
688
+ if (0 <= $lindex && $lindex < $this->_lcount && 0 <= $vindex && $vindex < $this->_vcount) {
689
+ // create syllable of form LV
690
+ $last = (int) $this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount;
691
+ $result[(count($result) - 1)] = $last; // reset last
692
+ continue; // discard char
693
+ }
694
+ // if neither case was true, just add the character
695
+ $last = $char;
696
+ $result[] = $char;
697
+ }
698
+ return $result;
699
+ }
700
+
701
+ /**
702
+ * Returns the combining class of a certain wide char
703
+ * @param integer Wide char to check (32bit integer)
704
+ * @return integer Combining class if found, else 0
705
+ * @access private
706
+ */
707
+ function _get_combining_class($char)
708
+ {
709
+ return isset($this->NP['norm_combcls'][$char]) ? $this->NP['norm_combcls'][$char] : 0;
710
+ }
711
+
712
+ /**
713
+ * Apllies the cannonical ordering of a decomposed UCS4 sequence
714
+ * @param array Decomposed UCS4 sequence
715
+ * @return array Ordered USC4 sequence
716
+ * @access private
717
+ */
718
+ function _apply_cannonical_ordering($input)
719
+ {
720
+ $swap = true;
721
+ $size = count($input);
722
+ while ($swap) {
723
+ $swap = false;
724
+ $last = $this->_get_combining_class(intval($input[0]));
725
+ for ($i = 0; $i < $size-1; ++$i) {
726
+ $next = $this->_get_combining_class(intval($input[$i+1]));
727
+ if ($next != 0 && $last > $next) {
728
+ // Move item leftward until it fits
729
+ for ($j = $i + 1; $j > 0; --$j) {
730
+ if ($this->_get_combining_class(intval($input[$j-1])) <= $next) break;
731
+ $t = intval($input[$j]);
732
+ $input[$j] = intval($input[$j-1]);
733
+ $input[$j-1] = $t;
734
+ $swap = true;
735
+ }
736
+ // Reentering the loop looking at the old character again
737
+ $next = $last;
738
+ }
739
+ $last = $next;
740
+ }
741
+ }
742
+ return $input;
743
+ }
744
+
745
+ /**
746
+ * Do composition of a sequence of starter and non-starter
747
+ * @param array UCS4 Decomposed sequence
748
+ * @return array Ordered USC4 sequence
749
+ * @access private
750
+ */
751
+ function _combine($input)
752
+ {
753
+ $inp_len = count($input);
754
+ foreach ($this->NP['replacemaps'] as $np_src => $np_target) {
755
+ if ($np_target[0] != $input[0]) continue;
756
+ if (count($np_target) != $inp_len) continue;
757
+ $hit = false;
758
+ foreach ($input as $k2 => $v2) {
759
+ if ($v2 == $np_target[$k2]) {
760
+ $hit = true;
761
+ } else {
762
+ $hit = false;
763
+ break;
764
+ }
765
+ }
766
+ if ($hit) return $np_src;
767
+ }
768
+ return false;
769
+ }
770
+
771
+ /**
772
+ * This converts an UTF-8 encoded string to its UCS-4 representation
773
+ * By talking about UCS-4 "strings" we mean arrays of 32bit integers representing
774
+ * each of the "chars". This is due to PHP not being able to handle strings with
775
+ * bit depth different from 8. This apllies to the reverse method _ucs4_to_utf8(), too.
776
+ * The following UTF-8 encodings are supported:
777
+ * bytes bits representation
778
+ * 1 7 0xxxxxxx
779
+ * 2 11 110xxxxx 10xxxxxx
780
+ * 3 16 1110xxxx 10xxxxxx 10xxxxxx
781
+ * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
782
+ * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
783
+ * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
784
+ * Each x represents a bit that can be used to store character data.
785
+ * The five and six byte sequences are part of Annex D of ISO/IEC 10646-1:2000
786
+ * @access private
787
+ */
788
+ function _utf8_to_ucs4($input)
789
+ {
790
+ $output = array();
791
+ $out_len = 0;
792
+ $inp_len = strlen($input);
793
+ $mode = 'next';
794
+ $test = 'none';
795
+ for ($k = 0; $k < $inp_len; ++$k) {
796
+ $v = ord($input{$k}); // Extract byte from input string
797
+
798
+ if ($v < 128) { // We found an ASCII char - put into stirng as is
799
+ $output[$out_len] = $v;
800
+ ++$out_len;
801
+ if ('add' == $mode) {
802
+ $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
803
+ return false;
804
+ }
805
+ continue;
806
+ }
807
+ if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char
808
+ $start_byte = $v;
809
+ $mode = 'add';
810
+ $test = 'range';
811
+ if ($v >> 5 == 6) { // &110xxxxx 10xxxxx
812
+ $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left
813
+ $v = ($v - 192) << 6;
814
+ } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx
815
+ $next_byte = 1;
816
+ $v = ($v - 224) << 12;
817
+ } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
818
+ $next_byte = 2;
819
+ $v = ($v - 240) << 18;
820
+ } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
821
+ $next_byte = 3;
822
+ $v = ($v - 248) << 24;
823
+ } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
824
+ $next_byte = 4;
825
+ $v = ($v - 252) << 30;
826
+ } else {
827
+ $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k);
828
+ return false;
829
+ }
830
+ if ('add' == $mode) {
831
+ $output[$out_len] = (int) $v;
832
+ ++$out_len;
833
+ continue;
834
+ }
835
+ }
836
+ if ('add' == $mode) {
837
+ if (!$this->_allow_overlong && $test == 'range') {
838
+ $test = 'none';
839
+ if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) {
840
+ $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k);
841
+ return false;
842
+ }
843
+ }
844
+ if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx
845
+ $v = ($v - 128) << ($next_byte * 6);
846
+ $output[($out_len - 1)] += $v;
847
+ --$next_byte;
848
+ } else {
849
+ $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k);
850
+ return false;
851
+ }
852
+ if ($next_byte < 0) {
853
+ $mode = 'next';
854
+ }
855
+ }
856
+ } // for
857
+ return $output;
858
+ }
859
+
860
+ /**
861
+ * Convert UCS-4 string into UTF-8 string
862
+ * See _utf8_to_ucs4() for details
863
+ * @access private
864
+ */
865
+ function _ucs4_to_utf8($input)
866
+ {
867
+ $output = '';
868
+ $k = 0;
869
+ foreach ($input as $v) {
870
+ ++$k;
871
+ // $v = ord($v);
872
+ if ($v < 128) { // 7bit are transferred literally
873
+ $output .= chr($v);
874
+ } elseif ($v < (1 << 11)) { // 2 bytes
875
+ $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
876
+ } elseif ($v < (1 << 16)) { // 3 bytes
877
+ $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
878
+ } elseif ($v < (1 << 21)) { // 4 bytes
879
+ $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63))
880
+ . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
881
+ } elseif ($v < (1 << 26)) { // 5 bytes
882
+ $output .= chr(248 + ($v >> 24)) . chr(128 + (($v >> 18) & 63))
883
+ . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63))
884
+ . chr(128 + ($v & 63));
885
+ } elseif ($v < (1 << 31)) { // 6 bytes
886
+ $output .= chr(252 + ($v >> 30)) . chr(128 + (($v >> 24) & 63))
887
+ . chr(128 + (($v >> 18) & 63)) . chr(128 + (($v >> 12) & 63))
888
+ . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
889
+ } else {
890
+ $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k);
891
+ return false;
892
+ }
893
+ }
894
+ return $output;
895
+ }
896
+
897
+ /**
898
+ * Convert UCS-4 array into UCS-4 string
899
+ *
900
+ * @access private
901
+ */
902
+ function _ucs4_to_ucs4_string($input)
903
+ {
904
+ $output = '';
905
+ // Take array values and split output to 4 bytes per value
906
+ // The bit mask is 255, which reads &11111111
907
+ foreach ($input as $v) {
908
+ $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255);
909
+ }
910
+ return $output;
911
+ }
912
+
913
+ /**
914
+ * Convert UCS-4 strin into UCS-4 garray
915
+ *
916
+ * @access private
917
+ */
918
+ function _ucs4_string_to_ucs4($input)
919
+ {
920
+ $output = array();
921
+ $inp_len = strlen($input);
922
+ // Input length must be dividable by 4
923
+ if ($inp_len % 4) {
924
+ $this->_error('Input UCS4 string is broken');
925
+ return false;
926
+ }
927
+ // Empty input - return empty output
928
+ if (!$inp_len) return $output;
929
+ for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) {
930
+ // Increment output position every 4 input bytes
931
+ if (!($i % 4)) {
932
+ $out_len++;
933
+ $output[$out_len] = 0;
934
+ }
935
+ $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) );
936
+ }
937
+ return $output;
938
+ }
939
+ }
940
+
941
+ /**
942
+ * Adapter class for aligning the API of idna_convert with that of Net_IDNA
943
+ * @author Matthias Sommerfeld <mso@phlylabs.de>
944
+ */
945
+ class Net_IDNA_php4 extends idna_convert
946
+ {
947
+ /**
948
+ * Sets a new option value. Available options and values:
949
+ * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8,
950
+ * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8]
951
+ * [overlong - Unicode does not allow unnecessarily long encodings of chars,
952
+ * to allow this, set this parameter to true, else to false;
953
+ * default is false.]
954
+ * [strict - true: strict mode, good for registration purposes - Causes errors
955
+ * on failures; false: loose mode, ideal for "wildlife" applications
956
+ * by silently ignoring errors and returning the original input instead
957
+ *
958
+ * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs)
959
+ * @param string Value to use (if parameter 1 is a string)
960
+ * @return boolean true on success, false otherwise
961
+ * @access public
962
+ */
963
+ function setParams($option, $param = false)
964
+ {
965
+ return $this->IC->set_parameters($option, $param);
966
+ }
967
+ }
968
+
969
+ ?>
lib/whois/whois.ie.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__IE_HANDLER__'))
29
+ define('__IE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ie_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'nic-hdl' => 'handle',
39
+ 'person' => 'name',
40
+ 'renewal' => 'expires'
41
+ );
42
+
43
+ $contacts = array(
44
+ 'admin-c' => 'admin',
45
+ 'tech-c' => 'tech',
46
+ );
47
+
48
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
49
+
50
+ if (isset($reg['domain']['descr']))
51
+ {
52
+ $reg['owner']['organization'] = $reg['domain']['descr'][0];
53
+ unset($reg['domain']['descr']);
54
+ }
55
+
56
+ $r['regrinfo'] = $reg;
57
+ $r['regyinfo'] = array(
58
+ 'referrer' => 'http://www.domainregistry.ie',
59
+ 'registrar' => 'IE Domain Registry'
60
+ );
61
+ return $r;
62
+ }
63
+ }
64
+ ?>
lib/whois/whois.in.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__IN_HANDLER__'))
29
+ define('__IN_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class in_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://whois.registry.in',
40
+ 'registrar' => 'INRegistry'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.info.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__INFO_HANDLER__'))
29
+ define('__INFO_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class info_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://whois.afilias.info',
40
+ 'registrar' => 'Afilias Global Registry Services'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.int.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__INT_HANDLER__'))
29
+ define('__INT_HANDLER__', 1);
30
+
31
+ require_once('whois.gtld.iana.php');
32
+
33
+ class int_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $iana = new iana_handler();
38
+ $r['regrinfo'] = $iana->parse($data_str['rawdata'], $query);
39
+ $r['regyinfo']['referrer'] = 'http://www.iana.org/int-dom/int.htm';
40
+ $r['regyinfo']['registrar'] = 'Internet Assigned Numbers Authority';
41
+ return ($r);
42
+ }
43
+ }
44
+ ?>
lib/whois/whois.ip.afrinic.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__AFRINIC_HANDLER__'))
31
+ define('__AFRINIC_HANDLER__', 1);
32
+
33
+ class afrinic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'person' => 'name',
42
+ 'netname' => 'name',
43
+ 'organisation' => 'handle',
44
+ 'org-name' => 'organization',
45
+ 'org-type' => 'type'
46
+ );
47
+
48
+ $contacts = array(
49
+ 'admin-c' => 'admin',
50
+ 'tech-c' => 'tech',
51
+ 'org' => 'owner'
52
+ );
53
+
54
+ $r = generic_parser_a($data_str, $translate, $contacts, 'network', 'Ymd');
55
+
56
+ if (isset($r['network']['descr']))
57
+ {
58
+ $r['owner']['organization'] = $r['network']['descr'];
59
+ unset($r['network']['descr']);
60
+ }
61
+
62
+ if (isset($r['owner']['remarks']) && is_array($r['owner']['remarks']))
63
+ while (list($key, $val) = each($r['owner']['remarks']))
64
+ {
65
+ $pos = strpos($val,'rwhois://');
66
+
67
+ if ($pos!==false)
68
+ $r['rwhois'] = strtok(substr($val,$pos),' ');
69
+ }
70
+
71
+ $r = array( 'regrinfo' => $r );
72
+ $r['regyinfo']['type'] = 'ip';
73
+ $r['regyinfo']['registrar'] = 'African Network Information Center';
74
+ return $r;
75
+ }
76
+ }
77
+ ?>
lib/whois/whois.ip.apnic.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if(!defined('__APNIC_HANDLER__'))
31
+ define('__APNIC_HANDLER__',1);
32
+
33
+ class apnic_handler
34
+ {
35
+ function parse ($data_str, $query)
36
+ {
37
+ $translate = array (
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'person' => 'name',
42
+ 'country' => 'address',
43
+ 'netname' => 'name',
44
+ 'descr' => 'desc',
45
+ 'aut-num' => 'handle'
46
+ );
47
+
48
+ $contacts = array (
49
+ 'admin-c' => 'admin',
50
+ 'tech-c' => 'tech'
51
+ );
52
+
53
+ $blocks = generic_parser_a_blocks($data_str,$translate,$disclaimer);
54
+
55
+ if (isset($disclaimer) && is_array($disclaimer)) $r['disclaimer'] = $disclaimer;
56
+
57
+ if (empty($blocks) || !is_array($blocks['main']))
58
+ {
59
+ $r['registered'] = 'no';
60
+ }
61
+ else
62
+ {
63
+ if (isset($blocks[$query]))
64
+ {
65
+ $as = true;
66
+ $rb = $blocks[$query];
67
+ }
68
+ else
69
+ {
70
+ $rb = $blocks['main'];
71
+ $as = false;
72
+ }
73
+
74
+ $r['registered'] = 'yes';
75
+
76
+ while (list($key,$val) = each($contacts))
77
+ if (isset($rb[$key]))
78
+ {
79
+ if (is_array($rb[$key]))
80
+ $blk = $rb[$key][count($rb[$key])-1];
81
+ else
82
+ $blk = $rb[$key];
83
+
84
+ //$blk = strtoupper(strtok($blk,' '));
85
+ if (isset($blocks[$blk])) $r[$val] = $blocks[$blk];
86
+ unset($rb[$key]);
87
+ }
88
+
89
+ $r['network'] = $rb;
90
+ format_dates($r,'Ymd');
91
+
92
+ if (isset($r['network']['desc']))
93
+ {
94
+ if (is_array($r['network']['desc']))
95
+ {
96
+ $r['owner']['organization'] = array_shift($r['network']['desc']);
97
+ $r['owner']['address'] = $r['network']['desc'];
98
+ }
99
+ else
100
+ $r['owner']['organization'] = $r['network']['desc'];
101
+
102
+ unset($r['network']['desc']);
103
+ }
104
+
105
+ if (isset($r['network']['address']))
106
+ {
107
+ if (isset($r['owner']['address']))
108
+ $r['owner']['address'][] = $r['network']['address'];
109
+ else
110
+ $r['owner']['address'] = $r['network']['address'];
111
+
112
+ unset($r['network']['address']);
113
+ }
114
+ }
115
+
116
+ $r = array( 'regrinfo' => $r );
117
+ $r['regyinfo']['type'] ='ip';
118
+ $r['regyinfo']['registrar'] = 'Asia Pacific Network Information Centre';
119
+ return $r;
120
+ }
121
+ }
122
+ ?>
lib/whois/whois.ip.arin.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+
29
+ if (!defined('__ARIN_HANDLER__'))
30
+ define('__ARIN_HANDLER__', 1);
31
+
32
+ require_once('whois.parser.php');
33
+
34
+ class arin_handler
35
+ {
36
+ function parse($data_str, $query)
37
+ {
38
+ $items = array(
39
+ 'OrgName:' => 'owner.organization',
40
+ 'CustName:' => 'owner.organization',
41
+ 'OrgId:' => 'owner.handle',
42
+ 'Address:' => 'owner.address.street.',
43
+ 'City:' => 'owner.address.city',
44
+ 'StateProv:' => 'owner.address.state',
45
+ 'PostalCode:' => 'owner.address.pcode',
46
+ 'Country:' => 'owner.address.country',
47
+ 'NetRange:' => 'network.inetnum',
48
+ 'NetName:' => 'network.name',
49
+ 'NetHandle:' => 'network.handle',
50
+ 'NetType:' => 'network.status',
51
+ 'NameServer:' => 'network.nserver.',
52
+ 'Comment:' => 'network.desc.',
53
+ 'RegDate:' => 'network.created',
54
+ 'Updated:' => 'network.changed',
55
+ 'ASHandle:' => 'network.handle',
56
+ 'ASName:' => 'network.name',
57
+ 'NetHandle:' => 'network.handle',
58
+ 'NetName:' => 'network.name',
59
+ 'TechHandle:' => 'tech.handle',
60
+ 'TechName:' => 'tech.name',
61
+ 'TechPhone:' => 'tech.phone',
62
+ 'TechEmail:' => 'tech.email',
63
+ 'OrgAbuseName:' => 'abuse.name',
64
+ 'OrgAbuseHandle:' => 'abuse.handle',
65
+ 'OrgAbusePhone:' => 'abuse.phone',
66
+ 'OrgAbuseEmail:' => 'abuse.email.',
67
+ 'ReferralServer:' => 'rwhois'
68
+ );
69
+
70
+ $r = generic_parser_b($data_str, $items, 'ymd', false, true);
71
+
72
+ if (@isset($r['abuse']['email']))
73
+ $r['abuse']['email'] = implode(',',$r['abuse']['email']);
74
+
75
+ return array( 'regrinfo' => $r );
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.ip.krnic.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__KRNIC_HANDLER__'))
29
+ define('__KRNIC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class krnic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $blocks = array(
38
+ 'owner1' => '[ Organization Information ]',
39
+ 'tech1' => '[ Technical Contact Information ]',
40
+
41
+ 'owner2' => '[ ISP Organization Information ]',
42
+ 'admin2' => '[ ISP IP Admin Contact Information ]',
43
+ 'tech2' => '[ ISP IP Tech Contact Information ]',
44
+
45
+ 'admin3' => '[ ISP IPv4 Admin Contact Information ]',
46
+ 'tech3' => '[ ISP IPv4 Tech Contact Information ]',
47
+
48
+ 'abuse' => '[ ISP Network Abuse Contact Information ]',
49
+
50
+ 'network.inetnum' => 'IPv4 Address :',
51
+ 'network.name' => 'Network Name :',
52
+ 'network.mnt-by' => 'Connect ISP Name :',
53
+ 'network.created' => 'Registration Date :'
54
+ );
55
+
56
+ $items = array(
57
+ 'Orgnization ID :' => 'handle',
58
+ 'Org Name :' => 'organization',
59
+ 'Org Name :' => 'organization',
60
+ 'Name :' => 'name',
61
+ 'Name :' => 'name',
62
+ 'Org Address :' => 'address.street',
63
+ 'Zip Code :' => 'address.pcode',
64
+ 'State :' => 'address.state',
65
+ 'Address :' => 'address.street',
66
+ 'Zip Code :' => 'address.pcode',
67
+ 'Phone :' => 'phone',
68
+ 'Phone :' => 'phone',
69
+ 'Fax :' => 'fax',
70
+ 'E-Mail :' => 'email',
71
+ 'E-Mail :' => 'email'
72
+ );
73
+
74
+ $b = get_blocks($data_str, $blocks);
75
+
76
+ if (isset($b['network']))
77
+ $r['network'] = $b['network'];
78
+
79
+ if (isset($b['owner1']))
80
+ $r['owner'] = generic_parser_b($b['owner1'], $items, 'Ymd', false);
81
+ else
82
+ if (isset($b['owner2']))
83
+ $r['owner'] = generic_parser_b($b['owner2'], $items, 'Ymd', false);
84
+
85
+ if (isset($b['admin2']))
86
+ $r['admin'] = generic_parser_b($b['admin2'], $items, 'Ymd', false);
87
+ else
88
+ if (isset($b['admin3']))
89
+ $r['admin'] = generic_parser_b($b['admin3'], $items, 'Ymd', false);
90
+
91
+ if (isset($b['tech1']))
92
+ $r['tech'] = generic_parser_b($b['tech1'], $items, 'Ymd', false);
93
+ else
94
+ if (isset($b['tech2']))
95
+ $r['tech'] = generic_parser_b($b['tech2'], $items, 'Ymd', false);
96
+ else
97
+ if (isset($b['tech3']))
98
+ $r['tech'] = generic_parser_b($b['tech3'], $items, 'Ymd', false);
99
+
100
+ if (isset($b['abuse']))
101
+ $r['abuse'] = generic_parser_b($b['abuse'], $items, 'Ymd', false);
102
+
103
+ $r = format_dates($r, 'Ymd');
104
+
105
+ $r = array( 'regrinfo' => $r );
106
+ $r['regyinfo']['type'] ='ip';
107
+ $r['regyinfo']['registrar'] = 'Korean Network Information Centre';
108
+
109
+ return $r;
110
+ }
111
+ }
112
+ ?>
lib/whois/whois.ip.lacnic.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__LACNIC_HANDLER__'))
31
+ define('__LACNIC_HANDLER__', 1);
32
+
33
+ class lacnic_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl-br' => 'handle',
41
+ 'nic-hdl' => 'handle',
42
+ 'person' => 'name',
43
+ 'netname' => 'name',
44
+ 'descr' => 'desc',
45
+ 'country' => 'address.country'
46
+ );
47
+
48
+ $contacts = array(
49
+ 'owner-c' => 'owner',
50
+ 'tech-c' => 'tech',
51
+ 'abuse-c' => 'abuse',
52
+ 'admin-c' => 'admin'
53
+ );
54
+
55
+ $r = generic_parser_a($data_str, $translate, $contacts, 'network');
56
+
57
+ unset($r['network']['owner']);
58
+ unset($r['network']['ownerid']);
59
+ unset($r['network']['responsible']);
60
+ unset($r['network']['address']);
61
+ unset($r['network']['phone']);
62
+ unset($r['network']['aut-num']);
63
+ unset($r['network']['nsstat']);
64
+ unset($r['network']['nslastaa']);
65
+ unset($r['network']['inetrev']);
66
+
67
+ if (!empty($r['network']['aut-num']))
68
+ $r['network']['handle'] = $r['network']['aut-num'];
69
+
70
+ if (is_array($r['network']['nserver']))
71
+ $r['network']['nserver'] = array_unique($r['network']['nserver']);
72
+
73
+ $r = array( 'regrinfo' => $r );
74
+ $r['regyinfo']['type'] ='ip';
75
+ $r['regyinfo']['registrar'] = 'Latin American and Caribbean IP address Regional Registry';
76
+ return $r;
77
+ }
78
+ }
79
+ ?>
lib/whois/whois.ip.lib.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ //-----------------------------------------------------------------
29
+ // Check if ip adddress is valid
30
+
31
+ function phpwhois_validip($ip)
32
+ {
33
+
34
+ if (empty($ip))
35
+ return false;
36
+
37
+ if ((ip2long($ip) == -1) or (ip2long($ip) === false))
38
+ return false;
39
+
40
+ $reserved_ips = array (
41
+ array('0.0.0.0','2.255.255.255'),
42
+ array('10.0.0.0','10.255.255.255'),
43
+ array('127.0.0.0','127.255.255.255'),
44
+ array('169.254.0.0','169.254.255.255'),
45
+ array('172.16.0.0','172.31.255.255'),
46
+ array('192.0.2.0','192.0.2.255'),
47
+ array('192.168.0.0','192.168.255.255'),
48
+ array('255.255.255.0','255.255.255.255')
49
+ );
50
+
51
+ foreach ($reserved_ips as $r)
52
+ {
53
+ $min = ip2long($r[0]);
54
+ $max = ip2long($r[1]);
55
+ if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
56
+ }
57
+
58
+ return true;
59
+ }
60
+
61
+ //-----------------------------------------------------------------
62
+ // Get real client ip address
63
+
64
+ function phpwhois_getclientip()
65
+ {
66
+ if (!empty($_SERVER['HTTP_CLIENT_IP']) && phpwhois_validip($_SERVER['HTTP_CLIENT_IP']))
67
+ return $_SERVER['HTTP_CLIENT_IP'];
68
+
69
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
70
+ foreach (explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']) as $ip)
71
+ if (phpwhois_validip(trim($ip)))
72
+ return $ip;
73
+
74
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
75
+ return $_SERVER['HTTP_X_FORWARDED'];
76
+
77
+ if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && phpwhois_validip($_SERVER['HTTP_FORWARDED_FOR']))
78
+ return $_SERVER['HTTP_FORWARDED_FOR'];
79
+
80
+ if (!empty($_SERVER['HTTP_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_FORWARDED']))
81
+ return $_SERVER['HTTP_FORWARDED'];
82
+
83
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && phpwhois_validip($_SERVER['HTTP_X_FORWARDED']))
84
+ return $_SERVER['HTTP_X_FORWARDED'];
85
+
86
+ return $_SERVER['REMOTE_ADDR'];
87
+ }
88
+
89
+ //-----------------------------------------------------------------
90
+ // Convert from CIDR to net range
91
+
92
+ function phpwhois_cidr_conv($net)
93
+ {
94
+ $start = strtok($net, '/');
95
+ $n = 3-substr_count($net, '.');
96
+
97
+ if ($n > 0)
98
+ {
99
+ for ($i = $n; $i > 0; $i--)
100
+ $start.= '.0';
101
+ }
102
+
103
+ $bits1 = str_pad(decbin(ip2long($start)), 32, '0', 'STR_PAD_LEFT');
104
+ $net = pow(2, (32-substr(strstr($net, '/'), 1))) - 1;
105
+ $bits2 = str_pad(decbin($net), 32, '0', 'STR_PAD_LEFT');
106
+ $final = '';
107
+
108
+ for ($i = 0; $i < 32; $i++)
109
+ {
110
+ if ($bits1[$i] == $bits2[$i])
111
+ $final.= $bits1[$i];
112
+ if ($bits1[$i] == 1 and $bits2[$i] == 0)
113
+ $final.= $bits1[$i];
114
+ if ($bits1[$i] == 0 and $bits2[$i] == 1)
115
+ $final.= $bits2[$i];
116
+ }
117
+
118
+ return $start." - ".long2ip(bindec($final));
119
+ }
120
+ ?>
lib/whois/whois.ip.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__IP_HANDLER__'))
29
+ define('__IP_HANDLER__', 1);
30
+
31
+ require_once('whois.ip.lib.php');
32
+
33
+ class ip_handler extends WhoisClient
34
+ {
35
+ // Deep whois ?
36
+ var $deep_whois = true;
37
+
38
+ var $HANDLER_VERSION = '1.0';
39
+
40
+ var $REGISTRARS = array(
41
+ 'European Regional Internet Registry/RIPE NCC' => 'whois.ripe.net',
42
+ 'RIPE Network Coordination Centre' => 'whois.ripe.net',
43
+ 'Asia Pacific Network Information Center' => 'whois.apnic.net',
44
+ 'Asia Pacific Network Information Centre' => 'whois.apnic.net',
45
+ 'Latin American and Caribbean IP address Regional Registry' => 'whois.lacnic.net',
46
+ 'African Network Information Center' => 'whois.afrinic.net'
47
+ );
48
+
49
+ var $HANDLERS = array(
50
+ 'whois.krnic.net' => 'krnic',
51
+ 'whois.apnic.net' => 'apnic',
52
+ 'whois.ripe.net' => 'ripe',
53
+ 'whois.arin.net' => 'arin',
54
+ 'whois.lacnic.net' => 'lacnic',
55
+ 'whois.afrinic.net' => 'afrinic'
56
+ );
57
+
58
+ var $more_data = array(); // More queries to get more accurated data
59
+ var $done = array();
60
+
61
+ function parse($data, $query)
62
+ {
63
+ $result['regrinfo'] = array();
64
+ $result['regyinfo'] = array();
65
+ $result['regyinfo']['registrar'] = 'American Registry for Internet Numbers (ARIN)';
66
+ $result['rawdata'] = array();
67
+
68
+ if (strpos($query,'.') === false)
69
+ $result['regyinfo']['type'] = 'AS';
70
+ else
71
+ $result['regyinfo']['type'] = 'ip';
72
+
73
+ if (!$this->deep_whois) return null;
74
+
75
+ $this->Query = array();
76
+ $this->Query['server'] = 'whois.arin.net';
77
+ $this->Query['query'] = $query;
78
+
79
+ $rawdata = $data['rawdata'];
80
+
81
+ if (empty($rawdata)) return $result;
82
+
83
+ $presults[] = $rawdata;
84
+ $ip = ip2long($query);
85
+ $done = array();
86
+
87
+ while (count($presults) > 0)
88
+ {
89
+ $rwdata = array_shift($presults);
90
+ $found = false;
91
+
92
+ foreach($rwdata as $line)
93
+ {
94
+ if (!strncmp($line,'American Registry for Internet Numbers',38)) continue;
95
+
96
+ $p = strpos($line, '(NETBLK-');
97
+
98
+ if ($p === false) $p = strpos($line, '(NET-');
99
+
100
+ if ($p !== false)
101
+ {
102
+ $net = strtok(substr($line,$p+1),') ');
103
+ list($low,$high) = explode('-',str_replace(' ','',substr($line,$p+strlen($net)+3)));
104
+
105
+ if (!isset($done[$net]) && $ip >= ip2long($low) && $ip <= ip2long($high))
106
+ {
107
+ $owner = substr($line,0,$p-1);
108
+
109
+ if (!empty($this->REGISTRARS['owner']))
110
+ {
111
+ $this->handle_rwhois($this->REGISTRARS['owner'],$query);
112
+ break 2;
113
+ }
114
+ else
115
+ {
116
+ $this->Query['args'] = 'n '.$net;
117
+ $presults[] = $this->GetRawData($net);
118
+ $done[$net] = 1;
119
+ }
120
+ }
121
+ $found = true;
122
+ }
123
+ }
124
+
125
+ if (!$found)
126
+ {
127
+ $this->Query['file'] = 'whois.ip.arin.php';
128
+ $this->Query['handler'] = 'arin';
129
+ $result = $this->parse_results($result,$rwdata,$query,true);
130
+ }
131
+ }
132
+
133
+ unset($this->Query['args']);
134
+
135
+ while (count($this->more_data) > 0)
136
+ {
137
+ $srv_data = array_shift($this->more_data);
138
+ $this->Query['server'] = $srv_data['server'];
139
+ unset($this->Query['handler']);
140
+ // Use original query
141
+ $rwdata = $this->GetRawData($srv_data['query']);
142
+
143
+ if (!empty($rwdata))
144
+ {
145
+ if (!empty($srv_data['handler']))
146
+ {
147
+ $this->Query['handler'] = $srv_data['handler'];
148
+
149
+ if (!empty($srv_data['file']))
150
+ $this->Query['file'] = $srv_data['file'];
151
+ else
152
+ $this->Query['file'] = 'whois.'.$this->Query['handler'].'.php';
153
+ }
154
+
155
+ $result = $this->parse_results($result,$rwdata,$query,$srv_data['reset']);
156
+ $result = $this->set_whois_info($result);
157
+ $reset = false;
158
+ }
159
+ }
160
+
161
+
162
+ // Normalize nameserver fields
163
+
164
+ if (isset($result['regrinfo']['network']['nserver']))
165
+ {
166
+ if (!is_array($result['regrinfo']['network']['nserver']))
167
+ {
168
+ unset($result['regrinfo']['network']['nserver']);
169
+ }
170
+ else
171
+ $result['regrinfo']['network']['nserver'] = $this->FixNameServer($result['regrinfo']['network']['nserver']);
172
+ }
173
+
174
+ return $result;
175
+ }
176
+
177
+ //-----------------------------------------------------------------
178
+
179
+ function parse_results($result,$rwdata,$query,$reset)
180
+ {
181
+ $rwres = $this->Process($rwdata);
182
+
183
+ if ($result['regyinfo']['type'] == 'AS' && !empty($rwres['regrinfo']['network']))
184
+ {
185
+ $rwres['regrinfo']['AS'] = $rwres['regrinfo']['network'];
186
+ unset($rwres['regrinfo']['network']);
187
+ }
188
+
189
+ if ($reset)
190
+ {
191
+ $result['regrinfo'] = $rwres['regrinfo'];
192
+ $result['rawdata'] = $rwdata;
193
+ }
194
+ else
195
+ {
196
+ $result['rawdata'][] = '';
197
+
198
+ foreach ($rwdata as $line)
199
+ $result['rawdata'][] = $line;
200
+
201
+ foreach($rwres['regrinfo'] as $key => $data)
202
+ {
203
+ $result = $this->join_result($result,$key,$rwres);
204
+ }
205
+ }
206
+
207
+ if ($this->deep_whois)
208
+ {
209
+ if (isset($rwres['regrinfo']['rwhois']))
210
+ {
211
+ $this->handle_rwhois($rwres['regrinfo']['rwhois'],$query);
212
+ unset($result['regrinfo']['rwhois']);
213
+ }
214
+ else
215
+ if (!@empty($rwres['regrinfo']['owner']['organization']))
216
+ switch ($rwres['regrinfo']['owner']['organization'])
217
+ {
218
+ case 'KRNIC':
219
+ $this->handle_rwhois('whois.krnic.net',$query);
220
+ break;
221
+
222
+ case 'African Network Information Center':
223
+ $this->handle_rwhois('whois.afrinic.net',$query);
224
+ break;
225
+ }
226
+ }
227
+
228
+ if (!empty($rwres['regyinfo']))
229
+ $result['regyinfo'] = array_merge($result['regyinfo'],$rwres['regyinfo']);
230
+
231
+ return $result;
232
+ }
233
+
234
+ //-----------------------------------------------------------------
235
+
236
+ function handle_rwhois($server,$query)
237
+ {
238
+ // Avoid querying the same server twice
239
+
240
+ $parts = parse_url($server);
241
+
242
+ if (empty($parts['host']))
243
+ $host = $parts['path'];
244
+ else
245
+ $host = $parts['host'];
246
+
247
+ if (array_key_exists($host,$this->done)) return;
248
+
249
+ $q = array (
250
+ 'query' => $query,
251
+ 'server' => $server
252
+ );
253
+
254
+ if (isset($this->HANDLERS[$host]))
255
+ {
256
+ $q['handler'] = $this->HANDLERS[$host];
257
+ $q['file'] = sprintf('whois.ip.%s.php', $q['handler']);
258
+ $q['reset'] = true;
259
+ }
260
+ else
261
+ {
262
+ $q['handler'] = 'rwhois';
263
+ $q['reset'] = false;
264
+ unset($q['file']);
265
+ }
266
+
267
+ $this->more_data[] = $q;
268
+ $this->done[$host] = 1;
269
+ }
270
+
271
+ //-----------------------------------------------------------------
272
+
273
+ function join_result($result, $key, $newres)
274
+ {
275
+ if (isset($result['regrinfo'][$key]) && !array_key_exists(0,$result['regrinfo'][$key]))
276
+ {
277
+ $r = $result['regrinfo'][$key];
278
+ $result['regrinfo'][$key] = array($r);
279
+ }
280
+
281
+ $result['regrinfo'][$key][] = $newres['regrinfo'][$key];
282
+ return $result;
283
+ }
284
+ }
285
+ ?>
lib/whois/whois.ip.ripe.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__RIPE_HANDLER__'))
31
+ define('__RIPE_HANDLER__', 1);
32
+
33
+ class ripe_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'person' => 'name',
42
+ 'netname' => 'name',
43
+ 'descr' => 'desc'
44
+ );
45
+
46
+ $contacts = array(
47
+ 'admin-c' => 'admin',
48
+ 'tech-c' => 'tech'
49
+ );
50
+
51
+ if (!empty($data_str['rawdata'])) $data_str = $data_str['rawdata'];
52
+
53
+ $r = generic_parser_a($data_str, $translate, $contacts, 'network');
54
+
55
+ if (isset($r['network']['desc']))
56
+ {
57
+ $r['owner']['organization'] = $r['network']['desc'];
58
+ unset($r['network']['desc']);
59
+ }
60
+
61
+ if (isset($r['admin']['abuse-mailbox']))
62
+ {
63
+ $r['abuse']['email'] = $r['admin']['abuse-mailbox'];
64
+ unset($r['admin']['abuse-mailbox']);
65
+ }
66
+
67
+ if (isset($r['tech']['abuse-mailbox']))
68
+ {
69
+ $r['abuse']['email'] = $r['tech']['abuse-mailbox'];
70
+ unset($r['tech']['abuse-mailbox']);
71
+ }
72
+
73
+ // Clean mess
74
+ if (isset($r['tech']['tech-c'])) unset($r['tech']['tech-c']);
75
+ if (isset($r['tech']['admin-c'])) unset($r['tech']['admin-c']);
76
+ if (isset($r['admin']['tech-c'])) unset($r['admin']['tech-c']);
77
+ if (isset($r['admin']['admin-c'])) unset($r['admin']['admin-c']);
78
+
79
+ $r = array( 'regrinfo' => $r );
80
+ $r['regyinfo']['type'] ='ip';
81
+ $r['regyinfo']['registrar'] = 'RIPE Network Coordination Centre';
82
+ return $r;
83
+ }
84
+ }
85
+ ?>
lib/whois/whois.ir.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPWhois IR Lookup Extension - http://github.com/sepehr/phpwhois-ir
4
+ *
5
+ * An extension to PHPWhois (http://phpwhois.org) library to support IR lookups.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ // Define the handler flag.
22
+ if (!defined('__IR_HANDLER__'))
23
+ define('__IR_HANDLER__', 1);
24
+
25
+ // Loadup the parser.
26
+ require_once('whois.parser.php');
27
+
28
+ /**
29
+ * IR Domain names lookup handler class.
30
+ */
31
+ class ir_handler
32
+ {
33
+ function parse($data_str, $query)
34
+ {
35
+ $translate = array(
36
+ 'nic-hdl' => 'handle',
37
+ 'org' => 'organization',
38
+ 'e-mail' => 'email',
39
+ 'person' => 'name',
40
+ 'fax-no' => 'fax',
41
+ 'domain' => 'name'
42
+ );
43
+
44
+ $contacts = array(
45
+ 'admin-c' => 'admin',
46
+ 'tech-c' => 'tech',
47
+ 'holder-c' => 'owner'
48
+ );
49
+
50
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
51
+
52
+ $r['regrinfo'] = $reg;
53
+ $r['regyinfo'] = array(
54
+ 'referrer'=>'http://whois.nic.ir/',
55
+ 'registrar' => 'NIC-IR'
56
+ );
57
+ return $r;
58
+ }
59
+ }
60
+ ?>
lib/whois/whois.is.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__IS_HANDLER__'))
29
+ define('__IS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class is_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'fax-no' => 'fax',
39
+ 'e-mail' => 'email',
40
+ 'nic-hdl' => 'handle',
41
+ 'person' => 'name'
42
+ );
43
+
44
+ $contacts = array(
45
+ 'owner-c' => 'owner',
46
+ 'admin-c' => 'admin',
47
+ 'tech-c' => 'tech',
48
+ 'billing-c' => 'billing',
49
+ 'zone-c' => 'zone'
50
+ );
51
+
52
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'mdy');
53
+
54
+ if (isset($reg['domain']['descr']))
55
+ {
56
+ $reg['owner']['name'] = array_shift($reg['domain']['descr']);
57
+ $reg['owner']['address'] = $reg['domain']['descr'];
58
+ unset($reg['domain']['descr']);
59
+ }
60
+
61
+ $r['regrinfo'] = $reg;
62
+ $r['regyinfo'] = array(
63
+ 'referrer' => 'http://www.isnic.is',
64
+ 'registrar' => 'ISNIC'
65
+ );
66
+ return $r;
67
+ }
68
+ }
69
+ ?>
lib/whois/whois.it.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ /*
29
+ BUG
30
+ - nserver -> array
31
+ - ContactID in address
32
+ */
33
+
34
+ if (!defined('__IT_HANDLER__'))
35
+ define('__IT_HANDLER__', 1);
36
+
37
+ require_once('whois.parser.php');
38
+
39
+ class it_handler
40
+ {
41
+ function parse($data_str, $query)
42
+ {
43
+ $items = array(
44
+ 'domain.name' => 'Domain:',
45
+ 'domain.nserver' => 'Nameservers',
46
+ 'domain.status' => 'Status:',
47
+ 'domain.expires' => 'Expire Date:',
48
+ 'owner' => 'Registrant',
49
+ 'admin' => 'Admin Contact',
50
+ 'tech' => 'Technical Contacts',
51
+ 'registrar' => 'Registrar'
52
+ );
53
+
54
+ $extra = array(
55
+ 'address:' => 'address.',
56
+ 'contactid:' => 'handle',
57
+ 'organization:' => 'organization',
58
+ 'created:' => 'created',
59
+ 'last update:' => 'changed',
60
+ 'web:' => 'web'
61
+ );
62
+
63
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'ymd',$extra);
64
+
65
+ if (isset($r['regrinfo']['registrar']))
66
+ {
67
+ $r['regrinfo']['domain']['registrar'] = $r['regrinfo']['registrar'];
68
+ unset($r['regrinfo']['registrar']);
69
+ }
70
+
71
+ $r['regyinfo'] = array(
72
+ 'registrar' => 'IT-Nic',
73
+ 'referrer' => 'http://www.nic.it/'
74
+ );
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.jp.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__JP_HANDLER__'))
29
+ define('__JP_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class jp_handler extends WhoisClient
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ '[State]' => 'domain.status',
39
+ '[Status]' => 'domain.status',
40
+ '[Registered Date]' => 'domain.created',
41
+ '[Created on]' => 'domain.created',
42
+ '[Expires on]' => 'domain.expires',
43
+ '[Last Updated]' => 'domain.changed',
44
+ '[Last Update]' => 'domain.changed',
45
+ '[Organization]' => 'owner.organization',
46
+ '[Name]' => 'owner.name',
47
+ '[Email]' => 'owner.email',
48
+ '[Postal code]' => 'owner.address.pcode',
49
+ '[Postal Address]' => 'owner.address.street',
50
+ '[Phone]' => 'owner.phone',
51
+ '[Fax]' => 'owner.fax',
52
+ '[Administrative Contact]' => 'admin.handle',
53
+ '[Technical Contact]' => 'tech.handle',
54
+ '[Name Server]' => 'domain.nserver.'
55
+ );
56
+
57
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'ymd');
58
+
59
+ $r['regyinfo'] = array(
60
+ 'referrer' => 'http://www.jprs.jp',
61
+ 'registrar' => 'Japan Registry Services'
62
+ );
63
+
64
+ if (!$this->deep_whois) return $r;
65
+
66
+ $r['rawdata'] = $data_str['rawdata'];
67
+
68
+ $items = array(
69
+ 'a. [JPNIC Handle]' => 'handle',
70
+ 'c. [Last, First]' => 'name',
71
+ 'd. [E-Mail]' => 'email',
72
+ 'g. [Organization]' => 'organization',
73
+ 'o. [TEL]' => 'phone',
74
+ 'p. [FAX]' => 'fax',
75
+ '[Last Update]' => 'changed'
76
+ );
77
+
78
+ $this->Query['server'] = 'jp.whois-servers.net';
79
+
80
+ if (!empty($r['regrinfo']['admin']['handle']))
81
+ {
82
+ $rwdata = $this->GetRawData('CONTACT '.$r['regrinfo']['admin']['handle'].'/e');
83
+ $r['rawdata'][] = '';
84
+ $r['rawdata'] = array_merge($r['rawdata'],$rwdata);
85
+ $r['regrinfo']['admin'] = generic_parser_b($rwdata,$items,'ymd',false);
86
+ $r = $this->set_whois_info($r);
87
+ }
88
+
89
+ if (!empty($r['regrinfo']['tech']['handle']))
90
+ {
91
+ if (!empty($r['regrinfo']['admin']['handle']) &&
92
+ $r['regrinfo']['admin']['handle'] == $r['regrinfo']['tech']['handle'])
93
+ {
94
+ $r['regrinfo']['tech'] = $r['regrinfo']['admin'];
95
+ }
96
+ else
97
+ {
98
+ unset($this->Query);
99
+ $this->Query['server'] = 'jp.whois-servers.net';
100
+ $rwdata = $this->GetRawData('CONTACT '.$r['regrinfo']['tech']['handle'].'/e');
101
+ $r['rawdata'][] = '';
102
+ $r['rawdata'] = array_merge($r['rawdata'],$rwdata);
103
+ $r['regrinfo']['tech'] = generic_parser_b($rwdata,$items,'ymd',false);
104
+ $r = $this->set_whois_info($r);
105
+ }
106
+ }
107
+
108
+ return $r;
109
+ }
110
+ }
111
+ ?>
lib/whois/whois.lt.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__LT_HANDLER__'))
29
+ define('__LT_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class lt_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'contact nic-hdl:' => 'handle',
39
+ 'contact name:' => 'name'
40
+ );
41
+
42
+ $items = array(
43
+ 'admin' => 'Contact type: Admin',
44
+ 'tech' => 'Contact type: Tech',
45
+ 'zone' => 'Contact type: Zone',
46
+ 'owner.name' => 'Registrar:',
47
+ 'owner.email' => 'Registrar email:',
48
+ 'domain.status' => 'Status:',
49
+ 'domain.created' => 'Registered:',
50
+ 'domain.changed' => 'Last updated:',
51
+ 'domain.nserver.' => 'NS:',
52
+ '' => '%'
53
+ );
54
+
55
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'ymd', $translate);
56
+
57
+ $r['regyinfo'] = array(
58
+ 'referrer' => 'http://www.domreg.lt',
59
+ 'registrar' => 'DOMREG.LT'
60
+ );
61
+ return $r;
62
+ }
63
+ }
64
+ ?>
lib/whois/whois.lu.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__LU_HANDLER__'))
29
+ define('__LU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class lu_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domainname:' => 'domain.name',
39
+ 'domaintype:' => 'domain.status',
40
+ 'nserver:' => 'domain.nserver.',
41
+ 'registered:' => 'domain.created',
42
+ 'source:' => 'domain.source',
43
+ 'ownertype:' => 'owner.type',
44
+ 'org-name:' => 'owner.organization',
45
+ 'org-address:' => 'owner.address.',
46
+ 'org-zipcode:' => 'owner.address.pcode',
47
+ 'org-city:' => 'owner.address.city',
48
+ 'org-country:' => 'owner.address.country',
49
+ 'adm-name:' => 'admin.name',
50
+ 'adm-address:' => 'admin.address.',
51
+ 'adm-zipcode:' => 'admin.address.pcode',
52
+ 'adm-city:' => 'admin.address.city',
53
+ 'adm-country:' => 'admin.address.country',
54
+ 'adm-email:' => 'admin.email',
55
+ 'tec-name:' => 'tech.name',
56
+ 'tec-address:' => 'tech.address.',
57
+ 'tec-zipcode:' => 'tech.address.pcode',
58
+ 'tec-city:' => 'tech.address.city',
59
+ 'tec-country:' => 'tech.address.country',
60
+ 'tec-email:' => 'tech.email',
61
+ 'bil-name:' => 'billing.name',
62
+ 'bil-address:' => 'billing.address.',
63
+ 'bil-zipcode:' => 'billing.address.pcode',
64
+ 'bil-city:' => 'billing.address.city',
65
+ 'bil-country:' => 'billing.address.country',
66
+ 'bil-email:' => 'billing.email'
67
+ );
68
+
69
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'dmy');
70
+
71
+ $r['regyinfo'] = array(
72
+ 'referrer' => 'http://www.dns.lu',
73
+ 'registrar' => 'DNS-LU'
74
+ );
75
+ return $r;
76
+ }
77
+ }
78
+ ?>
lib/whois/whois.ly.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__LY_HANDLER__'))
31
+ define('__LY_HANDLER__', 1);
32
+
33
+ class ly_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'domain.name' => 'Domain Name:',
42
+ 'domain.status' => 'Domain Status:',
43
+ 'domain.created' => 'Created:',
44
+ 'domain.changed' => 'Updated:',
45
+ 'domain.expires' => 'Expired:',
46
+ 'domain.nserver' => 'Domain servers in listed order:'
47
+ );
48
+
49
+ $extra = array( 'zip/postal code:' => 'address.pcode' );
50
+
51
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
52
+
53
+ if (!empty($r['regrinfo']['domain']['name']))
54
+ {
55
+ $r['regrinfo'] = get_contacts($r['regrinfo'],$extra);
56
+ $r['regrinfo']['domain']['name'] = $r['regrinfo']['domain']['name'][0];
57
+ $r['regrinfo']['registered'] = 'yes';
58
+ }
59
+ else
60
+ {
61
+ $r = '';
62
+ $r['regrinfo']['registered'] = 'no';
63
+ }
64
+
65
+ $r['regyinfo'] = array(
66
+ 'referrer' => 'http://www.nic.ly',
67
+ 'registrar' => 'Libya ccTLD'
68
+ );
69
+ return $r;
70
+ }
71
+ }
72
+ ?>
lib/whois/whois.main.php ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.client.php');
29
+ require_once('whois.idna.php');
30
+
31
+ class Whois extends WhoisClient
32
+ {
33
+ // Deep whois ?
34
+ var $deep_whois = true;
35
+
36
+ // Windows based ?
37
+ var $windows = false;
38
+
39
+ // Recursion allowed ?
40
+ var $gtld_recurse = true;
41
+
42
+ // Support for non-ICANN tld's
43
+ var $non_icann = false;
44
+
45
+ // Network Solutions registry server
46
+ var $NSI_REGISTRY = 'whois.nsiregistry.net';
47
+
48
+ /*
49
+ * Constructor function
50
+ */
51
+ function Whois()
52
+ {
53
+ // Load DATA array
54
+ @require('whois.servers.php');
55
+
56
+ if ( ( substr( php_uname(), 0, 7 ) == 'Windows' ) )
57
+ $this->windows = true;
58
+ else
59
+ $this->windows = false;
60
+
61
+ // Set version
62
+ $this->VERSION = sprintf("phpWhois v%s-%s", $this->CODE_VERSION, $this->DATA_VERSION);
63
+ }
64
+
65
+ /*
66
+ * Use special whois server
67
+ */
68
+
69
+ function UseServer ($tld, $server)
70
+ {
71
+ $this->WHOIS_SPECIAL[$tld] = $server;
72
+ }
73
+
74
+ /*
75
+ * Lookup query
76
+ */
77
+
78
+ function Lookup($query = '', $is_utf = true)
79
+ {
80
+ // start clean
81
+ $this->Query = array( 'status' => '' );
82
+
83
+ $query = trim($query);
84
+
85
+ $IDN = new idna_convert();
86
+
87
+ if ($is_utf)
88
+ $query = $IDN->encode($query);
89
+ else
90
+ $query = $IDN->encode(utf8_encode($query));
91
+
92
+ // If domain to query was not set
93
+ if (!isSet($query) || $query == '')
94
+ {
95
+ // Configure to use default whois server
96
+ $this->Query['server'] = $this->NSI_REGISTRY;
97
+ return ;
98
+ }
99
+
100
+ // Set domain to query in query array
101
+
102
+ $this->Query['query'] = $domain = strtolower($query);
103
+
104
+ // If query is an ip address do ip lookup
105
+
106
+ if ($query == long2ip(ip2long($query)))
107
+ {
108
+ // IPv4 Prepare to do lookup via the 'ip' handler
109
+ $ip = @gethostbyname($query);
110
+
111
+ if (isset($this->WHOIS_SPECIAL['ip']))
112
+ {
113
+ $this->Query['server'] = $this->WHOIS_SPECIAL['ip'];
114
+ $this->Query['args'] = $ip;
115
+ }
116
+ else
117
+ {
118
+ $this->Query['server'] = 'whois.arin.net';
119
+ $this->Query['args'] = "n $ip";
120
+ $this->Query['file'] = 'whois.ip.php';
121
+ $this->Query['handler'] = 'ip';
122
+ }
123
+ $this->Query['host_ip'] = $ip;
124
+ $this->Query['query'] = $ip;
125
+ $this->Query['tld'] = 'ip';
126
+ $this->Query['host_name'] = @gethostbyaddr($ip);
127
+ return $this->GetData('',$this->deep_whois);
128
+ }
129
+
130
+ if (strpos($query, ':'))
131
+ {
132
+ // IPv6 AS Prepare to do lookup via the 'ip' handler
133
+ $ip = @gethostbyname($query);
134
+
135
+ if (isset($this->WHOIS_SPECIAL['ip']))
136
+ {
137
+ $this->Query['server'] = $this->WHOIS_SPECIAL['ip'];
138
+ }
139
+ else
140
+ {
141
+ $this->Query['server'] = 'whois.ripe.net';
142
+ $this->Query['file'] = 'whois.ip.ripe.php';
143
+ $this->Query['handler'] = 'ripe';
144
+ }
145
+ $this->Query['query'] = $ip;
146
+ $this->Query['tld'] = 'ip';
147
+ return $this->GetData('',$this->deep_whois);
148
+ }
149
+
150
+ if (!strpos($query, '.'))
151
+ {
152
+ // AS Prepare to do lookup via the 'ip' handler
153
+ $ip = @gethostbyname($query);
154
+ $this->Query['server'] = 'whois.arin.net';
155
+ if (strtolower(substr($ip,0,2)) == 'as')
156
+ $as = substr($ip,2);
157
+ else
158
+ $as = $ip;
159
+ $this->Query['args'] = "a $as";
160
+ $this->Query['file'] = 'whois.ip.php';
161
+ $this->Query['handler'] = 'ip';
162
+ $this->Query['query'] = $ip;
163
+ $this->Query['tld'] = 'as';
164
+ return $this->GetData('',$this->deep_whois);
165
+ }
166
+
167
+ // Build array of all possible tld's for that domain
168
+
169
+ $tld = '';
170
+ $server = '';
171
+ $dp = explode('.', $domain);
172
+ $np = count($dp)-1;
173
+ $tldtests = array();
174
+
175
+ for ($i = 0; $i < $np; $i++)
176
+ {
177
+ array_shift($dp);
178
+ $tldtests[] = implode('.', $dp);
179
+ }
180
+
181
+ // Search the correct whois server
182
+
183
+ if ($this->non_icann)
184
+ $special_tlds = array_merge($this->WHOIS_SPECIAL,$this->WHOIS_NON_ICANN);
185
+ else
186
+ $special_tlds = $this->WHOIS_SPECIAL;
187
+
188
+ foreach($tldtests as $tld)
189
+ {
190
+ // Test if we know in advance that no whois server is
191
+ // available for this domain and that we can get the
192
+ // data via http or whois request
193
+
194
+ if (isset($special_tlds[$tld]))
195
+ {
196
+ $val = $special_tlds[$tld];
197
+
198
+ if ($val == '') return $this->Unknown();
199
+
200
+ $domain = substr($query, 0, - strlen($tld) - 1);
201
+ $val = str_replace('{domain}', $domain, $val);
202
+ $server = str_replace('{tld}', $tld, $val);
203
+ break;
204
+ }
205
+ }
206
+
207
+ if ($server == '')
208
+ foreach($tldtests as $tld)
209
+ {
210
+ // Determine the top level domain, and it's whois server using
211
+ // DNS lookups on 'whois-servers.net'.
212
+ // Assumes a valid DNS response indicates a recognised tld (!?)
213
+
214
+ $cname = $tld.'.whois-servers.net';
215
+
216
+ if (gethostbyname($cname) == $cname) continue;
217
+ $server = $tld.'.whois-servers.net';
218
+ break;
219
+ }
220
+
221
+ if ($tld && $server)
222
+ {
223
+ // If found, set tld and whois server in query array
224
+ $this->Query['server'] = $server;
225
+ $this->Query['tld'] = $tld;
226
+ $handler = '';
227
+
228
+ foreach($tldtests as $htld)
229
+ {
230
+ // special handler exists for the tld ?
231
+
232
+ if (isSet($this->DATA[$htld]))
233
+ {
234
+ $handler = $this->DATA[$htld];
235
+ break;
236
+ }
237
+
238
+ // Regular handler exists for the tld ?
239
+ if (($fp = @fopen('whois.'.$htld.'.php', 'r', 1)) and fclose($fp))
240
+ {
241
+ $handler = $htld;
242
+ break;
243
+ }
244
+ }
245
+
246
+ // If there is a handler set it
247
+
248
+ if ($handler != '')
249
+ {
250
+ $this->Query['file'] = "whois.$handler.php";
251
+ $this->Query['handler'] = $handler;
252
+ }
253
+
254
+ // Special parameters ?
255
+
256
+ if (isset($this->WHOIS_PARAM[$server]))
257
+ $this->Query['server'] = $this->Query['server'].'?'.str_replace('$',$domain,$this->WHOIS_PARAM[$server]);
258
+
259
+ $result = $this->GetData('',$this->deep_whois);
260
+ $this->Checkdns($result);
261
+ return $result;
262
+ }
263
+
264
+ // If tld not known, and domain not in DNS, return error
265
+ return $this->Unknown();
266
+ }
267
+
268
+ /* Unsupported domains */
269
+
270
+ function Unknown()
271
+ {
272
+ unset($this->Query['server']);
273
+ $this->Query['status'] = 'error';
274
+ $result['rawdata'][] = $this->Query['errstr'][] = $this->Query['query'].' domain is not supported';
275
+ $this->Checkdns($result);
276
+ $this->FixResult($result, $this->Query['query']);
277
+ return $result;
278
+ }
279
+
280
+ /* Get nameservers if missing */
281
+
282
+ function Checkdns(&$result)
283
+ {
284
+ if ($this->deep_whois && empty($result['regrinfo']['domain']['nserver']) && function_exists('dns_get_record'))
285
+ {
286
+ $ns = @dns_get_record($this->Query['query'],DNS_NS);
287
+ if (!is_array($ns)) return;
288
+ $nserver = array();
289
+ foreach($ns as $row) $nserver[] = $row['target'];
290
+ if (count($nserver) > 0)
291
+ $result['regrinfo']['domain']['nserver'] = $this->FixNameServer($nserver);
292
+ }
293
+ }
294
+ /*
295
+ * Fix and/or add name server information
296
+ */
297
+
298
+ function FixResult(&$result, $domain)
299
+ {
300
+ // Add usual fields
301
+ $result['regrinfo']['domain']['name'] = $domain;
302
+
303
+ // Check if nameservers exist
304
+
305
+ if (!isset($result['regrinfo']['registered']))
306
+ {
307
+ if (function_exists('checkdnsrr') && checkdnsrr($domain, 'NS'))
308
+ $result['regrinfo']['registered'] = 'yes';
309
+ else
310
+ $result['regrinfo']['registered'] = 'unknown';
311
+ }
312
+
313
+ // Normalize nameserver fields
314
+
315
+ if (isset($result['regrinfo']['domain']['nserver']))
316
+ {
317
+ if (!is_array($result['regrinfo']['domain']['nserver']))
318
+ {
319
+ unset($result['regrinfo']['domain']['nserver']);
320
+ }
321
+ else
322
+ $result['regrinfo']['domain']['nserver'] = $this->FixNameServer($result['regrinfo']['domain']['nserver']);
323
+ }
324
+ }
325
+ }
326
+
327
+ ?>
lib/whois/whois.me.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ME_HANDLER__'))
29
+ define('__ME_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class me_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://domain.me',
40
+ 'registrar' => 'doMEn'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.mobi.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__MOBI_HANDLER__'))
29
+ define('__MOBI_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class mobi_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+
39
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
+ $r['regrinfo']['registered'] = 'unknown';
41
+
42
+ $r['regyinfo']['referrer'] = 'http://www.mtld.mobi/';
43
+ $r['regyinfo']['registrar'] = 'Dot Mobi Registry';
44
+ return $r;
45
+ }
46
+ }
47
+ ?>
lib/whois/whois.museum.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__MUSEUM_HANDLER__'))
29
+ define('__MUSEUM_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class museum_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://musedoma.museum',
40
+ 'registrar' => 'Museum Domain Management Association'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.mx.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__MX_HANDLER__'))
29
+ define('__MX_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class mx_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner' => 'Registrant:',
39
+ 'admin' => 'Administrative Contact:',
40
+ 'tech' => 'Technical Contact:',
41
+ 'billing' => 'Billing Contact:',
42
+ 'domain.nserver' => 'Name Servers:',
43
+ 'domain.created' => 'Created On:',
44
+ 'domain.expires' => 'Expiration Date:',
45
+ 'domain.changed' => 'Last Updated On:',
46
+ 'domain.sponsor' => 'Registrar:'
47
+ );
48
+
49
+ $extra = array(
50
+ 'city:' => 'address.city',
51
+ 'state:' => 'address.state',
52
+ 'dns:' => '0'
53
+ );
54
+
55
+ $r['regrinfo'] = easy_parser($data_str['rawdata'],$items,'dmy',$extra);
56
+
57
+ $r['regyinfo'] = array(
58
+ 'registrar' => 'NIC Mexico',
59
+ 'referrer' => 'http://www.nic.mx/'
60
+ );
61
+
62
+ if (empty($r['regrinfo']['domain']['created']))
63
+ $r['regrinfo']['registered'] = 'no';
64
+ else
65
+ $r['regrinfo']['registered'] = 'yes';
66
+
67
+ return $r;
68
+ }
69
+ }
70
+ ?>
lib/whois/whois.name.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NAME_HANDLER__'))
29
+ define('__NAME_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class name_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.nic.name/',
40
+ 'registrar' => 'Global Name Registry'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.nl.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NL_HANDLER__'))
29
+ define('__NL_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nl_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.name' => 'Domain name:',
39
+ 'domain.status' => 'Status:',
40
+ 'domain.nserver' => 'Domain nameservers:',
41
+ 'domain.created' => 'Date registered:',
42
+ 'domain.changed' => 'Record last updated:',
43
+ 'domain.sponsor' => 'Registrar:',
44
+ 'admin' => 'Administrative contact:',
45
+ 'tech' => 'Technical contact(s):'
46
+ );
47
+
48
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
49
+ $r['regyinfo']['referrer'] = 'http://www.domain-registry.nl';
50
+ $r['regyinfo']['registrar'] = 'Stichting Internet Domeinregistratie NL';
51
+
52
+ if (!isset($r['regrinfo']['domain']['status']))
53
+ {
54
+ $r['regrinfo']['registered'] = 'no';
55
+ return $r;
56
+ }
57
+
58
+ if (isset($r['regrinfo']['tech']))
59
+ $r['regrinfo']['tech'] = $this->get_contact($r['regrinfo']['tech']);
60
+
61
+ if (isset($r['regrinfo']['zone']))
62
+ $r['regrinfo']['zone'] = $this->get_contact($r['regrinfo']['zone']);
63
+
64
+ if (isset($r['regrinfo']['admin']))
65
+ $r['regrinfo']['admin'] = $this->get_contact($r['regrinfo']['admin']);
66
+
67
+ if (isset($r['regrinfo']['owner']))
68
+ $r['regrinfo']['owner'] = $this->get_contact($r['regrinfo']['owner']);
69
+
70
+ $r['regrinfo']['registered'] = 'yes';
71
+ format_dates($r,'dmy');
72
+ return $r;
73
+ }
74
+
75
+ function get_contact($data)
76
+ {
77
+ $r = get_contact($data);
78
+
79
+ if (isset($r['name']) && preg_match('/^[A-Z0-9]+-[A-Z0-9]+$/',$r['name']))
80
+ {
81
+ $r['handle'] = $r['name'];
82
+ $r['name'] = array_shift ($r['address']);
83
+ }
84
+
85
+ return $r;
86
+ }
87
+ }
88
+ ?>
lib/whois/whois.nu.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NU_HANDLER__'))
29
+ define('__NU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nu_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'name' => 'Domain Name (UTF-8):',
39
+ 'created' => 'Record created on',
40
+ 'expires' => 'Record expires on',
41
+ 'changed' => 'Record last updated on',
42
+ 'status' => 'Record status:',
43
+ 'handle' => 'Record ID:'
44
+ );
45
+
46
+ while (list($key, $val) = each($data_str['rawdata']))
47
+ {
48
+ $val = trim($val);
49
+
50
+ if ($val != '')
51
+ {
52
+ if ($val == 'Domain servers in listed order:')
53
+ {
54
+ while (list($key, $val) = each($data_str['rawdata']))
55
+ {
56
+ $val = trim($val);
57
+ if ($val == '')
58
+ break;
59
+ $r['regrinfo']['domain']['nserver'][] = $val;
60
+ }
61
+ break;
62
+ }
63
+
64
+ reset($items);
65
+
66
+ while (list($field, $match) = each($items))
67
+ if (strstr($val, $match))
68
+ {
69
+ $r['regrinfo']['domain'][$field] = trim(substr($val, strlen($match)));
70
+ break;
71
+ }
72
+ }
73
+ }
74
+
75
+ if (isset($r['regrinfo']['domain']))
76
+ $r['regrinfo']['registered'] = 'yes';
77
+ else
78
+ $r['regrinfo']['registered'] = 'no';
79
+
80
+ $r['regyinfo'] = array(
81
+ 'whois' => 'whois.nic.nu',
82
+ 'referrer' => 'http://www.nunames.nu',
83
+ 'registrar' => '.NU Domain, Ltd'
84
+ );
85
+
86
+ format_dates($r, 'dmy');
87
+ return $r;
88
+ }
89
+ }
90
+ ?>
lib/whois/whois.nz.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__NZ_HANDLER__'))
29
+ define('__NZ_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class nz_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain_name:' => 'domain.name',
39
+ 'query_status:' => 'domain.status',
40
+ 'ns_name_01:' => 'domain.nserver.0',
41
+ 'ns_name_02:' => 'domain.nserver.1',
42
+ 'ns_name_03:' => 'domain.nserver.2',
43
+ 'domain_dateregistered:' => 'domain.created',
44
+ 'domain_datelastmodified:' => 'domain.changed',
45
+ 'domain_datebilleduntil:' => 'domain.expires',
46
+ 'registrar_name:' => 'domain.sponsor',
47
+ 'registrant_contact_name:' => 'owner.name',
48
+ 'registrant_contact_address1:' => 'owner.address.address.0',
49
+ 'registrant_contact_address2:' => 'owner.address.address.1',
50
+ 'registrant_contact_address3:' => 'owner.address.address.2',
51
+ 'registrant_contact_postalcode:'=> 'owner.address.pcode',
52
+ 'registrant_contact_city:' => 'owner.address.city',
53
+ 'Registrant State/Province:' => 'owner.address.state',
54
+ 'registrant_contact_country:' => 'owner.address.country',
55
+ 'registrant_contact_phone:' => 'owner.phone',
56
+ 'registrant_contact_fax:' => 'owner.fax',
57
+ 'registrant_contact_email:' => 'owner.email',
58
+ 'admin_contact_name:' => 'admin.name',
59
+ 'admin_contact_address1:' => 'admin.address.address.0',
60
+ 'admin_contact_address2:' => 'admin.address.address.1',
61
+ 'admin_contact_address3:' => 'admin.address.address.2',
62
+ 'admin_contact_postalcode:' => 'admin.address.pcode',
63
+ 'admin_contact_city:' => 'admin.address.city',
64
+ 'admin_contact_country:' => 'admin.address.country',
65
+ 'admin_contact_phone:' => 'admin.phone',
66
+ 'admin_contact_fax:' => 'admin.fax',
67
+ 'admin_contact_email:' => 'admin.email',
68
+ 'technical_contact_name:' => 'tech.name',
69
+ 'technical_contact_address1:' => 'tech.address.address.0',
70
+ 'technical_contact_address1:' => 'tech.address.address.1',
71
+ 'technical_contact_address1:' => 'tech.address.address.2',
72
+ 'technical_contact_postalcode:' => 'tech.address.pcode',
73
+ 'technical_contact_city:' => 'tech.address.city',
74
+ 'technical_contact_country:' => 'tech.address.country',
75
+ 'technical_contact_phone:' => 'tech.phone',
76
+ 'technical_contact_fax:' => 'tech.fax',
77
+ 'technical_contact_email:' => 'tech.email'
78
+ );
79
+
80
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items);
81
+
82
+ if (!empty($r['regrinfo']['domain']['status']))
83
+ $domain_status = substr($r['regrinfo']['domain']['status'],0,3);
84
+ else
85
+ $domain_status = '';
86
+
87
+ if ($domain_status=='200')
88
+ $r['regrinfo']['registered']='yes';
89
+ elseif ($domain_status=='220')
90
+ $r['regrinfo']['registered']='no';
91
+ else
92
+ $r['regrinfo']['registered']='unknown';
93
+
94
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
95
+ $r['regrinfo']['registered'] = 'unknown';
96
+
97
+ $r['regyinfo']['referrer'] = 'http://www.dnc.org.nz';
98
+ $r['regyinfo']['registrar'] = 'New Zealand Domain Name Registry Limited';
99
+ return $r;
100
+ }
101
+ }
102
+ ?>
lib/whois/whois.org.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ORG_HANDLER__'))
29
+ define('__ORG_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class org_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+
39
+ if (!strncmp($data_str['rawdata'][0], 'WHOIS LIMIT EXCEEDED', 20))
40
+ $r['regrinfo']['registered'] = 'unknown';
41
+
42
+ $r['regyinfo']['referrer'] = 'http://www.pir.org/';
43
+ $r['regyinfo']['registrar'] = 'Public Interest Registry';
44
+ return $r;
45
+ }
46
+ }
47
+ ?>
lib/whois/whois.org.za.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__ORG_ZA_HANDLER__'))
31
+ define('__ORG_ZA_HANDLER__', 1);
32
+
33
+ class org_za_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.status' => 'Status:',
39
+ 'domain.nserver' => 'Domain name servers in listed order:',
40
+ 'domain.changed' => 'Record last updated on',
41
+ 'owner' => 'rwhois search on',
42
+ 'admin' => 'Administrative Contact:',
43
+ 'tech' => 'Technical Contact:',
44
+ 'billing' => 'Billing Contact:',
45
+ '#' => 'Search Again'
46
+ );
47
+
48
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
49
+
50
+ if (isset($r['regrinfo']['domain']['status']))
51
+ {
52
+ $r['regrinfo']['registered'] = 'yes';
53
+ $r['regrinfo']['domain']['handler'] = strtok(array_shift($r['regrinfo']['owner']),' ');
54
+ $r['regrinfo'] = get_contacts($r['regrinfo']);
55
+ }
56
+ else
57
+ $r['regrinfo']['registered'] = 'no';
58
+
59
+ $r['regyinfo']['referrer'] = 'http://www.org.za';
60
+ $r['regyinfo']['registrar'] = 'The ORG.ZA Domain';
61
+ return $r;
62
+ }
63
+ }
64
+ ?>
lib/whois/whois.parser.php ADDED
@@ -0,0 +1,873 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ //-------------------------------------------------------------------------
29
+
30
+ function generic_parser_a ($rawdata, $translate, $contacts, $main='domain', $dateformat='dmy')
31
+ {
32
+ $blocks = generic_parser_a_blocks($rawdata,$translate,$disclaimer);
33
+
34
+ if (isset($disclaimer) && is_array($disclaimer))
35
+ $ret['disclaimer']=$disclaimer;
36
+
37
+ if (empty($blocks) || !is_array($blocks['main']))
38
+ {
39
+ $ret['registered']='no';
40
+ return $ret;
41
+ }
42
+
43
+ $r = $blocks['main'];
44
+ $ret['registered'] = 'yes';
45
+
46
+ while (list($key,$val) = each($contacts))
47
+ if (isset($r[$key]))
48
+ {
49
+ if (is_array($r[$key]))
50
+ $blk = $r[$key][count($r[$key])-1];
51
+ else
52
+ $blk = $r[$key];
53
+
54
+ $blk = strtoupper(strtok($blk,' '));
55
+ if (isset($blocks[$blk])) $ret[$val] = $blocks[$blk];
56
+ unset($r[$key]);
57
+ }
58
+
59
+ if ($main) $ret[$main] = $r;
60
+
61
+ format_dates($ret,$dateformat);
62
+ return $ret;
63
+ }
64
+
65
+ //-------------------------------------------------------------------------
66
+
67
+ function generic_parser_a_blocks ($rawdata, $translate, &$disclaimer)
68
+ {
69
+ $r = array();
70
+ $newblock = false;
71
+ $hasdata = false;
72
+ $block = array();
73
+ $blocks = false;
74
+ $gkey = 'main';
75
+ $dend = false;
76
+
77
+ while (list($key,$val)=each($rawdata))
78
+ {
79
+ $val=trim($val);
80
+
81
+ if ($val != '' && ($val[0] == '%' || $val[0] == '#'))
82
+ {
83
+ if (!$dend) $disclaimer[]=trim(substr($val,1));
84
+ continue;
85
+ }
86
+ if ($val=='')
87
+ {
88
+ $newblock = true;
89
+ continue;
90
+ }
91
+ if ($newblock && $hasdata)
92
+ {
93
+ $blocks[$gkey] = $block;
94
+ $block = array();
95
+ $gkey = '';
96
+ }
97
+ $dend = true;
98
+ $newblock = false;
99
+ $k = trim(strtok($val,':'));
100
+ $v = trim(substr(strstr($val,':'),1));
101
+
102
+ if ($v == '') continue;
103
+
104
+ $hasdata = true;
105
+
106
+ if (isset($translate[$k]))
107
+ {
108
+ $k=$translate[$k];
109
+ if ($k=='') continue;
110
+ if (strstr($k,'.'))
111
+ {
112
+ eval("\$block".getvarname($k)."=\$v;");
113
+ continue;
114
+ }
115
+ }
116
+ else $k=strtolower($k);
117
+
118
+ if ($k=='handle')
119
+ {
120
+ $v = strtok($v,' ');
121
+ $gkey = strtoupper($v);
122
+ }
123
+
124
+ if (isset($block[$k]) && is_array($block[$k]))
125
+ $block[$k][]=$v;
126
+ else
127
+ if (!isset($block[$k]) || $block[$k]=='')
128
+ $block[$k]=$v;
129
+ else
130
+ {
131
+ $x=$block[$k];
132
+ unset($block[$k]);
133
+ $block[$k][]=$x;
134
+ $block[$k][]=$v;
135
+ }
136
+ }
137
+
138
+ if ($hasdata) $blocks[$gkey]=$block;
139
+
140
+ return $blocks;
141
+ }
142
+
143
+ //-------------------------------------------------------------------------
144
+
145
+ function generic_parser_b ( $rawdata, $items = false, $dateformat='mdy', $hasreg=true, $scanall=false )
146
+ {
147
+ if (!$items)
148
+ $items = array(
149
+ 'Domain Name:' => 'domain.name',
150
+ 'Domain ID:' => 'domain.handle',
151
+ 'Sponsoring Registrar:' => 'domain.sponsor',
152
+ 'Registrar ID:' => 'domain.sponsor',
153
+ 'Domain Status:' => 'domain.status.',
154
+ 'Status:' => 'domain.status.',
155
+ 'Name Server:' => 'domain.nserver.',
156
+ 'Nameservers:' => 'domain.nserver.',
157
+ 'Maintainer:' => 'domain.referer',
158
+
159
+ 'Domain Registration Date:' => 'domain.created',
160
+ 'Domain Create Date:' => 'domain.created',
161
+ 'Domain Expiration Date:' => 'domain.expires',
162
+ 'Domain Last Updated Date:' => 'domain.changed',
163
+ 'Creation Date:' => 'domain.created',
164
+ 'Last Modification Date:' => 'domain.changed',
165
+ 'Expiration Date:' => 'domain.expires',
166
+ 'Created On:' => 'domain.created',
167
+ 'Last Updated On:' => 'domain.changed',
168
+ 'Expiration Date:' => 'domain.expires',
169
+
170
+ 'Registrant ID:' => 'owner.handle',
171
+ 'Registrant Name:' => 'owner.name',
172
+ 'Registrant Organization:' => 'owner.organization',
173
+ 'Registrant Address:' => 'owner.address.street.',
174
+ 'Registrant Address1:' => 'owner.address.street.',
175
+ 'Registrant Address2:' => 'owner.address.street.',
176
+ 'Registrant Street:' => 'owner.address.street.',
177
+ 'Registrant Street1:' => 'owner.address.street.',
178
+ 'Registrant Street2:' => 'owner.address.street.',
179
+ 'Registrant Street3:' => 'owner.address.street.',
180
+ 'Registrant Postal Code:' => 'owner.address.pcode',
181
+ 'Registrant City:' => 'owner.address.city',
182
+ 'Registrant State/Province:' => 'owner.address.state',
183
+ 'Registrant Country:' => 'owner.address.country',
184
+ 'Registrant Country/Economy:' => 'owner.address.country',
185
+ 'Registrant Phone Number:' => 'owner.phone',
186
+ 'Registrant Phone:' => 'owner.phone',
187
+ 'Registrant Facsimile Number:' => 'owner.fax',
188
+ 'Registrant FAX:' => 'owner.fax',
189
+ 'Registrant Email:' => 'owner.email',
190
+ 'Registrant E-mail:' => 'owner.email',
191
+
192
+ 'Administrative Contact ID:' => 'admin.handle',
193
+ 'Administrative Contact Name:' => 'admin.name',
194
+ 'Administrative Contact Organization:' => 'admin.organization',
195
+ 'Administrative Contact Address:' => 'admin.address.street.',
196
+ 'Administrative Contact Address1:' => 'admin.address.street.',
197
+ 'Administrative Contact Address2:' => 'admin.address.street.',
198
+ 'Administrative Contact Postal Code:' => 'admin.address.pcode',
199
+ 'Administrative Contact City:' => 'admin.address.city',
200
+ 'Administrative Contact State/Province:' => 'admin.address.state',
201
+ 'Administrative Contact Country:' => 'admin.address.country',
202
+ 'Administrative Contact Phone Number:' => 'admin.phone',
203
+ 'Administrative Contact Email:' => 'admin.email',
204
+ 'Administrative Contact Facsimile Number:' => 'admin.fax',
205
+ 'Administrative Contact Tel:' => 'admin.phone',
206
+ 'Administrative Contact Fax:' => 'admin.fax',
207
+ 'Administrative ID:' => 'admin.handle',
208
+ 'Administrative Name:' => 'admin.name',
209
+ 'Administrative Organization:' => 'admin.organization',
210
+ 'Administrative Address:' => 'admin.address.street.',
211
+ 'Administrative Address1:' => 'admin.address.street.',
212
+ 'Administrative Address2:' => 'admin.address.street.',
213
+ 'Administrative Postal Code:' => 'admin.address.pcode',
214
+ 'Administrative City:' => 'admin.address.city',
215
+ 'Administrative State/Province:' => 'admin.address.state',
216
+ 'Administrative Country/Economy:' => 'admin.address.country',
217
+ 'Administrative Phone:' => 'admin.phone',
218
+ 'Administrative E-mail:' => 'admin.email',
219
+ 'Administrative Facsimile Number:' => 'admin.fax',
220
+ 'Administrative Tel:' => 'admin.phone',
221
+ 'Administrative FAX:' => 'admin.fax',
222
+ 'Admin ID:' => 'admin.handle',
223
+ 'Admin Name:' => 'admin.name',
224
+ 'Admin Organization:' => 'admin.organization',
225
+ 'Admin Street:' => 'admin.address.street.',
226
+ 'Admin Street1:' => 'admin.address.street.',
227
+ 'Admin Street2:' => 'admin.address.street.',
228
+ 'Admin Street3:' => 'admin.address.street.',
229
+ 'Admin Address:' => 'admin.address.street.',
230
+ 'Admin Address2:' => 'admin.address.street.',
231
+ 'Admin Address3:' => 'admin.address.street.',
232
+ 'Admin City:' => 'admin.address.city',
233
+ 'Admin State/Province:' => 'admin.address.state',
234
+ 'Admin Postal Code:' => 'admin.address.pcode',
235
+ 'Admin Country:' => 'admin.address.country',
236
+ 'Admin Country/Economy:' => 'admin.address.country',
237
+ 'Admin Phone:' => 'admin.phone',
238
+ 'Admin FAX:' => 'admin.fax',
239
+ 'Admin Email:' => 'admin.email',
240
+ 'Admin E-mail:' => 'admin.email',
241
+
242
+ 'Technical Contact ID:' => 'tech.handle',
243
+ 'Technical Contact Name:' => 'tech.name',
244
+ 'Technical Contact Organization:' => 'tech.organization',
245
+ 'Technical Contact Address:' => 'tech.address.street.',
246
+ 'Technical Contact Address1:' => 'tech.address.street.',
247
+ 'Technical Contact Address2:' => 'tech.address.street.',
248
+ 'Technical Contact Postal Code:' => 'tech.address.pcode',
249
+ 'Technical Contact City:' => 'tech.address.city',
250
+ 'Technical Contact State/Province:' => 'tech.address.state',
251
+ 'Technical Contact Country:' => 'tech.address.country',
252
+ 'Technical Contact Phone Number:' => 'tech.phone',
253
+ 'Technical Contact Facsimile Number:' => 'tech.fax',
254
+ 'Technical Contact Phone:' => 'tech.phone',
255
+ 'Technical Contact Fax:' => 'tech.fax',
256
+ 'Technical Contact Email:' => 'tech.email',
257
+ 'Technical ID:' => 'tech.handle',
258
+ 'Technical Name:' => 'tech.name',
259
+ 'Technical Organization:' => 'tech.organization',
260
+ 'Technical Address:' => 'tech.address.street.',
261
+ 'Technical Address1:' => 'tech.address.street.',
262
+ 'Technical Address2:' => 'tech.address.street.',
263
+ 'Technical Postal Code:' => 'tech.address.pcode',
264
+ 'Technical City:' => 'tech.address.city',
265
+ 'Technical State/Province:' => 'tech.address.state',
266
+ 'Technical Country/Economy:' => 'tech.address.country',
267
+ 'Technical Phone Number:' => 'tech.phone',
268
+ 'Technical Facsimile Number:' => 'tech.fax',
269
+ 'Technical Phone:' => 'tech.phone',
270
+ 'Technical Fax:' => 'tech.fax',
271
+ 'Technical FAX:' => 'tech.fax',
272
+ 'Technical E-mail:' => 'tech.email',
273
+ 'Tech ID:' => 'tech.handle',
274
+ 'Tech Name:' => 'tech.name',
275
+ 'Tech Organization:' => 'tech.organization',
276
+ 'Tech Address:' => 'tech.address.street.',
277
+ 'Tech Address2:' => 'tech.address.street.',
278
+ 'Tech Address3:' => 'tech.address.street.',
279
+ 'Tech Street:' => 'tech.address.street.',
280
+ 'Tech Street1:' => 'tech.address.street.',
281
+ 'Tech Street2:' => 'tech.address.street.',
282
+ 'Tech Street3:' => 'tech.address.street.',
283
+ 'Tech City:' => 'tech.address.city',
284
+ 'Tech Postal Code:' => 'tech.address.pcode',
285
+ 'Tech State/Province:' => 'tech.address.state',
286
+ 'Tech Country:' => 'tech.address.country',
287
+ 'Tech Country/Economy:' => 'tech.address.country',
288
+ 'Tech Phone:' => 'tech.phone',
289
+ 'Tech FAX:' => 'tech.fax',
290
+ 'Tech Email:' => 'tech.email',
291
+ 'Tech E-mail:' => 'tech.email',
292
+
293
+ 'Billing Contact ID:' => 'billing.handle',
294
+ 'Billing Contact Name:' => 'billing.name',
295
+ 'Billing Contact Organization:' => 'billing.organization',
296
+ 'Billing Contact Address1:' => 'billing.address.street.',
297
+ 'Billing Contact Address2:' => 'billing.address.street.',
298
+ 'Billing Contact Postal Code:' => 'billing.address.pcode',
299
+ 'Billing Contact City:' => 'billing.address.city',
300
+ 'Billing Contact State/Province:' => 'billing.address.state',
301
+ 'Billing Contact Country:' => 'billing.address.country',
302
+ 'Billing Contact Phone Number:' => 'billing.phone',
303
+ 'Billing Contact Facsimile Number:' => 'billing.fax',
304
+ 'Billing Contact Email:' => 'billing.email',
305
+ 'Billing ID:' => 'billing.handle',
306
+ 'Billing Name:' => 'billing.name',
307
+ 'Billing Organization:' => 'billing.organization',
308
+ 'Billing Address:' => 'billing.address.street.',
309
+ 'Billing Address1:' => 'billing.address.street.',
310
+ 'Billing Address2:' => 'billing.address.street.',
311
+ 'Billing Address3:' => 'billing.address.street.',
312
+ 'Billing Street:' => 'billing.address.street.',
313
+ 'Billing Street1:' => 'billing.address.street.',
314
+ 'Billing Street2:' => 'billing.address.street.',
315
+ 'Billing Street3:' => 'billing.address.street.',
316
+ 'Billing City:' => 'billing.address.city',
317
+ 'Billing Postal Code:' => 'billing.address.pcode',
318
+ 'Billing State/Province:' => 'billing.address.state',
319
+ 'Billing Country:' => 'billing.address.country',
320
+ 'Billing Country/Economy:' => 'billing.address.country',
321
+ 'Billing Phone:' => 'billing.phone',
322
+ 'Billing Fax:' => 'billing.fax',
323
+ 'Billing FAX:' => 'billing.fax',
324
+ 'Billing Email:' => 'billing.email',
325
+ 'Billing E-mail:' => 'billing.email',
326
+
327
+ 'Zone ID:' => 'zone.handle',
328
+ 'Zone Organization:' => 'zone.organization',
329
+ 'Zone Name:' => 'zone.name',
330
+ 'Zone Address:' => 'zone.address.street.',
331
+ 'Zone Address 2:' => 'zone.address.street.',
332
+ 'Zone City:' => 'zone.address.city',
333
+ 'Zone State/Province:' => 'zone.address.state',
334
+ 'Zone Postal Code:' => 'zone.address.pcode',
335
+ 'Zone Country:' => 'zone.address.country',
336
+ 'Zone Phone Number:' => 'zone.phone',
337
+ 'Zone Fax Number:' => 'zone.fax',
338
+ 'Zone Email:' => 'zone.email'
339
+ );
340
+
341
+ $r = '';
342
+ $disok = true;
343
+
344
+ while (list($key,$val) = each($rawdata))
345
+ {
346
+ if (trim($val) != '')
347
+ {
348
+ if (($val[0]=='%' || $val[0]=='#') && $disok)
349
+ {
350
+ $r['disclaimer'][] = trim(substr($val,1));
351
+ $disok = true;
352
+ continue;
353
+ }
354
+
355
+ $disok = false;
356
+ reset($items);
357
+
358
+ while (list($match, $field)=each($items))
359
+ {
360
+ $pos = strpos($val,$match);
361
+
362
+ if ($pos !== false)
363
+ {
364
+ if ($field != '')
365
+ {
366
+ $var = '$r'.getvarname($field);
367
+ $itm = trim(substr($val,$pos+strlen($match)));
368
+
369
+ if ($itm!='')
370
+ eval($var.'="'.str_replace('"','\"',$itm).'";');
371
+ }
372
+
373
+ if (!$scanall)
374
+ break;
375
+ }
376
+ }
377
+ }
378
+ }
379
+
380
+ if (empty($r))
381
+ {
382
+ if ($hasreg) $r['registered'] = 'no';
383
+ }
384
+ else
385
+ {
386
+ if ($hasreg) $r['registered'] = 'yes';
387
+
388
+ $r = format_dates($r, $dateformat);
389
+ }
390
+
391
+ return $r;
392
+ }
393
+
394
+ //-------------------------------------------------------------------------
395
+
396
+ function getvarname ( $vdef )
397
+ {
398
+ $parts = explode('.',$vdef);
399
+ $var = '';
400
+
401
+ foreach($parts as $mn)
402
+ if ($mn == '') $var = $var.'[]';
403
+ else $var = $var.'["'.$mn.'"]';
404
+
405
+ return $var;
406
+ }
407
+
408
+ //-------------------------------------------------------------------------
409
+
410
+ function get_blocks ( $rawdata, $items, $partial_match = false, $def_block = false )
411
+ {
412
+
413
+ $r = array();
414
+ $endtag = '';
415
+
416
+ while (list($key,$val) = each($rawdata))
417
+ {
418
+ $val = trim($val);
419
+ if ($val == '') continue;
420
+
421
+ $var = $found = false;
422
+
423
+ foreach ($items as $field => $match)
424
+ {
425
+ $pos = strpos($val,$match);
426
+
427
+ if ($field != '' && $pos !== false)
428
+ {
429
+ if ($val == $match)
430
+ {
431
+ $found = true;
432
+ $endtag = '';
433
+ $line = $val;
434
+ break;
435
+ }
436
+
437
+ $last = substr($val,-1,1);
438
+
439
+ if ($last == ':' || $last == '-' || $last == ']')
440
+ {
441
+ $found = true;
442
+ $endtag = $last;
443
+ $line = $val;
444
+ }
445
+ else
446
+ {
447
+ $var = getvarname(strtok($field,'#'));
448
+ $itm = trim(substr($val,$pos+strlen($match)));
449
+ eval('$r'.$var.'=$itm;');
450
+ }
451
+
452
+ break;
453
+ }
454
+ }
455
+
456
+ if (!$found)
457
+ {
458
+ if (!$var && $def_block) $r[$def_block][] = $val;
459
+ continue;
460
+ }
461
+
462
+ $block = array();
463
+
464
+ // Block found, get data ...
465
+
466
+ while (list($key,$val) = each($rawdata))
467
+ {
468
+ $val = trim($val);
469
+
470
+ if ($val == '' || $val == str_repeat($val[0],strlen($val))) continue;
471
+
472
+ $last = substr($val,-1,1);
473
+ /*
474
+ if ($last == $endtag)
475
+ {
476
+ // Another block found
477
+ prev($rawdata);
478
+ break;
479
+ }
480
+
481
+ if ($endtag == '' || $partial_match)
482
+ */
483
+ if ($endtag == '' || $partial_match || $last == $endtag)
484
+ {
485
+ //Check if this line starts another block
486
+ $et = false;
487
+
488
+ foreach ($items as $field => $match)
489
+ {
490
+ $pos = strpos($val,$match);
491
+
492
+ if ($pos !== false && $pos == 0)
493
+ {
494
+ $et = true;
495
+ break;
496
+ }
497
+ }
498
+
499
+ if ($et)
500
+ {
501
+ // Another block found
502
+ prev($rawdata);
503
+ break;
504
+ }
505
+ }
506
+
507
+ $block[] = $val;
508
+ }
509
+
510
+ if (empty($block)) continue;
511
+
512
+ foreach ($items as $field => $match)
513
+ {
514
+ $pos = strpos($line,$match);
515
+
516
+ if ($pos !== false)
517
+ {
518
+ $var = getvarname(strtok($field,'#'));
519
+ if ($var != '[]') eval('$r'.$var.'=$block;');
520
+ }
521
+ }
522
+ }
523
+
524
+ return $r;
525
+ }
526
+
527
+ //-------------------------------------------------------------------------
528
+
529
+ function easy_parser($data_str, $items, $date_format, $translate = false ,
530
+ $has_org = false, $partial_match = false,
531
+ $def_block = false )
532
+ {
533
+ $r = get_blocks($data_str, $items, $partial_match, $def_block);
534
+ $r = get_contacts($r, $translate, $has_org);
535
+ format_dates($r, $date_format);
536
+ return $r;
537
+ }
538
+
539
+ //-------------------------------------------------------------------------
540
+
541
+ function get_contacts ( $array, $extra_items='', $has_org= false )
542
+ {
543
+ if (isset($array['billing']))
544
+ $array['billing'] = get_contact($array['billing'], $extra_items, $has_org);
545
+
546
+ if (isset($array['tech']))
547
+ $array['tech'] = get_contact($array['tech'], $extra_items, $has_org);
548
+
549
+ if (isset($array['zone']))
550
+ $array['zone'] = get_contact($array['zone'], $extra_items, $has_org);
551
+
552
+ if (isset($array['admin']))
553
+ $array['admin'] = get_contact($array['admin'], $extra_items, $has_org);
554
+
555
+ if (isset($array['owner']))
556
+ $array['owner'] = get_contact($array['owner'], $extra_items, $has_org);
557
+
558
+ if (isset($array['registrar']))
559
+ $array['registrar'] = get_contact($array['registrar'], $extra_items, $has_org);
560
+
561
+ return $array;
562
+ }
563
+
564
+ //-------------------------------------------------------------------------
565
+
566
+ function get_contact ( $array, $extra_items='', $has_org= false )
567
+ {
568
+
569
+ if (!is_array($array))
570
+ return array();
571
+
572
+ $items = array (
573
+ 'fax..:' => 'fax',
574
+ 'fax.' => 'fax',
575
+ 'fax-no:' => 'fax',
576
+ 'fax -' => 'fax',
577
+ 'fax-' => 'fax',
578
+ 'fax::' => 'fax',
579
+ 'fax:' => 'fax',
580
+ '[fax]' => 'fax',
581
+ '(fax)' => 'fax',
582
+ 'fax' => 'fax',
583
+ 'tel. ' => 'phone',
584
+ 'tel:' => 'phone',
585
+ 'phone::' => 'phone',
586
+ 'phone:' => 'phone',
587
+ 'phone-' => 'phone',
588
+ 'phone -' => 'phone',
589
+ 'email:' => 'email',
590
+ 'e-mail:' => 'email',
591
+ 'company name:' => 'organization',
592
+ 'organisation:' => 'organization',
593
+ 'first name:' => 'name.first',
594
+ 'last name:' => 'name.last',
595
+ 'street:' => 'address.street',
596
+ 'address:' => 'address.street.',
597
+ 'language:' => '',
598
+ 'location:' => 'address.city',
599
+ 'country:' => 'address.country',
600
+ 'name:' => 'name',
601
+ 'last modified:' => 'changed'
602
+ );
603
+
604
+ if ($extra_items)
605
+ {
606
+ foreach($items as $match => $field)
607
+ if (!isset($extra_items[$match]))
608
+ $extra_items[$match] = $field;
609
+ $items = $extra_items;
610
+ }
611
+
612
+ while (list($key,$val)=each($array))
613
+ {
614
+ $ok=true;
615
+
616
+ while ($ok)
617
+ {
618
+ reset($items);
619
+ $ok = false;
620
+
621
+ while (list($match,$field) = each($items))
622
+ {
623
+ $pos = strpos(strtolower($val),$match);
624
+
625
+ if ($pos === false) continue;
626
+
627
+ $itm = trim(substr($val,$pos+strlen($match)));
628
+
629
+ if ($field != '' && $itm != '')
630
+ {
631
+ eval('$r'.getvarname($field).'=$itm;');
632
+ }
633
+
634
+ $val = trim(substr($val,0,$pos));
635
+
636
+ if ($val == '')
637
+ {
638
+ unset($array[$key]);
639
+ break;
640
+ }
641
+ else
642
+ {
643
+ $array[$key] = $val;
644
+ $ok = true;
645
+ }
646
+ //break;
647
+ }
648
+
649
+ if (preg_match("/([+]*[-\(\)\. x0-9]){7,}/", $val, $matches))
650
+ {
651
+ $phone = trim(str_replace(' ','',$matches[0]));
652
+
653
+ if (strlen($phone) > 8 && !preg_match('/[0-9]{5}\-[0-9]{3}/',$phone))
654
+ {
655
+ if (isset($r['phone']))
656
+ {
657
+ if (isset($r['fax'])) continue;
658
+ $r['fax'] = trim($matches[0]);
659
+ }
660
+ else
661
+ {
662
+ $r['phone'] = trim($matches[0]);
663
+ }
664
+
665
+ $val = str_replace($matches[0],'',$val);
666
+
667
+ if ($val == '')
668
+ {
669
+ unset($array[$key]);
670
+ continue;
671
+ }
672
+ else
673
+ {
674
+ $array[$key] = $val;
675
+ $ok = true;
676
+ }
677
+ }
678
+ }
679
+
680
+ if (preg_match('/([-0-9a-zA-Z._+&\/=]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6})/',$val, $matches))
681
+ {
682
+ $r['email'] = $matches[0];
683
+
684
+ $val = str_replace($matches[0],'',$val);
685
+ $val = trim(str_replace('()','',$val));
686
+
687
+ if ($val == '')
688
+ {
689
+ unset($array[$key]);
690
+ continue;
691
+ }
692
+ else
693
+ {
694
+ if (!isset($r['name']))
695
+ {
696
+ $r['name'] = $val;
697
+ unset($array[$key]);
698
+ }
699
+ else
700
+ $array[$key] = $val;
701
+
702
+ $ok = true;
703
+ }
704
+ }
705
+ }
706
+ }
707
+
708
+ if (!isset($r['name']) && count($array)>0)
709
+ {
710
+ $r['name'] = array_shift($array);
711
+ }
712
+
713
+ if ($has_org && count($array)>0)
714
+ {
715
+ $r['organization'] = array_shift($array);
716
+ }
717
+
718
+ if (isset($r['name']) && is_array($r['name']))
719
+ {
720
+ $r['name'] = implode($r['name'],' ');
721
+ }
722
+
723
+ if (!empty($array))
724
+ {
725
+ if (isset($r['address']))
726
+ $r['address'] = array_merge($r['address'],$array);
727
+ else
728
+ $r['address'] = $array;
729
+ }
730
+
731
+ return $r;
732
+ }
733
+
734
+ //-------------------------------------------------------------------------
735
+
736
+ function format_dates (&$res,$format='mdy')
737
+ {
738
+ if (!is_array($res)) return $res;
739
+
740
+ foreach ($res as $key => $val)
741
+ {
742
+ if (is_array($val))
743
+ {
744
+ if (!is_numeric($key) && ($key=='expires' || $key=='created' || $key=='changed'))
745
+ {
746
+ $d = get_date($val[0],$format);
747
+ if ($d) $res[$key] = $d;
748
+ }
749
+ else
750
+ {
751
+ $res[$key] = format_dates($val,$format);
752
+ }
753
+ }
754
+ else
755
+ {
756
+ if (!is_numeric($key) && ($key=='expires' || $key=='created' || $key=='changed'))
757
+ {
758
+ $d = get_date($val,$format);
759
+ if ($d) $res[$key] = $d;
760
+ }
761
+ }
762
+ }
763
+
764
+ return $res;
765
+ }
766
+
767
+ //-------------------------------------------------------------------------
768
+
769
+ function get_date($date,$format)
770
+ {
771
+ $months = array( 'jan'=>1, 'ene'=>1, 'feb'=>2, 'mar'=>3, 'apr'=>4, 'abr'=>4,
772
+ 'may'=>5, 'jun'=>6, 'jul'=>7, 'aug'=>8, 'ago'=>8, 'sep'=>9,
773
+ 'oct'=>10, 'nov'=>11, 'dec'=>12, 'dic'=>12 );
774
+
775
+ $parts = explode(' ',$date);
776
+
777
+ if (strpos($parts[0],'@') !== false)
778
+ {
779
+ unset($parts[0]);
780
+ $date = implode(' ',$parts);
781
+ }
782
+
783
+ $date = str_replace(',',' ',trim($date));
784
+ $date = str_replace('.',' ',$date);
785
+ $date = str_replace('-',' ',$date);
786
+ $date = str_replace('/',' ',$date);
787
+ $date = str_replace("\t",' ',$date);
788
+
789
+ $parts = explode(' ',$date);
790
+ $res = false;
791
+
792
+ if ((strlen($parts[0]) == 8 || count($parts) == 1) && is_numeric($parts[0]))
793
+ {
794
+ $val = $parts[0];
795
+ for ($p=$i=0; $i<3; $i++)
796
+ {
797
+ if ($format[$i] != 'Y')
798
+ {
799
+ $res[$format[$i]] = substr($val,$p,2);
800
+ $p += 2;
801
+ }
802
+ else
803
+ {
804
+ $res['y'] = substr($val,$p,4);
805
+ $p += 4;
806
+ }
807
+ }
808
+ }
809
+ else
810
+ {
811
+ $format = strtolower($format);
812
+
813
+ for ($p=$i=0; $p<count($parts) && $i<strlen($format); $p++)
814
+ {
815
+ if (trim($parts[$p]) == '')
816
+ continue;
817
+
818
+ if ($format[$i] != '-')
819
+ {
820
+ $res[$format[$i]] = $parts[$p];
821
+ }
822
+ $i++;
823
+ }
824
+ }
825
+
826
+ if (!$res) return $date;
827
+
828
+ $ok = false;
829
+
830
+ while (!$ok)
831
+ {
832
+ reset($res);
833
+ $ok = true;
834
+
835
+ while (list($key, $val) = each($res))
836
+ {
837
+ if ($val == '' || $key == '') continue;
838
+
839
+ if (!is_numeric($val) && isset($months[substr(strtolower($val),0,3)]))
840
+ {
841
+ $res[$key] = $res['m'];
842
+ $res['m'] = $months[substr(strtolower($val),0,3)];
843
+ $ok = false;
844
+ break;
845
+ }
846
+
847
+ if ($key != 'y' && $key != 'Y' && $val > 1900)
848
+ {
849
+ $res[$key] = $res['y'];
850
+ $res['y'] = $val;
851
+ $ok = false;
852
+ break;
853
+ }
854
+ }
855
+ }
856
+
857
+ if ($res['m'] > 12)
858
+ {
859
+ $v = $res['m'];
860
+ $res['m'] = $res['d'];
861
+ $res['d'] = $v;
862
+ }
863
+
864
+ if ($res['y'] < 70)
865
+ $res['y'] += 2000;
866
+ else
867
+ if ($res['y'] <= 99)
868
+ $res['y'] += 1900;
869
+
870
+ return sprintf("%.4d-%02d-%02d",$res['y'],$res['m'],$res['d']);
871
+ }
872
+
873
+ ?>
lib/whois/whois.pl.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__PL_HANDLER__'))
29
+ define('__PL_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class pl_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.created' => 'created:',
39
+ 'domain.changed' => 'last modified:',
40
+ 'domain.sponsor' => 'REGISTRAR:',
41
+ '#' => 'WHOIS displays data with a delay not exceeding 15 minutes in relation to the .pl Registry system'
42
+
43
+ );
44
+
45
+ $r['regrinfo'] = easy_parser($data_str['rawdata'], $items, 'ymd');
46
+
47
+ $r['regyinfo'] = array(
48
+ 'referrer' => 'http://www.dns.pl/english/index.html',
49
+ 'registrar' => 'NASK'
50
+ );
51
+ return $r;
52
+ }
53
+ }
54
+ ?>
lib/whois/whois.pro.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ require_once('whois.parser.php');
29
+
30
+ if (!defined('__PRO_HANDLER__'))
31
+ define('__PRO_HANDLER__', 1);
32
+
33
+ class pro_handler
34
+ {
35
+ function parse($data, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data['rawdata']);
38
+ $r['regyinfo']['referrer'] = 'http://www.registrypro.pro';
39
+ $r['regyinfo']['registrar'] = 'RegistryPRO';
40
+ return $r;
41
+ }
42
+ }
43
+ ?>
lib/whois/whois.pt.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ /* TODO:
29
+ - whois - converter para http://domaininfo.com/idn_conversion.asp punnycode antes de efectuar a pesquisa
30
+ - o punnycode deveria fazer parte dos resultados fazer parte dos resultados!
31
+ */
32
+
33
+ if (!defined('__PT_HANDLER__'))
34
+ define('__PT_HANDLER__', 1);
35
+
36
+ require_once('whois.parser.php');
37
+
38
+ class pt_handler
39
+ {
40
+ function parse($data, $query)
41
+ {
42
+ $items = array(
43
+ 'domain.name' => ' / Domain Name:',
44
+ 'domain.created' => 'Data de registo / Creation Date (dd/mm/yyyy):',
45
+ 'domain.nserver.' => 'Nameserver:',
46
+ 'domain.status' => 'Estado / Status:',
47
+ 'owner' => 'Titular / Registrant',
48
+ 'billing' => 'Entidade Gestora / Billing Contact',
49
+ 'admin' => 'Respons�vel Administrativo / Admin Contact',
50
+ 'tech' => 'Respons�vel T�cnico / Tech Contact',
51
+ '#' => 'Nameserver Information'
52
+ );
53
+
54
+ $r['regrinfo'] = get_blocks($data['rawdata'], $items);
55
+
56
+ if (empty($r['regrinfo']['domain']['name']))
57
+ {
58
+ print_r($r['regrinfo']);
59
+ $r['regrinfo']['registered'] = 'no';
60
+ return $r;
61
+ }
62
+
63
+ $r['regrinfo']['domain']['created'] = get_date($r['regrinfo']['domain']['created'], 'dmy');
64
+
65
+ if ($r['regrinfo']['domain']['status'] == 'ACTIVE')
66
+ {
67
+ $r['regrinfo'] = get_contacts($r['regrinfo']);
68
+ $r['regrinfo']['registered'] = 'yes';
69
+ }
70
+ else
71
+ $r['regrinfo']['registered'] = 'no';
72
+
73
+ $r['regyinfo'] = array(
74
+ 'referrer' => 'http://www.fccn.pt',
75
+ 'registrar' => 'FCCN'
76
+ );
77
+
78
+ return $r;
79
+ }
80
+ }
81
+ ?>
lib/whois/whois.ro.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ /*
29
+ BUG
30
+ - date on ro could be given as "mail date" (ex: updated field)
31
+ - multiple person for one role, ex: news.ro
32
+ - seems the only role listed is registrant
33
+ */
34
+
35
+ if (!defined('__RO_HANDLER__'))
36
+ define('__RO_HANDLER__', 1);
37
+
38
+ require_once('whois.parser.php');
39
+
40
+ class ro_handler
41
+ {
42
+ function parse($data_str, $query)
43
+ {
44
+ $translate = array(
45
+ 'fax-no' => 'fax',
46
+ 'e-mail' => 'email',
47
+ 'nic-hdl' => 'handle',
48
+ 'person' => 'name',
49
+ 'address' => 'address.',
50
+ 'domain-name' => '',
51
+ 'updated' => 'changed',
52
+ 'registration-date' => 'created',
53
+ 'domain-status' => 'status',
54
+ 'nameserver' => 'nserver'
55
+ );
56
+
57
+ $contacts = array(
58
+ 'admin-contact' => 'admin',
59
+ 'technical-contact' => 'tech',
60
+ 'zone-contact' => 'zone',
61
+ 'billing-contact' => 'billing'
62
+ );
63
+
64
+ $extra = array(
65
+ 'postal code:' => 'address.pcode'
66
+ );
67
+
68
+ $reg = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain','Ymd');
69
+
70
+ if (isset($reg['domain']['description']))
71
+ {
72
+ $reg['owner'] = get_contact($reg['domain']['description'],$extra);
73
+ unset($reg['domain']['description']);
74
+
75
+ foreach($reg as $key => $item)
76
+ {
77
+ if (isset($item['address']))
78
+ {
79
+ $data = $item['address'];
80
+ unset($reg[$key]['address']);
81
+ $reg[$key] = array_merge($reg[$key],get_contact($data,$extra));
82
+ }
83
+ }
84
+
85
+ $reg['registered'] = 'yes';
86
+ }
87
+ else
88
+ $reg['registered'] = 'no';
89
+
90
+ $r['regrinfo'] = $reg;
91
+ $r['regyinfo'] = array(
92
+ 'referrer' => 'http://www.nic.ro',
93
+ 'registrar' => 'nic.ro'
94
+ );
95
+
96
+ return $r;
97
+ }
98
+ }
99
+ ?>
lib/whois/whois.ru.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__RU_HANDLER__'))
29
+ define('__RU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ru_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain:' => 'domain.name',
39
+ 'state:' => 'domain.status',
40
+ 'nserver:' => 'domain.nserver.',
41
+ 'source:' => 'domain.source',
42
+ 'created:' => 'domain.created',
43
+ 'paid-till:' => 'domain.expires',
44
+ 'type:' => 'owner.type',
45
+ 'org:' => 'owner.organization',
46
+ 'phone:' => 'owner.phone',
47
+ 'fax-no:' => 'owner.fax',
48
+ 'email:' => 'admin.email'
49
+ );
50
+
51
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'dmy');
52
+
53
+ if (empty($r['regrinfo']['domain']['status']))
54
+ $r['regrinfo']['registered'] = 'no';
55
+
56
+ $r['regyinfo'] = array(
57
+ 'referrer' => 'http://www.ripn.net',
58
+ 'registrar' => 'RUCENTER-REG-RIPN'
59
+ );
60
+ return $r;
61
+ }
62
+ }
63
+ ?>
lib/whois/whois.rwhois.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__RWHOIS_HANDLER__'))
29
+ define('__RWHOIS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class rwhois_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'network:Organization-Name:' => 'owner.name',
39
+ 'network:Organization;I:' => 'owner.organization',
40
+ 'network:Organization-City:' => 'owner.address.city',
41
+ 'network:Organization-Zip:' => 'owner.address.pcode',
42
+ 'network:Organization-Country:' => 'owner.address.country',
43
+ 'network:IP-Network-Block:' => 'network.inetnum',
44
+ 'network:IP-Network:' => 'network.inetnum',
45
+ 'network:Network-Name:' => 'network.name',
46
+ 'network:ID:' => 'network.handle',
47
+ 'network:Created:' => 'network.created',
48
+ 'network:Updated:' => 'network.changed',
49
+ 'network:Tech-Contact;I:' => 'tech.email',
50
+ 'network:Admin-Contact;I:' => 'admin.email'
51
+ );
52
+
53
+ $res = generic_parser_b($data_str, $items, 'Ymd', false);
54
+ if (isset($res['disclaimer'])) unset($res['disclaimer']);
55
+ return array( 'regrinfo' => $res );
56
+ }
57
+ }
58
+ ?>
lib/whois/whois.sc.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SC_HANDLER__'))
29
+ define('__SC_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class sc_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, 'dmy');
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.nic.sc',
40
+ 'registrar' => 'VCS (Pty) Limited'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.se.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SE_HANDLER__'))
29
+ define('__SE_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class se_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain' => 'domain.name',
39
+ 'state:' => 'domain.status.',
40
+ 'status:' => 'domain.status.',
41
+ 'expires:' => 'domain.expires',
42
+ 'created:' => 'domain.created',
43
+ 'nserver:' => 'domain.nserver.',
44
+ 'holder:' => 'owner.handle'
45
+ );
46
+
47
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'ymd', false);
48
+
49
+ $r['regrinfo']['registered'] = isset($r['regrinfo']['domain']['name']) ? 'yes' : 'no';
50
+
51
+ $r['regyinfo'] = array(
52
+ 'referrer' => 'http://www.nic-se.se',
53
+ 'registrar' => 'NIC-SE'
54
+ );
55
+ return $r;
56
+ }
57
+ }
58
+ ?>
lib/whois/whois.servers.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ /* servers.whois v18 Markus Welters 2004/06/25 */
29
+ /* servers.whois v17 ross golder 2003/02/09 */
30
+ /* servers.whois v16 mark jeftovic 2001/02/28 */
31
+
32
+ $this->DATA_VERSION = '19';
33
+
34
+ $this->DATA = array(
35
+ 'bz' => 'gtld',
36
+ 'com' => 'gtld',
37
+ 'jobs' => 'gtld',
38
+ 'li' => 'ch',
39
+ 'net' => 'gtld',
40
+ 'tv' => 'gtld',
41
+ 'za.org' => 'zanet',
42
+ 'za.net' => 'zanet'
43
+ );
44
+
45
+ /* Non UTF-8 servers */
46
+
47
+ $this->NON_UTF8 = array(
48
+ 'br.whois-servers.net' => 1,
49
+ 'ca.whois-servers.net' => 1,
50
+ 'cl.whois-servers.net' => 1,
51
+ 'hu.whois-servers.net' => 1,
52
+ 'is.whois-servers.net' => 1,
53
+ 'pt.whois-servers.net' => 1,
54
+ 'whois.interdomain.net' => 1,
55
+ 'whois.lacnic.net' => 1,
56
+ 'whois.nicline.com' => 1,
57
+ 'whois.ripe.net' => 1
58
+ );
59
+
60
+ /* If whois Server needs any parameters, enter it here */
61
+
62
+ $this->WHOIS_PARAM = array(
63
+ 'com.whois-servers.net' => 'domain =$',
64
+ 'net.whois-servers.net' => 'domain =$',
65
+ 'de.whois-servers.net' => '-T dn,ace $',
66
+ 'jp.whois-servers.net' => 'DOM $/e'
67
+ );
68
+
69
+ /* TLD's that have special whois servers or that can only be reached via HTTP */
70
+
71
+ $this->WHOIS_SPECIAL = array(
72
+ 'ad' => '',
73
+ 'ae' => 'whois.aeda.net.ae',
74
+ 'af' => 'whois.nic.af',
75
+ 'ai' => 'http://whois.offshore.ai/cgi-bin/whois.pl?domain-name={domain}.ai',
76
+ 'al' => '',
77
+ 'az' => '',
78
+ 'ba' => '',
79
+ 'bb' => 'http://domains.org.bb/regsearch/getdetails.cfm?DND={domain}.bb',
80
+ 'bg' => 'http://www.register.bg/bg-nic/displaydomain.pl?domain={domain}.bg&search=exist',
81
+ 'bi' => 'whois.nic.bi',
82
+ 'bj' => 'whois.nic.bj',
83
+ 'by' => '',
84
+ 'bz' => 'whois2.afilias-grs.net',
85
+ 'cy' => '',
86
+ 'es' => '',
87
+ 'fj' => 'whois.usp.ac.fj',
88
+ 'fm' => 'http://www.dot.fm/query_whois.cfm?domain={domain}&tld=fm',
89
+ 'jobs' => 'jobswhois.verisign-grs.com',
90
+ 'ke' => 'kenic.or.ke',
91
+ 'la' => 'whois.centralnic.net',
92
+ 'gr' => '',
93
+ 'gs' => 'http://www.adamsnames.tc/whois/?domain={domain}.gs',
94
+ 'gt' => 'http://www.gt/Inscripcion/whois.php?domain={domain}.gt',
95
+ 'me' => 'whois.meregistry.net',
96
+ 'mobi' => 'whois.dotmobiregistry.net',
97
+ 'ms' => 'http://www.adamsnames.tc/whois/?domain={domain}.ms',
98
+ 'mt' => 'http://www.um.edu.mt/cgi-bin/nic/whois?domain={domain}.mt',
99
+ 'nl' => 'whois.domain-registry.nl',
100
+ 'ly' => 'whois.nic.ly',
101
+ 'pe' => 'kero.rcp.net.pe',
102
+ 'pr' => 'whois.uprr.pr',
103
+ 'pro' => 'whois.registry.pro',
104
+ 'sc' => 'whois2.afilias-grs.net',
105
+ 'tc' => 'http://www.adamsnames.tc/whois/?domain={domain}.tc',
106
+ 'tf' => 'http://www.adamsnames.tc/whois/?domain={domain}.tf',
107
+ 've' => 'whois.nic.ve',
108
+ 'vg' => 'http://www.adamsnames.tc/whois/?domain={domain}.vg',
109
+ // Second level
110
+ 'net.au' => 'whois.aunic.net',
111
+ 'ae.com' => 'whois.centralnic.net',
112
+ 'br.com' => 'whois.centralnic.net',
113
+ 'cn.com' => 'whois.centralnic.net',
114
+ 'de.com' => 'whois.centralnic.net',
115
+ 'eu.com' => 'whois.centralnic.net',
116
+ 'hu.com' => 'whois.centralnic.net',
117
+ 'jpn.com'=> 'whois.centralnic.net',
118
+ 'kr.com' => 'whois.centralnic.net',
119
+ 'gb.com' => 'whois.centralnic.net',
120
+ 'no.com' => 'whois.centralnic.net',
121
+ 'qc.com' => 'whois.centralnic.net',
122
+ 'ru.com' => 'whois.centralnic.net',
123
+ 'sa.com' => 'whois.centralnic.net',
124
+ 'se.com' => 'whois.centralnic.net',
125
+ 'za.com' => 'whois.centralnic.net',
126
+ 'uk.com' => 'whois.centralnic.net',
127
+ 'us.com' => 'whois.centralnic.net',
128
+ 'uy.com' => 'whois.centralnic.net',
129
+ 'gb.net' => 'whois.centralnic.net',
130
+ 'se.net' => 'whois.centralnic.net',
131
+ 'uk.net' => 'whois.centralnic.net',
132
+ 'za.net' => 'whois.za.net',
133
+ 'za.org' => 'whois.za.net',
134
+ 'co.za' => 'http://co.za/cgi-bin/whois.sh?Domain={domain}.co.za',
135
+ 'org.za' => 'http://www.org.za/cgi-bin/rwhois?domain={domain}.org.za&format=full'
136
+ );
137
+
138
+ /* handled gTLD whois servers */
139
+
140
+ $this->WHOIS_GTLD_HANDLER = array(
141
+ 'whois.bulkregister.com' => 'enom',
142
+ 'whois.dotregistrar.com' => 'dotster',
143
+ 'whois.namesdirect.com' => 'dotster',
144
+ 'whois.psi-usa.info' => 'psiusa',
145
+ 'whois.www.tv' => 'tvcorp',
146
+ 'whois.tucows.com' => 'opensrs',
147
+ 'whois.35.com' => 'onlinenic',
148
+ 'whois.nominalia.com' => 'genericb',
149
+ 'whois.encirca.com' => 'genericb',
150
+ 'whois.corenic.net' => 'genericb'
151
+ );
152
+
153
+ /* Non ICANN TLD's */
154
+
155
+ $this->WHOIS_NON_ICANN = array (
156
+ 'agent' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
157
+ 'agente' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
158
+ 'america' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
159
+ 'amor' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
160
+ 'amore' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
161
+ 'amour' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
162
+ 'arte' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
163
+ 'artes' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
164
+ 'arts' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
165
+ 'asta' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
166
+ 'auction' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
167
+ 'auktion' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
168
+ 'boutique' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
169
+ 'chat' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
170
+ 'chiesa' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
171
+ 'church' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
172
+ 'cia' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
173
+ 'ciao' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
174
+ 'cie' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
175
+ 'club' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
176
+ 'clube' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
177
+ 'com2' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
178
+ 'deporte' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
179
+ 'ditta' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
180
+ 'earth' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
181
+ 'eglise' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
182
+ 'enchere' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
183
+ 'escola' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
184
+ 'escuela' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
185
+ 'esporte' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
186
+ 'etc' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
187
+ 'famiglia' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
188
+ 'familia' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
189
+ 'familie' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
190
+ 'family' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
191
+ 'free' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
192
+ 'hola' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
193
+ 'game' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
194
+ 'ges' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
195
+ 'gmbh' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
196
+ 'golf' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
197
+ 'gratis' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
198
+ 'gratuit' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
199
+ 'iglesia' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
200
+ 'igreja' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
201
+ 'inc' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
202
+ 'jeu' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
203
+ 'jogo' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
204
+ 'juego' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
205
+ 'kids' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
206
+ 'kirche' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
207
+ 'krunst' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
208
+ 'law' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
209
+ 'legge' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
210
+ 'lei' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
211
+ 'leilao' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
212
+ 'ley' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
213
+ 'liebe' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
214
+ 'lion' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
215
+ 'llc' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
216
+ 'llp' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
217
+ 'loi' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
218
+ 'loja' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
219
+ 'love' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
220
+ 'ltd' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
221
+ 'makler' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
222
+ 'med' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
223
+ 'mp3' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
224
+ 'not' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
225
+ 'online' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
226
+ 'recht' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
227
+ 'reise' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
228
+ 'resto' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
229
+ 'school' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
230
+ 'schule' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
231
+ 'scifi' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
232
+ 'scuola' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
233
+ 'shop' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
234
+ 'soc' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
235
+ 'spiel' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
236
+ 'sport' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
237
+ 'subasta' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
238
+ 'tec' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
239
+ 'tech' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
240
+ 'tienda' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
241
+ 'travel' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
242
+ 'turismo' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
243
+ 'usa' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}',
244
+ 'verein' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
245
+ 'viaje' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
246
+ 'viagem' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
247
+ 'video' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
248
+ 'voyage' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
249
+ 'xxx' => 'http://www.new.net/search_whois.tp?domain={domain}&tld={tld}',
250
+ 'z' => 'http://www.adns.net/whois.php?txtDOMAIN={domain}.{tld}'
251
+ );
252
+ ?>
lib/whois/whois.si.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SI_HANDLER__'))
29
+ define('__SI_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class si_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $translate = array(
38
+ 'nic-hdl' => 'handle',
39
+ 'nameserver' => 'nserver'
40
+ );
41
+
42
+ $contacts = array(
43
+ 'registrant' => 'owner',
44
+ 'tech-c' => 'tech'
45
+ );
46
+
47
+ $r['regrinfo'] = generic_parser_a($data_str['rawdata'], $translate, $contacts, 'domain', 'Ymd');
48
+ $r['regyinfo'] = array(
49
+ 'referrer' => 'http://www.arnes.si',
50
+ 'registrar' => 'ARNES'
51
+ );
52
+ return $r;
53
+ }
54
+ }
55
+ ?>
lib/whois/whois.su.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__SU_HANDLER__'))
29
+ define('__SU_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class su_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain:' => 'domain.name',
39
+ 'state:' => 'domain.status',
40
+ 'person:' => 'owner.name',
41
+ 'phone:' => 'owner.phone',
42
+ 'e-mail:' => 'owner.email',
43
+ 'created:' => 'domain.created',
44
+ 'paid-till:' => 'domain.expires',
45
+ /*
46
+ 'nserver:' => 'domain.nserver.',
47
+ 'source:' => 'domain.source',
48
+ 'type:' => 'owner.type',
49
+ 'org:' => 'owner.organization',
50
+ 'fax-no:' => 'owner.fax',
51
+ */
52
+ );
53
+
54
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'dmy');
55
+
56
+ $r['regyinfo'] = array(
57
+ 'referrer' => 'http://www.ripn.net',
58
+ 'registrar' => 'RUCENTER-REG-RIPN'
59
+ );
60
+ return $r;
61
+ }
62
+ }
63
+ ?>
lib/whois/whois.tel.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__TEL_HANDLER__'))
29
+ define('__TEL_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class tel_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, '-md--y');
38
+ $r['regyinfo'] = array(
39
+ 'referrer' => 'http://www.telnic.org',
40
+ 'registrar' => 'Telnic'
41
+ );
42
+ return $r;
43
+ }
44
+ }
45
+ ?>
lib/whois/whois.travel.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__TRAVEL_HANDLER__'))
29
+ define('__TRAVEL_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class travel_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata']);
38
+ $r['regyinfo']['referrer'] = 'http://www.nic.travel/';
39
+ $r['regyinfo']['registrar'] = 'Tralliance Corporation';
40
+ return $r;
41
+ }
42
+ }
43
+ ?>
lib/whois/whois.uk.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__UK_HANDLER__'))
29
+ define('__UK_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class uk_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'owner.organization' => 'Registrant:',
39
+ 'owner.address' => "Registrant's address:",
40
+ 'owner.type' => 'Registrant type:',
41
+ 'domain.created' => 'Registered on:',
42
+ 'domain.changed' => 'Last updated:',
43
+ 'domain.expires' => 'Renewal date:',
44
+ 'domain.nserver' => 'Name servers:',
45
+ 'domain.sponsor' => 'Registrar:',
46
+ 'domain.status' => 'Registration status:',
47
+ 'domain.dnssec' => 'DNSSEC:',
48
+ '' => 'WHOIS lookup made at',
49
+ 'disclaimer' => '--',
50
+ );
51
+
52
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
53
+
54
+ if (isset($r['regrinfo']['owner']))
55
+ {
56
+ $r['regrinfo']['owner']['organization'] = $r['regrinfo']['owner']['organization'][0];
57
+ $r['regrinfo']['domain']['sponsor'] = $r['regrinfo']['domain']['sponsor'][0];
58
+ $r['regrinfo']['registered'] = 'yes';
59
+
60
+ $r = format_dates($r, 'dmy');
61
+ }
62
+ else
63
+ $r['regrinfo']['registered'] = 'no';
64
+
65
+ $r['regyinfo'] = array(
66
+ 'referrer' => 'http://www.nominet.org.uk',
67
+ 'registrar' => 'Nominet UK'
68
+ );
69
+ return $r;
70
+ }
71
+ }
72
+ ?>
lib/whois/whois.us.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if(!defined('__US_HANDLER__')) define('__US_HANDLER__',1);
29
+
30
+ require_once('whois.parser.php');
31
+
32
+ class us_handler
33
+ {
34
+ function parse ($data_str, $query)
35
+ {
36
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], false, '-md--y');
37
+ $r['regyinfo'] = array(
38
+ 'referrer'=>'http://www.neustar.us',
39
+ 'registrar' => 'NEUSTAR INC.'
40
+ );
41
+ return $r;
42
+ }
43
+ }
44
+ ?>
lib/whois/whois.utils.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ class utils extends Whois {
29
+
30
+ // showObject() and debugObject()
31
+ // - debug code to show an object or array
32
+
33
+ function showObject(&$obj)
34
+ {
35
+ $r = $this->debugObject($obj);
36
+ return "<pre>$r</pre>\n";
37
+ }
38
+
39
+ function debugObject($obj,$indent=0)
40
+ {
41
+ if (is_Array($obj))
42
+ {
43
+ $return = '';
44
+ foreach($obj as $k => $v)
45
+ {
46
+ $return .= str_repeat('&nbsp;',$indent);
47
+ $return .= $k."->$v\n";
48
+ $return .= $this->debugObject($v,$indent+1);
49
+ }
50
+ return $return;
51
+ }
52
+ }
53
+
54
+ function ns_rr_defined($query) {
55
+ return checkdnsrr($query,'NS');
56
+ }
57
+
58
+ // get nice HTML output
59
+
60
+ function showHTML($result, $link_myself=true, $params='query=$0&amp;output=nice') {
61
+
62
+ // adds links fort HTML output
63
+
64
+ $email_regex = "/([-_\w\.]+)(@)([-_\w\.]+)\b/i";
65
+ $html_regex = "/(?:^|\b)((((http|https|ftp):\/\/)|(www\.))([\w\.]+)([,:%#&\/?~=\w+\.-]+))(?:\b|$)/is";
66
+ $ip_regex = "/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/i";
67
+
68
+ $out = '';
69
+ $lempty = true;
70
+
71
+ foreach($result['rawdata'] as $line)
72
+ {
73
+ $line = trim($line);
74
+
75
+ if ($line == '')
76
+ {
77
+ if ($lempty) continue;
78
+ else $lempty = true;
79
+ }
80
+ else
81
+ $lempty = false;
82
+
83
+ $out .= $line."\n";
84
+ }
85
+
86
+ if ($lempty) $out = trim($out);
87
+
88
+ $out = strip_tags($out);
89
+ $out = preg_replace ($email_regex, '<a href="mailto:$0">$0</a>', $out);
90
+ $out = preg_replace_callback ($html_regex, 'href_replace', $out);
91
+
92
+ if ($link_myself)
93
+ {
94
+ if ($params[0] == '/')
95
+ $link = $params;
96
+ else
97
+ $link = $_SERVER['PHP_SELF'].'?'.$params;
98
+
99
+ $out = preg_replace ($ip_regex, '<a href="'.$link.'">$0</a>', $out);
100
+
101
+ if (isset($result['regrinfo']['domain']['nserver']))
102
+ {
103
+ $nserver = $result['regrinfo']['domain']['nserver'];
104
+ }
105
+ else
106
+ $nserver = false;
107
+
108
+ if (isset($result['regrinfo']['network']['nserver']))
109
+ {
110
+ $nserver = $result['regrinfo']['network']['nserver'];
111
+ }
112
+
113
+ if (is_array($nserver))
114
+ {
115
+ reset($nserver);
116
+ while (list($host, $ip) = each($nserver))
117
+ {
118
+ $url = '<a href="'. str_replace('$0',$ip,$link)."\">$host</a>";
119
+ $out = str_replace($host, $url, $out);
120
+ $out = str_replace(strtoupper($host), $url, $out);
121
+ }
122
+ }
123
+ }
124
+
125
+ // Add bold field names
126
+
127
+ $out = preg_replace ("/(?m)^([-\s\.&;'\w\t\(\)\/]+:\s*)/", '<b>$1</b>', $out);
128
+
129
+ // Add italics for disclaimer
130
+
131
+ $out = preg_replace ("/(?m)^(%.*)/", '<i>$0</i>', $out);
132
+
133
+ return str_replace("\n","<br/>\n",$out);
134
+ }
135
+ }
136
+
137
+ function href_replace($matches)
138
+ {
139
+ if (substr($matches[0],0,4)=='www.')
140
+ {
141
+ $web=$matches[0];
142
+ $url='http://'.$web;
143
+ }
144
+ else
145
+ {
146
+ $web=$matches[0];
147
+ $url=$web;
148
+ }
149
+
150
+ return '<a href="'.$url.'" target="_blank">'.$web.'</a>';
151
+ }
152
+ ?>
lib/whois/whois.ve.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26
+ USA.
27
+ */
28
+
29
+ if (!defined('__VE_HANDLER__'))
30
+ define('__VE_HANDLER__', 1);
31
+
32
+ require_once('whois.parser.php');
33
+
34
+ class ve_handler
35
+ {
36
+ function parse($data_str, $query)
37
+ {
38
+ $items = array(
39
+ 'owner' => 'Titular:',
40
+ 'domain.name' => 'Nombre de Dominio:',
41
+ 'admin' => 'Contacto Administrativo',
42
+ 'tech' => 'Contacto Tecnico',
43
+ 'billing' => 'Contacto de Cobranza:',
44
+ 'domain.created' => 'Fecha de Creacion:',
45
+ 'domain.changed' => 'Ultima Actualizacion:',
46
+ 'domain.expires' => 'Fecha de Vencimiento:',
47
+ 'domain.status' => 'Estatus del dominio:',
48
+ 'domain.nserver' => 'Servidor(es) de Nombres de Dominio'
49
+ );
50
+
51
+ $r['regrinfo'] = get_blocks($data_str['rawdata'], $items);
52
+
53
+ if (!isset($r['regrinfo']['domain']['created']) || is_array($r['regrinfo']['domain']['created']))
54
+ {
55
+ $r['regrinfo'] = array ( 'registered' => 'no');
56
+ return $r;
57
+ }
58
+
59
+ $dns = array();
60
+
61
+ foreach($r['regrinfo']['domain']['nserver'] as $nserv)
62
+ {
63
+ if ($nserv[0] == '-') $dns[] = $nserv;
64
+ }
65
+
66
+ $r['regrinfo']['domain']['nserver'] = $dns;
67
+ $r['regrinfo'] = get_contacts($r['regrinfo']);
68
+ $r['regyinfo'] = array(
69
+ 'referrer' => 'http://registro.nic.ve',
70
+ 'registrar' => 'NIC-Venezuela - CNTI'
71
+ );
72
+ return $r;
73
+ }
74
+ }
75
+ ?>
lib/whois/whois.ws.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__WS_HANDLER__'))
29
+ define('__WS_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class ws_handler extends WhoisClient
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'Domain Name:' => 'domain.name',
39
+ 'Registrant Name:' => 'owner.organization',
40
+ 'Registrant Email:' => 'owner.email',
41
+ 'Domain Created:' => 'domain.created',
42
+ 'Domain Last Updated:' => 'domain.changed',
43
+ 'Registrar Name:' => 'domain.sponsor',
44
+ 'Current Nameservers:' => 'domain.nserver.',
45
+ 'Administrative Contact Email:' => 'admin.email',
46
+ 'Administrative Contact Telephone:' => 'admin.phone',
47
+ 'Registrar Whois:' => 'rwhois'
48
+ );
49
+
50
+ $r['regrinfo'] = generic_parser_b($data_str['rawdata'], $items, 'ymd');
51
+
52
+ $r['regyinfo']['referrer'] = 'http://www.samoanic.ws';
53
+ $r['regyinfo']['registrar'] = 'Samoa Nic';
54
+
55
+ if (!empty($r['regrinfo']['domain']['name']))
56
+ {
57
+ $r['regrinfo']['registered'] = 'yes';
58
+
59
+ if (isset($r['regrinfo']['rwhois']))
60
+ {
61
+ if ($this->deep_whois)
62
+ {
63
+ $r['regyinfo']['whois'] = $r['regrinfo']['rwhois'];
64
+ $r = $this->DeepWhois($query,$r);
65
+ }
66
+
67
+ unset($r['regrinfo']['rwhois']);
68
+ }
69
+ }
70
+ else
71
+ $r['regrinfo']['registered'] = 'no';
72
+
73
+ return $r;
74
+ }
75
+ }
76
+ ?>
lib/whois/whois.zanet.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Whois.php PHP classes to conduct whois queries
4
+
5
+ Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic
6
+
7
+ Maintained by David Saez
8
+
9
+ For the most recent version of this package visit:
10
+
11
+ http://www.phpwhois.org
12
+
13
+ This program is free software; you can redistribute it and/or
14
+ modify it under the terms of the GNU General Public License
15
+ as published by the Free Software Foundation; either version 2
16
+ of the License, or (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
+ */
27
+
28
+ if (!defined('__ZANET_HANDLER__'))
29
+ define('__ZANET_HANDLER__', 1);
30
+
31
+ require_once('whois.parser.php');
32
+
33
+ class zanet_handler
34
+ {
35
+ function parse($data_str, $query)
36
+ {
37
+ $items = array(
38
+ 'domain.name' => 'Domain Name : ',
39
+ 'domain.created' => 'Record Created :',
40
+ 'domain.changed' => 'Record Last Updated :',
41
+ 'owner.name' => 'Registered for :',
42
+ 'admin' => 'Administrative Contact :',
43
+ 'tech' => 'Technical Contact :',
44
+ 'domain.nserver' => 'Domain Name Servers listed in order:',
45
+ 'registered' => 'No such domain: ',
46
+ '' => 'The ZA NiC whois'
47
+ );
48
+
49
+ // Arrange contacts ...
50
+
51
+ $rawdata = array();
52
+
53
+ while (list($key, $line) = each($data_str['rawdata']))
54
+ {
55
+ if (strpos($line, ' Contact ') !== false)
56
+ {
57
+ $pos = strpos($line, ':');
58
+
59
+ if ($pos !== false)
60
+ {
61
+ $rawdata[] = substr($line, 0, $pos + 1);
62
+ $rawdata[] = trim(substr($line, $pos + 1));
63
+ continue;
64
+ }
65
+ }
66
+ $rawdata[] = $line;
67
+ }
68
+
69
+ $r['regrinfo'] = get_blocks($rawdata, $items);
70
+
71
+ if (isset($r['regrinfo']['registered']))
72
+ {
73
+ $r['regrinfo']['registered'] = 'no';
74
+ }
75
+ else
76
+ {
77
+ if (isset($r['regrinfo']['admin']))
78
+ $r['regrinfo']['admin'] = get_contact($r['regrinfo']['admin']);
79
+
80
+ if (isset($r['regrinfo']['tech']))
81
+ $r['regrinfo']['tech'] = get_contact($r['regrinfo']['tech']);
82
+ }
83
+
84
+ $r['regyinfo']['referrer'] = 'http://www.za.net/'; // or http://www.za.org
85
+ $r['regyinfo']['registrar'] = 'ZA NiC';
86
+ format_dates($r, 'xmdxxy');
87
+ return $r;
88
+ }
89
+ }
90
+ ?>
license.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright © <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright © <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
logs/wp-security-log-cron-job.txt ADDED
File without changes
logs/wp-security-log.txt ADDED
File without changes
readme.txt ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === All In One WP Security & Firewall ===
2
+ Contributors: Tips and Tricks HQ, wpsolutions, Peter Petreski, Ruhul Amin
3
+ Donate link: http://www.tipsandtricks-hq.com/wordpress-security-and-firewall-plugin
4
+ Tags: security, Anti Virus, antivirus, virus, firewall, secure, login, lockdown, htaccess, hacking, malware, vulnerability, protect, phishing, database, backup, plugin
5
+ Requires at least: 3.5
6
+ Tested up to: 3.6
7
+ Stable tag: 1.0
8
+ License: GPLv3
9
+
10
+ A comprehensive, user-friendly, all in one security and firewall plugin for your WordPress site.
11
+
12
+ == Description ==
13
+ = A COMPREHENSIVE, EASY TO USE AND WELL SUPPORTED WORDPRESS SECURITY PLUGIN =
14
+
15
+ WordPress itself is a very secure platform. However, it helps to add some extra security and firewall to your site by using a security plugin that enforces a lot of good security practices.
16
+
17
+ The All In One WP Security plugin will take your website security to a whole new level.
18
+
19
+ This plugin is designed and written by experts and is easy to use and understand.
20
+
21
+ It offers the latest recommended WordPress security practices and techniques.
22
+
23
+ All In One WP Security also uses an unprecedented security points grading system to measure how well you are protecting your site based on the security features you have activated.
24
+
25
+ Below is a list of the security and firewall features offered in this plugin:
26
+
27
+ = .htaccess and wp-config.php settings =
28
+ * Easily backup your original .htaccess and wp-config.php files in case you will need to use them to restore broken functionality.
29
+ * Modify the contents of the currently active .htaccess or wp-config.php from the admin dashboard with only a few clicks
30
+
31
+ = User Accounts Security =
32
+ * Detect if there is a user account which has the default "admin" username and easily change the username to a value of your choice.
33
+ * The plugin will also detect if you have any WordPress user accounts which have identical login and display names. Having account's where display name is identical to login name is bad security practice because
34
+ you are making it 50% easier for hackers because they already know the login name.
35
+
36
+ = User Login Security =
37
+ * Protect against "Brute Force Login Attack" with the Login Lockdown feature. Users with a certain IP address or range will be locked out of the system for a predetermined amount of time based on the configuration settings and you can also choose to be notified
38
+ via email whenever somebody gets locked out due to too many login attempts.
39
+
40
+ * As the administrator you can view a list of all locked out users which are displayed in an easily readable and navigable table which also allows you to unlock individual or bulk IP addresses at the click of a button.
41
+
42
+ * Force logout of all users after a configurable time period
43
+
44
+ * Monitor/View failed login attempts which show the user's IP address, User ID/Username and Date/Time of the failed login attempt
45
+ * Monitor/View the account activity of all user accounts on your system by keeping track of the username, IP address, login date/time, and logout date/time.
46
+
47
+ = Database Security =
48
+ * Easily the default WP prefix to a value of your choice with the click of a button.
49
+
50
+ * Schedule automatic backups and email notifications or make an instant DB backup whenever you want with one click.
51
+
52
+ = File System Security =
53
+ * Identify files or folders which have permission settings which are not secure and set the permissions to the recommend secure values with click of a button.
54
+ * Protect your PHP code by disabling file editing from the WordPress administration area.
55
+ * Easily view and monitor all host system logs from a single menu page and stay informed of any issues or problems occurring on your server so you can address them quickly.
56
+
57
+ = WhoIs Lookup =
58
+ * Perform a WhoIs lookup of a suspicious host or IP address.
59
+
60
+ = Blacklist Functionality =
61
+ * Ban users by specifying IP addresses or use a wild card to specify IP ranges.
62
+ * Ban users by specifying user agents.
63
+ * Monitor the most active IP addresses which persistently produce the most SPAM comments and instantly block them with the click of a button.
64
+
65
+ = Firewall Functionality =
66
+ * Instantly activate a selection of firewall settings ranging from basic, intermediate and advanced.
67
+ * Enable the famous "5G Blacklist" Firewall rules courtesy of [Perishable Press](http://perishablepress.com/)
68
+ * Forbid proxy comment posting
69
+ * Disable trace and track
70
+ * Deny bad or malicious query strings
71
+ * Protect against Cross Site Scripting (XSS) by activating the comprehensive advanced character string filter.
72
+
73
+ = Other Benefits =
74
+ = Regular updates and additions of new security features =
75
+ * WordPress Security is something that evolves over time. We will be updating the All In One WP Security plugin with new security features (and fixes if required) on a regular basis so you can rest assured that your site will be on the cutting edge of security protection techniques.
76
+ * It should work smoothly with most popular WordPress plugins.
77
+ * Our firewall rules are categorized into "basic", "intermediate" and "advanced". This way you can apply the firewall rules progressively without breaking your site's functionality.
78
+
79
+ = Plugin Support =
80
+ * If you have a question or problem with the All In One Security plugin, post it on the support forum and we will help you.
81
+
82
+ = Translations =
83
+ * All In One WP Security plugin can be translated to any language.
84
+
85
+ == Installation ==
86
+
87
+ To begin making your WordPress site more secure:
88
+
89
+ 1. Upload the 'all-in-one-wp-security.zip' file from the Plugins->Add New page in the WordPress administration panel.
90
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
91
+ 3. Go to Settings menu under 'WP Security' and use the configuration wizard or start configuring the plugin yourself.
92
+
93
+ == Usage ==
94
+
95
+ Go to the settings menu after you activate the plugin and follow the instructions.
96
+
97
+ == Screenshots ==
98
+ None
99
+
100
+ == Frequently Asked Questions ==
101
+ None
102
+
103
+ == Upgrade Notice ==
104
+ None
105
+
106
+ == Changelog ==
107
+
108
+ = 1.0 =
109
+ - First commit to the WP repository.
wp-security-core.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!class_exists('AIO_WP_Security')){
4
+
5
+ class AIO_WP_Security{
6
+ var $version = '1.0';
7
+ var $db_version = '1.2';
8
+ var $plugin_url;
9
+ var $plugin_path;
10
+ var $configs;
11
+ var $admin_init;
12
+ var $debug_logger;
13
+ var $cron_handler;
14
+ var $user_login_obj;
15
+ var $backup_obj;
16
+
17
+ function __construct()
18
+ {
19
+ $this->load_configs();
20
+ $this->define_constants();
21
+ $this->includes();
22
+ $this->loader_operations();
23
+
24
+ add_action('init', array(&$this, 'wp_security_plugin_init'), 0);
25
+ do_action('aiowpsecurity_loaded');
26
+ }
27
+
28
+ function plugin_url()
29
+ {
30
+ if ($this->plugin_url) return $this->plugin_url;
31
+ return $this->plugin_url = plugins_url( basename( plugin_dir_path(__FILE__) ), basename( __FILE__ ) );
32
+ }
33
+
34
+ function plugin_path()
35
+ {
36
+ if ($this->plugin_path) return $this->plugin_path;
37
+ return $this->plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) );
38
+ }
39
+
40
+ function load_configs()
41
+ {
42
+ include_once('classes/wp-security-config.php');
43
+ $this->configs = AIOWPSecurity_Config::get_instance();
44
+ }
45
+
46
+ function define_constants()
47
+ {
48
+ define('AIO_WP_SECURITY_VERSION', $this->version);
49
+ define('AIO_WP_SECURITY_DB_VERSION', $this->db_version);
50
+ define('AIOWPSEC_WP_URL', site_url());
51
+ define('AIO_WP_SECURITY_URL', $this->plugin_url());
52
+ define('AIO_WP_SECURITY_PATH', $this->plugin_path());
53
+ define('AIO_WP_SECURITY_BACKUPS_PATH', AIO_WP_SECURITY_PATH.'/backups');
54
+ define('AIO_WP_SECURITY_LIB_PATH', AIO_WP_SECURITY_PATH.'/lib');
55
+ define('AIOWPSEC_MANAGEMENT_PERMISSION', 'add_users');
56
+ define('AIOWPSEC_MENU_SLUG_PREFIX', 'aiowpsec');
57
+ define('AIOWPSEC_MAIN_MENU_SLUG', 'aiowpsec');
58
+ define('AIOWPSEC_SETTINGS_MENU_SLUG', 'aiowpsec_settings');
59
+ define('AIOWPSEC_USER_ACCOUNTS_MENU_SLUG', 'aiowpsec_useracc');
60
+ define('AIOWPSEC_USER_LOGIN_MENU_SLUG', 'aiowpsec_userlogin');
61
+ define('AIOWPSEC_DB_SEC_MENU_SLUG', 'aiowpsec_database');
62
+ define('AIOWPSEC_FILESYSTEM_MENU_SLUG', 'aiowpsec_filesystem');
63
+ define('AIOWPSEC_WHOIS_MENU_SLUG', 'aiowpsec_whois');
64
+ define('AIOWPSEC_BLACKLIST_MENU_SLUG', 'aiowpsec_blacklist');
65
+ define('AIOWPSEC_FIREWALL_MENU_SLUG', 'aiowpsec_firewall');
66
+
67
+ global $wpdb;
68
+ define('AIOWPSEC_TBL_LOGIN_LOCKDOWN', $wpdb->prefix . 'aiowps_login_lockdown');
69
+ define('AIOWPSEC_TBL_FAILED_LOGINS', $wpdb->prefix . 'aiowps_failed_logins');
70
+ define('AIOWPSEC_TBL_USER_LOGIN_ACTIVITY', $wpdb->prefix . 'aiowps_login_activity');
71
+
72
+ }
73
+
74
+ function includes()
75
+ {
76
+ //Load common files for everywhere
77
+ include_once('classes/wp-security-debug-logger.php');
78
+ include_once('classes/wp-security-utility.php');
79
+ include_once('classes/wp-security-utility-htaccess.php');
80
+ include_once('classes/wp-security-utility-ip-address.php');
81
+ include_once('classes/wp-security-utility-file.php');
82
+
83
+ include_once('classes/wp-security-user-login.php');
84
+ include_once('classes/wp-security-backup.php');
85
+ include_once('classes/wp-security-cronjob-handler.php');
86
+ include_once('classes/grade-system/wp-security-feature-item.php');
87
+ include_once('classes/grade-system/wp-security-feature-item-manager.php');
88
+
89
+ if (is_admin()){ //Load admin side only files
90
+ include_once('classes/wp-security-configure-settings.php');
91
+ include_once('admin/wp-security-admin-init.php');
92
+ include_once('admin/general/wp-security-list-table.php');
93
+
94
+ }
95
+ else{ //Load front end side only files
96
+ }
97
+ }
98
+
99
+ function loader_operations()
100
+ {
101
+ add_action('plugins_loaded',array(&$this, 'plugins_loaded_handler'));//plugins loaded hook
102
+ $this->debug_logger = new AIOWPSecurity_Logger();
103
+ if(is_admin()){
104
+ $this->admin_init = new AIOWPSecurity_Admin_Init();
105
+ }
106
+ }
107
+
108
+ function activate_handler()
109
+ {
110
+ //Only runs when the plugin activates
111
+ include_once ('classes/wp-security-installer.php');
112
+ AIOWPSecurity_Installer::run_installer();
113
+ wp_schedule_event(time(), 'hourly', 'aiowps_hourly_cron_event'); //schedule an hourly cron event
114
+ //wp_schedule_event(time(), 'daily', 'aiowps_daily_cron_event'); //schedule an daily cron event
115
+ }
116
+
117
+ function deactivate_handler()
118
+ {
119
+ //Only runs with the pluign is deactivated
120
+ wp_clear_scheduled_hook('aiowps_hourly_cron_event');
121
+ //wp_clear_scheduled_hook('aiowps_daily_cron_event');
122
+ }
123
+
124
+ function db_upgrade_handler()
125
+ {
126
+ if(is_admin()){//Check if DB needs to be upgraded
127
+ if (get_option('aiowpsec_db_version') != AIO_WP_SECURITY_DB_VERSION) {
128
+ include_once ('classes/wp-security-installer.php');
129
+ AIOWPSecurity_Installer::run_installer();
130
+ }
131
+ }
132
+ }
133
+
134
+ function plugins_loaded_handler()
135
+ {
136
+ //Runs when plugins_loaded action gets fired
137
+ if(is_admin()){
138
+ //Do plugins_loaded operations for admin side
139
+ $this->db_upgrade_handler();
140
+ }
141
+ $this->do_additional_plugins_loaded_tasks();
142
+ }
143
+
144
+ function wp_security_plugin_init()
145
+ {
146
+ //Set up localisation
147
+ load_plugin_textdomain('aiowpsecurity', false, AIO_WP_SECURITY_PATH . "/languages" );
148
+
149
+ //Plugin into code goes here... actions, filters, shortcodes goes here
150
+ $this->user_login_obj = new AIOWPSecurity_User_Login();//Do the user login operation tasks
151
+ $this->backup_obj = new AIOWPSecurity_Backup();//Object to handle backup tasks
152
+ $this->cron_handler = new AIOWPSecurity_Cronjob_Handler();
153
+
154
+ add_action('wp_head',array(&$this, 'aiowps_header_content'));
155
+
156
+ add_action('wp_login', array('AIOWPSecurity_User_Login', 'wp_login_action_handler'), 10, 2);
157
+ do_action('aiowps_force_logout_check');
158
+ $this->do_additional_init_tasks();
159
+
160
+ }
161
+
162
+ function aiowps_header_content()
163
+ {
164
+ //NOP
165
+ }
166
+
167
+ function do_additional_init_tasks()
168
+ {
169
+ //NOP
170
+ }
171
+
172
+ function do_additional_plugins_loaded_tasks()
173
+ {
174
+ if(isset($_GET['aiowpsec_do_log_out']))
175
+ {
176
+ wp_logout();
177
+ if(isset($_GET['after_logout']))//Redirect to the after logout url directly
178
+ {
179
+ $after_logout_url = esc_url($_GET['after_logout']);
180
+ AIOWPSecurity_Utility::redirect_to_url($after_logout_url);
181
+ }
182
+ if(isset($_GET['al_additional_data']))//Inspect the payload and do redirect to login page with a msg and redirect url
183
+ {
184
+ $payload = strip_tags($_GET['al_additional_data']);
185
+ $decoded_payload = base64_decode($payload);
186
+ parse_str($decoded_payload);
187
+ if(!empty($redirect_to)){
188
+ $login_url = AIOWPSecurity_Utility::add_query_data_to_url(wp_login_url(),'redirect_to',$redirect_to);
189
+ }
190
+ if(!empty($msg)){
191
+ $login_url .= '&'.$msg;
192
+ }
193
+ if(!empty($login_url)){
194
+ AIOWPSecurity_Utility::redirect_to_url($login_url);
195
+ }
196
+ }
197
+ }
198
+ }
199
+
200
+ }//End of class
201
+
202
+ }//End of class not exists check
203
+
204
+ $GLOBALS['aio_wp_security'] = new AIO_WP_Security();
wp-security.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: All In One WP Security
4
+ Version: v1.0.0
5
+ Plugin URI: http://www.tipsandtricks-hq.com/
6
+ Author: Tips and Tricks HQ, Peter, Ruhul Amin
7
+ Author URI: http://www.tipsandtricks-hq.com/
8
+ Description: All round best WordPress security plugin!
9
+ License: GPL2
10
+ */
11
+
12
+ if(!defined('ABSPATH'))exit; //Exit if accessed directly
13
+
14
+ include_once('wp-security-core.php');
15
+ register_activation_hook(__FILE__,array('AIO_WP_Security','activate_handler'));//activation hook
16
+ register_deactivation_hook(__FILE__,array('AIO_WP_Security','deactivate_handler'));//deactivation hook
17
+
18
+ function aiowps_show_plugin_settings_link($links, $file)
19
+ {
20
+ if ($file == plugin_basename(__FILE__)){
21
+ $settings_link = '<a href="admin.php?page=aiowpsec_settings">Settings</a>';
22
+ array_unshift($links, $settings_link);
23
+ }
24
+ return $links;
25
+ }
26
+ add_filter('plugin_action_links', 'aiowps_show_plugin_settings_link', 10, 2 );