示例#1
0
/**
 * Update item list asynchronously
 *
 * @author  Andreas Goetz   <*****@*****.**>
 */
function ajax_render()
{
    global $smarty, $result;
    // add some delay for debugging
    if ($config['debug'] && $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
        usleep(rand(200, 1000) * 1000);
    }
    // load languages and config into Smarty
    tpl_language();
    tpl_list($result);
    $content = $smarty->fetch('list.tpl');
    #    file_append('log.txt', $content);
    header('X-JSON: ' . json_encode(array('count' => count($result))));
    echo $content;
    exit;
}
示例#2
0
/**
 * Update item list asynchronously
 *
 * @author  Andreas Goetz   <*****@*****.**>
 */
function ajax_render()
{
    global $smarty, $result, $filter;
    global $pageno, $totalpages, $totalresults;
    // TODO Smarty caching would require further efforts $smarty->caching = 1;
    #    if (!$smarty->is_cached('list.tpl', get_current_user_id().'|'.$filter.$pageno)) {
    // add some delay for debugging
    if ($config['debug'] && $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
        usleep(rand(200, 1000) * 1000);
    }
    // load languages and config into Smarty
    tpl_language();
    tpl_list($result);
    // TODO consider pagination
    $content = $smarty->fetch('list.tpl', get_current_user_id() . '|' . $filter . $pageno);
    header('X-JSON: ' . json_encode(array('totalresults' => $totalresults ? $totalresults : count($result), 'maxpageno' => $totalpages)));
    exit($content);
}
示例#3
0
         header('Location:index.php?b=' . $blog_serial . '&c=' . $category_name);
         exit;
     } else {
         header('Location:index.php?ac=1&f=' . urlencode('index.php?b=' . $blog_serial . '&c=' . $category_name));
         exit;
     }
     break;
 case '12':
     // settings form
     if (admin_check()) {
         if (isset($_GET['e'])) {
             $has_error = true;
         } else {
             $has_error = false;
         }
         $tpls = tpl_list();
         $langs = lang_list();
         $avail_blocks = block_list();
         $avail_blocks_str = '';
         if ($avail_blocks) {
             for ($i = 0, $size = count($avail_blocks); $i < $size; $i++) {
                 $avail_blocks_str .= ',' . $avail_blocks[$i];
             }
             $avail_blocks_str = substr($avail_blocks_str, 1);
         }
         $block_str = '';
         if (sizeof($blocks) > 0) {
             for ($i = 0, $size = count($blocks); $i < $size; $i++) {
                 $block_str .= ',' . $blocks[$i];
             }
             $block_str = substr($block_str, 1);