Exemplo n.º 1
0
 public function getContent()
 {
     $doc = new DOMDoc('1.0', 'UTF-8');
     $doc->load($this->folder . '/content.xml');
     if ($doc === FALSE) {
         trigger_error('unable load: ' . $this->folder . '/content.xml', E_USER_ERROR);
         throw new Exception('unable load: ' . $this->folder . '/content.xml');
     }
     $copy_year = $doc->getElementById('copy_year');
     $copy_year->nodeValue = Date::request_ts('Y');
     $bottom_link = $doc->getElementById('bottom_link');
     $bottom_link->setAttribute('href', '/');
     $bottom_link->nodeValue = DOMAIN;
     $ss = Session::getInstance();
     $username = $doc->getElementById('username');
     $username->nodeValue = $ss->user->attr['username'];
     return $doc->documentElement;
 }
Exemplo n.º 2
0
 public function getContent()
 {
     $doc = new DOMDoc('1.0', 'UTF-8');
     $file = $this->folder . '/content.xml';
     if (is_readable($file) && is_file($file)) {
         $doc->load($file);
     } else {
         $doc = FALSE;
     }
     if ($doc === FALSE) {
         $doc = null;
     } else {
         $doc = $doc->documentElement;
     }
     return $doc;
 }
Exemplo n.º 3
0
require_once './config.php';
require_once CLASS_PATH . '/Date.php';
require_once CLASS_PATH . '/Session.php';
require_once CLASS_PATH . '/DOMDoc.php';
require_once CLASS_PATH . '/BaseModule.php';
require_once CLASS_PATH . '/CompanyModule.php';
require_once CLASS_PATH . '/ServiceModule.php';
require_once CLASS_PATH . '/ConnectModule.php';
require_once CLASS_PATH . '/BillModule.php';
require_once CLASS_PATH . '/ContactModule.php';
$ss = Session::getInstance();
Date::init();
$doc = new DOMDoc('1.0', 'UTF-8');
$doc->formatOutput = true;
$doc->preserveWhiteSpace = true;
$doc->load('template.xml');
$head = $doc->getElementsByTagName('head')->item(0);
$body = $doc->getElementsByTagName('body')->item(0);
$ma = array('base' => new BaseModule('./base'), 'company' => new CompanyModule('./company'), 'service' => new ServiceModule('./service'), 'connect' => new ConnectModule('./connect'), 'bill' => new BillModule('./bill'), 'contact' => new ContactModule('./contact'));
# -- make module selection accordinly to user option --
if (isset($_GET['op']) && isset($ma[$_GET['op']])) {
    $option = $_GET['op'];
} else {
    $option = 'company';
}
$ma[$option]->select();
# -- Include CSS files into $doc from required modules --
foreach ($ma as $mod) {
    if ($mod->required()) {
        foreach ($mod->cssFiles as $file) {
            $link = $head->appendChild($doc->createElement('link'));
Exemplo n.º 4
0
<?php

require_once '../config.php';
require_once CLASS_PATH . '/Session.php';
require_once CLASS_PATH . '/DOMDoc.php';
$ss = Session::getInstance();
$doc = new DOMDoc('1.0', 'UTF-8');
$doc->load('plan_attr.html');
# -- init params --
$plan_id = isset($_GET['plan_id']) ? $_GET['plan_id'] : null;
$phone = isset($_GET['phone']) ? $_GET['phone'] : null;
if (isset($plan_id) and isset($phone)) {
    if ($ss->user->isPlanAuth($plan_id)) {
        $q = "SELECT (getcost).dir, (getcost).dir_name, (getcost).cost  from (SELECT getcost({$plan_id},'{$phone}')) r";
        $row = DB::select($q);
        if (isset($row[0])) {
            $row = $row[0];
            $plan_attr_dir = $doc->getElementById('plan_attr_dir');
            $plan_attr_dir->nodeValue = $row['dir'] . " " . $row['dir_name'];
            $plan_attr_cost = $doc->getElementById('plan_attr_cost');
            $plan_attr_cost->nodeValue = $row['cost'];
        }
    }
}
echo $doc->saveHTML();
Exemplo n.º 5
0
Arquivo: voip.php Projeto: ryzhov/ATS0
<?php

require_once '../config.php';
require_once CLASS_PATH . '/Session.php';
require_once CLASS_PATH . '/DOMDoc.php';
$ss = Session::getInstance();
$doc = new DOMDoc('1.0', 'UTF-8');
$doc->load('voip.html');
$planList = $doc->getElementById('PlanList');
foreach ($ss->user->plan as $plan) {
    $option = $planList->appendChild($doc->createElement('option'));
    $option->setAttribute('value', $plan['plan_id']);
    $option->nodeValue = $plan['name'];
}
echo $doc->saveHTML();
Exemplo n.º 6
0
<?php

require_once '../config.php';
require_once CLASS_PATH . '/Session.php';
require_once CLASS_PATH . '/DOMDoc.php';
$ss = Session::getInstance();
$doc = new DOMDoc('1.0', 'UTF-8');
$doc->load('response.html');
# -- init params --
$username = isset($_POST['username']) ? $_POST['username'] : null;
$content = isset($_POST['content']) ? $_POST['content'] : null;
$phone = isset($_POST['phone']) ? $_POST['phone'] : null;
$sender_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
$order_response = $doc->getElementById('order_response');
try {
    if (!isset($username)) {
        throw new Exception('Название организации или Имя частного лица не указано!');
    }
    if (!isset($content)) {
        throw new Exception('Заявка не заполнена!');
    }
    if (!isset($phone)) {
        throw new Exception('Контактный телефон не указан!');
    }
    if (!isset($sender_ip)) {
        throw new Exception('IP-адрес отправителя не определен');
    }
    $q = "INSERT INTO orders(sender_ip,username,content,phone)";
    $q .= " VALUES('{$sender_ip}','{$username}','{$content}','{$phone}') RETURNING id, start_ts";
    $row = DB::select($q);
    if (isset($row[0]) and isset($row[0]['id'])) {