示例#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;
 }
示例#2
0
文件: index.php 项目: ryzhov/ATS0
foreach ($ma as $mod) {
    if ($mod->required()) {
        foreach ($mod->jsFiles as $file) {
            $link = $head->appendChild($doc->createElement('script'));
            $link->setAttribute('type', 'text/javascript');
            $link->setAttribute('src', $file);
        }
    }
}
# -- Make title of document --
$title = $head->appendChild($doc->createElement('title'));
$title->appendChild($doc->createTextNode(DOMAIN . ' - ' . $ma[$option]->getMenu()));
# -- Make base document structure --
$body->appendChild($doc->importNode($ma['base']->getContent(), true));
# -- Make main menu --
$left = $doc->getElementById('left');
$center = $doc->getElementById('center');
if (isset($left)) {
    foreach ($ma as $op => $mod) {
        $menu = $mod->getMenu();
        if (isset($menu)) {
            $div = $left->appendChild($doc->createElement('div'));
            $div->setAttribute('class', 'menuItem');
            $a = $div->appendChild($doc->createElement('a'));
            $a->setAttribute('href', '?op=' . $op);
            if ($mod->selected()) {
                $a->setAttribute('class', 'selected');
                $content = $mod->getContent();
                if (isset($content)) {
                    $center->nodeValue = null;
                    $center->appendChild($doc->importNode($content, true));
示例#3
0
文件: getPlan.php 项目: 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('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();
示例#4
0
文件: voip.php 项目: 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();
示例#5
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'])) {