public static function validarLogin()
 {
     $errores = [];
     if (($err = self::validarEntradaLogin()) !== true) {
         $errores = $err;
     }
     if (!$errores) {
         $conn = Database::getInstance()->getDatabase();
         $ssql = "SELECT * \n\t\t\tfrom usuario inner join persona on (usuario.id = persona.id)\n\t\t\twhere (nick = :nick OR email = :nick) AND habilitado = 1";
         $nick = $_POST['nick'];
         $query = $conn->prepare($ssql);
         $query->bindParam(':nick', $nick);
         $query->execute();
         if ($query->rowCount() == 0) {
             $errores['nick'][] = "Usuario o contraseña incorrectos";
         } else {
             $ssql2 = "SELECT * \n\t\t\t\tFROM usuario inner join persona on (usuario.id = persona.id)\n\t\t\t\tWHERE (nick = :nick OR email = :nick) AND habilitado = 1 AND pass = :passwd";
             $passwd = HelperFunctions::encriptarPasswd($_POST['passwd']);
             $query = $conn->prepare($ssql2);
             $query->bindParam(':nick', $nick);
             $query->bindParam(':passwd', $passwd);
             $query->execute();
             if ($query->rowCount() == 0) {
                 $errores['passwd'][] = "La contraseña introducida es incorrecta";
             }
         }
     }
     return Validaciones::resultado($errores);
 }
 public static function getTemplate($name)
 {
     $filepath = SettingsManager::getInstance()->getThemeDir() . '/' . $name . '.template.php';
     if (file_exists($filepath)) {
         $template = file_get_contents($filepath);
     } else {
         HelperFunctions::addError('Template file not found when trying to parse template: ' . $name);
     }
 }
 function delete($node_id = null, $trans_id = null)
 {
     if (!$node_id) {
         $response = HelperFunctions::create_custom_error_message('node_id');
     } elseif (!$trans_id) {
         $response = HelperFunctions::create_custom_error_message('trans_id');
     } else {
         $path = $this->create_trans_path($node_id, $trans_id);
         $response = $this->client->delete($path);
     }
     return $response;
 }
 /**
  * Get the object of the PermissionManager, specific to the section
  * @return PermissionManager_admin
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         $section = HelperFunctions::getActiveSection();
         if (class_exists('PermissionManager_' . $section)) {
             eval('self::$instance = new PermissionManager_' . $section . '();');
         } else {
             echo 'Unknown Permission Manager';
         }
     }
     return self::$instance;
 }
 public function habilitar($url, $definitivo = false)
 {
     HelperFunctions::comprobarSesion();
     if ($definitivo === "true") {
         ArticuloModel::habilitar($url);
         header("Location: " . URL . "articulo");
     } else {
         $articulo = ArticuloModel::getArticulo($url);
         if (!$articulo) {
             header("Location: " . URL . "articulo");
         }
         $archivos = array("articulo/mostrarArticulo", "articulo/habilitarArticulo");
         $datos = array('titulo' => 'Habilitar Articulo', 'articulo' => $articulo);
         View::renderMulti($archivos, $datos);
     }
 }
 public static function nuevoArticulo($datos)
 {
     $conn = Database::getInstance()->getDatabase();
     $titulo = $datos['titulo'];
     $cuerpo = $datos['cuerpo'];
     $habilitado = $datos['publicar'];
     $url = HelperFunctions::generarUrl($datos['titulo']);
     $fecha = date('Y-m-d H:i:s');
     $ssql = "INSERT INTO articulo (titulo, cuerpo, url, fecha_publicacion, habilitado) \n\t\tvalues (:titulo, :cuerpo, :url, :fecha, :habilitado)";
     $query = $conn->prepare($ssql);
     $query->bindParam(':titulo', $titulo);
     $query->bindParam(':cuerpo', $cuerpo);
     $query->bindParam(':url', $url);
     $query->bindParam(':fecha', $fecha);
     $query->bindParam(':habilitado', $habilitado);
     $query->execute();
 }
 public function __construct()
 {
     $this->defaultLanguage = SettingsManager::getInstance()->getDefaultLanguage();
     // get lang setting from URL param, session or use default
     if (!empty($_GET['lang'])) {
         $this->language = $_GET['lang'];
     } elseif (($ses_lang = SessionManager::getInstance()->getLanguage()) != null) {
         $this->language = $ses_lang;
     } else {
         $this->language = $this->defaultLanguage;
     }
     $txt = array();
     // Parse Main lang file
     eval(self::parseLanguageFile($this->language));
     // Parse Section lang file
     eval(self::parseLanguageFile($this->language, HelperFunctions::getActiveSection()));
     // Parse Page lang file (if exists)
     eval(self::parseLanguageFile($this->language, HelperFunctions::getActiveSection(), HelperFunctions::getActivePage()));
     $this->text = $txt;
 }
Exemple #8
0
 public function showpost($id, $name)
 {
     $id_len = strlen($id);
     $forum_id = substr($id, 0, 1);
     $thread_id = substr($id, 1, $id_len - 1);
     $thread = Thread::find($thread_id);
     $thread->view = $thread->view + 1.25;
     $thread->save();
     $view = ForumViewCount::find($forum_id);
     $view->view = $view->view + 1.25;
     $view->save();
     $seo['page'] = $thread->title;
     $seo['title'] = $thread->title;
     $seo['discription'] = 'discription of this page';
     $seo['forum'] = $forum_id;
     $posts = Post::where('thread_id', $thread_id)->orderBy('status', 'desc')->where('status', '>', 0)->orderBy('created_at', 'asc')->paginate(10);
     $user_id = Session::get('WebUserId');
     $data = array('webuser' => WebUser::find($user_id), 'seo' => $seo, 'thread' => $thread, 'forums' => HelperFunctions::forum_list(), 'posts' => $posts, 'page' => "Forum", 'id' => Session::get('idCok'), 'coin' => Session::get('coinCok'));
     return View::make('template.neon.post')->with($data);
 }
    exit;
}
switch (getDownloadMethod()) {
    case 'file_get_contents':
        $agb = file_get_contents($url);
        break;
    case 'curl':
        $agb = handleCurlDownload($url);
        break;
    default:
        $agb = handleSocketDownload($url);
        break;
}
$matches = array();
preg_match("/<\\!-- content -->.*<\\!-- \\/content -->/s", $agb, $matches);
echo HelperFunctions::convertEncoding($matches[0], 1, 'ISO-8859-15');
function santiyCheck($url)
{
    if (strpos('aaaa' . $url, 'https://documents.sofort.com') == 4) {
        return true;
    }
    return false;
}
function getDownloadMethod()
{
    if (ini_get('allow_url_fopen')) {
        $method = 'file_get_contents';
    } elseif (function_exists('curl_init')) {
        $method = 'curl';
    } else {
        $method = 'socket';
 function remove()
 {
     xtc_db_query("delete from " . HelperFunctions::escapeSql(TABLE_CONFIGURATION) . " where configuration_key LIKE 'MODULE_ORDER_TOTAL_SOFORT_%'");
 }
Exemple #11
0
 function getServerBansIpString($srvid)
 {
     $bans = $this->getServerBans($srvid);
     foreach ($bans as &$ban) {
         $ban->address = HelperFunctions::int2ipAddress($ban->address);
     }
     return $bans;
 }
 public function editarPromocion($id)
 {
     HelperFunctions::comprobarSesion();
     if (!$_POST) {
         $promocion = PromocionModel::getPromocion($id);
         View::render('promocion/editarPromocion', array('titulo' => 'Promocion', 'promocion' => $promocion, 'destino' => 'promocion/editarPromocion/' . $id));
     } else {
         $_POST = HelperFunctions::sanear($_POST);
         $errores = [];
         if (!isset($_POST['descripcion']) || empty($_POST['descripcion'])) {
             $errores['descripcion'] = ['descripcion' => 'El campo es requerido'];
         }
         if (($err = Validaciones::validarUnidades($_POST['unidades'])) !== true) {
             $errores['unidades'] = $err;
         }
         if (($err = Validaciones::validarDecimales($_POST['porcentaje'])) !== true) {
             $errores['porcentaje'] = $err;
         }
         if (($err = Validaciones::validarFecha($_POST['fecha_inicio'])) !== true) {
             $errores['fecha_inicio'] = $err;
         }
         if ($errores) {
             $promocion = PromocionModel::getPromocion($id);
             View::render('promocion/editarPromocion', array('titulo' => 'Promocion', 'promocion' => $promocion, 'destino' => 'promocion/editarPromocion/' . $id, 'errores' => $errores));
         } else {
             PromocionModel::editPromocion($id, $_POST);
             View::render('promocion/promocionEditada', array('titulo' => 'Promocion Guardada'));
         }
     }
 }
/**
 * get link to bottom part of orders.php
 * @return string
 */
function shopGetBottom()
{
    return DIR_FS_CATALOG . 'callback/sofort/ressources/scripts/' . HelperFunctions::getIniValue('shopsystemVersion') . '_ordersBottom.php';
}
Exemple #14
0
 public static function echoMenuEntry($page)
 {
     echo '<li';
     if (HelperFunctions::getActivePage() == $page) {
         echo ' class="active"';
     }
     echo '><a href="./?page=' . $page . '">' . TranslationManager::getText($page) . '</a></li>';
 }
 function getSofortOrderhandlingLink()
 {
     $shopsystemVersion = HelperFunctions::getIniValue('shopsystemVersion');
     if (!$shopsystemVersion) {
         return '';
     }
     $shopsystemVersion = str_replace('..', '', $shopsystemVersion);
     return DIR_FS_CATALOG . 'callback/sofort/ressources/scripts/' . $shopsystemVersion . '_sofortOrderhandling.php';
 }
require_once SettingsManager::getInstance()->getMainDir() . '/classes/Captcha.php';
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'doregister') {
        $_POST['serverid'] = intval($_POST['serverid']);
        if (!isset($_POST['serverid']) || empty($_POST['serverid'])) {
            // no Server specified
            MessageManager::addWarning(tr('register_fail_noserver'));
        } elseif (!isset($_POST['name']) || empty($_POST['name'])) {
            MessageManager::addWarning(tr('register_fail_noNameFound'));
        } elseif (!isset($_POST['password']) || empty($_POST['password']) || !isset($_POST['password2']) || empty($_POST['password2'])) {
            echo tr('register_fail_noPasswordFound');
        } elseif ($_POST['password'] != $_POST['password2']) {
            MessageManager::addWarning(tr('register_fail_passwordMatch'));
        } elseif (SettingsManager::getInstance()->isForceEmail($_POST['serverid']) && empty($_POST['email'])) {
            MessageManager::addWarning(tr('register_fail_noEmail'));
        } elseif (!empty($_POST['email']) && !HelperFunctions::isValidEmail($_POST['email'])) {
            MessageManager::addWarning(tr('register_fail_emailinvalid'));
        } elseif (SettingsManager::getInstance()->isUseCaptcha() && !Captcha::cap_isCorrect($_POST['spamcheck'])) {
            MessageManager::addWarning(tr('register_fail_wrongCaptcha'));
        }
        // Everything ok, check if auth by mail
        if (SettingsManager::getInstance()->isAuthByMail($_POST['serverid'])) {
            // create Auth by mail (send activation mail)
            // Add unactivated account and send mail
            if (ServerInterface::getInstance()->getServer(intval($_POST['serverid'])) != null) {
                // Server does exist
                DBManager::getInstance()->addAwaitingAccount($_POST['serverid'], $_POST['name'], $_POST['password'], $_POST['email']);
                echo tr('register_success_toActivate');
                Logger::log_registration($_POST['name']);
            } else {
                // Server does not exist, add warning
?>
img/usuario.png" alt=""></a>
        <a class="med" href="<?php 
echo URL . 'servicio';
?>
"><img src="<?php 
echo URL;
?>
img/servicio.png" alt=""></a>
        <a href="<?php 
echo URL . 'rss';
?>
"><img src="<?php 
echo URL;
?>
img/rss.png" alt=""></a>
    </header>

    <?php 
HelperFunctions::comprobarSesion();
?>
    <div class="first">
        Actualmente te encuentras identificado como <?php 
echo $_SESSION['usuario']['nick'];
?>
        <a href="<?php 
echo URL . 'acceso/logout';
?>
">Cerrar Sesion</a>
    </div>
Exemple #18
0
 /**
  *
  * @return path to theme without trailing slash (theme/ + themename)
  */
 function getThemePath()
 {
     return 'themes/' . HelperFunctions::getActiveSection() . '/' . $this->theme;
 }
Exemple #19
0
    require_once MUMPHPI_MAINDIR . '/ajax/admin.ajax.php';
    // TODO: this should probably have a check, whether the function exists
    if (is_callable('Ajax_Admin::' . $_GET['ajax'])) {
        eval('Ajax_Admin::' . $_GET['ajax'] . '();');
    }
    MessageManager::echoAll();
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />

	<title><?php 
echo SettingsManager::getInstance()->getSiteTitle() . ' - ' . HelperFunctions::getActivePage();
?>
</title>
	<meta name="description" content="<?php 
echo SettingsManager::getInstance()->getSiteDescription();
?>
" />
	<meta name="keywords" content="<?php 
echo SettingsManager::getInstance()->getSiteKeywords();
?>
" />
	<meta name="generator" content="MumPI by KCode" />
	<meta name="author" content="KCode.de" />

	<?php 
TemplateManager::parseTemplate('HTMLHead');
 public function mostrarProyecto($id)
 {
     HelperFunctions::comprobarSesion();
     $proyecto = ProyectoModel::getProyecto($id);
     $datos = array('titulo' => 'Proyecto', 'proyecto' => $proyecto);
     View::render("proyecto/listarproyecto", $datos);
 }
Exemple #21
0
" method="post">
	<?php 
if (isset($data['errores']['generic'])) {
    HelperFunctions::mostrarErrores($data['errores']['generic']);
}
?>
	<br/>
	<label for="nick">Usuario</label><br/>
	<?php 
if (isset($data['errores']['nick'])) {
    HelperFunctions::mostrarErrores($data['errores']['nick']);
}
?>
	<br/>
	<input type="text" name="nick" value="<?php 
echo isset($_POST['nick']) ? $_POST['nick'] : '';
?>
">
	<br/>
	<label for="nick">Contraseña</label><br/>
	<?php 
if (isset($data['errores']['passwd'])) {
    HelperFunctions::mostrarErrores($data['errores']['passwd']);
}
?>
	<br/>
	<input type="password" name="passwd">
	<br/>
	<input type="submit" value="ENTRAR">
</form>
</div>
	<h1>Información del Cliente</h1>
	<p>
		<label for "nombreCorp">Nombre Corporativo:</label>
		<input type="text" name="nombreCorp" size="50" maxlength="100" value="<?php 
if (isset($_POST['nombreCorp'])) {
    HelperFunctions::mostrarDatos($data['persona'], 'nombreCorp');
} elseif (isset($data['persona']['nombre corporativo'])) {
    HelperFunctions::mostrarDatos($data['persona'], 'nombre corporativo');
}
?>
" required autofocus><br>
		<?php 
if (isset($data['errores']['nombreCorp'])) {
    HelperFunctions::mostrarErrores($data['errores']['nombreCorp']);
}
?>
	</p>

	<p>
		<input type="submit" name="persona" value="<?php 
echo $data['submit'];
?>
">
	</p>
	</form>
</div>
 function remove()
 {
     xtc_db_query("delete from " . HelperFunctions::escapeSql(TABLE_CONFIGURATION) . " where configuration_key LIKE 'MODULE_PAYMENT_SOFORT_SL%'");
     xtc_db_query("delete from " . HelperFunctions::escapeSql(TABLE_CONFIGURATION) . " where configuration_key LIKE 'MODULE_PAYMENT_SOFORT_SOFORTLASTSCHRIFT%'");
     //if this is the last removing of a multipay-paymentmethod --> we also remove all shared keys, that are used by all/most multipay-modules
     parent::remove();
 }
		<?php 
if (isset($data['errores']['fecha_prevista'])) {
    HelperFunctions::mostrarErrores($data['errores']['fecha_prevista']);
}
?>
		<label for="fecha_prevista">Fecha Prevista(YYYY-MM-DD)</label><br/>
		<input type="date" name="fecha_prevista" value="<?php 
if (isset($data['proyecto'])) {
    HelperFunctions::mostrarDatos($data['proyecto'], 'fecha prevista');
}
?>
"><br/>

		<label for="estado">Estado</label><br/>
		<select name="estado">
			<?php 
HelperFunctions::optionList($data['estadolist'], 'descripcion', false, $data['estado_selected']);
?>
		</select><br>
		<input type="submit" value="<?php 
echo $data['submit'];
?>
">
	</form>
	<br/>
	<a href="<?php 
echo URL . 'proyecto';
?>
">Atrás</a>
</div>
Exemple #25
0
 /**
  * @param int $groupID
  * @return array
  */
 public function getAdminGroupServers($groupID)
 {
     $servers = array();
     $fh = fopen($this->filepath_adminGroupServerAssoc, 'r');
     while ($line = fgets($fh)) {
         $line = HelperFunctions::stripNewline($line);
         $assoc = explode(';', $line);
         if (intval($assoc[0]) == $groupID) {
             $servers[] = $assoc[1];
         }
     }
     fclose($fh);
     sort($servers);
     return $servers;
 }
$smarty->assign('TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_TEXT);
$smarty->assign('HOLDER', HelperFunctions::htmlMask($_GET['holder']));
$smarty->assign('HOLDER_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_HOLDER_TEXT);
$smarty->assign('ACCOUNT_NUMBER', HelperFunctions::htmlMask($_GET['account_number']));
$smarty->assign('ACCOUNT_NUMBER_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_ACCOUNT_NUMBER_TEXT);
$smarty->assign('IBAN', HelperFunctions::htmlMask($_GET['iban']));
$smarty->assign('IBAN_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_IBAN_TEXT);
$smarty->assign('BANK_CODE', HelperFunctions::htmlMask($_GET['bank_code']));
$smarty->assign('BANK_CODE_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_BANK_CODE_TEXT);
$smarty->assign('BIC', HelperFunctions::htmlMask($_GET['bic']));
$smarty->assign('BIC_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_BIC_TEXT);
$smarty->assign('AMOUNT', number_format(HelperFunctions::htmlMask($_GET['amount']), 2, ',', '.') . ' &euro;');
$smarty->assign('AMOUNT_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_AMOUNT_TEXT);
$smarty->assign('REASON_1', HelperFunctions::htmlMask($_GET['reason_1']));
$smarty->assign('REASON_1_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_REASON_1_TEXT);
$smarty->assign('REASON_2', HelperFunctions::htmlMask($_GET['reason_2']));
$smarty->assign('REASON_2_TEXT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_REASON_2_TEXT);
$smarty->assign('REASONS_HINT', MODULE_PAYMENT_SOFORT_SV_CHECKOUT_REASON_HINT);
// Google Conversion tracking
if (GOOGLE_CONVERSION == 'true') {
    $smarty->assign('google_tracking', 'false');
    $smarty->assign('tracking_code', '');
}
$smarty->assign('language', $_SESSION['language']);
$smarty->assign('PAYMENT_BLOCK', $payment_block);
$smarty->caching = 0;
$main_content = $smarty->fetch('../callback/sofort/ressources/scripts/checkoutVorkasse.html');
$smarty->assign('language', $_SESSION['language']);
$smarty->assign('main_content', $main_content);
$smarty->caching = 0;
if (!defined(RM)) {
 public function arpa_to_ip_cidr($arpa)
 {
     if (strpos($arpa, "ip6") !== false) {
         return HelperFunctions::arpa_to_ipv6_cidr($arpa);
     } else {
         return HelperFunctions::arpa_to_ipv4_cidr($arpa);
     }
 }
<div id="menu">
	<ul>
<?php 
if (!SessionManager::getInstance()->isAdmin()) {
    ?>
			<li<?php 
    if (HelperFunctions::getActivePage() == 'login') {
        echo ' class="active"';
    }
    ?>
>
				<a href="./?page=login">Login</a>
			</li>
<?php 
} else {
    HelperFunctions::echoMenuEntry('meta');
    HelperFunctions::echoMenuEntry('server');
    if (PermissionManager::getInstance()->serverCanEditAdmins()) {
        HelperFunctions::echoMenuEntry('admins');
    }
    HelperFunctions::echoMenuEntry('logout');
    ?>
		<li style="height:10px; font-size:10px; line-height:10px; margin-top:10px; border-bottom:black;">Back to…</li>
<?php 
}
?>
		<li><a href="../user/">&lt;-- User</a></li>
	</ul>
</div>
?>
"><br/><br/>
		
		<?php 
if (isset($data['errores']['fecha_inicio'])) {
    HelperFunctions::mostrarErrores($data['errores']['fecha_inicio']);
}
?>
		<label for="fecha_inicio">fecha de inicio de la Promocion</label><br/>
		<input type="date" name="fecha_inicio" value="<?php 
if (isset($data['promocion'])) {
    HelperFunctions::mostrarDatos($data['promocion'], 'fecha_inicio');
}
?>
"><br/><br/>
		
		<?php 
if (isset($data['errores']['fecha_fin'])) {
    HelperFunctions::mostrarErrores($data['errores']['fecha_fin']);
}
?>
		<label for="fecha_fin">fecha final de la Promocion</label><br/>
		<input type="date" name="fecha_fin" value="<?php 
if (isset($data['promocion'])) {
    HelperFunctions::mostrarDatos($data['promocion'], 'fecha_fin');
}
?>
"><br/><br/>
		<input type="submit" value="Enviar Promocion">
	</form>
</div>
 public function get_zone($response, $identifier, &$out = null, $details = true, $arpa_expand = true, $include_zone_id = false)
 {
     $arpa = null;
     if (preg_match(VALID_IPV4, $identifier) === 1) {
         $arpa = HelperFunctions::ipv4_to_arpa($identifier);
     } else {
         if (preg_match(VALID_IPV6, $identifier) === 1) {
             $arpa = HelperFunctions::ipv6_to_arpa($identifier);
         }
     }
     if ($arpa !== null && $arpa_expand === true) {
         for ($i = 0; ($ret = HelperFunctions::truncate_arpa($arpa, $i)) !== false; $i++) {
             $response = ZoneFunctions::get_zone($response, $ret, $out, $details, false);
             if ($response->code !== Response::NOTFOUND) {
                 return $response;
             }
         }
         $response->code = Response::NOTFOUND;
         $response->error = sprintf("Could not find a reverse DNS zone for %s", $identifier);
         $response->error_detail = "ARPA_ZONE_NOT_FOUND";
         return $response;
     }
     try {
         $connection = Database::getConnection();
     } catch (PDOException $e) {
         $response->code = Response::INTERNALSERVERERROR;
         $response->error = "Could not connect to PowerDNS server.";
         $response->error_detail = "INTERNAL_SERVER_ERROR";
         return $response;
     }
     $statement = $connection->prepare(sprintf("SELECT z.id as z_id, z.name as z_name, z.master as z_master, z.last_check as z_last_check, z.type as z_type, z.notified_serial as z_notified_serial,\n\t\t\t        r.id as r_id, r.name as r_name, r.type as r_type, r.content as r_content, r.ttl as r_ttl, r.prio as r_prio, r.change_date as r_change_date\n\t\t\t FROM `%s` z\n\t\t\t LEFT JOIN `%s` r ON (z.id = r.domain_id)\n\t\t\t WHERE z.name = :name\n\t\t\t ORDER BY CAST(r_name AS UNSIGNED) ASC,\n\t\t\t r_name ASC,\n\t\t\t r_type DESC,\n\t\t\t r_prio ASC,\n\t\t\t r_content ASC;", PowerDNSConfig::DB_ZONE_TABLE, PowerDNSConfig::DB_RECORD_TABLE));
     if ($statement === false || $statement->execute(array(":name" => $identifier)) === false) {
         $response->code = Response::INTERNALSERVERERROR;
         $response->error = "Could not query PowerDNS server.";
         $response->error_detail = "INTERNAL_SERVER_ERROR";
         return $response;
     }
     $output = array();
     $first = true;
     while (($row = $statement->fetch(PDO::FETCH_ASSOC)) !== false) {
         if ($first) {
             if ($include_zone_id) {
                 $output['z_id'] = $row['z_id'];
             }
             $output['name'] = $row['z_name'];
             $output['type'] = $row['z_type'];
             if (!empty($row['z_master'])) {
                 $output['master'] = $row['z_master'];
             }
             if (!empty($row['z_last_check'])) {
                 $output['last_check'] = $row['z_last_check'];
             }
             if (!empty($row['z_notified_serial'])) {
                 $output['notified_serial'] = $row['z_notified_serial'];
             }
             $first = false;
             if ($details === false) {
                 break;
             }
         }
         if (empty($row['r_name']) && empty($row['r_content'])) {
             break;
         }
         $record = array();
         $record['name'] = $row['r_name'];
         $record['type'] = $row['r_type'];
         $record['content'] = $row['r_content'];
         $record['ttl'] = $row['r_ttl'];
         $record['priority'] = $row['r_prio'];
         if (!empty($row['r_change_date'])) {
             $record['change_date'] = $row['r_change_date'];
         }
         $output['records'][] = $record;
     }
     if (empty($output)) {
         $response->code = Response::NOTFOUND;
         $response->body = array();
         $response->log_message = sprintf("Zone %s was not found.", $identifier);
         $out = array();
     } else {
         if (!isset($output['records'])) {
             $output['records'] = array();
         }
         $response->code = Response::OK;
         $response->body = $output;
         $response->log_message = sprintf("Zone %s with %d records was retrieved.", $identifier, count($output['records']));
         $out = $output;
     }
     return $response;
 }