Example #1
0
    if ($title != "") {
        echo $title . " :";
    }
    echo "<div class=\"membarfree\" style=\"width: " . $width . "px\">";
    if ($cache > 0) {
        printf("<div class=\"membarcache\" style=\"width: %.0fpx\">", $wused);
        $wused = ($used - $cache) / $max * $width;
    }
    printf("<div class=\"membarused\" style=\"width: %.0fpx\"></div>", $wused);
    if ($cache > 0) {
        echo "</div>";
    }
    echo "</div>\n";
}
function get_process()
{
    return xmlCall("base.listProcess", null);
}
$arr = get_process();
if (count($arr) == 0) {
    //if no job in background
    print '<div style="text-align: center;">' . _("No job.") . '</div>';
    return;
}
foreach ($arr as $ps) {
    echo $ps[0] . "<br/>";
    echo $ps[2] . "<br/>";
    if ($ps[1] != "-1") {
        print_mem_bar("progress", 100, $ps[1]);
    }
}
Example #2
0
$content_table = content_table($moduleid, $itemid, $MOD['split'], $table_data);
$t = $db->get_one("SELECT content FROM {$content_table} WHERE itemid={$itemid}");
$content = $t['content'];
if ($lazy) {
    $content = img_lazy($content);
}
if ($MOD['keylink']) {
    $content = keylink($content, $moduleid);
}
$CP = $MOD['cat_property'] && $CAT['property'];
if ($CP) {
    require DT_ROOT . '/include/property.func.php';
    $options = property_option($catid);
    $values = property_value($moduleid, $itemid);
}
$process = get_process($fromtime, $totime);
$fromtime = timetodate($fromtime, 3);
$totime = timetodate($totime, 3);
$adddate = timetodate($addtime, 3);
$editdate = timetodate($edittime, 3);
$linkurl = $MOD['linkurl'] . $linkurl;
$maincat = get_maincat(0, $moduleid);
$update = '';
$fee = get_fee($item['fee'], $MOD['fee_view']);
if (check_group($_groupid, $MOD['group_contact'])) {
    if ($fee) {
        $user_status = 4;
        $destoon_task = "moduleid={$moduleid}&html=show&itemid={$itemid}";
        $description = get_description($content, $MOD['pre_view']);
    } else {
        $user_status = 3;
Example #3
0
级" alt=""/></a><?php 
    }
    ?>
</td>
<td align="left">&nbsp;<a href="<?php 
    echo $v['linkurl'];
    ?>
" target="_blank"><?php 
    echo $v['title'];
    ?>
</td>
<td><img src="<?php 
    echo DT_PATH;
    ?>
file/image/process_<?php 
    echo get_process($v['fromtime'], $v['totime']);
    ?>
.gif"/></td>
<td class="px11"><?php 
    echo $v['hits'];
    ?>
</td>
<td class="px11"><?php 
    echo $v['adddate'];
    ?>
</td>
<td>
<a href="?moduleid=<?php 
    echo $moduleid;
    ?>
&file=<?php 
Example #4
0
 function get_list($condition = 'status=3', $order = 'addtime DESC', $cache = '')
 {
     global $MOD, $pages, $page, $pagesize, $offset, $items, $sum;
     if ($page > 1 && $sum) {
         $items = $sum;
     } else {
         $r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}", $cache);
         $items = $r['num'];
     }
     $pages = defined('CATID') ? listpages(1, CATID, $items, $page, $pagesize, 10, $MOD['linkurl']) : pages($items, $page, $pagesize);
     $lists = $catids = $CATS = array();
     $result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}", $cache);
     while ($r = $this->db->fetch_array($result)) {
         $r['adddate'] = timetodate($r['addtime'], 5);
         $r['editdate'] = timetodate($r['edittime'], 5);
         $r['fromdate'] = timetodate($r['fromtime'], 3);
         $r['todate'] = timetodate($r['totime'], 3);
         $r['alt'] = $r['title'];
         $r['title'] = set_style($r['title'], $r['style']);
         $r['process'] = get_process($r['fromtime'], $r['totime']);
         $r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
         $catids[$r['catid']] = $r['catid'];
         $lists[] = $r;
     }
     if ($catids) {
         $result = $this->db->query("SELECT catid,catname,linkurl FROM {$this->db->pre}category WHERE catid IN (" . implode(',', $catids) . ")");
         while ($r = $this->db->fetch_array($result)) {
             $CATS[$r['catid']] = $r;
         }
         if ($CATS) {
             foreach ($lists as $k => $v) {
                 $lists[$k]['catname'] = $v['catid'] ? $CATS[$v['catid']]['catname'] : '';
                 $lists[$k]['caturl'] = $v['catid'] ? $MOD['linkurl'] . $CATS[$v['catid']]['linkurl'] : '';
             }
         }
     }
     return $lists;
 }
Example #5
0
function get_input_processlist_desc($userid, $id)
{
    $process_list = get_input_processlist($userid, $id);
    // Get the input's process list
    $list = array();
    if ($process_list) {
        $array = explode(",", $process_list);
        // input process list is comma seperated
        foreach ($array as $row) {
            $row = explode(":", $row);
            // Divide into process id and arg
            $processid = $row[0];
            $arg = $row[1];
            // Named variables
            $process = get_process($processid);
            // gets process details of id given
            $processDescription = $process[0];
            // gets process description
            if ($process[1] == ProcessArg::INPUTID) {
                $arg = get_input_name($arg);
            } elseif ($process[1] == ProcessArg::FEEDID) {
                $arg = get_feed_name($arg);
            }
            // if feed: get feed name
            $list[] = array($processDescription, $arg);
            // Populate list array
        }
    }
    return $list;
}
Example #6
0
            $content = $db->get_one("SELECT content FROM {$content_table} WHERE itemid={$itemid}");
            $content = $content['content'];
            if ($MOD['keylink']) {
                $content = keylink($content, $moduleid);
            }
            if ($user_status == 2) {
                $description = get_description($content, $MOD['pre_view']);
            }
        }
        $content = strip_nr(ob_template('content', 'chip'), true);
        echo 'Inner("content", \'' . $content . '\');';
    }
    $update = '';
    include DT_ROOT . '/include/update.inc.php';
    echo 'Inner("hits", \'' . $item['hits'] . '\');';
    echo 'Dd("process").src = \'' . (DT_PATH . 'file/image/process_' . get_process($item['fromtime'], $item['totime']) . '.gif') . '\';';
    if ($MOD['show_html'] && $task_item && $DT_TIME - @filemtime(DT_ROOT . '/' . $MOD['moduledir'] . '/' . $item['linkurl']) > $task_item) {
        tohtml('show', $module);
    }
} else {
    if ($html == 'list') {
        $catid or exit;
        if ($MOD['list_html'] && $task_list && $CAT) {
            $num = 1;
            $totalpage = max(ceil($CAT['item'] / $MOD['pagesize']), 1);
            $demo = DT_ROOT . '/' . $MOD['moduledir'] . '/' . listurl($CAT, '{DEMO}');
            $fid = $page;
            if ($fid >= 1 && $fid <= $totalpage && $DT_TIME - @filemtime(str_replace('{DEMO}', $fid, $demo)) > $task_list) {
                tohtml('list', $module);
            }
            $fid = $page + 1;
#
#
#
#
#
#
#
#
#
require "settings.php";
require "libs/ext.lib.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "do_process":
            if (isset($_POST["process"])) {
                $OUTPUT = get_process($_POST);
            } else {
                $OUTPUT = printSupp($_POST);
            }
            break;
        case "alloc":
            $OUTPUT = alloc_process($_POST);
            break;
        default:
            $OUTPUT = printSupp($_POST);
    }
} else {
    $OUTPUT = printSupp($_POST);
}
require "template.php";
# show stock
Example #8
0
 $offset = ($page - 1) * $pagesize;
 $items = $db->count($table, $condition, $DT['cache_search']);
 $pages = pages($items, $page, $pagesize);
 if ($items) {
     $order = $dorder[$order] ? " ORDER BY {$dorder[$order]}" : '';
     $result = $db->query("SELECT {$fds} FROM {$table} WHERE {$condition}{$order} LIMIT {$offset},{$pagesize}", $DT['cache_search'] && $page == 1 ? 'CACHE' : '', $DT['cache_search']);
     if ($kw) {
         $replacef = explode(' ', $kw);
         $replacet = array_map('highlight', $replacef);
     }
     while ($r = $db->fetch_array($result)) {
         $r['adddate'] = timetodate($r['addtime'], 5);
         $r['editdate'] = timetodate($r['edittime'], 5);
         $r['fromdate'] = timetodate($r['fromtime'], 3);
         $r['todate'] = timetodate($r['totime'], 3);
         $r['process'] = get_process($r['fromtime'], $r['totime']);
         if ($lazy && isset($r['thumb']) && $r['thumb']) {
             $r['thumb'] = DT_SKIN . 'image/lazy.gif" original="' . $r['thumb'];
         }
         $r['alt'] = $r['title'];
         $r['title'] = set_style($r['title'], $r['style']);
         if ($kw) {
             $r['title'] = str_replace($replacef, $replacet, $r['title']);
         }
         $r['linkurl'] = $MOD['linkurl'] . $r['linkurl'];
         $tags[] = $r;
     }
     $db->free_result($result);
     if ($page == 1 && $kw) {
         keyword($kw, $items, $moduleid);
     }
Example #9
0
         dalert($L['gift_error_7'], rewrite('index.php?action=my'));
     }
     credit_add($_username, -$credit);
     credit_record($_username, -$credit, 'system', $L['gift_credit_reason'], 'ID:' . $itemid);
     $db->query("INSERT INTO {$DT_PRE}gift_order (itemid,credit,username,ip,addtime,status) VALUES ('{$itemid}','{$credit}','{$_username}','{$DT_IP}','{$DT_TIME}','" . $L['gift_status'] . "')");
     $db->query("UPDATE {$DT_PRE}gift SET orders=orders+1 WHERE itemid={$itemid}");
     dheader(rewrite('index.php?success=1&itemid=' . $itemid));
     break;
 default:
     if ($itemid) {
         $do->itemid = $itemid;
         $item = $do->get_one();
         $item or dheader($MOD['gift_url']);
         extract($item);
         $left = $amount - $orders > 0 ? $amount - $orders : 0;
         $process = $left ? get_process($fromtime, $totime) : 4;
         $adddate = timetodate($addtime, 3);
         $fromdate = $fromtime ? timetodate($fromtime, 3) : $L['timeless'];
         $todate = $totime ? timetodate($totime, 3) : $L['timeless'];
         $middle = str_replace('.thumb.', '.middle.', $thumb);
         $gname = '';
         if ($groupid) {
             $GROUP = cache_read('group.php');
             foreach (explode(',', $groupid) as $gid) {
                 if (isset($GROUP[$gid])) {
                     $gname .= $GROUP[$gid]['groupname'] . ' ';
                 }
             }
         }
         $db->query("UPDATE {$DT_PRE}gift SET hits=hits+1 WHERE itemid={$itemid}");
         $head_title = $title . $DT['seo_delimiter'] . $L['gift_title'];
function process_controller()
{
    require "Models/process_model.php";
    require "Models/input_model.php";
    require "Models/feed_model.php";
    global $session, $action, $format;
    $output['content'] = "";
    $output['message'] = "";
    //---------------------------------------------------------------------------------------------------------
    // Get process list of input
    // http://yoursite/emoncms/process/list.html?inputid=1
    // http://yoursite/emoncms/process/list.json?inputid=1
    //---------------------------------------------------------------------------------------------------------
    if ($action == "list" && $session['read']) {
        $inputid = intval($_GET["inputid"]);
        $input_processlist = get_input_processlist_desc($session['userid'], $inputid);
        if ($format == 'json') {
            $output['content'] = json_encode($input_processlist);
        } elseif ($format == 'html') {
            $output['content'] = view("process/list_view.php", array('inputid' => $inputid, 'input_processlist' => $input_processlist, 'process_list' => get_process_list()));
        }
    } elseif ($action == "add" && $session['write']) {
        $inputid = intval($_GET['inputid']);
        $processid = intval($_GET['type']);
        // get process type (ProcessArg::)
        $arg = floatval($_GET['arg']);
        // This is actual value, inputid or feedid
        //arg2 is feed name if arg=-1 (create new feed)
        $arg2 = preg_replace('/[^\\w\\s-.]/', '', $_GET['arg2']);
        // filter out all except for alphanumeric white space and dash
        $arg2 = db_real_escape_string($arg2);
        $process = get_process($processid);
        $valid = false;
        // Flag to determine if argument is valid
        switch ($process[1]) {
            case ProcessArg::VALUE:
                // If arg type value
                $arg = floatval($arg);
                $id = $arg;
                if ($arg != '') {
                    $valid = true;
                } else {
                    $output['message'] = 'ERROR: Argument must be a valid number greater or less than 0.';
                }
                break;
            case ProcessArg::INPUTID:
                // If arg type input
                // Check if input exists (returns 0 if invalid)
                $name = get_input_name($arg);
                $id = get_input_id($_SESSION['userid'], $name);
                if ($name == '' || $id == '') {
                    $output['message'] = 'ERROR: Input does not exist!';
                } else {
                    $valid = true;
                }
                break;
            case ProcessArg::FEEDID:
                // If arg type feed
                // First check if feed exists of given feed id and user.
                $name = get_feed_name($arg);
                $id = get_feed_id($_SESSION['userid'], $name);
                if ($name == '' || $id == '') {
                    // If it doesnt then create a feed, $process[3] is the number of datafields in the feed table
                    $id = create_feed($_SESSION['userid'], $arg2, $process[3], $process[4]);
                    // Check feed was created successfully
                    $name = get_feed_name($id);
                    if ($name == '') {
                        $output['message'] = 'ERROR: Could not create new feed!';
                    } else {
                        $valid = true;
                    }
                } else {
                    $valid = true;
                }
                break;
        }
        if ($valid) {
            add_input_process($session['userid'], $inputid, $processid, $id);
        }
        if ($format == 'json') {
            $output['message'] = json_encode($output['message']);
        } elseif ($format == 'html') {
            header('Location: list?inputid=' . $inputid);
        }
    } elseif ($action == 'delete' && $session['write']) {
        $inputid = intval($_GET['inputid']);
        $processid = intval($_GET['processid']);
        delete_input_process($session['userid'], $inputid, $processid);
        if ($format == 'html') {
            header('Location: list?inputid=' . $inputid);
        }
    } elseif ($action == 'move' && $session['write']) {
        $inputid = intval($_GET['inputid']);
        $processid = intval($_GET['processid']);
        $moveby = intval($_GET['moveby']);
        move_input_process($session['userid'], $inputid, $processid, $moveby);
        if ($format == 'html') {
            header('Location: list?inputid=' . $inputid);
        }
    } elseif ($action == 'query' && $session['read']) {
        $inputid = intval($_GET["inputid"]);
        $processid = intval($_GET["type"]);
        // get process type
        $arg = preg_replace('/[^\\w\\s-.]/', '', $_GET["arg"]);
        // filter out all except for alphanumeric white space and dash
        $arg = db_real_escape_string($arg);
        $process = get_process($processid);
        $newprocess[0] = $process[1];
        // Process arg type
        switch ($process[1]) {
            case ProcessArg::VALUE:
                $newprocess[1] = "Value";
                break;
            case ProcessArg::INPUTID:
                $newprocess[1] = "Input";
                $newprocess[2] = get_user_input_names($session['userid']);
                break;
            case ProcessArg::FEEDID:
                $newprocess[1] = "Feed";
                $newprocess[2] = get_user_feed_names($session['userid']);
                break;
            default:
                $newprocess[1] = "ERROR";
        }
        if ($format == 'json') {
            $output['content'] = json_encode($newprocess);
        }
        //if ($format == 'html') $output['content'] = $argboxhtml;
    } elseif ($action == "test" && $_SESSION['write']) {
        set_time_limit(360);
        // Increase PHP limit
        // Create Histogram data - (to feed, from feed, from date, to date).
        // $rows = histogram_history(4,1,"2008-01-01","2012-05-01");
    } elseif ($action == "autoconfigure" && $session['write']) {
        $inputs = get_user_inputs($session['userid']);
        foreach ($inputs as $input) {
            auto_configure_inputs($session['userid'], $input[0], $input[1]);
        }
        if ($format == 'html') {
            header("Location: ../feed/list");
        }
    }
    return $output;
}