Beispiel #1
0
 function __construct($host, $port = null)
 {
     $this->host = $host;
     $this->ip = _or(setting('BackendServerIP', $this->host), $host);
     // If the IP contains a ':' It's likely an IPv6 address so enclose it in '[]'
     if (strpos($this->ip, ":") > 0) {
         $this->ip = "[" . $this->ip . "]";
     }
     $this->port = _or($port, _or(setting('BackendServerPort', $this->host), 6543));
     $this->port_http = _or(setting('BackendStatusPort', $this->host), _or(setting('BackendStatusPort'), 6544));
 }
Beispiel #2
0
 // Set things as the user requested
 $schedule->profile = $_POST['profile'];
 $schedule->recgroup = $_POST['recgroup'];
 $schedule->storagegroup = $_POST['storagegroup'];
 $schedule->playgroup = $_POST['playgroup'];
 $schedule->autoexpire = $_POST['autoexpire'] ? 1 : 0;
 $schedule->autocommflag = $_POST['autocommflag'] ? 1 : 0;
 $schedule->autouserjob1 = $_POST['autouserjob1'] ? 1 : 0;
 $schedule->autouserjob2 = $_POST['autouserjob2'] ? 1 : 0;
 $schedule->autouserjob3 = $_POST['autouserjob3'] ? 1 : 0;
 $schedule->autouserjob4 = $_POST['autouserjob4'] ? 1 : 0;
 $schedule->autometadata = $_POST['autometadata'] ? 1 : 0;
 $schedule->maxnewest = $_POST['maxnewest'] ? 1 : 0;
 $schedule->inactive = $_POST['inactive'] ? 1 : 0;
 $schedule->dupin = _or($_POST['dupin'] + $_POST['dupin2'], dupsin_all);
 $schedule->dupmethod = _or($_POST['dupmethod'], 6);
 $schedule->recpriority = intval($_POST['recpriority']);
 $schedule->maxepisodes = intval($_POST['maxepisodes']);
 $schedule->startoffset = intval($_POST['startoffset']);
 $schedule->endoffset = intval($_POST['endoffset']);
 $schedule->autotranscode = $_POST['autotranscode'] ? 1 : 0;
 $schedule->transcoder = $_POST['transcoder'];
 $schedule->prefinput = $_POST['prefinput'];
 $schedule->inetref = $_POST['inetref'];
 $schedule->season = intval($_POST['season']);
 $schedule->episode = intval($_POST['episode']);
 // Keep track of the parent recording for overrides
 if ($_POST['record'] == rectype_override) {
     $schedule->parentid = $schedule->recordid;
 }
 // Search schedules saved here will create a new standard schedule,
Beispiel #3
0
    }
    echo $schedule->channel->name;
    ?>
</td>
    <td nowrap><?php 
    echo _or($schedule->profile, '&nbsp;');
    ?>
</td>
    <td nowrap>
        <?php 
    global $Transcoders;
    echo _or($Transcoders[$schedule->transcoder], '&nbsp;');
    ?>
    </td>
    <td nowrap><?php 
    echo _or($schedule->recgroup, '&nbsp;');
    ?>
</td>
    <td nowrap><?php 
    echo $schedule->texttype;
    ?>
</td>
</tr><?php 
    $prev_group = $cur_group;
}
?>

</table>
<?php 
// Print the page footer
require 'modules/_shared/tmpl/' . tmpl . '/footer.php';
Beispiel #4
0
    case 'mp3':
        $mime = 'audio/mpeg';
        break;
    case 'ogg':
        $mime = 'application/ogg';
        break;
    case 'm4a':
        $mime = 'audio/mp4a-latm';
        break;
    default:
        $mime = 'application/octet-stream';
}
header('Content-Type: ' . $mime);
// Send the filename
header('Content-Disposition: filename="' . $fname . '"');
// Base music path
$basepath = setting('MusicLocation', hostname);
// Local file?
if (file_exists("{$basepath}/{$path}/{$fname}")) {
    header('Content-Length: ' . filesize("{$basepath}/{$path}/{$fname}"));
    readfile("{$basepath}/{$path}/{$fname}");
} else {
    $Master_Host = setting('MasterServerIP');
    $port = _or(get_backend_setting('BackendStatusPort', $Master_Host), get_backend_setting('BackendStatusPort'));
    if (stripos($Master_Host, ':') !== false) {
        $Master_Host = '[' . $Master_Host . ']';
    }
    readfile("http://{$Master_Host}:{$port}/{$xml_command}?Id=" . $xml_id);
}
// Nothing else to do
exit;
Beispiel #5
0
 public function __construct($data)
 {
     global $db;
     // This is a mythbackend-formatted program - info about this data structure is stored in libs/libmyth/programinfo.cpp
     if (!isset($data['chanid']) && isset($data[0])) {
         // Load the remaining info we got from mythbackend
         $this->title = trim($data[0]);
         # program name/title
         $this->subtitle = $data[1];
         # episode name
         $this->description = $data[2];
         # episode description
         $this->season = $data[3];
         $this->episode = $data[4];
         $this->total_episodes = $data[5];
         $this->syndicatedepisodenumber = $data[6];
         $this->category = $data[7];
         $this->chanid = $data[8];
         # mysql chanid
         $this->channum = $data[9];
         $this->callsign = $data[10];
         $this->channame = $data[11];
         $this->filename = $data[12];
         $this->filesize = $data[13];
         $this->starttime = $data[14];
         # show start-time
         $this->endtime = $data[15];
         # show end-time
         $this->findid = $data[16];
         $this->hostname = $data[17];
         $this->sourceid = $data[18];
         $this->cardid = $data[19];
         $this->inputid = $data[20];
         $this->recpriority = $data[21];
         $this->recstatus = $data[22];
         $this->recordid = $data[23];
         $this->rectype = $data[24];
         $this->dupin = $data[25];
         $this->dupmethod = $data[26];
         $this->recstartts = $data[27];
         # ACTUAL start time (also maps to recorded.starttime)
         $this->recendts = $data[28];
         # ACTUAL end time
         $this->progflags = $data[29];
         $this->recgroup = $data[30];
         $this->outputfilters = $data[31];
         $this->seriesid = $data[32];
         $this->programid = $data[33];
         $this->inetref = $data[34];
         $this->lastmodified = $data[35];
         $this->stars = $data[36];
         $this->airdate = $data[37];
         $this->playgroup = $data[38];
         $this->recpriority2 = $data[39];
         $this->parentid = $data[40];
         $this->storagegroup = $data[41];
         $this->audioproperties = $data[42];
         $this->videoproperties = $data[43];
         $this->subtitletype = $data[44];
         $this->year = $data[45];
         $this->partnumber = $data[46];
         $this->parttotal = $data[47];
         $this->category_type = $data[48];
         $this->recordedid = $data[49];
         // Is this a previously-recorded program?
         if (!empty($this->filename)) {
             $this->url = video_url($this);
             // get download info
         }
         // Assign the program flags
         $this->has_commflag = $this->progflags & 0x1 ? true : false;
         // FL_COMMFLAG       = 0x00000001
         $this->has_cutlist = $this->progflags & 0x2 ? true : false;
         // FL_CUTLIST        = 0x00000002
         $this->auto_expire = $this->progflags & 0x4 ? true : false;
         // FL_AUTOEXP        = 0x00000004
         $this->is_editing = $this->progflags & 0x8 ? true : false;
         // FL_EDITING        = 0x00000008
         $this->bookmark = $this->progflags & 0x10 ? true : false;
         // FL_BOOKMARK       = 0x00000010
         $this->is_recording = $this->progflags & 0x100000 ? true : false;
         // FL_INUSERECORDING = 0x00100000
         $this->is_playing = $this->progflags & 0x200000 ? true : false;
         // FL_INUSEPLAYING   = 0x00200000
         $this->is_transcoded = $this->progflags & 0x100 ? true : false;
         // FL_TRANSCODED     = 0x00000100
         $this->is_watched = $this->progflags & 0x200 ? true : false;
         // FL_WATCHED        = 0x00000200
         // Can be deleted?
         $this->can_delete = !$this->is_recording && !$this->is_playing || $this->recgroup != 'LiveTV';
         // Add a generic "will record" variable, too
         $this->will_record = $this->rectype && $this->rectype != rectype_dontrec ? true : false;
     } else {
         if (in_array($data['airdate'], array('0000-00-00', '0000', '1900-01-01'))) {
             $this->airdate = $data['originalairdate'];
         } else {
             $this->airdate = $data['airdate'];
         }
         $this->category = _or($data['category'], t('Unknown'));
         $this->category_type = _or($data['category_type'], t('Unknown'));
         $this->chanid = $data['chanid'];
         $this->description = $data['description'];
         $this->endtime = $data['endtime_unix'];
         $this->previouslyshown = $data['previouslyshown'];
         $this->programid = $data['programid'];
         $this->rater = $data['rater'];
         $this->rating = $data['rating'];
         $this->seriesid = $data['seriesid'];
         $this->showtype = $data['showtype'];
         $this->stars = $data['stars'];
         $this->starttime = $data['starttime_unix'];
         $this->subtitle = $data['subtitle'];
         $this->subtitled = $data['subtitled'];
         $this->title = $data['title'];
         $this->partnumber = $data['partnumber'];
         $this->parttotal = $data['parttotal'];
         $this->colorcode = $data['colorcode'];
         $this->syndicatedepisodenumber = $data['syndicatedepisodenumber'];
         $this->title_pronounce = $data['title_pronounce'];
         $this->recstatus = $data['recstatus'];
         $this->recordedid = $data['recordedid'];
         // These db fields should really get renamed...
         $this->audioproperties = $data['stereo'];
         $this->videoproperties = $data['hdtv'];
         $this->subtitletype = $data['closecaptioned'];
     }
     // Assign shortcut names to the new audio/video/subtitle property flags
     $this->stereo = $this->audioproperties & 0x1;
     $this->mono = $this->audioproperties & 0x2;
     $this->surround = $this->audioproperties & 0x4;
     $this->dolby = $this->audioproperties & 0x8;
     $this->audiohardhear = $this->audioproperties & 0x10;
     $this->audiovisimpair = $this->audioproperties & 0x20;
     $this->hdtv = $this->videoproperties & 0x1;
     $this->widescreen = $this->videoproperties & 0x2;
     $this->avc = $this->videoproperties & 0x4;
     $this->hd_ready = $this->videoproperties & 0x8;
     $this->fullhd = $this->videoproperties & 0x10;
     $this->damaged = $this->videoproperties & 0x20;
     $this->closecaptioned = $this->subtitletype & 0x1;
     $this->has_subtitles = $this->subtitletype & 0x2;
     $this->subtitled = $this->subtitletype & 0x4;
     $this->deaf_signed = $this->subtitletype & 0x8;
     // Generate the star string, since mysql has issues with REPEAT() and
     // decimals, and the backend doesn't do it for us, anyway.
     $this->starstring = @str_repeat(star_character, intVal($this->stars * max_stars));
     $frac = $this->stars * max_stars - intVal($this->stars * max_stars);
     if ($frac >= 0.75) {
         $this->starstring .= '&frac34;';
     } elseif ($frac >= 0.5) {
         $this->starstring .= '&frac12;';
     } elseif ($frac >= 0.25) {
         $this->starstring .= '&frac14;';
     }
     // Get the name of the input
     if ($this->inputid) {
         $this->inputname = $db->query_col('SELECT displayname
                                              FROM capturecard
                                             WHERE cardid=?', $this->inputid);
     } else {
         $this->inputname = $db->query_col('SELECT inputname
                                              FROM recorded
                                             WHERE recordedid=?', $this->recordedid);
     }
     // Turn recstatus into a word
     if (isset($this->recstatus) && $GLOBALS['RecStatus_Types'][$this->recstatus]) {
         $this->recstatus_orig = $this->recstatus;
         $this->recstatus = $GLOBALS['RecStatus_Types'][$this->recstatus];
         $this->conflicting = $this->recstatus == 'Conflict';
         # conflicts with another scheduled recording?
         $this->recording = $this->recstatus == 'WillRecord';
         # scheduled to record?
     }
     // No longer a null column, so check for blank entries
     if (in_array($this->airdate, array('0000-00-00', '0000', '1900-01-01'))) {
         $this->airdate = NULL;
     }
     // Do we have a chanid?  Load some info about it
     if ($this->chanid && !isset($this->channel)) {
         $this->channel =& Channel::find($this->chanid);
     }
     // Calculate the duration
     if ($this->recendts) {
         $this->length = $this->recendts - $this->recstartts;
     } else {
         $this->length = $this->endtime - $this->starttime;
     }
     // A special recstatus for shows that this was manually set to record
     if ($this->rectype == rectype_override) {
         $this->recstatus = 'ForceRecord';
     }
     // Find out which css category this program falls into
     if ($this->chanid != '') {
         $this->css_class = category_class($this);
     }
     // Create the fancy description
     $this->update_fancy_desc();
 }
Beispiel #6
0
                            .' create a symlink to your Coverart storage directory at'
                            .' data/video_covers in order to use the video artwork portions'
                            .' of MythWeb.');
            }
            $ret = @symlink($artwork_dir, 'data/video_covers');
            if (!$ret) {
                custom_error("Could not create a symlink to $dir, the local MythVideo artwork"
                            .' directory for this hostname ('.hostname.').  Please create a'
                            .' symlink to your MythVideo directory at data/video_covers in order to'
                            .' use the video artwork portions of MythWeb.');
            }
        }
    }
*/
define('video_img_height', _or(setting('web_video_thumbnail_height', hostname), 140));
define('video_img_width', _or(setting('web_video_thumbnail_width', hostname), 94));
// Load a custom page
switch ($Path[1]) {
    case 'edit':
        require_once 'modules/video/edit.php';
        exit;
        //// this is probably doing bad things
        //        case 'imdb':
        //            require_once 'modules/video/imdb.php';
        //            exit;
        //// this is broken, so disable it
        //        case 'scan':
        //            require_once 'modules/video/scan.php';
        //            exit;
        //// new stuff
    //// this is probably doing bad things
    ?>
</td>
    <td class="x-type"><?php 
    echo $schedule->texttype;
    ?>
</td>
    <td class="x-sgroup"><?php 
    echo _or($schedule->storagegroup, '&nbsp;');
    ?>
</td>
    <td class="x-startoffset"><?php 
    echo _or($schedule->startoffset, '&nbsp;');
    ?>
</td>
    <td class="x-endoffset"><?php 
    echo _or($schedule->endoffset, '&nbsp;');
    ?>
</td>
    <td class="x-lastrec"><?php 
    echo _or($schedule->last_record, '&nbsp;');
    ?>
</td>
</tr><?php 
    $prev_group = $cur_group;
}
?>

</table>
<?php 
// Print the page footer
require 'modules/_shared/tmpl/' . tmpl . '/footer.php';
<td class="small tv_Unknown" colspan="<?php 
echo _or($timeslots_used, 1);
?>
" valign="top"><?php 
echo t('NO DATA');
?>
</td>
    <td><input type="text" name="vbitrate"
         size="5" title="Video Bitrate"
         value="<?php 
echo html_entities(_or(setting('WebFLV_vb'), 256));
?>
" />
         kbps</td>
</tr><tr>
    <th><?php 
echo t('Audio Bitrate');
?>
:</th>
    <td><input type="text" name="abitrate"
         size="5" title="Audio Bitrate"
         value="<?php 
echo html_entities(_or(setting('WebFLV_ab'), 64));
?>
" />
         kbps</td>
</tr><tr>
    <td align="right"><input type="reset"  class="submit" value="<?php 
echo t('Reset');
?>
"></td>
    <td align="center"><input type="submit" class="submit" name="save" value="<?php 
echo t('Save');
?>
"></td>
</tr>
</table>
Beispiel #10
0
    }

    #path {
        position:           relative;
        padding:            1em;
        float:              left;
        background-color:   #102923;
        margin-top:         1em;
        margin-left:        1em;
        border:             1px solid black;
        min-width:          <?php 
echo _or(setting('web_video_thumbnail_width', hostname), 96) + 106;
?>
px;
        min-height:         <?php 
echo _or(setting('web_video_thumbnail_height', hostname), 140) + 28;
?>
px;
    }

    #path .active {
        color:              yellow;
    }

    #window {
        position:           fixed;
        left:               35%;
        right:              35%;
        width:              30%;
        top:                35%;
        background-color:   green;
Beispiel #11
0
 /**
  * The "details list" for recording schedules.  Very similar to that for
  * programs, but with a few extra checks, and some information arranged
  * differently.
 /**/
 public function details_list()
 {
     // Start the list, and print the title and schedule type
     $str = "<dl class=\"details_list\">\n" . "\t<dt>" . t('Title') . ":</dt>\n" . "\t<dd>" . html_entities($this->title) . "</dd>\n" . "\t<dt>" . t('Type') . ":</dt>\n" . "\t<dd>" . html_entities($this->texttype) . "</dd>\n";
     // Only show these fields for recording types where they're relevant
     if (in_array($this->type, array(rectype_once, rectype_daily, rectype_weekly, rectype_override, rectype_dontrec))) {
         // Airtime
         $str .= "\t<dt>" . t('Airtime') . ":</dt>\n" . "\t<dd>" . strftime($_SESSION['date_scheduled_popup'] . ', ' . $_SESSION['time_format'], $this->starttime) . ' to ' . strftime($_SESSION['time_format'], $this->endtime) . "</dd>\n";
         // Subtitle
         if (preg_match('/\\S/', $this->subtitle)) {
             $str .= "\t<dt>" . t('Subtitle') . ":</dt>\n" . "\t<dd>" . html_entities($this->subtitle) . "</dd>\n";
         }
         // Description
         if (preg_match('/\\S/', $this->description)) {
             $str .= "\t<dt>" . t('Description') . ":</dt>\n" . "\t<dd>" . nl2br(html_entities($this->description)) . "</dd>\n";
         }
         // Rating
         if (preg_match('/\\S/', $this->rating)) {
             $str .= "\t<dt>" . t('Rating') . ":</dt>\n" . "\t<dd>" . html_entities($this->rating) . "</dd>\n";
         }
     }
     // Category
     if (preg_match('/\\S/', $this->category)) {
         $str .= "\t<dt>" . t('Category') . ":</dt>\n" . "\t<dd>" . html_entities($this->category) . "</dd>\n";
     }
     // Rerun?
     if (!empty($this->previouslyshown)) {
         $str .= "\t<dt>" . t('Repeat') . ":</dt>\n" . "\t<dd>" . t('Yes') . "</dd>\n";
     }
     // Will be recorded at some point in the future?
     if (!empty($this->will_record)) {
         $str .= "\t<dt>" . t('Schedule') . ":</dt>\n" . "\t<dd>";
         switch ($this->type) {
             case rectype_once:
                 $str .= t('rectype-long: once');
                 break;
             case rectype_daily:
                 $str .= t('rectype-long: daily');
                 break;
             case rectype_always:
                 $str .= t('rectype-long: always');
                 break;
             case rectype_weekly:
                 $str .= t('rectype-long: weekly');
                 break;
             case rectype_findone:
                 $str .= t('rectype-long: findone');
                 break;
             case rectype_override:
                 $str .= t('rectype-long: override');
                 break;
             case rectype_dontrec:
                 $str .= t('rectype-long: dontrec');
                 break;
             default:
                 $str .= t('Unknown');
         }
         $str .= "</dd>\n";
     }
     // Which duplicate-checking method will be used
     if ($this->dupmethod > 0) {
         $str .= "\t<dt>" . t('Dup Method') . ":</dt>\n" . "\t<dd>";
         switch ($this->dupmethod) {
             case 1:
                 $str .= t('None');
                 break;
             case 2:
                 $str .= t('Subtitle');
                 break;
             case 4:
                 $str .= t('Description');
                 break;
             case 6:
                 $str .= t('Subtitle and Description');
                 break;
             case 8:
                 $str .= t('Subtitle then Description');
                 break;
             case 22:
                 $str .= t('Sub and Desc (Empty matches)');
                 break;
         }
         $str .= "</dd>\n";
     }
     // Recording Priority
     if (preg_match('/\\S/', $this->recpriority)) {
         $str .= "\t<dt>" . t('Recording Priority') . ":</dt>\n" . "\t<dd>" . html_entities($this->recpriority) . "</dd>\n";
     }
     // Profile
     if (preg_match('/\\S/', $this->profile)) {
         $str .= "\t<dt>" . t('Profile') . ":</dt>\n" . "\t<dd>" . html_entities($this->profile) . "</dd>\n";
     }
     // Transcoder
     if (preg_match('/\\S/', $this->transcoder)) {
         global $Transcoders;
         $str .= "\t<dt>" . t('Transcoder') . ":</dt>\n" . "\t<dd>" . html_entities(_or($Transcoders[$this->transcoder], '&nbsp;')) . "</dd>\n";
     }
     // Recording Group
     if (!empty($this->recgroup)) {
         $str .= "\t<dt>" . t('Recording Group') . ":</dt>\n" . "\t<dd>" . html_entities($this->recgroup) . "</dd>\n";
     }
     // Storage Group
     if (!empty($this->storagegroup)) {
         $str .= "\t<dt>" . t('Storage Group') . ":</dt>\n" . "\t<dd>" . html_entities($this->storagegroup) . "</dd>\n";
     }
     // Finish off the table and return
     $str .= "\n</dl>";
     return $str;
 }
Beispiel #12
0
if (isset($_REQUEST['RESET_TMPL'])) {
    $tmpl = _or($_REQUEST['RESET_TMPL'], 'default');
} elseif (isset($_REQUEST['RESET_TEMPLATE'])) {
    $tmpl = _or($_REQUEST['RESET_TEMPLATE'], 'default');
} elseif (isMobileUser()) {
    $tmpl = 'wap';
} elseif (preg_match('/^(Lynx|ELinks)/i', $_SERVER['HTTP_USER_AGENT'])) {
    $tmpl = 'lite';
}
if (!file_exists(modules_path . '/_shared/tmpl/' . $tmpl . '/welcome.php')) {
    $tmpl = 'default';
}
// Figure out the skin
$skin = $_SESSION['skin'];
if (isset($_REQUEST['RESET_SKIN'])) {
    $skin = _or($_REQUEST['RESET_SKIN'], 'default');
} elseif (isMobileUser()) {
    $skin = 'wap';
}
if (!file_exists('skins/' . $skin . '/img/')) {
    $skin = 'default';
}
// We do want to over-ride the template for some paths.
// We do this after setting because certain templates
// Should never be stored as the normal end-user view
if ($Path[0] == 'rss' || $Path[0] == 'ical') {
    $tmpl = $Path[0];
}
// And now we define the paths
define('skin', $skin);
define('skin_url', root_url . 'skins/' . skin . '/');
Beispiel #13
0
tv/channel/<?php 
    echo $channel->chanid, '/', $program->starttime;
    ?>
">
<?php 
    if ($_SESSION["show_channel_icons"] == true && !empty($channel->icon)) {
        ?>
                    <img src="<?php 
        echo $channel->icon;
        ?>
" height="30" width="30"></a>
<?php 
    }
    ?>
                    <span class="preferred"><?php 
    echo _or($_SESSION["prefer_channum"] ? $channel->channum : $channel->callsign, '&nbsp');
    ?>
</span><br />
                    <?php 
    echo ($_SESSION["prefer_channum"] ? $channel->callsign : $channel->channum) . "\n";
    ?>
                </a>
            </div>
<?php 
}
?>
            <div id="program_title">
                <h1>
                    <a href="<?php 
echo root_url;
?>
    <td><?php 
echo t('web_video_thumbnail_width');
?>
:</td>
    <td><input type="text" name="web_video_thumbnail_width" size="60" value="<?php 
echo _or(setting('web_video_thumbnail_width', $_SESSION['settings']['host']), 94);
?>
"></td>
</tr>
<tr>
    <td><?php 
echo t('web_video_thumbnail_height');
?>
:</td>
    <td><input type="text" name="web_video_thumbnail_height" size="60" value="<?php 
echo _or(setting('web_video_thumbnail_height', $_SESSION['settings']['host']), 140);
?>
"></td>
</tr>

<tr>
    <td><?php 
echo t('Default MythVideo View');
?>
:</td>
    <td><input type="text" name="DefaultMythVideoView" size="60" value="<?php 
echo setting('Default MythVideo View', $_SESSION['settings']['host']);
?>
"></td>
</tr>
<tr>
// Load all of the known mythtv hosts
$Settings_Hosts = array('' => '- ' . t('All Hosts') . ' -');
$sh = $db->query('SELECT DISTINCT hostname FROM settings ORDER BY hostname');
while (list($host) = $sh->fetch_row()) {
    if (empty($host)) {
        continue;
    }
    $Settings_Hosts[$host] = $host;
}
$sh->finish();
// Make sure we have a valid host selected
if (!isset($Settings_Hosts[$_SESSION['settings']['host']])) {
    $_SESSION['settings']['host'] = reset(array_keys($Settings_Hosts));
} elseif ($_POST['save'] && isset($_POST['host'])) {
    foreach ($_POST['settings'] as $value => $data) {
        setting($value, _or($_POST['host'], null), $data);
    }
    if (is_array($_POST['delete'])) {
        foreach ($_POST['delete'] as $value => $data) {
            if (!$data) {
                continue;
            }
            if (empty($_POST['host'])) {
                $sh = $db->query('DELETE FROM settings
                                       WHERE value=? AND hostname IS NULL', $value);
            } else {
                $sh = $db->query('DELETE FROM settings
                                       WHERE value=? AND hostname=?', $value, $_POST['host']);
            }
        }
    }
            }
            // Quick fix for LEFT JOINs to be syntaxly correct
            $schedule->subtitle = str_replace(', LEFT JOIN', ' LEFT JOIN', $schedule->subtitle);
            // Run a test query
            $db->disable_fatal_errors();
            $sh = $db->query('SELECT NULL FROM program, channel' . str_replace('?', '\\?', $schedule->subtitle) . ' WHERE ' . str_replace('?', '\\?', $schedule->description));
            $db->enable_fatal_errors();
            if ($db->error) {
                add_error("There is an error in your custom SQL query:\n\n" . preg_replace('/^.+?SQL\\s+syntax;\\s*/', '', $db->error));
            }
        } else {
            $schedule->description = _or($_POST['search_phrase'], $_POST['title']);
            $schedule->subtitle = '';
        }
        // Figure out the title
        $schedule->title = _or($_POST['title'], $schedule->description) . ' (' . t('$1 Search', $schedule->search_type) . ')';
        // Only save if there are no errors
        if (!errors()) {
            // Save the schedule
            $schedule->save($_POST['record']);
            // Redirect to the new schedule
            header('Location: ' . root_url . 'tv/schedules/custom/' . $schedule->recordid);
            exit;
        }
    }
} else {
    // Make sure we have a default rectype
    if (!$schedule->type) {
        $schedule->type = rectype_always;
    }
    // Get the searchtype string
Beispiel #17
0
<?php

/**
 *
 * @license     GPL
 *
 * @package     MythWeb
 *
 **/
if (empty($_REQUEST['host'])) {
    header('HTTP/1.0 400 Bad Request');
    echo 'No host specified.';
    exit;
}
$frontend = $Frontends[$_REQUEST['host']];
if (empty($frontend)) {
    header('HTTP/1.0 400 Bad Request');
    echo 'Unknown host:  ' . $_REQUEST['host'];
    exit;
}
# Build the request
$args = array('format' => strtolower(_or($_REQUEST['format'], 'jpg')), 'height' => $_REQUEST['height'], 'width' => $_REQUEST['width']);
# Print the image
header('Content-type: image/' . $args['format']);
echo $frontend->get_screenshot($args);