<?php
// app/api/accounts/delete

    header("Content-Type:application/json");
    include("../../../settings/dbconn.php");
    include("../../../settings/utils.php");
    
    // parametros obligatorios
    $parmsob = array('lang');
    if (!parametrosValidos($_GET, $parmsob))
        badEnd("400", array("msg"=>"Parametros obligatorios " . implode(", ", $parmsob)));
    
    //Declaramos e inicializamos nuestras variables
    $out = new stdClass();
    $lang = $_GET['lang'];
    
    //Consultamos los terminos y condiciones para retornarlos
    $sql = "SELECT * FROM cmspreferences LIMIT 1";
    if (!$rs=$db->query($sql))
        badEnd("500", array("msg"=>determinateDBError($db)));
            
    $row = $rs->fetch_assoc();
    
    if($lang == "eng"){
        $out->terms = $row['terms_eng'];
    }else{
        $out->terms = $row['terms'];
    }
    
    $out->date = new stdClass();
    $out->date->canonical = date('Y-m-d H:i:s', strtotime($row['datecreated']));
    $out->date->formatted = date('d/m/Y H:i', strtotime($row['datecreated']));
    
    header("HTTP/1.1 200");
    echo (json_encode($out));
    die();
?>
