Beispiel #1
0
 function Show()
 {
     global $limit;
     $this->Init();
     $this->AddStrings($ret);
     $offset = (int) get('offset');
     $limit = (int) get('limit', $this->Param('limit', $limit));
     $count = sql_getValue("SELECT COUNT(*) FROM " . STAT_SESSIONS_TABLE . " WHERE robot=0 AND time_last>" . (time() - STAT_SESS_TIME * 60));
     $data = sql_getRows("SELECT ip, 'count_pages', path, time, time_last FROM " . STAT_SESSIONS_TABLE . " WHERE robot=0 AND time_last>" . (time() - STAT_SESS_TIME * 60) . " ORDER BY time_last DESC LIMIT " . $offset . ", " . $limit);
     // Построить массив для всех страниц ($this->path)
     if ($data) {
         $pages_id = array();
         foreach ($data as $row) {
             $pages_id = array_merge($pages_id, explode(' ', trim($row['path'])));
         }
         $pages_id = array_unique($pages_id);
         $this->path_pages = sql_getRows("SELECT id, CONCAT(host, uri) AS page FROM " . STAT_PAGES_TABLE . " WHERE id IN (" . join(', ', $pages_id) . ")", true);
         $this->path_keys = array_flip(array_keys($this->path_pages));
         foreach ($this->path_pages as $page_id => $href) {
             $ret['pathes']['row'][] = array('key' => $this->path_keys[$page_id] + 1, 'href' => $href);
         }
     }
     // Main Table
     $columns = array(array('header' => 'ip', 'nowrap' => '1', 'type' => 'ip'), array('header' => 'pages', 'align' => 'right', 'type' => 'pages'), array('header' => 'pathes', 'type' => 'path'), array('header' => 'time', 'align' => 'right', 'type' => 'time'), array('header' => 'last', 'align' => 'right', 'type' => 'last'));
     if (isset($GLOBALS['_stat']['stat/stat_banlist'])) {
         $columns[] = array('header' => 'ban', 'type' => 'ban', 'align' => 'center');
     }
     $ret['table'] = $this->stat_table(array('columns' => $columns, 'data' => $data, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
     $ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
     return Parse($ret, 'stat/stat.no_navig.tmpl');
 }
Beispiel #2
0
 function getContent()
 {
     $data = array();
     $func = get('func', '', 'pg');
     if (!empty($func)) {
         $func = get('func', '', 'pg');
         if (!empty($func)) {
             $data = $this->{$func}();
         }
     } else {
         global $user;
         $data['current_user'] = $user['id'];
         $data['managers'] = sql_getRows("SELECT id, CONCAT(login,' (',email,') ') as name FROM admins", true);
         $this->AddStrings($data);
         include_fckeditor();
         $oFCKeditor = new FCKeditor();
         $oFCKeditor->ToolbarSet = 'Common';
         $oFCKeditor->Value = '';
         $data['editor'] = $oFCKeditor->ReturnFCKeditor('fld[html]', '100%', '100%');
         $this->AddStrings($data);
     }
     $tpl = strtolower($this->dir . '/' . $this->name . (!empty($func) ? '.' . $func : '') . '.tmpl');
     if (is_file($tpl)) {
         return Parse($data, $tpl);
     } else {
         return $data;
     }
 }
Beispiel #3
0
 function Show()
 {
     // обязательная фигня
     if (!empty($GLOBALS['_POST'])) {
         $actions = get('actions', '', 'p');
         if ($actions) {
             return $this->{$actions}();
         }
     }
     global $settings;
     $types = array();
     foreach ($settings['subscribe_categories'] as $key => $val) {
         if (isset($val['sub'])) {
             foreach ($val['sub'] as $k => $v) {
                 $types[$v['type']] = $v['title'];
             }
         }
     }
     require_once core('ajax_table');
     $data['table'] = ajax_table(array('columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox', 'width' => '1px'), array('select' => 'email', 'display' => 'email', 'flags' => FLAG_SORT | FLAG_SEARCH), array('select' => 'type', 'display' => 'type', 'type' => 'type', 'flags' => FLAG_SORT | FLAG_FILTER, 'filter_display' => 'type', 'filter_type' => 'array', 'filter_value' => array('' => '-- Все --') + $types, 'filter_field' => 'type')), 'from' => $this->table, 'where' => 'root_id=' . domainRootId(), 'params' => array('page' => $this->name, 'do' => 'show'), 'click' => 'ID=cb.value'), $this);
     $this->AddStrings($data);
     $data['thisname'] = $this->name;
     $data['thisname2'] = str_replace('/', '', $this->name);
     return Parse($data, "notify/tmpls/properties.tmpl");
 }
Beispiel #4
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($ret);
     $this->show = 'csv';
     $ret = @call_user_func(array(&$this, 'Get' . $this->show));
     $ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
     return Parse($ret, 'stat/stat.tmpl');
 }
Beispiel #5
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($ret);
     if ($this->show != 'csv') {
         $this->show = 'table';
     }
     $ret = @call_user_func(array(&$this, 'Get' . $this->show));
     return Parse($ret, 'stat/stat.tmpl');
 }
Beispiel #6
0
 function Show()
 {
     $ret['field_name'] = get('name', '');
     $ret['sid'] = 0;
     $this->sid = 0;
     $this->AddStrings($ret);
     $ret['tree'] = $this->GetTree();
     $ret['STR_LOADING'] = $this->str('loading');
     return Parse($ret, $this->name . '/tree.node_id.tmpl');
 }
function OnReadData($proxies, $idx, $r, $header, $body)
{
    //file_put_contents("0_" . $idx . ".html", $body);
    //global $proxies;
    print_r("OnReadData {$idx} : {$r}\n");
    $r = Parse($body);
    foreach ($r as $proxy) {
        $proxies[] = $proxy;
    }
}
Beispiel #8
0
 function ShowRecycle()
 {
     global $limit;
     $limit = -1;
     require_once core('ajax_table');
     $columns = sql_getRows('SHOW columns FROM ' . $this->table, 'Field');
     $name = isset($columns['name']) ? 'name' : 'address';
     $this->AddStrings($row);
     $row['table'] = ajax_table(array('columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => $name, 'display' => 'name')), 'where' => 'visible<0 and obj_type_id="room"', 'orderby' => 'address', 'params' => array('page' => $this->name, 'do' => 'Show')), $this);
     return Parse($row, 'recycle.tmpl');
 }
Beispiel #9
0
 function Show()
 {
     $row = array();
     $row['analyze']['from'] = sql_getValue("SELECT MIN(time) FROM " . STAT_LOG_TABLE);
     $row['analyze']['to'] = sql_getValue("SELECT MAX(time) FROM " . STAT_LOG_TABLE);
     $row['process']['from'] = sql_getValue("SELECT MIN(time) FROM " . STAT_TEMP_TABLE);
     $row['process']['to'] = sql_getValue("SELECT MAX(time) FROM " . STAT_TEMP_TABLE);
     $row['total'] = sql_getValue("SELECT COUNT(*) FROM " . STAT_TEMP_TABLE);
     $this->AddStrings($row);
     return Parse($row, 'stat/stat_process/stat.process.tmpl');
 }
Beispiel #10
0
 function Show()
 {
     $id = (int) get('id');
     $ret = array();
     $this->AddStrings($ret);
     $ret['path'] = $this->GetPath($id);
     $ret['tree'] = $this->GetAllTree(array('id' => $id, 'checkboxtree' => true));
     $ret['name'] = $this->name;
     $ret['fieldname'] = get("fieldname", '', 'gp');
     $ret['target_ids'] = get("target_ids", '', 'gp');
     return Parse($ret, 'tree/treecheck/treecheck.tmpl');
 }
Beispiel #11
0
 function Show()
 {
     $id = (int) get('id');
     $ret = array();
     $this->AddStrings($ret);
     $ret['path'] = $this->GetPath($id);
     $ret['treeurl'] = $this->GetAllTree(array('id' => $id, 'treeurl' => true));
     $ret['fld'] = $this->getQuoteJqueryString(get('fieldname'));
     $ret['name'] = $this->name;
     $ret['id'] = $id;
     return Parse($ret, 'tree/treeurl/treeurl.tmpl');
 }
Beispiel #12
0
function scan()
{
    if (system_is_overloaded(basename(__FILE__))) {
        apache_admin_mysql(0, "Overloaded system, retry next time....", null, __FILE__, __LINE__);
        return;
    }
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        events("A process, {$pid} Already exists...");
        return;
    }
    $GLOBALS["MYHOSTNAME_PROXY"] = $unix->hostname_g();
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if (!$GLOBALS["VERBOSE"]) {
        if ($time < 5) {
            events("{$time}mn, require minimal 5mn");
            return;
        }
    }
    $q = new mysql_squid_builder();
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `dashboard_apache_sizes` ( `TIME` DATETIME,\n\t\t\t`zmd5` VARCHAR(90) NOT NULL PRIMARY KEY,\n\t\t\t`SITENAME` VARCHAR(128),\n\t\t\t`SIZE` BIGINT UNSIGNED, `RQS` BIGINT UNSIGNED,\n\t\t\tKEY `TIME` (`TIME`),\n\t\t\tKEY `SIZE` (`SIZE`),\n\t\t\tKEY `RQS` (`RQS`)\n\t\t\t) ENGINE=MYISAM;");
    if (!$q->ok) {
        apache_admin_mysql(0, "Fatal MySQL error", $q->mysql_error, __FILE__, __LINE__);
        return;
    }
    if (!is_file("/home/apache/artica-stats/requests.log")) {
        echo "/home/apache/artica-stats/requests.log no such file...\n";
        return;
    }
    @mkdir("/home/apache/artica-stats/works", 0755, true);
    if (is_file("/home/apache/artica-stats/works/apache.log")) {
        echo "Parse /home/apache/artica-stats/works/apache.log\n";
        Parse("/home/apache/artica-stats/works/apache.log");
        return;
    }
    if (!@copy("/home/apache/artica-stats/requests.log", "/home/apache/artica-stats/works/apache.log")) {
        echo "Copy failed\n";
        return;
    }
    if (!is_file("/home/apache/artica-stats/works/apache.log")) {
        echo "/home/apache/artica-stats/works/apache.log no such file...\n";
        return;
    }
    @unlink("/home/apache/artica-stats/requests.log");
    echo "Parse /home/apache/artica-stats/works/apache.log\n";
    Parse("/home/apache/artica-stats/works/apache.log");
    CLEAN_MYSQL();
}
Beispiel #13
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($ret);
     if ($this->show != 'diag' && $this->show != 'csv') {
         $this->show = 'table';
     }
     $ret = @call_user_func(array(&$this, 'Get' . $this->show));
     /*		$ret['navig'] = $this->NavigForm(array(
     			'hidden'	=> array('show' => $this->show),
     		));
             if ($this->show == 'table') $ret['show_search'] = 1;*/
     return Parse($ret, 'stat/stat.tmpl');
 }
Beispiel #14
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($ret);
     $this->data['before'] = $this->GetStats();
     $period = get('period', 'none', 'p');
     if ($period == '1d' or $period == '7d' or $period == '1m' or $period == '3m' or $period == '6m' or $period == '1y') {
         $ret['message'] = $this->DoClear($period);
     }
     $ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
     $ret['options'] = array('values' => array('1d', '7d', '1m', '3m', '6m', '1y'), 'names' => array($this->str('1d'), $this->str('7d'), $this->str('1m'), $this->str('3m'), $this->str('6m'), $this->str('1y')), 'selected' => $period);
     $ret['data'] = $this->data;
     return Parse($ret, 'stat/stat_clear/stat.clear.tmpl');
 }
Beispiel #15
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($ret);
     if ($this->show != 'diag' && $this->show != 'csv') {
         $this->show = 'table';
     }
     $ret = @call_user_func(array(&$this, 'Get' . $this->show));
     $ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
     $ret['site_select'] = $this->selectSite(array('hidden' => array('show' => $this->show)));
     $ret['analyze_page'] = 'http://';
     if ($this->show == 'table') {
         $ret['show_search'] = 1;
     }
     return Parse($ret, 'stat/stat.tmpl');
 }
Beispiel #16
0
 function Show()
 {
     $this->Init();
     $this->AddStrings($data);
     // Вспомогательные данные
     $this->today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
     $diff = time() - sql_getValue("SELECT MIN(time) FROM " . STAT_SESSIONS_TABLE);
     $this->all_monthes = 12 * (date('Y', $diff) - 1970) + date('n', $diff);
     // Количество посетителей (%s - нужно чтобы туда вставить выборку по времени)
     $stat[] = $this->GetSummaryRow('<a href="?page=stat/stat_attendance&period=0&disp_by=hour">' . $this->str('visitors') . '</a>', "SELECT COUNT(*) FROM " . $this->sess_table . " WHERE %s robot='0'");
     // Количество зарегистированных клиентов на сайте
     /*		if(STAT_CLIENT_REPORT)
     		$stat[] = $this->GetSummaryRow(
     			'<a href="?page=stat/stat_clients&period=0">'.$this->str('reg_clients').'</a>',
     			"SELECT COUNT(*) FROM ".$this->sess_table." WHERE %s robot='0' AND client_id!=0"
     		);*/
     if (STAT_CLIENT_REPORT) {
         $stat[] = $this->GetRobotsRow('<a href="?page=stat/stat_clients&period=0">' . $this->str('reg_clients') . '</a>', "SELECT CONCAT(COUNT(*), ' (', COUNT(DISTINCT(client_id)), ')') FROM " . $this->sess_table . " WHERE %s robot='0' AND client_id!=0");
     }
     // Количество просмотренных страниц
     $stat[] = $this->GetSummaryRow('<a href="?page=stat/stat_popular&period=0">' . $this->str('pages') . '</a>', "SELECT SUM(loads) FROM " . $this->sess_table . " WHERE %s robot='0'");
     // Количество новых посетителей
     $stat[] = $this->GetSummaryRow('<a href="?page=stat/stat_attendance&period=0&disp_by=hour">' . $this->str('new_visitors') . '</a>', "SELECT COUNT(*) FROM " . $this->sess_table . " WHERE %s robot='0' AND new_visitor='1'");
     // Количество ip-адресов
     $stat[] = $this->GetSummaryRow('<a href="?page=stat/stat_ip&period=0">' . $this->str('ips') . '</a>', "SELECT COUNT(DISTINCT(ip)) FROM " . $this->sess_table . " WHERE %s robot='0'");
     // Количество ошибочных страниц
     $stat[] = $this->GetSummaryRow('<a href="?page=stat/stat_errors&period=0">' . $this->str('errors') . '</a>', "SELECT COUNT(*) FROM " . $this->log_table . " WHERE %s status IN (404, 403)");
     // Количество проиндексированных страниц с них
     $stat[] = $this->GetRobotsRow('<a href="?page=stat/stat_robots&period=0">' . $this->str('robots') . '</a>', "SELECT CONCAT(COUNT(DISTINCT(agent_id)), ' (', COUNT(*), ')') FROM " . $this->sess_table . " WHERE %s robot='1'");
     // Main Table
     $data['table'] = $this->stat_table(array('columns' => array(array('header' => 'attendance', 'nowrap' => 1, 'valign' => 'top'), array('header' => 'today', 'align' => 'right', 'width' => '15%'), array('header' => 'yesterday', 'align' => 'right', 'width' => '15%'), array('header' => 'week', 'align' => 'right', 'width' => '15%'), array('header' => 'month', 'align' => 'right', 'width' => '15%')), 'data' => $stat));
     // Stat Info Table
     $sess = sql_getRow("SHOW TABLE STATUS LIKE '" . STAT_SESSIONS_TABLE . "'", 'number');
     $log = sql_getRow("SHOW TABLE STATUS LIKE '" . STAT_LOG_TABLE . "'", 'number');
     $pages = sql_getRow("SHOW TABLE STATUS LIKE '" . STAT_PAGES_TABLE . "'", 'number');
     $agents = sql_getRow("SHOW TABLE STATUS LIKE '" . STAT_AGENTS_TABLE . "'", 'number');
     $db['Data_length'] = $sess['Data_length'] + $log['Data_length'] + $pages['Data_length'] + $agents['Data_length'];
     $db['Index_length'] = $sess['Index_length'] + $log['Index_length'] + $pages['Index_length'] + $agents['Index_length'];
     $db['Rows'] = $sess['Rows'] + $log['Rows'] + $pages['Rows'] + $agents['Rows'];
     $data['info'] = array('STATINFO' => $this->str('info'), 'rows' => array(0 => array('key' => $this->str('info_begin'), 'val' => $sess['Create_time']), 1 => array('key' => $this->str('info_last'), 'val' => $log['Update_time']), 2 => array('key' => $this->str('info_size'), 'val' => number_format(($db['Data_length'] + $db['Index_length']) / 1024, 2, ',', ' ') . " KB"), 3 => array('key' => $this->str('info_rows'), 'val' => $db['Rows'])));
     $data['site_select'] = $this->selectSite(array('hidden' => array('show' => $this->show)));
     return Parse($data, 'stat/stat.tmpl');
 }
Beispiel #17
0
 function Show()
 {
     if (!empty($GLOBALS['_POST'])) {
         $actions = get('actions', '', 'p');
         if ($actions) {
             return $this->{$actions}();
         }
     }
     require_once core('ajax_table');
     $ret['thisname'] = $this->name;
     global $site_domains;
     $sites = array();
     foreach ($site_domains as $key => $val) {
         foreach ($val['langs'] as $l) {
             $sites[$l['root_id']] = $val['name'] . ' (' . $l['descr'] . ')';
         }
     }
     $ret['params'] = ajax_table(array('columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => 'name', 'display' => 'name', 'flags' => FLAG_SORT | FLAG_SEARCH), array('select' => 'budget', 'display' => 'budget', 'flags' => FLAG_SEARCH), array('select' => 'start_date', 'display' => 'start_date', 'type' => 'text', 'flags' => FLAG_SORT), array('select' => 'end_date', 'display' => 'end_date', 'type' => 'text', 'flags' => FLAG_SORT), array('select' => 'root_id', 'type' => 'text', 'flags' => FLAG_SORT | FLAG_FILTER, 'filter_type' => 'array', 'filter_display' => 'root_id', 'filter_value' => array('' => '-- все --') + $sites)), 'from' => $this->table, 'where' => '', 'orderby' => 'id', 'params' => array('page' => "stat/reklama_obj", 'do' => 'show'), 'click' => 'ID=cb.value', 'dblclick' => 'editItem(id)'), $this);
     $ret['thisname2'] = str_replace('/', '', $this->name);
     return Parse($ret, $this->name . '/reklama_obj.tmpl');
 }
Beispiel #18
0
 function ElemForm()
 {
     $id = (int) get('id', 0);
     if ($id) {
         $row = $this->getObject();
     }
     if ($row['object']['obj_type_id'] == 'newbuild') {
         $row['object']['price'] = $row['object']['price_rub_print'] . '<br>' . $row['object']['price_dollar_print'];
     } else {
         $row['object']['price'] = number_format(doubleval(str_replace(',', '.', $row['object']['price_rub'])), 0, ',', ' ') . ' руб. (' . number_format(doubleval(str_replace(',', '.', $row['object']['price_dollar'])), 0, ',', ' ') . 'у.е. )';
     }
     $row['object']['x'] = $row['object']['y'] = '0.000000';
     if ($row['object']['address_id']) {
         $coordinats = sql_getRow('SELECT x, y FROM `obj_address` WHERE id=' . $row['object']['address_id']);
         $row['object']['x'] = $coordinats['x'];
         $row['object']['y'] = $coordinats['y'];
     }
     // добавляет в шаблон дефолтные строковые константы
     $this->AddStrings($row);
     return Parse($row, 'objects/elem_google.tmpl');
 }
Beispiel #19
0
 function Show()
 {
     global $limit;
     $this->Init();
     $this->AddStrings($ret);
     $offset = (int) get('offset');
     $limit = (int) get('limit', $this->Param('limit', $limit));
     $ret['navig'] = $this->NavigForm();
     $ret['site_select'] = $this->selectSite(array('hidden' => array('show' => $this->show)));
     $count = sql_getValue("SELECT COUNT(DISTINCT(path)) FROM " . $this->sess_table . " WHERE robot=0");
     $total_value = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0");
     $data = sql_getRows("SELECT path, COUNT(*) AS kol, COUNT(*)/" . $total_value . "*100 AS proc, loads FROM " . $this->sess_table . " WHERE robot=0 AND path!='' GROUP BY path ORDER BY kol DESC, loads LIMIT " . $offset . ", " . $limit);
     $count_pages[1] = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0 AND path!='' AND LENGTH(path)-LENGTH(REPLACE(path,' ',''))+1 = 1");
     $count_pages[2] = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0 AND path!='' AND LENGTH(path)-LENGTH(REPLACE(path,' ',''))+1 = 2");
     $count_pages[3] = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0 AND path!='' AND LENGTH(path)-LENGTH(REPLACE(path,' ',''))+1 = 3");
     $count_pages[4] = sql_getValue("SELECT COUNT(*) FROM " . $this->sess_table . " WHERE robot=0 AND path!='' AND LENGTH(path)-LENGTH(REPLACE(path,' ',''))+1 > 3");
     $total_head = array('', $this->_str('amount'));
     $total[] = array($this->str('total_period'), $total_value);
     for ($i = 1; $i < 5; $i++) {
         $total[] = array(sprintf($this->str('see_pages' . $i), $i < 4 ? "=" . $i : ">" . ($i - 1)), $count_pages[$i] . ' <span class="Tsmall">(' . round($count_pages[$i] / $total_value * 100, 2) . '%)</span>');
     }
     // ѕостроить массив дл¤ всех страниц ($this->path)
     if ($data) {
         $pages_id = array();
         foreach ($data as $row) {
             $pages_id = array_merge($pages_id, explode(' ', trim($row['path'])));
         }
         $pages_id = array_unique($pages_id);
         $this->path_pages = sql_getRows("SELECT id, CONCAT(host, uri) AS page FROM " . STAT_PAGES_TABLE . " WHERE id IN (" . join(', ', $pages_id) . ")", true);
         $this->path_keys = array_flip(array_keys($this->path_pages));
         foreach ($this->path_pages as $page_id => $href) {
             $ret['pathes']['row'][] = array('key' => $this->path_keys[$page_id] + 1, 'href' => $href);
         }
     }
     // Main Table
     $ret['table'] = $this->stat_table(array('columns' => array(array('header' => 'pathes', 'type' => 'path'), array('header' => 'amount', 'align' => 'right', 'width' => '20%'), array('header' => 'percent', 'align' => 'right', 'width' => '50%', 'type' => 'graph')), 'data' => $data, 'total' => $total, 'total_head' => $total_head, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
     return Parse($ret, 'stat/stat.tmpl');
 }
 function intValue($Hashtable, $key)
 {
     $s = $Hashtable[key];
     return Int32 . Parse(s);
 }
Beispiel #21
0
 function GetBasicElement($elems)
 {
     global $cfg, $intlang;
     if (empty($elems)) {
         return;
     }
     # прорисовка дерева елементов
     $tree = '';
     $c = $_bars = $loaded = 0;
     $count = count($elems);
     $pid = get('id');
     # tree.id = common elements pid
     $items = array();
     foreach ($elems as $key => $val) {
         $c++;
         $row = array('id' => 0, 'pid' => $pid, 'priority' => $c, 'next' => $cfg['elements'][$val]['next'] ? $val : '', 'elem' => $val, 'name' => utf($cfg['elements'][$val][$intlang]));
         $tree .= $this->_get_element_item($row, $bars, $_bars, $c, $count, $loaded) . "\n";
         $items[] = $this->_get_element_item_data($row, $bars, $_bars, $c, $count, $loaded);
     }
     $items_data['items'] =& $items;
     $this->AddStrings($items_data);
     $tree = Parse($items_data, 'ced/ced.elements.tmpl');
     return array('STR_BASIC' => $GLOBALS['_name'], 'basic_caption' => str('basic_caption', $this->name), 'basic_icon' => $GLOBALS['str'][$this->name]['basic_icon'], 'src' => $GLOBALS['_SERVER']['QUERY_STRING'], 'tree' => $tree);
 }
Beispiel #22
0
 function ShowRecycle()
 {
     global $limit;
     $limit = -1;
     require_once core('ajax_table');
     $this->AddStrings($row);
     $row['table'] = ajax_table(array('columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => "name", 'display' => 'name')), 'where' => 'lang="' . lang() . '" AND visible<0', 'orderby' => 'id DESC', 'params' => array('page' => $this->name, 'do' => 'Show')), $this);
     return Parse($row, 'recycle.tmpl');
 }
Beispiel #23
0
 function CopyDlg()
 {
     $id = (int) $_GET['id'];
     $src = (int) $_GET['src'];
     // Смотрим путь назначения
     $dir = explode("/", sql_getValue('SELECT dir FROM ' . $this->table . ' WHERE id = ' . $id));
     $ret['from'] = $this->str('from');
     $ret['from_path'] = $this->GetPath($src, 'CopyDlg&src=' . $src);
     $ret['to'] = $this->str('to');
     $ret['to_path'] = $this->GetPath($id, 'CopyDlg&src=' . $src);
     $ret['copy_to'] = $this->str('copy_to');
     $ret['copy'] = $this->str('copy');
     $ret['copy_disabled'] = in_array($src, $dir) || $src == $id ? 'DISABLED' : '';
     $ret['move'] = $this->str('move');
     $ret['move_disabled'] = in_array($src, $dir) || $src == $id ? 'DISABLED' : '';
     $ret['id'] = $id;
     $ret['src'] = $src;
     $ret['name'] = $this->name;
     $ret['trees'] = $this->GetAllTree(array('id' => $id, 'src' => $src, 'copy' => true));
     return Parse($ret, 'custom_tree/custom_tree.copy.tmpl');
 }
Beispiel #24
0
 function ShowWhois()
 {
     $ip = get('whois_ip', '', 'g');
     $ip = long2ip($ip);
     //real ip
     $whois = get('whois_server', $this->whois[0], 'g');
     $this->AddStrings($data);
     $data['whois_options'] = $this->GetArrayOptions($this->whois, $whois);
     $data['ip'] = $ip;
     if (!$ip) {
         $data['error']['res'] = $this->str('e_whois');
     } elseif (!in_array($whois, $this->whois)) {
         $data['error']['res'] = $this->str('e_whois');
     } else {
         $result = `whois -h {$whois} {$ip}`;
         if ($result) {
             $data['whois']['res'] = $result;
         } else {
             $data['error']['res'] = $this->str('e_whois');
         }
     }
     return Parse($data, 'stat/stat_ip/stat_whois.tmpl');
 }
Beispiel #25
0
 function showStun()
 {
     // скидываем ифрэйм для поста в него и строим окно
     $plg = $this->getPluginClass();
     $plg->LoadStrings();
     $data = array();
     $plg->AddStrings($data);
     //pr($data);
     return Parse($data, NOTIFY_DIR . 'tmpls/sending.tmpl');
 }
Beispiel #26
0
 function GetPages()
 {
     global $limit;
     $offset = (int) get('offset');
     $limit = (int) get('limit', $this->Param('limit', $limit));
     $from_date = (int) get('from_date');
     $to_date = (int) get('to_date');
     $adv = get('adv', array(), 'g');
     $this->sess_table = get('sess');
     $agent_id = get('agent_id');
     $q = "CREATE TEMPORARY TABLE tmp_stat_robot_" . $agent_id . " SELECT log.time, log.page_id\tFROM " . $this->sess_table . " AS sess LEFT JOIN " . STAT_LOG_TABLE . " AS log ON log.sess_id=sess.sess_id WHERE sess.robot=1 AND sess.agent_id=" . $agent_id;
     sql_query($q);
     $q = "select count(*) FROM tmp_stat_robot_" . $agent_id . " AS sess LEFT JOIN " . STAT_PAGES_TABLE . " AS page on page.id=sess.page_id order by sess.time ASC";
     $count = sql_getValue("SELECT COUNT(*) FROM tmp_stat_robot_" . $agent_id . "");
     $data = sql_getRows("select FROM_UNIXTIME(sess.time), CONCAT('&nbsp;<a href=\"http://',page.host,page.uri,'\">','http://',page.host,page.uri) FROM tmp_stat_robot_" . $agent_id . " AS sess LEFT JOIN " . STAT_PAGES_TABLE . " AS page on page.id=sess.page_id order by sess.time ASC LIMIT " . $offset . ", " . $limit);
     // Main Table
     $ret['table'] = $this->stat_table(array('columns' => array(array('header' => 'time', 'nowrap' => 1, 'type' => 'time', 'align' => 'center'), array('header' => 'page', 'align' => 'left', 'width' => '80%')), 'data' => $data, 'count' => $count, 'offset' => $offset, 'limit' => $limit));
     $ret['navig'] = $this->NavigForm(array('hidden' => array('show' => $this->show)));
     $ret['navig']['hidden'][] = array('name' => 'agent_id', 'value' => $agent_id);
     echo '<title>' . $this->GetTitle() . '</title>';
     $ret['navig']['hidden'][] = array('name' => 'sess', 'value' => $this->sess_table);
     echo Parse($ret, 'stat/stat.no_navig.tmpl');
 }
Beispiel #27
0
 function ShowRecipients()
 {
     if (!empty($GLOBALS['_POST'])) {
         $actions = get('actions', '', 'p');
         if ($actions) {
             return $this->{$actions}();
         }
     }
     require_once core_file('table.lib');
     $ret['thisname'] = $this->name;
     $ret['table'] = table(array('from' => "clients", 'columns' => array(array('select' => 'id', 'display' => 'id', 'type' => 'checkbox'), array('select' => 'CONCAT(cont_name,CHAR(32),cont_lname)', 'display' => 'client', 'flags' => FLAG_SEARCH), array('select' => 'email', 'display' => 'email', 'flags' => FLAG_SEARCH), array('select' => 'reg_date', 'display' => 'registered', 'align' => 'right', 'type' => 'registered')), 'where' => 'visible=1 AND LENGTH(email)>0 ' . (is_root() ? '' : 'AND (admin_id IS NULL OR admin_id IN (' . join(',', $this->user['subst']) . '))'), 'orderby' => 'id', 'params' => array('page' => $this->name, 'do' => 'showrecipients'), 'click' => 'ID=cb.value;', 'dblclick' => 'PasteRecipients(id)'), $this);
     return Parse($ret, $this->name . '.recipients.tmpl');
 }
Beispiel #28
0
<?php

function Parse($url)
{
    $fileContents = file_get_contents($url);
    $fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
    $fileContents = trim(str_replace('"', "'", $fileContents));
    $simpleXml = simplexml_load_string($fileContents);
    $json = json_encode($simpleXml);
    return $json;
}
$input = urlencode($_POST['input']);
if (isset($_POST['type'])) {
    $type = $_POST['type'];
} else {
    $type = "json";
}
if ($type == "json") {
    $return["name"] = $_POST['input'];
    $return["jsonCall"] = Parse("http://api.wolframalpha.com/v2/query?input=" . $input . "&appid=8XV52V-P6RE2RGYA9");
    echo json_encode($return);
} else {
    if ($type == "xml") {
        $return["name"] = $_POST['input'];
        $return["xmlCall"] = file_get_contents("http://api.wolframalpha.com/v2/query?input=" . $input . "&appid=RJ45AJ-T8JV49E92P");
        echo json_encode($return);
    }
}
Beispiel #29
0
 /**
  * строим список с элемами
  *
  * @return html
  */
 function ElemList($tabname = "")
 {
     $id = (int) get('id', 0);
     $rows = array();
     $pid = $this->id;
     $this->table = $this->elem_table;
     // если редактируем
     $rows = $this->getObject();
     if (count($rows['object'])) {
         foreach ($rows['object'] as $kobj => $vobj) {
             $rows['object'][$kobj]['tabname'] = $tabname;
             $rows['object'][$kobj]['onclick'] = $tabname . ".showSelectDiv(" . $vobj['id'] . ", this);";
         }
     }
     if ($this->elem_type == 'link') {
         unset($this->list_buttons['create']);
     }
     if (isset($this->list_buttons['create']['div_id'])) {
         $this->list_buttons['create']['div_id'] = 'tmp' . $tabname . $this->name . $id;
     }
     if (isset($this->list_buttons['delete']['div_id'])) {
         $this->list_buttons['delete']['div_id'] = 'tmp' . $tabname . $this->name . $id;
     }
     // Если указан класс для использования редактирования берем его
     // Если нет то получаем название класса из имени элема
     if (!empty($this->elem_class)) {
         $class_name = $this->elem_class;
     } else {
         $str = explode("_", $this->elem_name);
         $class_name = isset($str[1]) ? $str[1] : '';
     }
     if (!elem($class_name . "/" . $class_name)) {
         die("У multielem - " . $this->elem_name . " не найден класс для подключения создания/редактирования");
     }
     $_GET['limit'] = "-1";
     // Параметр is_fancy=1 обозначает что всплывающий фрейм организован на основе fancybox
     $table = array('columns' => $this->columns, 'dataset' => isset($rows['object']) ? $rows['object'] : array(), 'params' => array('id' => $id, 'page' => $this->name, 'tab' => $tabname, 'class' => $class_name), 'action' => 'editor.php', 'click' => $this->click, 'dblclick' => $this->dblclick, 'tabframename' => 'tmp' . $tabname . $this->name . $id, 'id_table_list_name' => 'tbl' . $tabname . $this->name . $id, 'list_buttons' => $this->list_buttons, 'script' => isset($this->script) ? $this->script : "", 'src_frame' => "'./editor.php?page=" . $class_name . "&frame=view&pid=" . $pid . "&tabname=" . $tabname . "&page_name=" . $this->name . "&elem_name=" . $this->elem_name . "&is_fancy=1'", 'tmpl' => 'table_no_form.tmpl');
     //debug
     if ($this->sql) {
         $table['_sql'] = true;
     }
     require_once core('list_table');
     $data['table'] = list_table($table, $this);
     $data['window_size'] = $this->window_size;
     $this->AddStrings($data);
     $data['id'] = $id;
     $data['tab'] = $tabname;
     $data['elem_actions'] = $this->elem_actions;
     $data['thisname2'] = str_replace('/', '', $data['thisname']);
     $data['elem_type'] = $this->elem_type;
     if ($this->elem_type == 'link') {
         $data['autosuggest'] = array('table' => $this->elem_table, 'field' => @$this->autosuggest['field'], 'where' => @$this->autosuggest['where'], 'note' => @$this->autosuggest['note'], 'lang_select' => LANG_SELECT);
     }
     return Parse($data, OBJECT_EDITOR_MODULE . '/list.tmpl');
 }
Beispiel #30
0
 function ShowPrintForm()
 {
     $id = (int) get('id');
     if ($id) {
         $row['order'] = $this->getRow($id);
     }
     $row['id'] = $id;
     // получаем счет по данному заказу
     $row['bill'] = sql_getRow("SELECT * FROM bills WHERE status!='canceled' AND order_id=" . $row['id']);
     $row['bill']['r_comp'] = sql_getRow("SELECT r_comp_fname, r_comp_inn, r_comp_kpp, r_comp_rs, r_comp_ks, r_comp_bank, r_comp_bik, r_comp_addr FROM bills WHERE id=" . $row['bill']['id']);
     $row['bill']['r_comp']['kind_of_payment'] = sql_getValue("SELECT kind_of_payment FROM bills_accounts WHERE type='" . $row['bill']['type'] . "'");
     $row['bill']['r_comp']['r_comp_sign'] = sql_getValue("SELECT r_comp_sign FROM bills_accounts WHERE type='" . $row['bill']['type'] . "'");
     $row['bill']['total'] -= $row['bill']['bonus'];
     // дата оформления заказа
     $row['order']['order_date'] = date('d.m.Y', $row['order']['order_date']);
     // получаем значение currency
     $row['currency'] = sql_getRow("SELECT * FROM currency WHERE name='" . $row['order']['currency'] . "'");
     // получем список товаров по данному заказу
     $row['product_list'] = sql_getRows("SELECT * FROM cart as c LEFT JOIN products as p on c.product_id=p.id WHERE c.order_id=" . $row['order']['id']);
     // считаем кол-во заказов
     $row['count'] = 0;
     foreach ($row['product_list'] as $key => $item) {
         $row['count'] += $item['quantity'];
     }
     $row['host'] = $_SERVER['HTTP_HOST'];
     if ($row['bill']['client_type'] == 'jur') {
         $row['bill']['sum_pr'] = @$this->SumProp($row['bill']['total']);
     }
     $row['text'] = $row;
     $this->AddStrings($row);
     return Parse($row, '../templates/print_kvit.html');
 }