inc/toolkit.inc.php
author rejo
Tue, 17 Apr 2007 21:18:14 +0000
changeset 5 ebf8868e99f5
parent 4 55ed92aa7cf5
child 6 9fcac40c1b0e
permissions -rwxr-xr-x
[feladat @ 6] - Fixed bug in record.inc.php, search did never give matching domains. - Some modifications to Dutch translation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
session_start();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
// | PowerAdmin                                                         |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
// | Copyright (c) 1997-2002 The PowerAdmin Team                        |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
// | This source file is subject to the license carried by the overal   |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
// | program PowerAdmin as found on http://poweradmin.sf.net            |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
// | The PowerAdmin program falls under the QPL License:                |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
// | http://www.trolltech.com/developer/licensing/qpl.html              |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl>       |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
// |          Sjeemz <sjeemz <AT> sjeemz <DOT> nl>                      |
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
// +--------------------------------------------------------------------+
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
// Filename: toolkit.inc.php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
// Startdate: 26-10-2002
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
// Description: general functions needed on a large variety of locations.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
// Kills the db.inc.php.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
// If you include this file you include the whole 'backend'
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
// $Id: toolkit.inc.php,v 1.13 2003/02/24 01:46:31 azurazu Exp $
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
//
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
 * Constants  *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
  *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
define(ROWAMOUNT, 500);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    32
if (isset($_GET["start"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
   define(ROWSTART, (($_GET["start"] - 1) * ROWAMOUNT));
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
   } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
   define(ROWSTART, 0);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
if (isset($_GET["letter"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
   define(LETTERSTART, $_GET["letter"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
   $_SESSION["letter"] = $_GET["letter"];
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
} elseif(isset($_SESSION["letter"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
   define(LETTERSTART, $_SESSION["letter"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
} else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
   define(LETTERSTART, "a");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    45
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    46
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
if(!@include_once("config.inc.php"))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
	error("You have to create a config.inc.php!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
if(is_file( dirname(__FILE__) . '/../install.php'))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
	error("You have to remove install.php before this program will run");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
if(is_file( dirname(__FILE__) . '/../migrator.php'))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
        error("You have to remove migrator.php before this program will run");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    62
/* Database connection */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
require_once("database.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
// Generates $db variable to access database.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
 * Includes  *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
 *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
require_once("error.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
require_once("auth.inc.php");
3
64525a2eb098 [feladat @ 4]
rejo
parents: 1
diff changeset
    73
require_once("i18n.inc.php");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    74
require_once("users.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    75
require_once("dns.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
require_once("record.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    79
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
 * Functions *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
 *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
 * Display the page option: [1] [2] .. [n]
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    87
function show_pages($amount,$rowamount,$id='')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
   if ($amount > $rowamount) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    90
      if (!isset($_GET["start"])) $_GET["start"]=1;
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
    91
      echo "<br /><br />" . _('Show page') . " ";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    92
      for ($i=1;$i<=ceil($amount / $rowamount);$i++) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    93
         if ($_GET["start"] == $i) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    94
            echo "[ <b>".$i."</b> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    95
         } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    96
            echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?start=".$i;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    97
	    if ($id!='') echo "&id=".$id;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
	    echo "\">".$i."</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    99
         }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   100
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   101
      echo "</small>";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   102
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   103
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   104
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   105
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   106
 * Display the alphabetic option: [0-9] [a] [b] .. [z]
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   107
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   108
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   109
function show_letters($letterstart,$doms)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   110
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   111
   foreach ($doms as $dom) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   112
      if (is_numeric($dom["name"][0])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   113
         $letter_taken["0"] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   114
      } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   115
         $letter_taken[$dom["name"][0]] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   116
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   117
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   118
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   119
   echo _('Show domains beginning with:') . "<br />";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   120
   if ($letterstart == 1) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   121
      echo "[ <b>0-9</b> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   122
   } elseif ($letter_taken["0"] != 1) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   123
      echo "[ 0-9 ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   124
   } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   125
      echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?letter=1\">0-9</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   126
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   127
   
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   128
   foreach (range('a','z') as $letter) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   129
      if ($letterstart === $letter) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   130
         echo "[ <b>".$letter."</b> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   131
      } elseif ($letter_taken[$letter] != 1) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   132
         echo "[ <span style=\"color:#999\">".$letter."</span> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   133
      } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   134
          echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?letter=".$letter."\">".$letter."</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   135
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   136
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   137
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   138
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   139
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   140
 * Print a nice useraimed error.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   141
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   142
function error($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   143
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   144
	// General function for printing critical errors.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   145
	if ($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   146
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   147
		include_once("header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   148
	?>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   149
	<P><TABLE CLASS="error"><TR><TD CLASS="error"><H2><? echo _('Oops! An error occured!'); ?></H2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   150
	<BR>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   151
	<FONT STYLE="font-weight: Bold"><?= nl2br($msg) ?><BR><BR><a href="javascript:history.go(-1)">&lt;&lt; <? echo _('back'); ?></a></FONT><BR></TD></TR></TABLE></P>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   152
	<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   153
		include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   154
		die();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   155
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   156
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   157
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   158
		include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   159
		die("No error specified!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   160
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   161
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   162
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   163
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   164
 * Something has been done nicely, display a message and a back button.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   165
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   166
function message($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   167
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   168
    include_once("header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   169
    ?>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   170
    <P><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><? echo _('Success!'); ?></H2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   171
    <BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   172
	<FONT STYLE="font-weight: Bold">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   173
	<P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   174
	<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   175
    if($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   176
    {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   177
        echo nl2br($msg);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   178
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   179
    else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   180
    {
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   181
        echo _('Successful!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   182
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   183
    ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   184
    </P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   185
    <BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   186
    <P>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   187
    <a href="javascript:history.go(-1)">&lt;&lt; <? echo _('back'); ?></a></FONT>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   188
    </P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   189
    </TD></TR></TABLE></P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   190
    <?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   191
    include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   192
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   193
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   194
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   195
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   196
 * Reroute a user to a cleanpage of (if passed) arg
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   197
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   198
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   199
function clean_page($arg='')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   200
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   201
	if (!$arg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   202
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   203
		header("Location: ".$_SERVER["PHP_SELF"]."?time=".time());
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   204
		exit;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   205
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   206
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   207
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   208
		if (preg_match('!\?!si', $arg))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   209
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   210
			$add = "&time=";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   211
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   212
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   213
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   214
			$add = "?time=";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   215
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   216
		header("Location: $arg$add".time());
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   217
		exit;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   218
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   219
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   220
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   221
function level($l)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   222
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   223
	if ($_SESSION["level"] >= $l)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   224
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   225
		return 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   226
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   227
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   228
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   229
		return 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   230
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   231
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   232
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   233
function xs($zoneid)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   234
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   235
	global $db;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   236
	if (is_numeric($zoneid) && is_numeric($_SESSION["level"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   237
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   238
		$result = $db->query("SELECT id FROM zones WHERE owner=".$_SESSION["userid"]." AND domain_id=$zoneid");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   239
		$result_extra = $db->query("SELECT record_owners.id FROM record_owners,records WHERE record_owners.user_id=".$_SESSION["userid"]." AND records.domain_id = $zoneid AND records.id = record_owners.record_id LIMIT 1");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   240
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   241
                if ($result->numRows() == 1 || $_SESSION["level"] >= 5)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   242
                {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   243
			$_SESSION[$zoneid."_ispartial"] = 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   244
			return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   245
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   246
		elseif ($result_extra->numRows() == 1)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   247
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   248
			$_SESSION[$zoneid."_ispartial"] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   249
			return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   250
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   251
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   252
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   253
			return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   254
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   255
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   256
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   257
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   258
        	return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   259
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   260
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   261
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   262
function get_status($res)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   263
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   264
	if ($res == '0')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   265
	{
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   266
		return "<FONT CLASS=\"inactive\">" . _('Inactive') . "</FONT>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   267
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   268
	elseif ($res == '1')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   269
	{
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   270
		return "<FONT CLASS=\"active\">" . _('Active') . "</FONT>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   271
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   272
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   273
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   274
function parse_template_value($val, $domain, $webip, $mailip)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   275
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   276
	$val = str_replace('##DOMAIN##', $domain, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   277
	$val = str_replace('##WEBIP##', $webip, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   278
	$val = str_replace('##MAILIP##', $mailip, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   279
	return $val;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   280
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   281
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   282
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   283
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   284
 * Validates an email address.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   285
 * Checks if there is something before the at '@' sign and its followed by a domain and a tld of minimum 2
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   286
 * and maximum of 4 characters.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   287
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   288
function is_valid_email($email)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   289
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   290
	if(!eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.([a-z]{2,6}$)", $email))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   291
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   292
		return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   293
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   294
	return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   295
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   296
?>