inc/toolkit.inc.php
author rejo
Mon, 25 Jun 2007 19:56:50 +0000
changeset 23 4abaed69febd
parent 13 2ff220cfde13
child 29 e1c60f72d494
permissions -rwxr-xr-x
[feladat @ 70] Changed default TTL from 3600 to 86400. Changed max number of records on a single screen from 500 to 50. Added print of version number to footer.
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
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
 * Constants  *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
  *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
23
4abaed69febd [feladat @ 70]
rejo
parents: 13
diff changeset
     8
define(ROWAMOUNT, 50);
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
if (isset($_GET["start"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
   define(ROWSTART, (($_GET["start"] - 1) * ROWAMOUNT));
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
   } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
   define(ROWSTART, 0);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
if (isset($_GET["letter"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
   define(LETTERSTART, $_GET["letter"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
   $_SESSION["letter"] = $_GET["letter"];
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
} elseif(isset($_SESSION["letter"])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
   define(LETTERSTART, $_SESSION["letter"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
} else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
   define(LETTERSTART, "a");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
if(!@include_once("config.inc.php"))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
{
6
9fcac40c1b0e [feladat @ 7]
rejo
parents: 4
diff changeset
    27
	error( _('You have to create a config.inc.php!') );
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
if(is_file( dirname(__FILE__) . '/../install.php'))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
{
6
9fcac40c1b0e [feladat @ 7]
rejo
parents: 4
diff changeset
    32
	error( _('You have to remove install.php before this program will run') );
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
if(is_file( dirname(__FILE__) . '/../migrator.php'))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
{
6
9fcac40c1b0e [feladat @ 7]
rejo
parents: 4
diff changeset
    37
        error( _('You have to remove migrator.php before this program will run') );
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
/* Database connection */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
require_once("database.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
// Generates $db variable to access database.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    44
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    45
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    46
// Array of the available zone types
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    47
$server_types = array("MASTER", "SLAVE", "NATIVE");
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    48
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    49
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    51
 * Includes  *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
 *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    53
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    54
require_once("error.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    55
require_once("auth.inc.php");
3
64525a2eb098 [feladat @ 4]
rejo
parents: 1
diff changeset
    56
require_once("i18n.inc.php");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
require_once("users.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
require_once("dns.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    59
require_once("record.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    62
/*************
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    63
 * Functions *
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    64
 *************/
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    65
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    66
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    67
 * Display the page option: [1] [2] .. [n]
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    68
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    69
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    70
function show_pages($amount,$rowamount,$id='')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    71
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    72
   if ($amount > $rowamount) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    73
      if (!isset($_GET["start"])) $_GET["start"]=1;
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
    74
      echo _('Show page') . "<br>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    75
      for ($i=1;$i<=ceil($amount / $rowamount);$i++) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    76
         if ($_GET["start"] == $i) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    77
            echo "[ <b>".$i."</b> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    78
         } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    79
            echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?start=".$i;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    80
	    if ($id!='') echo "&id=".$id;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
	    echo "\">".$i."</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    82
         }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    83
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    84
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    87
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
 * Display the alphabetic option: [0-9] [a] [b] .. [z]
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    90
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    91
function show_letters($letterstart,$doms)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    92
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    93
   foreach ($doms as $dom) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    94
      if (is_numeric($dom["name"][0])) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    95
         $letter_taken["0"] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    96
      } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    97
         $letter_taken[$dom["name"][0]] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    99
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   100
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
   101
   echo _('Show zones beginning with:') . "<br>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   102
   if ($letterstart == 1) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   103
      echo "[ <b>0-9</b> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   104
   } elseif ($letter_taken["0"] != 1) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   105
      echo "[ 0-9 ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   106
   } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   107
      echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?letter=1\">0-9</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   108
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   109
   
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   110
   foreach (range('a','z') as $letter) {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   111
      if ($letterstart === $letter) {
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
   112
         echo "[ <span class=\"lettertaken\">".$letter."</span> ] ";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   113
      } elseif ($letter_taken[$letter] != 1) {
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
   114
         echo "[ <span class=\"letternotavailble\">".$letter."</span> ] ";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   115
      } else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   116
          echo "[ <a href=\"".$_SERVER["PHP_SELF"]."?letter=".$letter."\">".$letter."</a> ] ";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   117
      }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   118
   }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   119
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   120
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   121
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   122
 * Print a nice useraimed error.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   123
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   124
function error($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   125
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   126
	// General function for printing critical errors.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   127
	if ($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   128
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   129
		include_once("header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   130
	?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
   131
	<p><? echo _('Oops! An error occured!'); ?></p>
2ff220cfde13 [feladat @ 60]
rejo
parents: 6
diff changeset
   132
	<p><? echo nl2br($msg) ?></p>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   133
	<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   134
		include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   135
		die();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   136
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   137
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   138
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   139
		include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   140
		die("No error specified!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   141
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   142
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   143
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   144
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   145
 * Something has been done nicely, display a message and a back button.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   146
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   147
function message($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   148
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   149
    include_once("header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   150
    ?>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   151
    <P><TABLE CLASS="messagetable"><TR><TD CLASS="message"><H2><? echo _('Success!'); ?></H2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   152
    <BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   153
	<FONT STYLE="font-weight: Bold">
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   154
	<P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   155
	<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   156
    if($msg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   157
    {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   158
        echo nl2br($msg);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   159
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   160
    else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   161
    {
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   162
        echo _('Successful!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   163
    }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   164
    ?>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   165
    </P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   166
    <BR>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   167
    <P>
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   168
    <a href="javascript:history.go(-1)">&lt;&lt; <? echo _('back'); ?></a></FONT>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   169
    </P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   170
    </TD></TR></TABLE></P>
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   171
    <?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   172
    include_once("footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   173
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   174
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   175
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   176
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   177
 * Reroute a user to a cleanpage of (if passed) arg
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   178
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   179
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   180
function clean_page($arg='')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   181
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   182
	if (!$arg)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   183
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   184
		header("Location: ".$_SERVER["PHP_SELF"]."?time=".time());
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   185
		exit;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   186
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   187
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   188
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   189
		if (preg_match('!\?!si', $arg))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   190
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   191
			$add = "&time=";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   192
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   193
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   194
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   195
			$add = "?time=";
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   196
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   197
		header("Location: $arg$add".time());
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   198
		exit;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   199
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   200
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   201
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   202
function level($l)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   203
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   204
	if ($_SESSION["level"] >= $l)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   205
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   206
		return 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   207
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   208
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   209
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   210
		return 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   211
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   212
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   213
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   214
function xs($zoneid)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   215
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   216
	global $db;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   217
	if (is_numeric($zoneid) && is_numeric($_SESSION["level"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   218
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   219
		$result = $db->query("SELECT id FROM zones WHERE owner=".$_SESSION["userid"]." AND domain_id=$zoneid");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   220
		$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
   221
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   222
                if ($result->numRows() == 1 || $_SESSION["level"] >= 5)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   223
                {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   224
			$_SESSION[$zoneid."_ispartial"] = 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   225
			return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   226
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   227
		elseif ($result_extra->numRows() == 1)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   228
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   229
			$_SESSION[$zoneid."_ispartial"] = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   230
			return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   231
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   232
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   233
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   234
			return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   235
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   236
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   237
	else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   238
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   239
        	return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   240
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   241
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   242
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   243
function get_status($res)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   244
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   245
	if ($res == '0')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   246
	{
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   247
		return "<FONT CLASS=\"inactive\">" . _('Inactive') . "</FONT>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   248
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   249
	elseif ($res == '1')
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   250
	{
4
55ed92aa7cf5 [feladat @ 5]
rejo
parents: 3
diff changeset
   251
		return "<FONT CLASS=\"active\">" . _('Active') . "</FONT>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   252
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   253
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   254
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   255
function parse_template_value($val, $domain, $webip, $mailip)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   256
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   257
	$val = str_replace('##DOMAIN##', $domain, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   258
	$val = str_replace('##WEBIP##', $webip, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   259
	$val = str_replace('##MAILIP##', $mailip, $val);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   260
	return $val;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   261
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   262
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   263
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   264
/*
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   265
 * Validates an email address.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   266
 * 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
   267
 * and maximum of 4 characters.
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   268
 */
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   269
function is_valid_email($email)
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   270
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   271
	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
   272
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   273
		return false;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   274
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   275
	return true;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   276
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
   277
?>