コード例 #1
0
ファイル: radio.php プロジェクト: Rojk/hamsterpaj
     if (!isset($_POST['program']) || !is_numeric($_POST['program'])) {
         throw new Exception('Du måste välja ett program');
     }
     if (!isset($_POST['starttime']) || strlen($_POST['endtime']) < 0) {
         throw new Exception('Du måste sätta en starttid');
     }
     if (!isset($_POST['endtime']) || strlen($_POST['starttime']) < 0) {
         throw new Exception('Du måste sätta en sluttid');
     }
     if ($_POST['starttime'] >= $_POST['endtime']) {
         throw new Exception('Det är ju bra om programmet har börjat innan det slutar om man säger så...');
     }
     $options['program_id'] = $_POST['program'];
     $options['starttime'] = $_POST['starttime'];
     $options['endtime'] = $_POST['endtime'];
     radio_schedule_add($options);
     echo '<div class="form_notice_success">';
     echo 'Programmet inplanerat';
     echo '</div>';
     break;
 case schedule_remove:
     if (!is_privilegied('radio_sender')) {
         throw new Exception('Du har inte privilegier att ta bort sändningar');
     }
     if (!isset($_GET['id'])) {
         throw new Exception('Inget ID kom med');
     }
     if (!is_numeric($_GET['id'])) {
         throw new Exception('ID\'t är inte numeriskt');
     }
     $options['id'] = $_GET['id'];
コード例 #2
0
ファイル: index.php プロジェクト: Rambutan/hamsterpaj
                 if (!isset($_POST['name'], $_POST['dj'], $_POST['sendtime'], $_POST['information'])) {
                     throw new Exception('Getmjölk?');
                 }
                 if (strlen($_POST['name']) < 0 || !is_numeric($_POST['dj']) || strlen($_POST['information']) < 0) {
                     throw new Exception('Något fält var ju INTE korrekt ifyllt säger jag ju då.');
                 }
                 radio_program_add(array('name' => $_POST['name'], 'sendtime' => $_POST['sendtime'], 'information' => $_POST['information'], 'dj' => $_POST['dj']));
                 break;
             case 'schedule_add':
                 if (!isset($_POST['program'], $_POST['starttime'], $_POST['endtime'])) {
                     throw new Exception('Getmjölk i soppan?');
                 }
                 if (strlen($_POST['starttime']) < 0 || !is_numeric($_POST['program']) || strlen($_POST['endtime']) < 0) {
                     throw new Exception('Något fält var ju INTE korrekt ifyllt säger jag ju då.');
                 }
                 radio_schedule_add(array('program_id' => $_POST['program'], 'starttime' => $_POST['starttime'], 'endtime' => $_POST['endtime']));
                 break;
         }
     } else {
         throw new Exception('Haxx0r!');
     }
     break;
 case 'crew':
     $options['order-by'] = 'username';
     $options['order-direction'] = 'ASC';
     $radio_djs = radio_djs_fetch($options);
     foreach ($radio_djs as $radio_dj) {
         $out .= '<div class="radio_crew">' . "\n";
         $out .= insert_avatar($radio_dj['user_id']) . "\n";
         $out .= '<h2>' . $radio_dj['username'] . '</h2>' . "\n";
         if (is_privilegied('radio_admin')) {