Example #1
0
 public function index()
 {
     $id = $this->uri->segment(2);
     if ($this->uri->segment(3) || !is_numeric($id)) {
         show_404();
     }
     $detail = $this->Data_model->getSingle(array('id' => $id, 'status' => 1), 'down');
     if ($detail) {
         $this->load->helper('download');
         $filename = $detail['attrname'] == '' ? $detail['title'] : $detail['attrname'];
         $filename = urlencode($filename) . '.' . get_suffix($detail['attrurl']);
         $data = file_get_contents($detail['attrurl']);
         force_download($filename, $data);
     } else {
         show_404();
     }
 }
Example #2
0
 public function index()
 {
     $this->Purview_model->checkPurview($this->tablefunc);
     $folder = $this->input->post('folder');
     if (!$folder) {
         $folder = $this->defaultfolder;
     }
     $listarr = directory_map($folder, 1);
     $folderlist = array();
     $phplist = array();
     $csslist = array();
     $jslist = array();
     foreach ($listarr as $list) {
         $thispath = $folder . '/' . $list;
         $newlist = get_file_info($thispath);
         $newlist['permissions'] = octal_permissions(fileperms($thispath));
         $newlist['name'] = $list;
         if (is_dir($thispath)) {
             $folderlist[] = $newlist;
         } else {
             $newlist['size'] = byte_format($newlist['size']);
             $ext = get_suffix($thispath);
             switch ($ext) {
                 case 'php':
                     $phplist[] = $newlist;
                     break;
                 case 'css':
                     $csslist[] = $newlist;
                     break;
                 case 'js':
                     $jslist[] = $newlist;
                     break;
                 default:
                     break;
             }
         }
     }
     $res = array('tpl' => 'list', 'tablefunc' => $this->tablefunc, 'folderlist' => $folderlist, 'phplist' => $phplist, 'csslist' => $csslist, 'jslist' => $jslist, 'defaultfolder' => $this->defaultfolder, 'folder' => $folder);
     $this->load->view($this->tablefunc, $res);
 }
Example #3
0
 function generate_rss2($channel, $item, $use_mrss = 0, $use_rsscache = 0, $xsl_stylesheet = NULL)
 {
     // DEBUG
     //  echo '<pre><tt>';
     //  print_r ($channel);
     //  print_r ($item);
     $use_cms = 0;
     if ($use_rsscache == 1) {
         $use_cms = 1;
     }
     $p = '';
     $p .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     if ($xsl_stylesheet) {
         $p .= '<?xml-stylesheet href="' . $xsl_stylesheet . '" type="text/xsl"?>' . "\n";
     }
     $p .= '<rss version="2.0"';
     // base
     //  $p .= ' xml:base="http://rsscache.a1.25u.com/"';
     if ($use_mrss == 1) {
         $p .= ' xmlns:media="http://search.yahoo.com/mrss/"';
     }
     if ($use_rsscache == 1) {
         $p .= ' xmlns:rsscache="data:,rsscache"';
     }
     if ($use_cms == 1) {
         $p .= ' xmlns:cms="data:,cms"';
     }
     $p .= '>' . "\n";
     $p .= '  <channel>' . "\n";
     $a = array('title', 'link', 'description', 'docs', 'cms:subdomain');
     $p .= generate_rss2_func($channel, $a, '    ');
     if (isset($channel['lastBuildDate'])) {
         $p .= '    <lastBuildDate>' . strftime("%a, %d %h %Y %H:%M:%S %z", $channel['lastBuildDate']) . '</lastBuildDate>' . "\n";
     }
     if (isset($channel['image'])) {
         $p .= '' . '    <image>' . "\n" . '      <title>' . misc_xml_escape($channel['title']) . '</title>' . "\n" . '      <url>' . $channel['image'] . '</url>' . "\n" . '      <link>' . misc_xml_escape($channel['link']) . '</link>' . "\n" . '    </image>' . "\n";
     }
     $a = array('rsscache:stats_items', 'rsscache:stats_days', 'rsscache:stats_items_today', 'rsscache:stats_items_7_days', 'rsscache:stats_items_30_days');
     $p .= generate_rss2_func($channel, $a, '    ');
     // items
     //  for ($i = 0; isset ($item[$i]['link']); $i++)
     for ($i = 0; isset($item[$i]); $i++) {
         $p .= '    <item>' . "\n";
         $a = array('title', 'link', 'description', 'category', 'author', 'comments');
         $p .= generate_rss2_func($item[$i], $a);
         //                <pubDate>Fri, 05 Aug 2011 15:03:02 +0200</pubDate>
         if (isset($item[$i]['pubDate'])) {
             $p .= '' . '      <pubDate>' . strftime("%a, %d %h %Y %H:%M:%S %z", $item[$i]['pubDate']) . '</pubDate>' . "\n";
         }
         if (isset($item[$i]['enclosure'])) {
             $suffix = strtolower(get_suffix($item[$i]['enclosure']));
             // HACK
             if ($suffix == '.jpg') {
                 $suffix = '.jpeg';
             }
             // TODO: get filesize from db
             $p .= '      <enclosure url="' . $item[$i]['enclosure'] . '"' . ' type="image/' . substr($suffix, 1) . '" />' . "\n";
         }
         // mrss
         if ($use_mrss == 1) {
             //      $p .= '    <media:group>'."\n";
             //      $p .= '      <media:category scheme="">'.'</media:category>';
             if (isset($item[$i]['media:thumbnail'])) {
                 $p .= '      <media:thumbnail url="' . $item[$i]['media:thumbnail'] . '" media:url="' . $item[$i]['media:thumbnail'] . '" />' . "\n";
             }
             $a = array('media:duration', 'media:keywords', 'media:embed');
             $p .= generate_rss2_func($item[$i], $a);
             /*
                     <media:content 
                            url="http://www.foo.com/movie.mov"
                            fileSize="12216320" 
                            type="video/quicktime"
                            medium="video"
                            isDefault="true"
                            expression="full"
                            bitrate="128"
                            framerate="25"
                            samplingrate="44.1"
                            channels="2"
                            duration="185"
                            height="200"
                            width="300"
                            lang="en" />
             */
             for ($j = 0; isset($item[$i]['media:content_' . $j . '_url']); $j++) {
                 if (isset($item[$i]['media:content_' . $j . '_url'])) {
                     $p .= '      <media:content url="' . $item[$i]['media:content_' . $j . '_url'] . '"' . ' medium="' . $item[$i]['media:content_' . $j . '_medium'] . '"' . ' />' . "\n";
                 }
             }
             //      $p .= '      </media:group>'."\n";
         }
         // rsscache
         if ($use_rsscache == 1) {
             //      $p .= '    <rsscache:group>'."\n";
             if (isset($item[$i]['pubDate'])) {
                 $p .= '      <rsscache:pubDate>' . sprintf("%u", $item[$i]['pubDate']) . '</rsscache:pubDate>' . "\n";
             }
             $a = array('rsscache:category_title', 'rsscache:dl_date', 'rsscache:related_id', 'rsscache:event_start', 'rsscache:event_end', 'rsscache:url_crc32', 'rsscache:table_suffix');
             $p .= generate_rss2_func($item[$i], $a);
             // DEBUG
             //  echo '<pre><tt>';
             //  print_r ($channel);
             //  print_r ($item);
             for ($j = 0; isset($item[$i]['rsscache:feed_' . $j . '_link']); $j++) {
                 $p .= '      <rsscache:feed>' . "\n";
                 if (isset($item[$i]['rsscache:feed_' . $j . '_exec'])) {
                     $p .= '        <rsscache:exec>' . misc_xml_escape($item[$i]['rsscache:feed_' . $j . '_exec']) . '</rsscache:exec>' . "\n";
                 }
                 if (isset($item[$i]['rsscache:feed_' . $j . '_link'])) {
                     $p .= '        <rsscache:link>' . misc_xml_escape($item[$i]['rsscache:feed_' . $j . '_link']) . '</rsscache:link>' . "\n";
                 }
                 $p .= '      </rsscache:feed>' . "\n";
             }
             //      $p .= '      </rsscache:group>'."\n";
         }
         $a = array('rsscache:stats_category', 'rsscache:stats_items', 'rsscache:stats_days', 'rsscache:stats_items_today', 'rsscache:stats_items_7_days', 'rsscache:stats_items_30_days');
         $p .= generate_rss2_func($item[$i], $a);
         // CMS
         if ($use_cms == 1) {
             //          $p .= '    <cms:group>'."\n";
             $a = array('cms:separate', 'cms:button_only', 'cms:status', 'cms:select', 'cms:local', 'cms:iframe', 'cms:proxy', 'cms:feed', 'cms:demux', 'cms:button_html', 'cms:option_html');
             $p .= generate_rss2_func($item[$i], $a);
             //          $p .= '    </cms:group>'."\n";
         }
         $p .= '    </item>' . "\n";
     }
     $p .= '  </channel>' . "\n";
     $p .= '</rss>' . "\n";
     return $p;
 }
Example #4
0
 function set_suffix($filename, $suffix)
 {
     // always use set_suffix() and NEVER the code below
     return str_replace(get_suffix($filename), $suffix, $filename);
 }
function get_table_info($input, $method, $id, $dbTable, $param)
{
    require CONFIG . 'config.php';
    mysql_select_db($database, $brewing);
    if ($dbTable == "default") {
        $judging_tables_db_table = $prefix . "judging_tables";
        $judging_locations_db_table = $prefix . "judging_locations";
        $judging_scores_db_table = $prefix . "judging_scores";
        $judging_scores_bos_db_table = $prefix . "judging_scores_bos";
        $styles_db_table = $prefix . "styles";
        $brewing_db_table = $prefix . "brewing";
    } else {
        $suffix = ltrim(get_suffix($dbTable), "_");
        $suffix = "_" . $suffix;
        $judging_tables_db_table = $prefix . "judging_tables" . $suffix;
        $judging_locations_db_table = $prefix . "judging_locations" . $suffix;
        $judging_scores_db_table = $prefix . "judging_scores" . $suffix;
        $judging_scores_bos_db_table = $prefix . "judging_scores_bos" . $suffix;
        $styles_db_table = $prefix . "styles";
        $brewing_db_table = $prefix . "brewing" . $suffix;
    }
    $query_table = "SELECT * FROM {$judging_tables_db_table}";
    if ($id != "default") {
        $query_table .= " WHERE id='{$id}'";
    }
    if ($param != "default") {
        $query_table .= " WHERE tableLocation='{$param}'";
    }
    $table = mysql_query($query_table, $brewing) or die(mysql_error());
    $row_table = mysql_fetch_assoc($table);
    if ($method == "basic") {
        $return = $row_table['tableNumber'] . "^" . $row_table['tableName'] . "^" . $row_table['tableLocation'] . "^" . $row_table['id'];
        return $return;
    }
    if ($method == "location") {
        // used in output/assignments.php and output/pullsheets.php
        $query_judging_location = sprintf("SELECT * FROM %s WHERE id='%s'", $prefix . "judging_locations", $input);
        $judging_location = mysql_query($query_judging_location, $brewing) or die(mysql_error());
        $row_judging_location = mysql_fetch_assoc($judging_location);
        $return = $row_judging_location['judgingDate'] . "^" . $row_judging_location['judgingTime'] . "^" . $row_judging_location['judgingLocName'];
        return $return;
    }
    if ($method == "unassigned") {
        $return = "";
        $query_styles = "SELECT id,brewStyle FROM {$styles_db_table}";
        $styles = mysql_query($query_styles, $brewing) or die(mysql_error());
        $row_styles = mysql_fetch_assoc($styles);
        do {
            $a[] = $row_styles['id'];
        } while ($row_styles = mysql_fetch_assoc($styles));
        sort($a);
        //echo "<p>"; print_r($a); echo "</p>";
        foreach ($a as $value) {
            //echo $input."<br>";
            $b = array(explode(",", $input));
            //echo "<p>".print_r($b)."</p>";
            //echo "<p>-".$value."-</p>";
            if (in_array($value, $b)) {
                //echo "Yes. The style ID is $value.<br>";
                //$query_styles1 = "SELECT brewStyle FROM $styles_db_table WHERE id='$value'";
                //$styles1 = mysql_query($query_styles1, $brewing) or die(mysql_error());
                //$row_styles1 = mysql_fetch_assoc($styles1);
                //echo "<p>".$row_styles1['brewStyle']."</p>";
            }
            //else echo "No.<br>";
        }
        return $return;
    }
    if ($method == "styles") {
        do {
            $a = explode(",", $row_table['tableStyles']);
            $b = $input;
            foreach ($a as $value) {
                if ($value == $input) {
                    return TRUE;
                }
            }
        } while ($row_table = mysql_fetch_assoc($table));
    }
    if ($method == "assigned") {
        do {
            $a = explode(",", $row_table['tableStyles']);
            $b = $input;
            foreach ($a as $value) {
                if ($value == $input) {
                    $c = "<br><em>Assigned to Table #" . $row_table['tableNumber'] . ": <a href='index.php?section=admin&go=judging_tables&action=edit&id=" . $row_table['id'] . "'>" . $row_table['tableName'] . "</a></em>";
                }
            }
        } while ($row_table = mysql_fetch_assoc($table));
        return $c;
    }
    if ($method == "list") {
        $a = explode(",", $row_table['tableStyles']);
        foreach ($a as $value) {
            require CONFIG . 'config.php';
            mysql_select_db($database, $brewing);
            $query_styles = "SELECT * FROM {$styles_db_table} WHERE id='{$value}'";
            $styles = mysql_query($query_styles, $brewing) or die(mysql_error());
            $row_styles = mysql_fetch_assoc($styles);
            $c[] = ltrim($row_styles['brewStyleGroup'] . $row_styles['brewStyleNum'], "0") . ",&nbsp;";
        }
        $d = array($c);
        return $d;
    }
    if ($method == "count_total" && $param == "default") {
        $lala = "";
        $a = explode(",", $row_table['tableStyles']);
        foreach ($a as $value) {
            require CONFIG . 'config.php';
            mysql_select_db($database, $brewing);
            $query_styles = "SELECT brewStyleGroup,brewStyleNum FROM {$styles_db_table} WHERE id='{$value}'";
            $styles = mysql_query($query_styles, $brewing) or die(mysql_error());
            $row_styles = mysql_fetch_assoc($styles);
            $query_style_count = sprintf("SELECT COUNT(*) as count FROM {$brewing_db_table} WHERE brewCategorySort='%s' AND brewSubCategory='%s' AND brewReceived='1'", $row_styles['brewStyleGroup'], $row_styles['brewStyleNum']);
            $style_count = mysql_query($query_style_count, $brewing) or die(mysql_error());
            $row_style_count = mysql_fetch_assoc($style_count);
            $totalRows_style_count = $row_style_count['count'];
            $c[] = $totalRows_style_count;
            // DEBUG
            $lala .= $query_style_count . "<br>";
        }
        $d = array_sum($c);
        return $d;
        //return $lala;
    }
    if ($method == "score_total" && $param == "default") {
        $query_score_count = sprintf("SELECT COUNT(*) as 'count' FROM {$judging_scores_db_table} WHERE scoreTable='%s'", $id);
        $score_count = mysql_query($query_score_count, $brewing) or die(mysql_error());
        $row_score_count = mysql_fetch_assoc($score_count);
        $totalRows_score_count = $row_score_count['count'];
        return $totalRows_score_count;
    }
    if ($method == "count_total" && $param != "default") {
        do {
            $a = explode(",", $row_table['tableStyles']);
            foreach ($a as $value) {
                require CONFIG . 'config.php';
                mysql_select_db($database, $brewing);
                $query_styles = "SELECT brewStyleGroup,brewStyleNum FROM {$styles_db_table} WHERE id='{$value}'";
                $styles = mysql_query($query_styles, $brewing) or die(mysql_error());
                $row_styles = mysql_fetch_assoc($styles);
                $query_style_count = sprintf("SELECT COUNT(*) as count FROM {$brewing_db_table} WHERE brewCategorySort='%s' AND brewSubCategory='%s' AND brewReceived='1'", $row_styles['brewStyleGroup'], $row_styles['brewStyleNum']);
                $style_count = mysql_query($query_style_count, $brewing) or die(mysql_error());
                $row_style_count = mysql_fetch_assoc($style_count);
                $totalRows_style_count = $row_style_count['count'];
                $c[] = $totalRows_style_count;
            }
        } while ($row_table = mysql_fetch_assoc($table));
        $d = array_sum($c);
        return $d;
    }
    if ($method == "count") {
        require CONFIG . 'config.php';
        mysql_select_db($database, $brewing);
        $input = explode("^", $input);
        /*
        $query_style = sprintf("SELECT brewStyleNum,brewStyleGroup FROM $styles_db_table WHERE brewStyleNum='%s' AND brewStyleGroup='%s' AND (brewStyleVersion='%s'  OR brewStyleOwn='custom'))",$input[0],$input[1],$_SESSION['prefsStyleSet']);
        $style = mysql_query($query_style, $brewing) or die(mysql_error());
        $row_style = mysql_fetch_assoc($style);
        echo $query_style."<br>";
        */
        $query = sprintf("SELECT COUNT(*) as 'count' FROM {$brewing_db_table} WHERE brewCategorySort='%s' AND brewSubCategory='%s' AND brewReceived='1'", $input[1], $input[0]);
        $result = mysql_query($query, $brewing) or die(mysql_error());
        $num_rows = mysql_fetch_array($result);
        //echo $query."<br>";
        //echo $num_rows['count']."<br>";
        //$num_rows = mysql_num_rows($result);
        //echo $num_rows."<br>";
        return $num_rows['count'];
    }
    if ($method == "count_scores") {
        $a = explode(",", $row_table['tableStyles']);
        foreach ($a as $value) {
            require CONFIG . 'config.php';
            mysql_select_db($database, $brewing);
            $query_styles = "SELECT brewStyleGroup,brewStyleNum FROM {$styles_db_table} WHERE id='{$value}'";
            $styles = mysql_query($query_styles, $brewing) or die(mysql_error());
            $row_styles = mysql_fetch_assoc($styles);
            $query_style_count = sprintf("SELECT COUNT(*) as count FROM {$brewing_db_table} WHERE brewCategorySort='%s' AND brewSubCategory='%s' AND brewReceived='1'", $row_styles['brewStyleGroup'], $row_styles['brewStyleNum']);
            $style_count = mysql_query($query_style_count, $brewing) or die(mysql_error());
            $row_style_count = mysql_fetch_assoc($style_count);
            $totalRows_style_count = $row_style_count['count'];
            $c[] = $totalRows_style_count;
        }
        $query_score_count = sprintf("SELECT COUNT(*) as 'count' FROM {$judging_scores_db_table} WHERE scoreTable='%s'", $input);
        $score_count = mysql_query($query_score_count, $brewing) or die(mysql_error());
        $row_score_count = mysql_fetch_assoc($score_count);
        $totalRows_score_count = $row_score_count['count'];
        $e = array_sum($c);
        if ($e == $totalRows_score_count) {
            return true;
        }
    }
    if ($method == "count_single_table") {
        $query_score_count = sprintf("SELECT COUNT(*) as 'count' FROM {$judging_scores_db_table} WHERE scoreTable='%s'", $input);
        $score_count = mysql_query($query_score_count, $brewing) or die(mysql_error());
        $row_score_count = mysql_fetch_assoc($score_count);
        return $row_score_count['count'];
    }
}
Example #6
0
function set_suffix($filename, $suffix)
{
    // always use set_suffix() and NEVER the code below
    strcpy(get_suffix($filename), $suffix);
    return $filename;
}
Example #7
0
function php_quh_player($w, $php_quh)
{
    $file = "";
    $artist = "";
    $title = "";
    $album = "";
    $year = "";
    $track = 0;
    $genre = "";
    $length = "00:00:00";
    $size = 0;
    //echo "|".$php_quh->incoming."|".$php_quh->incoming_abs."|";
    $p = "";
    if ($php_quh->file) {
        $id3 =& new MP3_Id();
        $id3->read($php_quh->incoming_abs . basename($php_quh->file));
        $id3->study($php_quh->incoming_abs . basename($php_quh->file));
        //      $stat = stat ($php_quh->incoming_abs.basename ($php_quh->file));
        $file = basename($php_quh->file);
        $artist = $id3->getTag('artists');
        $title = $id3->getTag('name');
        $album = $id3->getTag('album');
        $year = $id3->getTag('year');
        $track = $id3->getTag('track');
        $genre = $id3->getTag('genre');
        $length = $id3->lengthh;
        $size = $id3->musicsize;
        /*
            * version of mpeg
            var $mpeg_ver = 0;
            * version of layer
            var $layer = 0;
            * version of bitrate
            var $bitrate = 0;
            * Frames are crc protected?
            var $crc = false;
            * frequency
            var $frequency = 0;
            * encoding type (CBR or VBR)
            var $encoding_type = 0;
            * number of samples per MPEG audio frame
            var $samples_per_frame = 0;
            * samples in file
            var $samples = 0;
            * Bytes in file without tag overhead
            var $musicsize = -1;
            * number of MPEG audio frames
            var $frames = 0;
            * quality indicator (0% - 100%)
            var $quality = 0;
            * Frames padded
            var $padding = false;
            * private bit set
            var $private = false;
            * Mode (Stero etc)
            var $mode = '';
            * Copyrighted
            var $copyright = false;
            * On Original Media? (never used)
            var $original = false;
            * Emphasis (also never used)
            var $emphasis = '';
            * Bytes in file
            var $filesize = -1;
            * Byte at which the first mpeg header was found
            var $frameoffset = -1;
            * length of mp3 format hh:mm:ss
            var $lengthh = false;
            * length of mp3 format mm:ss
            var $length = false;
            * length of mp3 in seconds
            var $lengths = false;
        */
    }
    $p .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr>" . "<td style=\"background-image:url('images/black_opaque80.png');\" valign=\"top\" width=\"400\">" . "<font face=\"arial,sans-serif\" size=\"-1\" color=\"00e300\">" . "File: " . $file . "<br>\nArtist: " . $artist . "<br>\nTitle: " . $title . "<br>\nAlbum: " . $album . "<br>\nYear: " . $year . "<br>\nTrack: " . $track . "<br>\nGenre: " . $genre . "<br>\nLength: " . $length . ", " . $size . " Bytes" . "</td></tr></table>";
    /*
       $next =
               $_SERVER['PHP_SELF']
               ."?file="
               .$next_file
               ."&start="
               ."0"
               ."&stream="
               ."1"
               ."&pos="
               .$php_quh->pos + 1
    */
    $p .= $w->widget_image("back", NULL, "images/back.png", -1, -1, "Previous Song", 0) . $w->widget_image("play", NULL, "images/play.png", -1, -1, "Play Song", 0) . $w->widget_image("pause", NULL, "images/pause.png", -1, -1, "Pause Song", 0) . $w->widget_image("stop", NULL, "images/stop.png", -1, -1, "Stop Song", 0) . $w->widget_image("next", NULL, "images/forward.png", -1, -1, "Next Song", 0) . "<br>" . "<div>";
    //  $next_file = "";
    $dir = opendir($php_quh->incoming_abs);
    for ($pos = 0; ($file = readdir($dir)) != false; $pos++) {
        if (get_suffix($file) == ".mp3" || get_suffix($file) == ".wav") {
            //      $stat = stat ($php_quh->incoming_abs.$file);
            $curr = basename($php_quh->file) == basename($file);
            //      if ($pos == $php_quh->pos + 1)
            //        $next_file = $file;
            $p .= "<a class=\"widget_a_label\" target=\"_top\" href=\"" . $_SERVER['PHP_SELF'] . "?file=" . $file . "&start=" . "0" . "&stream=" . "1" . "&pos=" . $pos . "\"" . ($curr ? " style=\"color:#fff;\"" : "") . ">" . $file . "</a> " . "<br>\n";
        }
    }
    closedir($dir);
    $p .= "</div>" . $w->widget_end();
    return $p;
}
Example #8
0
require_once ykfile('source/activity_service.php');
function get_suffix($type)
{
    $tok = explode('/', $type);
    return end($tok);
}
$status = NULL;
$message = NULL;
if ($_FILES['file']['error']) {
    // 文件上传失败
    $status = ERR_INTERNAL;
    $message = $_FILES['file']['error'];
} else {
    //生成文件名
    $suffix = get_suffix($_FILES['file']['type']);
    $fname = '/upload/' . md5(uniqid(rand())) . '.' . $suffix;
    //保存文件
    $data = file_get_contents($_FILES['file']['tmp_name']);
    // 文件的全部路径
    // windows 上的路径会是  \\m//  linux 上的路径会是 /m/
    $change_array = array("/m/" => "/", "\\m//" => "\\");
    $upload_path = strtr(ykfile($fname), $change_array);
    if (file_put_contents($upload_path, $data)) {
        $status = 0;
        $message = "保存成功";
    } else {
        $status = ERR_INTERNAL;
        $message = "保存失败";
    }
}
<?php

include DB . 'styles.db.php';
include DB . 'admin_judging_tables.db.php';
?>
<h2><?php 
if ($action == "edit") {
    echo "Edit Table";
} elseif ($action == "add") {
    echo "Add a Table";
} else {
    echo "All Tables";
}
if ($dbTable != "default") {
    echo ": " . get_suffix($dbTable);
}
?>
</h2>

<?php 
if ($action != "print") {
    ?>
<div class="adminSubNavContainer">
		<span class="adminSubNav">
        	<span class="icon"><img src="<?php 
    echo $base_url;
    ?>
images/arrow_left.png" alt="Back"></span><?php 
    if ($action == "default") {
        ?>
<a href="<?php 
 $table_assign_steward = table_assignments($user_info[0], "S", $_SESSION['prefsTimeZone'], $_SESSION['prefsDateFormat'], $_SESSION['prefsTimeFormat'], 1);
 $table_assign_steward = rtrim($table_assign_steward, ",&nbsp;");
 $judge_entries = judge_entries($row_brewer['uid'], 1);
 if ($filter == "judges") {
     $locations = $row_brewer['brewerJudgeLocation'];
 }
 if ($filter == "stewards") {
     $locations = $row_brewer['brewerStewardLocation'];
 }
 if ($_SESSION['brewerCountry'] == "United States") {
     $us_phone = TRUE;
 } else {
     $us_phone = FALSE;
 }
 if ($dbTable != "default") {
     $archive = get_suffix($dbTable);
 } else {
     $archive = "default";
 }
 unset($brewer_assignment);
 $brewer_assignment = brewer_assignment($row_brewer['uid'], "1", $id, $dbTable, $filter, $archive);
 if (!empty($brewer_assignment)) {
     // Build assignment modal for participants
     unset($assignment_modal_body);
     if (strpos($brewer_assignment, "Judge") !== false || strpos($brewer_assignment, "Steward") !== false) {
         if (strpos($brewer_assignment, "Judge") !== false) {
             if (!empty($table_assign_judge)) {
                 $assignment_modal_body = "<p>" . $row_brewer['brewerFirstName'] . " is assigned as a <strong>judge</strong> to table(s): " . $table_assign_judge . "<p>";
             } else {
                 $assignment_modal_body = "<p>" . $row_brewer['brewerFirstName'] . " has been added to the <strong>judge</strong> pool, but has not been assigned to a table yet.<p>";
             }
Example #11
0
 function widget_indexof($dir, $suffix, $indexof_func)
 {
     $b = array(array());
     $a = array();
     $a = scandir($dir, 0);
     // read filenames, sizes and mtime
     $i_max = sizeof($a);
     for ($i = 0, $j = 0; $i < $i_max; $i++) {
         $dirname = str_replace('//', '/', $dir . '/');
         $basename = str_replace("\n", '', $a[$i]);
         $path = $dirname . '/' . $basename;
         if (!file_exists($path)) {
             continue;
         }
         if ($basename == '.' || $basename == '..') {
             continue;
         }
         if (!is_file($path)) {
             continue;
         }
         if ($suffix) {
             if (get_suffix($basename) != $suffix) {
                 continue;
             }
         }
         $b[$j][0] = $dirname;
         $b[$j][1] = $basename;
         /*
         stat ()
         
         0  	dev  	device number
         1 	ino 	inode number *
         2 	mode 	inode protection mode
         3 	nlink 	number of links
         4 	uid 	userid of owner *
         5 	gid 	groupid of owner *
         6 	rdev 	device type, if inode device
         7 	size 	size in bytes
         8 	atime 	time of last access (Unix timestamp)
         9 	mtime 	time of last modification (Unix timestamp)
         10 	ctime 	time of last inode change (Unix timestamp)
         11 	blksize 	blocksize of filesystem IO **
         12 	blocks 	number of blocks allocated **
         
         * On Windows this will always be 0.
         
         ** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1.
         
         In case of error, stat() returns FALSE
         */
         $s = stat($path);
         $b[$j][2] = $s['size'];
         $b[$j][3] = $s['mtime'];
         $b[$j][4] = is_file($path) ? '1' : '0';
         $b[$j][5] = get_suffix($path);
         $j++;
     }
     // sort by date or size or suffix
     usort($b, 'widget_indexof_sort_time');
     return $indexof_func ? $indexof_func($b) : widget_indexof_func($b);
 }
        <?php 
    if ($action != "print" && $dbTable == "default") {
        ?>
        <th class="dataHeading bdr1B hidden-print">Actions</th>
    	<?php 
    }
    ?>
    </tr>
</thead>
<tbody>
 <?php 
    do {
        if ($dbTable == "default") {
            $brewer_info_filter = "default";
        } else {
            $brewer_info_filter = get_suffix($dbTable);
        }
        $brewer_info = brewer_info($row_log['brewBrewerID'], $brewer_info_filter);
        $brewer_info = explode("^", $brewer_info);
        $styleConvert = style_convert($row_log['brewCategorySort'], 1);
        $entry_style = $row_log['brewCategorySort'] . "-" . $row_log['brewSubCategory'];
        $entry_style_display = "";
        $entry_brewer_display = "";
        $entry_updated_display = "";
        $entry_judging_num_display = "";
        $entry_paid_display = "";
        $entry_received_display = "";
        $entry_box_num_display = "";
        $entry_actions = "";
        $entry_unconfirmed_row = "";
        if ($row_log['brewConfirmed'] == 0 || $row_log['brewConfirmed'] == "") {
else if(typeof window.attachEvent!='undefined')
window.attachEvent('onload', uniqueChoicesSetup);
// -->
</script>

<p class="lead"><?php 
echo $_SESSION['contestName'];
if ($action == "edit" && $id != "default") {
    echo ": Edit Scores for Table " . $row_tables_edit['tableNumber'] . " - " . $row_tables_edit['tableName'];
} elseif ($action == "add" && $id != "default") {
    echo ": Add Scores for Table " . $row_tables_edit['tableNumber'] . " - " . $row_tables_edit['tableName'];
} else {
    echo " Scores";
}
if ($dbTable != "default") {
    echo ": All Scores (Archive " . get_suffix($dbTable) . ")";
}
$totalRows_entry_count = total_paid_received($go, "default");
?>
</p>

<div class="bcoem-admin-element hidden-print">
	<?php 
if ($dbTable != "default") {
    ?>
    <!-- Postion 1: View All Button -->
    <div class="btn-group" role="group" aria-label="...">
        <a class="btn btn-default" href="<?php 
    echo $base_url;
    ?>
index.php?section=admin&amp;go=archive"><span class="fa fa-arrow-circle-left"></span> Archives</a>
// If so, activate the JS popup warnings if unchecking styles
if ($action == "edit") {
    $title = ": Edit a Table";
} elseif ($action == "add") {
    $title = ": Add a Table";
} elseif ($action == "assign" && $filter == "default") {
    $title = ": Assign Judges or Stewards to Tables";
} elseif ($action == "assign" && $filter == "judges") {
    $title = ": Assign Judges to a Table";
} elseif ($action == "assign" && $filter == "stewards") {
    $title = ": Assign Stewards a to Table";
} else {
    $title = " Judging Tables";
}
if ($dbTable != "default") {
    $title .= ": All Judging Tables (Archive " . get_suffix($dbTable) . ")";
}
?>
<p class="lead"><?php 
echo $_SESSION['contestName'] . $title;
?>
</p>
<?php 
if ($action == "default" && $filter == "default" && $dbTable == "default") {
    ?>
    <p>To ensure accuracy, verify that all paid and received entries have been marked as so via the <a href="<?php 
    echo $base_url;
    ?>
index.php?section=admin&amp;go=entries">Manage Entries</a> screen.</p>
<?php 
}
 function widget_media_demux($media_url)
 {
     $s = strtolower($media_url);
     if (strstr($s, '.youtube.com')) {
         return 1;
     } else {
         if (strstr($s, 'dailymotion.')) {
             return 2;
         } else {
             if (strstr($s, 'xfire.com')) {
                 return 3;
             } else {
                 if (in_array(get_suffix($s), array('.flv', '.mp4', '.mp3'))) {
                     return 4;
                 } else {
                     if (in_array(get_suffix($s), array('.webm', '.ogg'))) {
                         return 5;
                     } else {
                         if (in_array(get_suffix($s), array('.weba', '.wav'))) {
                             return 6;
                         } else {
                             if (strstr($s, 'veoh.com')) {
                                 return 7;
                             } else {
                                 if (strstr($s, 'xvideos.com')) {
                                     return 8;
                                 } else {
                                     if (strstr($s, 'xxxbunker.com')) {
                                         return 9;
                                     } else {
                                         if (strstr($s, 'video.google')) {
                                             return 10;
                                         } else {
                                             if (strstr($s, 'tnaflix.com')) {
                                                 return 11;
                                             } else {
                                                 if (strstr($s, 'own3d.tv')) {
                                                     return 12;
                                                 } else {
                                                     if (strstr($s, 'archive.org')) {
                                                         return 13;
                                                     } else {
                                                         if (in_array(get_suffix($s), array('.jpg', '.png', '.webp', '.gif'))) {
                                                             return 14;
                                                         } else {
                                                             if (strstr($s, 'liveleak.com')) {
                                                                 return 15;
                                                             } else {
                                                                 if (strstr($s, 'justin.tv')) {
                                                                     return 16;
                                                                 } else {
                                                                     if (strstr($s, 'www.juzp.net')) {
                                                                         return 24;
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return 0;
     // not supported
 }
// *****************************************************************************
// Build Subtitle
$subtitle .= "<h2>";
if ($filter == "judges") {
    $subtitle .= "Available Judges";
    $csv = "avail_judges";
} elseif ($filter == "stewards") {
    $subtitle .= "Available Stewards";
    $csv = "avail_stewards";
} elseif ($action == "add") {
    $subtitle .= "Add Participant";
} else {
    $subtitle .= "Participants";
}
if ($dbTable != "default") {
    $subtitle .= ": " . get_suffix($dbTable);
}
$subtitle .= "</h2>";
if ($action != "print") {
    $goto_nav .= "<div class='adminSubNavContainer'>";
    // Back to Dashboard
    $goto_nav .= "<span class='adminSubNav'>";
    $goto_nav .= "<span class='icon'><img src='" . $base_url . "images/arrow_left.png' alt='Back' title='Back'></span><a href='" . $base_url . "index.php?section=admin'>Back to Admin Dashboard</a>";
    $goto_nav .= "</span>";
    if ($filter != "default") {
        $goto_nav .= "<span class='adminSubNav'>";
        $goto_nav .= "<span class='icon'><img src='" . $base_url . "images/arrow_left.png' alt='Back' title='Back'></span><a href='" . $base_url . "index.php?section=admin&amp;go=participants'>Back to Participants</a>";
        $goto_nav .= "</span>";
    }
    if ($dbTable == "default") {
        $goto_nav .= "<span class='adminSubNav'>";
Example #17
0
 public function attrlist()
 {
     $usergroupid = $this->session->userdata('usergroup');
     if (!$usergroupid) {
         $result = array('error' => 1, 'message' => lang('nopur'));
         echo json_encode($result);
         exit;
     }
     $attr_url = 'data/attachment/';
     $ext_arr = array('gif', 'jpg', 'jpeg', 'png', 'bmp');
     $dir_name = $this->input->get('dir');
     $path_name = $this->input->get('path');
     $order = $this->input->get('order');
     if (!in_array($dir_name, array('image', 'flash', 'media', 'file'))) {
         echo "Invalid Directory name.";
         exit;
     }
     if ($dir_name != '') {
         $attr_url .= $dir_name . '/';
         if (!file_exists($attr_url)) {
             mkdir($attr_url);
         }
     }
     $current_path = $attr_url . ($path_name != '' ? $path_name . '/' : '');
     if ($path_name == '') {
         $current_path = $attr_url;
         $current_dir_path = '';
         $moveup_dir_path = '';
     } else {
         $current_path = $attr_url . $path_name . '/';
         $current_dir_path = $path_name;
         $moveup_dir_path = preg_replace('/(.*?)[^\\/]+\\/$/', '$1', $current_dir_path);
     }
     $order = $order == '' ? 'name' : strtolower($order);
     if (preg_match('/\\.\\./', $current_path)) {
         echo 'Access is not allowed.';
         exit;
     }
     if (!preg_match('/\\/$/', $current_path)) {
         echo 'Parameter is not valid.';
         exit;
     }
     if (!file_exists($current_path) || !is_dir($current_path)) {
         echo 'Directory does not exist.';
         exit;
     }
     $this->load->helper('directory');
     $this->load->helper('file');
     $this->load->helper('number');
     $listarr = directory_map($current_path, 1);
     $i = 0;
     foreach ($listarr as $filename) {
         $filepath = $current_path . $filename;
         $file = get_file_info($filepath);
         if (is_dir($filepath)) {
             $tmpDir = directory_map($file['server_path'], 1);
             $file_list[$i]['is_dir'] = true;
             $file_list[$i]['has_file'] = count($tmpDir) > 0;
             $file_list[$i]['filesize'] = 0;
             $file_list[$i]['is_photo'] = false;
             $file_list[$i]['filetype'] = '';
             unset($tmpDir);
         } else {
             $file_list[$i]['is_dir'] = false;
             $file_list[$i]['has_file'] = false;
             $file_list[$i]['filesize'] = $file['size'];
             $file_list[$i]['dir_path'] = '';
             $file_ext = strtolower(get_suffix($file['server_path']));
             $file_list[$i]['is_photo'] = in_array($file_ext, $ext_arr);
             $file_list[$i]['filetype'] = $file_ext;
         }
         $file_list[$i]['filename'] = $filename;
         //文件名,包含扩展名
         $file_list[$i]['datetime'] = date('Y-m-d H:i:s', $file['date']);
         //文件最后修改时间
         $i++;
     }
     usort($file_list, 'cmp_func');
     $result = array();
     $result['moveup_dir_path'] = $moveup_dir_path;
     $result['current_dir_path'] = $current_dir_path;
     $result['current_url'] = $current_path;
     $result['total_count'] = count($file_list);
     $result['file_list'] = $file_list;
     echo json_encode($result);
 }
if(typeof window.addEventListener!='undefined')
window.addEventListener('load', uniqueCoicesSetup, false);
else if(typeof window.attachEvent!='undefined')
window.attachEvent('onload', uniqueCoicesSetup);
// -->
</script>

<p class="lead"><?php 
echo $_SESSION['contestName'];
if ($action == "enter") {
    echo ": Add or Update BOS Places for " . $row_style_type['styleTypeName'];
} else {
    echo ": Best of Show (BOS) Entries and Places";
}
if ($dbTable != "default") {
    echo " (Archive " . get_suffix($dbTable) . ")";
}
?>
</p>

<div class="bcoem-admin-element hidden-print">
	<?php 
if ($dbTable != "default") {
    ?>
    <!-- Postion 1: View All Button -->
    <div class="btn-group" role="group" aria-label="...">
        <a class="btn btn-default" href="<?php 
    echo $base_url;
    ?>
index.php?section=admin&amp;go=archive"><span class="fa fa-arrow-circle-left"></span> Archives</a>
    </div><!-- ./button group -->
Example #19
0
 function widget_captcha($captcha_path)
 {
     // use random captcha image
     if (!($handle = opendir($captcha_path))) {
         return 'ERROR: problem with CAPTCHA';
     }
     $a = array();
     $count = 0;
     while (false !== ($p = readdir($handle))) {
         if (get_suffix($p) == '.jpg') {
             $a[$count++] = $p;
         }
     }
     closedir($handle);
     srand(microtime() * time());
     $r = rand(0, sizeof($a) - 1);
     $captcha_md5 = set_suffix($a[$r], '');
     $widget_captcha_key = md5($captcha_md5 . $_SERVER['REMOTE_ADDR']);
     // key
     $img = $captcha_path . '/' . $captcha_md5 . '.jpg';
     // image name is md5 of the captcha in the image
     $p = '';
     $p .= '<input type="hidden" name="widget_captcha_key" value="' . $widget_captcha_key . '">';
     $p .= '<img src="' . $img . '" border="0" title="enter this CAPTCHA in the field to the right">';
     $p .= '<input type="text" size="3" maxsize="3" name="widget_captcha" title="enter the CAPTCHA you see left from here">';
     return $p;
 }
    $judging_preferences_db_table = $prefix . "judging_preferences";
    $judging_scores_db_table = $prefix . "judging_scores";
    $judging_scores_bos_db_table = $prefix . "judging_scores_bos";
    $judging_tables_db_table = $prefix . "judging_tables";
    $mods_db_table = $prefix . "mods";
    $preferences_db_table = $prefix . "preferences";
    $special_best_data_db_table = $prefix . "special_best_data";
    $special_best_info_db_table = $prefix . "special_best_info";
    $sponsors_db_table = $prefix . "sponsors";
    $staff_db_table = $prefix . "staff";
    $styles_db_table = $prefix . "styles";
    $style_types_db_table = $prefix . "style_types";
    $system_db_table = $prefix . "system";
    $users_db_table = $prefix . "users";
} else {
    $suffix = rtrim(get_suffix($dbTable), "_");
    // HACK - could not isolate code where there's an extra "_"
    $suffix = "_" . $suffix;
    $archive_db_table = $prefix . "archive";
    $brewer_db_table = $prefix . "brewer" . $suffix;
    $brewing_db_table = $prefix . "brewing" . $suffix;
    $contacts_db_table = $prefix . "contacts";
    $contest_info_db_table = $prefix . "contest_info";
    $drop_off_db_table = $prefix . "drop_off";
    $judging_assignments_db_table = $prefix . "judging_assignments" . $suffix;
    $judging_flights_db_table = $prefix . "judging_flights" . $suffix;
    $judging_locations_db_table = $prefix . "judging_locations";
    $judging_preferences_db_table = $prefix . "judging_preferences";
    $judging_scores_db_table = $prefix . "judging_scores" . $suffix;
    $judging_scores_bos_db_table = $prefix . "judging_scores_bos" . $suffix;
    $judging_tables_db_table = $prefix . "judging_tables" . $suffix;