Exemple #1
0
     break;
 case 'quicklist':
     $todo = $_POST['todo'];
     $id = mysql_clean($_POST['vid']);
     if ($todo == 'add') {
         $return = $cbvid->add_to_quicklist($id);
     } else {
         $return = $cbvid->remove_from_quicklist($id);
     }
     echo $return;
     break;
 case 'getquicklistbox':
     //$cookie = $_COOKIE[QUICK_LIST_SESS];
     //$vids = json_decode($cookie,true);
     if ($cbvid->total_quicklist() > 0) {
         TEMPLATE('blocks/quicklist/block.html');
     }
     break;
 case 'clear_quicklist':
     $cbvid->clear_quicklist();
     return 'removed';
     break;
 case 'delete_comment':
     $type = $_POST['type'];
     switch ($type) {
         case 'v':
         case 'video':
         default:
             $cid = mysql_clean($_POST['cid']);
             $type_id = $myquery->delete_comment($cid);
             $cbvid->update_comments_count($type_id);
Exemple #2
0
function run_template($w, $p, $t, $arg, $ignore, $change, $overwrite = FALSE)
{
    $t->read_paths();
    error_log("Template size: " . count($t->path_storage));
    $w->read_paths();
    foreach ($t->paths() as $path) {
        // Path: create from $w
        $p2 = PATH($w);
        // Merge $p and $path into $p2
        $p2->add2((string) $p, (string) $path);
        // Don't overwrite existing values
        if (!$overwrite and $p2->hasvalue()) {
            continue;
        }
        // Don't do if matches an ignore field
        $cont = FALSE;
        foreach ($ignore as $ig) {
            foreach ($ig as $value) {
                if (!in_array($value, $p2->map)) {
                    $cont = FALSE;
                    break;
                } else {
                    $cont = TRUE;
                }
            }
            if ($cont) {
                break;
            }
        }
        #error_log($cont ? "TRUE: $p2" : "FALSE: $p2");
        if ($cont) {
            continue;
        }
        // Modify path based on changes
        foreach ($p2->map as $value) {
            if (array_key_exists($value, $change)) {
                $p2->add($change[$value]);
            }
        }
        // Make template
        $l = TEMPLATE($path->get());
        // Evaluate the template
        $value = $l($arg);
        if ($value === NULL) {
            return "Missing variable";
        }
        if (!$p2->hasvalue()) {
            #error_log($p2 . $value);
            #error_log(var_export($w->path_storage,1));
            $p2->set($value);
            #error_log(var_export($w->path_storage,1));
            #error_log(var_export($p2->get(),1));
            $p2 = $w->add_path($p2);
            #error_log(var_export($p2->id(),1));
        } else {
            $p2 = $w->get_path($p2);
            $p2->set_value($value);
            $p2->set($value);
        }
    }
    return NULL;
}