示例#1
0
 public function set_val($val)
 {
     $result = DigiplayDB::update("configuration", array("val" => $val), "id = " . $this->id);
     if ($result) {
         return $this->val = $val;
     }
 }
示例#2
0
 public function mark_as_read()
 {
     $query = DigiplayDB::update("email", array("new_flag" => 'f'), "id = " . $this->id);
     if ($query) {
         $this->new_flag = FALSE;
     }
     return $query;
 }
示例#3
0
 public function save()
 {
     if ($this->id) {
         DigiplayDB::update("showitems", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("showitems", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#4
0
 public function save()
 {
     if (isset($this->id)) {
         DigiplayDB::update("sustslots", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("sustslots", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#5
0
 public function save()
 {
     if (!$this->enabled) {
         $this->enabled = TRUE;
     }
     if (!$this->ghost) {
         $this->ghost = FALSE;
     }
     return DigiplayDB::update("users", get_object_vars($this), "id = " . $this->id);
 }
示例#6
0
 public function save()
 {
     if (!$this->name) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("artists", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("artists", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#7
0
 public function save()
 {
     if (!$this->content) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("info_faults", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("info_faults", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#8
0
 public function save()
 {
     if (!$this->name) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("scripts", get_object_vars($this), "id = " . $this->id . ";");
     } else {
         if (!$this->creationdate) {
             $this->creationdate = time();
         }
         $this->id = DigiplayDB::insert("scripts", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#9
0
 public function save()
 {
     if (!$this->track_title) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("log", get_object_vars($this), "id = " . $this->id . ";");
     } else {
         $this->datetime = time();
         if ($this->userid == NULL) {
             $this->userid = 0;
         }
         $this->id = DigiplayDB::insert("log", get_object_vars($this), "id");
     }
     return $this->id;
 }
示例#10
0
 public function save()
 {
     if (isset($this->id)) {
         DigiplayDB::update('jinglepkgs', get_object_vars($this), 'id = ' . $this->id);
     } else {
         if (!isset($this->name)) {
             return false;
         }
         if (!isset($this->enabled)) {
             $this->enabled = 'f';
         }
         if (!isset($this->archived)) {
             $this->archived = 'f';
         }
         $this->id = DigiplayDB::insert('jinglepkgs', get_object_vars($this), 'id');
     }
     return $this->id;
 }
             }
         } elseif ($_REQUEST['val'] == 'viewer') {
             if ($current[2] == '1') {
                 $new = '111';
             } else {
                 if ($current[1] == '1') {
                     $new = '110';
                 } else {
                     $new = '100';
                 }
             }
         } elseif ($_REQUEST['val'] == 'admin') {
             $new = '111';
         }
         $data = array('permissions' => $new);
         DigiplayDB::update("aw_sets_permissions", $data, "set_id = '" . $a->get_id() . "' AND user_id = '" . $user->get_id() . "'");
     } else {
         if ($_REQUEST['val'] == 'viewer') {
             $data = array('user_id' => $user->get_id(), 'set_id' => $a->get_id(), 'permissions' => '100');
             DigiplayDB::insert("aw_sets_permissions", $data);
         } elseif ($_REQUEST['val'] == 'editor') {
             $data = array('user_id' => $user->get_id(), 'set_id' => $a->get_id(), 'permissions' => '110');
             DigiplayDB::insert("aw_sets_permissions", $data);
         } elseif ($_REQUEST['val'] == 'admin') {
             $data = array('user_id' => $user->get_id(), 'set_id' => $a->get_id(), 'permissions' => '111');
             DigiplayDB::insert("aw_sets_permissions", $data);
         }
     }
 } else {
     exit(json_encode(array("error" => "User Not Found!")));
 }
示例#12
0
 public function fetch_from_trash()
 {
     return DigiplayDB::update("audiodir", array("dirid" => 2), "audioid = " . $this->id);
 }
示例#13
0
 public function delete()
 {
     $query = "DELETE FROM aw_items WHERE wall_id = '" . $this->id . "'";
     $result = DigiplayDB::query($query);
     $query = "DELETE FROM aw_walls WHERE id = '" . $this->id . "'";
     $result = DigiplayDB::query($query);
     $wallsInSet = DigiplayDB::select("* FROM aw_walls WHERE set_id = " . $this->get_set_id() . " ORDER BY page ASC", "Audiowall", true);
     foreach ($wallsInSet as $aw) {
         if ($aw->get_page() > $this->page) {
             $newValue = $aw->get_page() - 1;
             $newPage = array("page" => $newValue);
             DigiplayDB::update("aw_walls", $newPage, "set_id = " . $aw->get_set_id() . " AND id =" . $aw->get_id());
         }
     }
 }
<?php

if (Session::is_user()) {
    $set = AudiowallSets::get((int) $_REQUEST['awid']);
    if ($set->user_can_view()) {
        $data = array("val" => (int) $_REQUEST['awid']);
        $thisUserID = (int) $_REQUEST['userid'];
        DigiplayDB::update("usersconfigs", $data, "userid = " . $thisUserID . " AND configid = 1");
        if (Errors::occured()) {
            http_response_code(400);
            exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array"))));
            Errors::clear();
        } else {
            exit(json_encode(array('response' => 'success', 'id' => $data['val'])));
        }
    } else {
        http_response_code(403);
        exit(json_encode(array('error' => 'Permission denied.')));
    }
} else {
    http_response_code(403);
    exit(json_encode(array('error' => 'Permission denied.')));
}