Example #1
0
 public function set_val($val)
 {
     $result = DigiplayDB::update("configuration", array("val" => $val), "id = " . $this->id);
     if ($result) {
         return $this->val = $val;
     }
 }
Example #2
0
 public static function get_by_wall($wall)
 {
     $return = array();
     foreach (DigiplayDB::select("* FROM aw_items WHERE wall_id = :wall_id ORDER BY item ASC;", "AudiowallItem", true, array(":wall_id" => $wall->get_id())) as $item) {
         $return[$item->get_item()] = $item;
     }
     return $return;
 }
Example #3
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;
 }
Example #4
0
 public static function connect()
 {
     try {
         self::$connection = new PDO("pgsql:host=" . DATABASE_DPS_HOST . ";port=" . DATABASE_DPS_PORT . ";dbname=" . DATABASE_DPS_NAME . ";user="******"Database error: " . $e->getMessage(), E_USER_ERROR);
     }
 }
Example #5
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;
 }
Example #6
0
 public function del_from_track($track)
 {
     $result = DigiplayDB::delete("audiokeywords", "audioid = " . $track->get_id() . " AND keywordid = " . $this->id);
     $remaining = DigiplayDB::select("* FROM audiokeywords WHERE keywordid = " . $this->id);
     if (!$remaining) {
         DigiplayDB::delete("keywords", "id = " . $this->id);
     }
     return $result;
 }
Example #7
0
 public function del_from_track($track)
 {
     $result = DigiplayDB::delete("audioartists", "audioid = " . $track->get_id() . " AND artistid = " . $this->id);
     $remaining = DigiplayDB::select("* FROM audioartists WHERE artistid = " . $this->id . ";");
     if (!$remaining) {
         $result = DigiplayDB::delete("artists", "id = " . $this->id);
     }
     return (bool) $result;
 }
Example #8
0
 public function save()
 {
     if (!$this->comment) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("info_fault_comments", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("info_fault_comments", get_object_vars($this), "id");
     }
     return $this->id;
 }
Example #9
0
 public function save()
 {
     if (!$this->status) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("info_status_statuses", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("info_status_statuses", get_object_vars($this), "id");
     }
     return $this->id;
 }
Example #10
0
 public static function get_tracks_of_the_day($count = 1)
 {
     $today = mktime(0, 0, 0, (int) date("n"), (int) date("j"), (int) date("Y"));
     srand($today / pi());
     $trackcount = DigiplayDB::select("count(*) FROM audio INNER JOIN audiodir ON audio.id=audiodir.audioid WHERE audio.import_date < " . $today . " AND audio.type = 1 AND audiodir.dirid = 2;");
     $tracks = array();
     for ($i = 1; $i <= $count; $i++) {
         $track = rand(0, $trackcount);
         $sql = $tracks[] = self::get_by_id(DigiplayDB::select("audio.id FROM audio INNER JOIN audiodir ON audio.id=audiodir.audioid WHERE audio.import_date < " . $today . " AND audio.type = 1 AND audiodir.dirid = 2 ORDER BY audio.id LIMIT 1 OFFSET " . $track . ";"));
     }
     return $tracks;
 }
Example #11
0
 public function save()
 {
     if (!$this->name) {
         return false;
     }
     if ($this->id) {
         DigiplayDB::update("albums", get_object_vars($this), "id = " . $this->id);
     } else {
         $this->id = DigiplayDB::insert("albums", get_object_vars($this), "id");
     }
     return $this->id;
 }
Example #12
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;
 }
Example #13
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;
 }
Example #14
0
 public static function get_by_parent($parent)
 {
     return DigiplayDB::select("* FROM groups WHERE parentid " . ($parent ? "= " . $parent->get_id() : "IS NULL"), "Group", true);
 }
Example #15
0
 public static function print_page($content)
 {
     $start_time = microtime(true);
     if (strlen(LINK_PATH) > 0) {
         $sitePathArray = explode("/", LINK_PATH);
         for ($i = 0; $i < count($sitePathArray); $i++) {
             $file = FILE_ROOT . implode("/", array_slice($sitePathArray, 0, $i + 1)) . "/sidebar.php";
             if (file_exists($file)) {
                 include $file;
                 MainTemplate::set_sidebar(sidebar());
                 MainTemplate::set_menu(menu());
             }
         }
         unset($sitePathArray, $i, $file);
     }
     $main_menu = new Menu();
     $main_menu->add_many(array("music", "Music Library", "music"), array("playlists", "Playlists", "th-list"), array("audiowalls", "Audiowalls", "th"), array("files", "Files", "folder-open"), array("showplans", "Show Planning", "tasks"));
     if (Session::is_admin()) {
         $main_menu->add("admin", "Admin", "cog");
     }
     $site_path_array = explode("/", LINK_PATH);
     $main_menu->set_active($site_path_array[0]);
     header("Content-Type: text/html; charset=utf-8");
     $return = "<!DOCTYPE html> \n<html> \n\t<head> \n\t\t<title>RaW Digiplay";
     if (Output::get_title() != 'Untitled Page') {
         $return .= " - " . Output::get_title();
     }
     $return .= "</title> \n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n\t\t<script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"" . LINK_ABS . "js/bootstrap.min.js\"></script>\n\t\t";
     if (isset($_REQUEST["theme"])) {
         $return .= "<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/bootswatch/3.0.0/" . $_REQUEST["theme"] . "/bootstrap.min.css\">\n";
     } else {
         $return .= "<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/bootstrap.min.css\">\n";
     }
     if (count(Output::get_stylesheets()) > 0) {
         foreach (Output::get_stylesheets() as $src) {
             $return .= "<link href=\"" . $src . "\" rel=\"stylesheet\" type=\"text/css\">\n";
         }
     }
     if (count(Output::get_scripts()) > 0) {
         foreach (Output::get_scripts() as $src) {
             $return .= "<script src=\"" . $src . "\" type=\"text/javascript\"></script>\n";
         }
     }
     if (count(Output::get_feeds()) > 0) {
         foreach (Output::get_feeds() as $feed) {
             $return .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $feed['title'] . "\" href=\"" . $feed['url'] . "\">\n";
         }
     }
     if (self::$barebones == false) {
         $return .= "\n\t\t\t<link rel=\"stylesheet\" href=\"" . LINK_ABS . "css/style.css\">\n\t\t\t<script src=\"" . LINK_ABS . "js/main.js\" type=\"text/javascript\"></script>\n\t\t\t";
     }
     $return .= "\t</head>\n\t<body" . (self::$body_class ? " class=\"" . self::$body_class . "\"" : "") . ">";
     if (self::$barebones == false) {
         $return .= "\n\t\t<div id=\"wrap\">\n\t\t\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n\t\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"navbar-header\">\n\t\t\t\t\t<button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-dps-collapse\">\n      \t\t\t\t\t\t<span class=\"sr-only\">Toggle navigation</span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n      \t\t\t\t\t\t<span class=\"icon-bar\"></span>\n    \t\t\t\t\t</button>\n\t    \t\t\t\t<a class=\"navbar-brand hidden-sm\" href=\"" . LINK_ABS . "\">Digiplay</a>\n\t\t\t\t\t<div class=\"navbar-spinner hidden\">\n\t\t\t\t\t\t<svg class=\"spinner\" width=\"25px\" height=\"25px\" viewBox=\"0 0 66 66\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t<circle class=\"path\" fill=\"none\" stroke-width=\"8\" stroke-linecap=\"round\" cx=\"33\" cy=\"33\" r=\"29\"></circle>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"navbar-collapse collapse navbar-dps-collapse\">" . $main_menu->output(LINK_ABS, 6, "nav navbar-nav");
         if (Session::is_user()) {
             $return .= "\n\t\t\t\t\t<ul class=\"nav search-pull-right hidden-sm\">\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<form class=\"navbar-form\" action=\"" . LINK_ABS . "music/search\" method=\"GET\" role=\"search\">\n\t\t\t\t\t\t\t\t<div class=\"form-group\">\n\t            \t\t\t\t\t<input type=\"text\" class=\"form-control search-query\" placeholder=\"Search Tracks\" name=\"q\" autocomplete=\"off\">\n\t            \t\t\t\t</div>\n\t            \t\t\t</form>\n\t            \t\t</li>\n\t            \t\t<li>\n\t\t          \t\t\t<ul id=\"quick-search\" class=\"dropdown-menu pull-right\"></ul>\n\t\t          \t\t</li>\n\t\t          \t</ul>\n\t\t          \t";
         }
         $return .= "\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</nav>\n\t\t\t" . (isset(self::$feature_html) ? "<div class=\"jumbotron" . (isset(self::$feature_image) ? " feature-image\" style=\"background-image: url('" . self::$feature_image . "')\"" : "\"") . "><div class=\"container\">" . self::$feature_html . "</div></div>" : "") . "<div class=\"container\">";
         if (Output::get_title() != 'Untitled Page') {
             $return .= "\n\t\t\t\t<div class=\"page-header\">\n\t\t\t\t\t<h2>" . Output::get_title();
             if (isset(self::$subtitle)) {
                 $return .= " <small>" . self::$subtitle . "</small>";
             }
             $return .= "</h2>\n\t\t\t\t</div>";
         }
         $return .= "\n\t\t\t\t<div class=\"row\">";
         if (isset(self::$sidebar) || isset(self::$menu)) {
             $return .= "\n\t\t\t\t<div class=\"col-md-3\">";
             if (isset(self::$menu)) {
                 $return .= self::$menu;
             }
             if (isset(self::$sidebar)) {
                 $return .= "\t\n\t\t\t\t\t<div class=\"panel panel-noborder visible-md visible-lg\">\n\t\t\t\t\t\t<div class=\"panel-body\">" . self::$sidebar . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
             }
             $return .= "\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-9\">";
         } else {
             $return .= "\n\t\t\t\t<div class=\"col-md-12\">";
         }
     }
     $return .= $content;
     if (self::$barebones == false) {
         $return .= "\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>";
         if (Session::is_user()) {
             $return .= Bootstrap::modal("logout-modal", "You'll lose any unsaved changes on this page.", "Log out?", "<a class=\"btn btn-primary\" href=\"" . LINK_ABS . "ajax/logout.php\">Yes, log out</a>");
         }
         $return .= "\n\t\t<div id=\"push\"></div>\n\t</div>\n\t\t<footer class=\"jumbotron\">\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t\t<p class=\"text-muted credit\">";
         if (Session::is_user()) {
             $return .= "Logged in as " . Session::get_username() . ". <a href=\"#logout-modal\" data-toggle=\"modal\">Logout</a>. ";
         } else {
             $return .= "Not logged in. ";
         }
         $return .= "Copyright &copy; 2011-" . date("y") . " Radio Warwick\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t\t\t<a href=\"" . LINK_ABS . "\"><img src=\"" . LINK_ABS . "img/footer_logo.png\" alt=\"RaW 1251AM\" class=\"pull-right\"/></a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</footer>";
     }
     $return .= "\n\t<!-- Page generated in " . (microtime(true) - START_TIME) . " seconds. " . DigiplayDB::get_querycount() . " database queries ran in " . DigiplayDB::get_querytime() . " seconds. -->\n\t</body> \n</html>";
     return $return;
 }
Example #16
0
 public static function count()
 {
     return DigiplayDB::select("count(id) from aw_sets", null, false);
 }
Example #17
0
 public static function get_newest($num = 10)
 {
     return DigiplayDB::select("* FROM audio WHERE type = " . AudioTypes::get("Jingle")->get_id() . " ORDER BY id DESC LIMIT " . $num . ";", "Track", true);
 }
Example #18
0
 public static function find_in_dir($dir, $name)
 {
     return DigiplayDB::select("* FROM v_tree_dir WHERE parent = :parent AND name = :name", "File", false, array(":parent" => $dir->get_id(), ":name" => $name));
 }
        foreach ($walls as $wall) {
            $w++;
        }
        if ($_REQUEST['name'] == "") {
            $name = "New Page";
        } else {
            $name = $_REQUEST['name'];
        }
        if ($_REQUEST['desc'] == "") {
            $desc = "New Page";
        } else {
            $desc = $_REQUEST['desc'];
        }
        $table = "aw_walls";
        $data = array('id' => NULL, 'name' => pg_escape_string($name), 'set_id' => $_REQUEST['setid'], 'page' => $w, 'description' => pg_escape_string($desc));
        DigiplayDB::insert($table, $data);
        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' => $a->get_id())));
        }
    } else {
        http_response_code(403);
        exit(json_encode(array('error' => 'Permission denied.')));
    }
} else {
    http_response_code(403);
    exit(json_encode(array('error' => 'Permission denied.')));
}
Example #20
0
 public static function get_by_md5($md5)
 {
     $type = DigiplayDB::select("type FROM audio WHERE md5 = '" . $md5 . "'");
     if ($type) {
         if ($type == 1) {
             return Tracks::get_by_md5($md5);
         } else {
             if ($type == 2) {
                 return Jingles::get_by_md5($md5);
             } else {
                 if ($type == 3) {
                     return Adverts::get_by_md5($md5);
                 } else {
                     if ($type == 4) {
                         return Prerecs::get_by_md5($md5);
                     }
                 }
             }
         }
     }
 }
Example #21
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());
         }
     }
 }
                 }
             } 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!")));
     }
     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' => $a->get_id())));
     }
 } else {
     http_response_code(403);
     exit(json_encode(array('error' => 'Permission denied.')));
Example #23
0
 public static function prerecords($query, $limit = 0, $offset = 0)
 {
     $query_str = "id, count(*) OVER() AS full_count FROM v_audio_prerec WHERE to_tsvector(title)::tsvector @@ plainto_tsquery(:query)::tsquery ORDER BY id DESC";
     if ($limit > 0) {
         $query_str .= " LIMIT " . $limit;
     }
     if ($offset > 0) {
         $query_str .= " OFFSET " . $offset;
     }
     $result = DigiplayDB::select($query_str, NULL, true, array(":query" => $query));
     if ($result === false) {
         throw new UserError("Query failed: {$query_str}");
     }
     $results = array();
     $total = 0;
     if (count($result) > 0) {
         foreach ($result as $res) {
             $results[] = $res["id"];
             $total = $res["full_count"];
         }
     }
     $return = array("results" => $results, "total" => $total);
     return count($results) > 0 ? $return : NULL;
 }
Example #24
0
 public static function get_by_name($name)
 {
     return DigiplayDB::select("* FROM audiotypes WHERE name = :name", "AudioType", false, $name);
 }
Example #25
0
<?php

$session = Session::get_user();
$aw = AudiowallSets::get_by_id(pg_escape_string($_REQUEST['setid']));
$sessionpermissions = $aw->get_user_permissions($session->get_id());
if ($sessionpermissions[2] == '1' || Session::is_group_user('Audiowalls Admin')) {
    $ownerid = DigiplayDB::select("user_id FROM aw_sets_owner WHERE set_id = '" . $aw->get_id() . "'");
    if (isset($ownerid)) {
        $user = Users::get_by_id($ownerid);
        $username = $user->get_display_name();
    } else {
        $username = "";
    }
    require_once 'pre.php';
    Output::add_script("../aw.js");
    Output::set_title("Audiowall Users");
    MainTemplate::set_subtitle("<span style=\"margin-right:20px;\">Set: " . $aw->get_name() . "</span><span style=\"margin-right:20px;\">Owner: " . $username . "</span><span id=\"editor_edit_buttons\"><a href=\"#\" class=\"btn btn-success\">Add Viewer</a></span>");
    echo "<style type=\"text/css\">\n\ttable { font-size:1.2em; }\n\tthead { display:none; }\n\t.description { font-size:0.8em; font-style:italic; }\n\t.hover-info { display:none; }\n\t.table tbody tr.success td { background-color: #DFF0D8; }\n\t</style>";
    echo "<table class=\"table table-striped\" cellspacing=\"0\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th></th>\n\t\t\t\t\t\t<th style=\"width:65px\"></th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead><tbody>";
    $aw_set = AudiowallSets::get_by_id($_REQUEST['setid']);
    $users = $aw_set->get_users_with_permissions();
    if (!is_null($users) && count($users) > 1) {
        foreach ($users as $user) {
            $userclass = Users::get_by_id($user->get_id());
            $username = $userclass->get_username();
            $permissions = $aw_set->get_user_permissions($user->get_id());
            if ($permissions[0] == "1" && $permissions[1] == '0') {
                echo "<tr><td><strong>" . $username . "</strong></td>";
                echo "<td class=\"delete-aw-btn\" style=\"width:65px\"><a href=\"#\" class=\"btn btn-danger\">Delete</a></td>";
                echo "</td></tr>";
            }
Example #26
0
 public static function count()
 {
     return DigiplayDB::select("COUNT(id) FROM users WHERE id > 4", NULL, false);
 }
Example #27
0
 public static function get_by_id($id)
 {
     return DigiplayDB::select("* FROM info_status WHERE id = " . $id, "Status");
 }
Example #28
0
.description { font-size:0.8em; font-style:italic; }
.hover-info { display:none; }
.table tbody tr.success td { background-color: #DFF0D8; }
</style>
<?php 
echo "\t<div class=\"row\"><div class=\"col-md-3\"><div class=\"well\"><p><a href=\"#\" class=\"btn btn-success\" id=\"create\">Create New Audiowall</a></p><p>An Audiowall is a 3x4 grid of buttons in Digiplay which play audio when pressed. They are displayed on the right hand side of the touchscreen in the studio. The top audiowall is set for everyone and contains core station imaging, promos and beds. The bottom audiowall can be set on this page, and may contain jingles and other audio specific to your show.</p></div></div><div class=\"col-md-9\">\t<table class=\"table table-striped\" cellspacing=\"0\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th></th>\n\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t<th style=\"width:65px\"></th>\n\t\t\t\t\t<th style=\"width:185px\"></th>\n\t\t\t\t</tr>\n\t\t\t</thead><tbody>";
foreach ($sets as $set) {
    if (!$set->user_can_view() && !Session::is_group_user('Audiowalls Admin')) {
        continue;
    }
    echo "<tr" . ($set->get_id() == $active ? ' class="success"' : '') . "><td class=\"wall-info\" >";
    if ($set->user_can_delete()) {
        echo "<a href=\"users/users-viewers.php?setid=" . $set->get_id() . "\">" . Bootstrap::glyphicon("info-sign") . "</a>";
    }
    echo "</td><td><strong>" . $set->get_name() . "</strong><br /><span class=\"description\">" . $set->get_description() . "</span></td>";
    $station_aw = DigiplayDB::select("val FROM configuration WHERE parameter = 'station_aw_set' AND location = '1'");
    if (!($set->get_id() == (int) $station_aw)) {
        if ($set->user_can_delete() || Session::is_group_user('Audiowalls Admin')) {
            echo "<td class=\"delete-aw-btn\" data-aw-name=\"" . $set->get_name() . "\" data-dps-set-id=\"" . $set->get_id() . "\" style=\"width:65px\"><a href=\"#\" class=\"btn btn-danger\">Delete</a></td>";
        } else {
            echo "<td style=\"width:65px\"></td>";
        }
    } else {
        echo "<td style=\"width:65px\"></td>";
    }
    if ($set->user_can_edit() || Session::is_group_user('Audiowalls Admin')) {
        echo "<td style=\"width:65px\"><a href=\"edit.php?id=" . $set->get_id() . "\" class=\"btn btn-primary\">Edit</a></td>";
    } else {
        echo "<td style=\"width:65px\"></td>";
    }
    echo "<td style=\"width:185px\">";
Example #29
0
 public static function count()
 {
     return DigiplayDB::select("COUNT(id) FROM requests");
 }
Example #30
0
if (Session::is_group_user("Music Admin")) {
    $track_id = (int) $_REQUEST["id"];
    $track = Audio::get_by_id($track_id);
    $md5 = $track->get_md5();
    $archive = $track->get_archive();
    $dir = $archive->get_localpath();
    $folder = $md5[0];
    $files = array(0 => ".flac", 1 => ".xml");
    $tables = array(0 => 'audioartists', 1 => 'audiocomments', 2 => 'audiodir', 3 => 'audiogroups', 4 => 'audiojinglepkgs', 5 => 'audiokeywords', 6 => 'audioplaylists', 7 => 'audiousers');
    $wherepre = "audioid = " . $track_id;
    $where = pg_escape_string($wherepre);
    $track_id_escaped = pg_escape_string($track_id);
    DigiplayDB::delete('audio', "id = " . $track_id_escaped);
    foreach ($tables as $table) {
        DigiplayDB::delete($table, $where);
    }
    foreach ($files as $file) {
        $path = $dir . "/" . $folder . "/" . $md5 . $file;
        $cmd = "rm " . $path;
        shell_exec($cmd);
    }
    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' => 1)));
    }
} else {
    http_response_code(403);