Пример #1
0
 function show_content($param)
 {
     $this->getContent();
     if (coreFfile::is_image($this->nname)) {
         remove_if_older_than_a_minute_dir("tmp");
         $thumb = tempnam("tmp/", "image");
         lfile_put_contents($thumb, $this->image_content);
         lxfile_generic_chmod($thumb, "0755");
         $vlist['image_content'] = array('I', array("width" => 50, "height" => 50, "value" => "{$thumb}"));
         $vlist['image_width'] = null;
         $vlist['image_height'] = null;
         //$vlist['image_type'] = null;
         $vlist['copy_old_image_flag_f'] = null;
         $dir = dirname($this->nname);
         $name = basename($this->nname);
         $vlist['old_image_name_f'] = array('m', "{$dir}/copy-{$name}");
         $vlist['__v_button'] = "Resize";
     } else {
         if ($this->isOn('not_full_size')) {
             $vlist['fake_f'] = array('M', "Showing only the last {$this->numlines} KiloBytes of the file");
         }
         $vlist['content'] = null;
         $vlist['__v_button'] = "";
     }
     return $vlist;
 }
Пример #2
0
function __ac_desc_graph($object)
{
    global $gbl, $sgbl, $login, $ghtml;
    $subaction = $ghtml->frm_subaction;
    $selflist = $object->getSelfList();
    if (!$ghtml->frm_c_graph_time) {
        $ghtml->frm_c_graph_time = '1d';
    }
    $object->createShowPropertyList($alist);
    $object->createShowAlist($alist, $subaction);
    $nalist = null;
    if (!isset($alist['property'])) {
        $alist['property'] = array();
    }
    $nalist = lx_merge_good($nalist, $alist['property']);
    remove_if_older_than_a_minute_dir("__path_program_htmlbase/tmp/");
    $ghtml->print_tab_block($nalist);
    if ($selflist) {
        $ghtml->printShowSelectBox($selflist);
    }
    if (cse($ghtml->frm_subaction, 'base')) {
        $core = strtil($ghtml->frm_subaction, "base");
        $ghtml->__http_vars['frm_subaction'] = "{$core}traffic";
        $subaction = "{$core}traffic";
    }
    $galist = $object->createGraphList();
    $ghtml->print_tab_block($galist);
    $graphtlist = array('1h' => '1h', '12h' => '12h', '1d' => '1d', '2d' => '2d', '1week' => '1week', '1month' => '1month');
    $gtlistsec = array('1h' => 3600, '12h' => 12 * 3600, '1d' => 24 * 3600, '2d' => 2 * 24 * 3600, '1week' => 7 * 24 * 3600, '1month' => 30 * 24 * 3600, '1year' => 365 * 24 * 3600);
    $ghtml->printGraphSelect($graphtlist);
    lxfile_mkdir("__path_program_htmlbase/tmp");
    $tmpgraph = ltempnam("__path_program_htmlbase/tmp/", "graph");
    $object->setUpdateSubaction("graph_{$subaction}");
    $time = $ghtml->frm_c_graph_time;
    $object->rrdtime = $gtlistsec[$time];
    try {
        $object->createExtraVariables();
        $file = rl_exec_set(null, $object->syncserver, $object);
    } catch (lxException $e) {
        $ghtml->print_curvy_table_start();
        print "Graph Failed due to {$e->getMessage()} {$e->value}";
        $ghtml->print_curvy_table_end();
        $object->dbaction = 'clean';
        return;
    }
    $object->dbaction = 'clean';
    lfile_put_contents($tmpgraph, $file);
    $tmpgraph = basename($tmpgraph);
    print "<img src=/tmp/{$tmpgraph}>";
}