Esempio n. 1
0
 /**
  * Generate js onclick for confirmations for <input type=button
  */
 public static function button_js_confirm_href($str, $url)
 {
     $str = xml_gen::js_string($str);
     return "onclick='if (confirm(\"{$str}\")) location.href=\"{$url}\";'";
 }
Esempio n. 2
0
 /**
  * Handle fatal errors.
  */
 protected function fail($msg)
 {
     $this->rollback();
     $this->head("Fatal Error");
     echo xml_gen::p($msg);
     $this->foot();
 }
function FormatEncoderOptionsReport()
{
    echo xml_gen::h3('Format/Encoder/Options Distribution');
    global $dbh;
    $t = new Table(11, 'class=table', null, 'left;left;left;;right;left;right;left;right;left;right;left');
    // NOTE: Left joining because encoder_options might not be set....
    $dbh->query("select N.name as format_name, E.name as encoder_version, O.name as encoder_options, count(X.id) as counter, sum(X.filesize)/1024/1024/1024 as sumsize, sum(X.playtime)/3600 as sumplay, sum(X.avg_bit_rate)/1000 as sumbitr from getid3_file X left join getid3_encoder_options O on O.id = X.encoder_options_id, getid3_format_name N, getid3_encoder_version E where N.id = X.format_name_id and E.id = X.encoder_version_id  group by N.id,E.id,O.id order by N.name, E.name");
    while ($dbh->next_record()) {
        $t->data($dbh->f('format_name') . xml_gen::space(3));
        $t->data($dbh->f('encoder_version') . xml_gen::space(3));
        $t->data($dbh->f('encoder_options') . xml_gen::space(3));
        $t->data(number_format($dbh->f('counter')));
        $t->data('files' . xml_gen::space(3));
        $t->data(number_format($dbh->f('sumsize')));
        $t->data('Gb' . xml_gen::space(3));
        $t->data(number_format($dbh->f('sumplay'), 1));
        $t->data('hours' . xml_gen::space(3));
        $t->data(number_format($dbh->f('sumbitr') / $dbh->f('counter')));
        $t->data('kbps (avg)');
    }
    $t->done();
}
Esempio n. 4
0
function compress($string)
{
    static $i;
    $i++;
    $string2 = str_replace('<br>', ', ', $string);
    if (strlen($string2) <= GETID3_COMPRESS_LENGTH) {
        return $string2;
    }
    $string3 = str_replace("<br>", "\\n", addslashes(str_replace('"', "''", $string)));
    return xml_gen::a("javascript:alert('{$string3}')", substr($string2, 0, GETID3_COMPRESS_LENGTH - 2) . '...');
}