Exemple #1
0
 function class_rules($user_id, $tbl_result = "")
 {
     $this->user_id = $user_id;
     $this->login = $tbl_result["login"] == "" ? "Super Admin" : $tbl_result["login"];
     $this->listgroupeid = "";
     if ($user_id != -1) {
         $sql_getPerms = "select shortright from " . __racinebd__ . "droits d inner join " . __racinebd__ . "groupe_droits gd on d.droits_id=gd.droits_id inner join " . __racinebd__ . "groupe_users gu on gd.groupe_id=gu.groupe_id where gu.users_id=" . $user_id . " and droitarbre=0";
         $link = query($sql_getPerms);
         while ($li = fetch($link)) {
             $this->genericRules[$li["shortright"]] = 1;
         }
         $this->list_groupe_id = implode(",", $listgroupe_id);
         $sql_getPerms = "select * from " . __racinebd__ . "groupe_users gu where users_id=" . $user_id;
         //print $sql_getPerms;
         $link = query($sql_getPerms);
         $listgroupe_id = array();
         $tmptab = array();
         $tmptab[] = 0;
         while ($li = fetch($link)) {
             $this->groupe_id[$li["groupe_id"]] = 1;
             $tmptab[] = $li["groupe_id"];
         }
         $this->listgroupeid = implode(",", $tmptab) . ",0";
     } else {
         $this->listgroupeid = 0;
     }
 }
 function friend_link_check_ajax()
 {
     global $_G;
     $host = $_SERVER['HTTP_HOST'];
     $host = str_replace(array('http://', 'https://', '/'), '', $host);
     $id = intval($_GET[id]);
     $url = $_G[friend_link][$id]['url'];
     if (!$url) {
         json(array('status' => 'success', 'msg' => '-1'));
     } else {
         try {
             $res = fetch($url);
         } catch (Exception $e) {
             $res = false;
         }
         if (!$res) {
             $extends = -1;
         } elseif (stripos($res, $host) !== false) {
             $extends = 1;
         } else {
             $extends = 0;
         }
         json(array('status' => 'success', 'msg' => $extends));
     }
 }
Exemple #3
0
 /**
  * 返回的是分段视频
  * @param string $url
  * @return array
  */
 public function getDownloadByUrl($url)
 {
     require_once VPARSER_ROOT . '/Common/function.php';
     $content = fetch($url);
     preg_match_all('/fo\\.addVariable\\(\\"videoCenterId\\"\\,\\"(.*?)\\"\\)\\;/', $content, $arr);
     $contents = fetch('http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=' . $arr[1][0] . '&idl=32&idlr=32&modifyed=false');
     $v = json_decode($contents, true);
     // 		[video] => Array
     // 		(
     // 				[validChapterNum] => 2
     // 				[lowChapters] => Array
     // 				(
     // 						[0] => Array
     // 						(
     // 								[image] => http://p4.img.cctvpic.com/fmspic/2015/09/19/cdaae8023379407eb547870805762508-180.jpg
     // 								[url] => http://vod.cntv.lxdns.com/flash/mp4video45/TMS/2015/09/19/cdaae8023379407eb547870805762508_h264200000nero_aac16.mp4
     // 								[duration] => 146
     // 						)
     // 				)
     // 				[totalLength] => 146.00
     // 				[chapters] => Array
     // 				(
     // 						[0] => Array
     // 						(
     // 								[image] => http://p4.img.cctvpic.com/fmspic/2015/09/19/cdaae8023379407eb547870805762508-180.jpg
     // 								[url] => http://vod.cntv.lxdns.com/flash/mp4video45/TMS/2015/09/19/cdaae8023379407eb547870805762508_h264418000nero_aac32.mp4
     // 								[duration] => 146
     // 						)
     // 				)
     // 				[url] =>
     // 		)
     $vUrl = $v['video']['chapters'];
     return $vUrl;
 }
Exemple #4
0
function svn_clone($url)
{
    #去除多余的url结尾多余的斜杠
    $url = trim($url, '/');
    $entries_url = $url . '/.svn/entries';
    $content = get($entries_url);
    if (!$content) {
        return debug("{$url} 不是一个合法的svn工作副本!\n", ERROR);
    } elseif (strlen($content) < 10) {
        return debug("某个东西太短了,需要蓝色小药丸么?\n", ERROR);
    }
    #匹配出entries中的文件和目录名
    preg_match_all('/\\f\\n([^\\n]+?)\\s(\\w+)\\s/s', $content, $m) or debug("{$entries_url} 不包含文件或子目录\n", WARNING);
    $files = array_combine($m[1], $m[2]);
    foreach ($files as $file => $type) {
        if ($type == 'dir') {
            debug(">>> 进入 {$file} 目录\n", ALL);
            svn_clone($url . '/' . $file);
            debug("<<< 退出 {$file} 目录\n", ALL);
        } elseif ($type == 'file') {
            debug("*** 下载 {$file} 文件\n", ALL);
            fetch($url . '/.svn/text-base/' . $file . '.svn-base');
        }
    }
}
Exemple #5
0
/**
 * PLayer video in video-js player
 * @global boolean $pak_player
 * @param type $in
 * @return boolean 
 */
function video_js($in)
{
    //Assigning configs so we can easily use them in template..
    assign('configs', $in);
    //get the file for video...
    $files = $in['files'];
    $video_files = array();
    if ($files) {
        foreach ($files as $key => $file) {
            if ($key) {
                if ($key == 'flv' || $key == 'mp4' || $key == 'mobile') {
                    $video_file = $file;
                    break;
                }
            }
            if ($file['status'] == 's' && $file['is_original'] != 'yes') {
                $video_file = $file['file_path'];
                break;
            }
        }
    }
    assign('file', $video_file);
    assign('video_files', $video_files);
    $player = fetch(VIDEO_JS_DIR . '/player.html', false);
    return $player;
}
function checkMilestone($class, $action)
{
    if (!$class) {
        $action();
        return;
    }
    $milestones = fetchAll("SELECT points FROM milestone ORDER BY points ASC");
    $startPoints = array_pop(calculatePoints($class)["points"]);
    $action();
    $endPoints = array_pop(calculatePoints($class)["points"]);
    $achieved = [];
    foreach ($milestones as $stone) {
        if ($stone->points > $endPoints) {
            break;
        }
        if ($stone->points > $startPoints) {
            array_push($achieved, $stone->points);
        }
    }
    if (empty($achieved)) {
        return;
    }
    $classInfo = fetch("SELECT c.name, u.email FROM class AS c JOIN user AS u ON c.teacher = u.id");
    $n = "";
    if (count($achieved) > 1) {
        $n = "n";
    }
    foreach (fetchAll("SELECT email FROM user WHERE role = :admin", ["admin" => ADMIN]) as $admin) {
        own_mail($admin->email, "Etappe{$n} erreicht", "Guten Tag,\r\nDie Klasse \"{$classInfo->name}\" hat die Etappe{$n} " . implode(", ", $achieved) . " erreicht!\r\nDie Lehrkraft ist: {$classInfo->email} \r\n\r\nNachhaltige Grüße\r\nIhre Weltfairsteher-Website");
    }
    own_mail($classInfo->email, "Etappe{$n} erreicht", "Herzlichen Glückwunsch, Ihre  Klasse \"{$classInfo->name}\" hat bei WeltFAIRsteher die Etappe{$n} " . implode(", ", $achieved) . " erreicht!\r\nSie erhalten demnächst eine Überraschung per Post\r\n\r\nNachhaltige Grüße\r\nIhr WeltFAIRsteher-Team");
}
function requestAndDisplayCompany($company)
{
    // echo $response;
    $companies = fetch('GET', "/v1/company-search?keywords=" . urlencode($company) . "&country-code=us&facet=location,us:0&hq-only=true&");
    if ($companies === FALSE) {
        restart();
    } else {
        ?>
    <html>
    <head>
      <title>Companies</title>
    </head>
    <body>
      <h1>Expires at: <?php 
        date_default_timezone_set('America/Los_Angeles');
        echo date('l jS \\of F Y h:i:s A', $_SESSION['expires_at']);
        ?>
</h1>
      <br><br>
      <h1><?php 
        echo $companies;
        ?>
</h1>
    </body>
    </html>
    <?php 
    }
}
Exemple #8
0
 function fetch_forums()
 {
     // data to be stored in here
     $json = array();
     $good = 0;
     foreach (self::$feeds as $url) {
         $data = fetch($url);
         if ($data) {
             $good++;
             $keep = self::$itemsToKeep;
             $rss = simplexml_load_string($data);
             foreach ($rss->channel->item as $item) {
                 if ($keep-- == 0) {
                     break;
                 }
                 $time = strtotime($item->pubDate);
                 $text = strip_tags($item->description);
                 if (strlen($text) > 140) {
                     $text = substr($text, 0, 140) . "&hellip;";
                 }
                 $json["T{$time}"] = array("time" => $time, "link" => (string) $item->link, "text" => $text);
             }
         }
     }
     if (count($json) > 0) {
         // sort items by key, newest to oldest
         krsort($json);
         apc_store(self::$forumKey, json_encode($json));
         return true;
     } else {
         return false;
     }
 }
Exemple #9
0
 function fetch_platform_issues()
 {
     // 1. Fetch the json encoded issues from github
     // 2. Iterate thru issues, just keeping data we need (title/number)
     // 3. Sort "temp" by updated_at (stored in key)
     // 4. Cache sorted json string
     $json = fetch(self::$platformIssueUrl);
     if ($json) {
         // Strip \r\n out of json, otherwise json_decode will fail
         $json = str_replace(array(chr(13), chr(10)), array("", ""), $json);
         $issues_arr = json_decode($json, 1);
         if ($issues_arr) {
             $data = array();
             foreach ($issues_arr as $issues) {
                 foreach ($issues as $i) {
                     // temp key so we can sort array based on date
                     $ut = strtotime($i["updated_at"]);
                     $data["T{$ut}"] = $this->get_issue_object($i);
                 }
             }
             // newest issues first
             krsort($data);
             apc_store(self::$platformIssueKey, json_encode(array_values($data)));
             return true;
         }
     }
     return false;
 }
function get_video_info($id)
{
    $html = fetch("http://www.youtube.com/get_video_info?video_id={$id}");
    // id: nCnJ_x-QpJM
    //
    // array (size=8)
    //   'errorcode' => string '150' (length=3)
    //   'reason' => string 'This video contains content from Quiz Group Pro. It is restricted from playback on certain sites.<br/><u><a href='http://www.youtube.com/watch?v=nCnJ_x-QpJM&feature=player_embedded' target='_blank'>Watch on YouTube</a></u>' (length=222)
    //   'status' => string 'fail' (length=4)
    //   'eventid' => string 'Aq4qVMLdN4ab-gOroIHwDQ' (length=22)
    //   'errordetail' => string '0' (length=1)
    //   'csi_page_type' => string 'embed' (length=5)
    //   'c' => string 'WEB' (length=3)
    //   'enablecsi' => string '1' (length=1)
    parse_str($html, $video_info);
    if (!empty($video_info['errorcode'])) {
        throw new Exception(__FUNCTION__ . ': ' . json_encode($video_info));
    }
    $tmp = array();
    foreach (explode(',', $video_info['url_encoded_fmt_stream_map']) as $stream_str) {
        parse_str($stream_str, $stream);
        $tmp[] = $stream;
    }
    $video_info['url_encoded_fmt_stream_map'] = $tmp;
    $tmp = array();
    foreach (explode(',', $video_info['adaptive_fmts']) as $fmt_str) {
        parse_str($fmt_str, $fmt);
        $tmp[] = $fmt;
    }
    $video_info['adaptive_fmts'] = $tmp;
    return $video_info;
}
function getAllSubCategories($filename)
{
    $categories = unserialize(file_get_contents($filename));
    echo "---- run getAllSubCategories() ----\n\r";
    foreach ($categories as $j => $category) {
        if ($category['childrens']) {
            foreach ($category['childrens'] as $k => $children) {
                echo "---- crawling childrens for {$children['name']} ----\n\r";
                $doc = phpQuery::newDocumentHTML(fetch('http://www.walmart.com' . $children['link']));
                phpQuery::selectDocument($doc);
                foreach (pq('.shop-by-category li') as $el) {
                    echo "---- " . pq($el)->find('a')->attr('href') . "} ----\n\r";
                    $childrens[] = array('name' => pq($el)->find('a')->data('name'), 'link' => pq($el)->find('a')->attr('href'));
                }
                $categories[$j]['childrens'][$k]['childrens'] = $childrens;
            }
        }
    }
    echo "---- creating deparment file ----\n\r";
    $file = fopen($filename, 'w+');
    echo "---- writing deparment file ----\n\r";
    fputs($file, serialize($categories));
    echo "---- closing deparment file ----\n\r";
    fclose($file);
}
Exemple #12
0
function adjust_tags($from, $layout = FALSE)
{
    static $open = '/\\s*<(script|style)[^>]*?>.*?<\\/\\1>\\s*/s', $close = '/\\s*<(meta|link)[^>]*?\\/?>\\s*/s', $header = '/<(head)[^<>]*>(.+?)<\\/\\1>/s', $descript = '/<title>(.+?)<\\/title>/s';
    if (preg_match('/^(?:<html|["\'\\[{])/', $from)) {
        return $from;
    }
    $separator = option('separator') ?: ' - ';
    $top_title = option('title');
    $sub_title = fetch('title');
    $raw = $head = $body = $title = $stack = array();
    $collect = function ($match) use(&$stack) {
        $stack[] = array('tag' => $match[1], 'full' => trim($match[0]));
    };
    $from = preg_replace_callback($header, function ($match) use(&$raw) {
        $raw[] = $match[2];
    }, $from);
    preg_match($descript, $layout, $match) && ($top_title = $match[1]);
    preg_match($descript, $from, $match) && ($sub_title = $match[1]);
    $top_title && ($title[] = trim($top_title));
    $sub_title && ($title[] = trim($sub_title));
    $layout = preg_replace($descript, '', $layout);
    $from = preg_replace($descript, '', $from);
    $from = preg_replace_callback($open, $collect, $from);
    $from = preg_replace_callback($close, $collect, $from);
    foreach ($stack as $one) {
        $one['tag'] === 'script' ? $body[] = $one['full'] : ($head[] = $one['full']);
    }
    while ($head[] = array_shift($raw)) {
    }
    $from = preg_replace('/<(body)([^<>]*?)>/', "<\\1\\2>\n{$from}", $layout);
    $from = str_replace('</head>', sprintf("%s\n</head>", join("\n", $head)), $from);
    $from = str_replace('</body>', sprintf("%s\n</body>", join("\n", $body)), $from);
    $from = str_replace('</head>', sprintf("<title>%s</title>\n</head>", join($separator, $title)), $from);
    return $from;
}
 /**
  * 编译并返回内容
  * @param unknown_type $attr
  * @param unknown_type $value
  * @param unknown_type $tagInfo
  * @return Ambigous <void, mixed>|string
  */
 public function replaceTag($attr, $value = '', $tagInfo)
 {
     $this->init($attr, $value);
     //调用子类的replace方法把参数引入
     $var = $this->replace();
     return fetch($this->templateFile, $var);
 }
Exemple #14
0
/**
 * The main Page editor panel.
 *
 * @param string|array $message The activity message
 */
function page_edit($message = '')
{
    global $event, $step;
    pagetop(gTxt('edit_pages'), $message);
    extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew'))));
    $name = sanitizeForPage(assert_string(gps('name')));
    $newname = sanitizeForPage(assert_string(gps('newname')));
    if ($step == 'page_delete' || empty($name) && $step != 'page_new' && !$savenew) {
        $name = safe_field('page', 'txp_section', "name = 'default'");
    } elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) {
        $name = $newname;
    }
    $buttons = n . tag(gTxt('page_name'), 'label', array('for' => 'new_page')) . br . fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_page', false, true);
    if ($name) {
        $buttons .= span(href(gTxt('duplicate'), '#', array('id' => 'txp_clone', 'class' => 'clone', 'title' => gTxt('page_clone'))), array('class' => 'txp-actions'));
    } else {
        $buttons .= hInput('savenew', 'savenew');
    }
    $html = !$save_error ? fetch('user_html', 'txp_page', 'name', $name) : gps('html');
    // Format of each entry is popTagLink -> array ( gTxt() string, class/ID).
    $tagbuild_items = array('page_article' => array('page_article_hed', 'article-tags'), 'page_article_nav' => array('page_article_nav_hed', 'article-nav-tags'), 'page_nav' => array('page_nav_hed', 'nav-tags'), 'page_xml' => array('page_xml_hed', 'xml-tags'), 'page_misc' => array('page_misc_hed', 'misc-tags'), 'page_file' => array('page_file_hed', 'file-tags'));
    $tagbuild_links = '';
    foreach ($tagbuild_items as $tb => $item) {
        $tagbuild_links .= wrapRegion($item[1] . '_group', taglinks($tb), $item[1], $item[0], 'page_' . $item[1]);
    }
    echo hed(gTxt('tab_pages'), 1, array('class' => 'txp-heading'));
    echo n . tag(n . tag(hed(gTxt('tagbuilder'), 2) . $tagbuild_links, 'div', array('id' => 'tagbuild_links', 'class' => 'txp-layout-cell txp-layout-1-4')) . n . tag(form(graf($buttons) . graf(tag(gTxt('page_code'), 'label', array('for' => 'html')) . br . '<textarea class="code" id="html" name="html" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($html) . '</textarea>') . graf(fInput('submit', '', gTxt('save'), 'publish') . eInput('page') . sInput('page_save') . hInput('name', $name)), '', '', 'post', 'edit-form', '', 'page_form'), 'div', array('id' => 'main_content', 'class' => 'txp-layout-cell txp-layout-2-4')) . n . tag(graf(sLink('page', 'page_new', gTxt('create_new_page')), ' class="action-create"') . page_list($name) . n, 'div', array('id' => 'content_switcher', 'class' => 'txp-layout-cell txp-layout-1-4')) . n, 'div', array('id' => $event . '_container', 'class' => 'txp-layout-grid'));
}
Exemple #15
0
function section_create()
{
    global $txpcfg;
    $name = ps('name');
    //Prevent non url chars on section names
    include_once txpath . '/lib/classTextile.php';
    $textile = new Textile();
    $title = $textile->TextileThis($name, 1);
    $name = strtolower(sanitizeForUrl($name));
    $chk = fetch('name', 'txp_section', 'name', $name);
    if (!$chk) {
        if ($name) {
            $default = doSlash(safe_row('page, css', 'txp_section', "name = 'default'"));
            $rs = safe_insert("txp_section", "name         = '" . doSlash($name) . "',\n\t\t\t\t\ttitle        = '" . doSlash($title) . "',\n\t\t\t\t\tpage         = '" . $default['page'] . "',\n\t\t\t\t\tcss          = '" . $default['css'] . "',\n\t\t\t\t\tis_default   = 0,\n\t\t\t\t\tin_rss       = 1,\n\t\t\t\t\ton_frontpage = 1");
            if ($rs) {
                update_lastmod();
                $message = gTxt('section_created', array('{name}' => $name));
                sec_section_list($message);
            }
        } else {
            sec_section_list();
        }
    } else {
        $message = array(gTxt('section_name_already_exists', array('{name}' => $name)), E_ERROR);
        sec_section_list($message);
    }
}
Exemple #16
0
function bb2_db_rows($result)
{
    $array = array();
    while ($resultRow = fetch($result)) {
        $array[] = $resultRow;
    }
    return $array;
}
Exemple #17
0
 public function getDownloadById($vid)
 {
     require_once VPARSER_ROOT . '/Common/function.php';
     $data = fetch('http://www.yinyuetai.com/insite/get-video-info?videoId=' . $vid . '&flex=true');
     preg_match_all('|(http://[a-z]{2}.yinyuetai.com/uploads/videos/common/[^&]+)&br=|', $data, $vUrl);
     $vUrl = $vUrl[1];
     return $vUrl;
 }
Exemple #18
0
function pull_all_comments($post_id)
{
    $query = "SELECT concat(users.name_first,' ',users.name_last) as user_name,\n\t\t\t\t\t\t\t comments.id as comment_id,\n\t\t\t\t\t\t\t comments.content as comment_content,\n\t\t\t\t\t\t\t comments.user_id as user_who_commented,\n\t\t\t\t\t\t\t comments.created_at as comment_date \n\t\t\t\t\t\t\t FROM comments\n\t\t\t\t\t\t\tJOIN users ON users.id = comments.user_id\n\t\t\t\t\t\t\t-- JOIN posts ON posts.id = comments.user_id\n\t\t\t\t\t\t\tWHERE comments.post_id = {$post_id}\n\t\t\t\t\t\t\tORDER BY comment_date DESC;";
    // var_dump($query);
    // die();
    return fetch($query);
    // returns array
}
Exemple #19
0
function fetchdata($fromdate, $todate)
{
    $user = fetch('GET', '/user/profile');
    $user2 = fetch('GET', '/user/summary/daily?from=' . $fromdate . '&to=' . $todate . '');
    print_r($user2);
    $userid = $user->userId;
    insertindatabase($user2, $userid);
}
Exemple #20
0
function get_rides()
{
    if (isset($_SESSION['school_id'])) {
        $query = "SELECT token FROM schools WHERE id = {$_POST['school_id']}";
        return fetch($query);
    } else {
        return "Please log in.";
    }
}
Exemple #21
0
 function view_pdf($id)
 {
     $preferences_q = query("SELECT settings FROM `" . $this->user['database'] . "`.account_settings WHERE group_id='" . $this->user['group'] . "' ORDER BY id DESC");
     $preferences_r = fetch($preferences_q);
     $this->smarty->assign('preferences', json_decode($preferences_r['settings'], 1));
     $shipment = new Shipment($id, $this->user);
     $this->smarty->assign('shipment', $shipment->toArray());
     $this->html['shipon_content'] = $this->smarty->fetch('history/view_pdf.tpl') . $this->get_pdf_footer($id);
 }
Exemple #22
0
 public function getDownloadById($vid)
 {
     require_once VPARSER_ROOT . '/Common/function.php';
     $data = fetch('http://api.miaopai.com/m/v2_channel.json?fillType=259&scid=' . $vid . '&vend=miaopai');
     $info = json_decode($data, true);
     //http://gslb.miaopai.com/stream/~7sCwx2y5qD53Ff~tcguUQ__.mp4?vend=miaopai&~7sCwx2y5qD53Ff~tcguUQ__.mp4?vend=sina
     $vUrl = $info['result']['stream']['base'];
     return $vUrl;
 }
Exemple #23
0
 /**
  * 渲染HTML页面
  * @param string $templateFile 模板文件路径
  * @param string $charset 字符集,默认为UTF8
  * @param string $contentType 内容类型,默认为text/html
  * @return string HTML页面数据
  */
 public function fetch($templateFile = '', $charset = 'utf-8', $contentType = 'text/html')
 {
     if (!is_file($templateFile)) {
         $templateFile = realpath($this->path . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . $templateFile . '.html');
     }
     // 获取当前Js语言包
     $this->langJsList = setLangJavsScript();
     $this->assign('langJsList', $this->langJsList);
     return fetch($templateFile, $this->tVar, $charset, $contentType, false);
 }
Exemple #24
0
 function fetch_search_tweets($search)
 {
     $json = fetch(self::$searchUrl . urlencode($search));
     if ($json) {
         apc_store(self::$searchKey . $search, $json);
         return true;
     } else {
         return false;
     }
 }
Exemple #25
0
function mentionInsert($array)
{
    extract(doSlash($array));
    $chk = fetch('article_id', 'txp_log_mention', 'refpage', $refpage);
    if (!$chk) {
        safe_insert("txp_log_mention", "article_id = '{$id}', \n\t\t\t\trefpage    = '{$refpage}', \n\t\t\t\treftitle   = '{$reftitle}', \n\t\t\t\texcerpt    = '{$excerpt}', \n\t\t\t\tcount      = 1");
    } else {
        safe_update("textpattern", "count=count+1", "refpage='{$refpage}'");
    }
}
Exemple #26
0
 function cb_player($in)
 {
     global $cb_player;
     $cb_player = true;
     $vdetails = $in['video'];
     //Checking for YT Referal
     if (function_exists('get_refer_url_from_embed_code')) {
         $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
         $ytcode = $ref_details['ytcode'];
     }
     $files = $in['files'];
     if ($files) {
         foreach ($files as $key => $file) {
             if ($key == 'flv' || $key == 'mp4' || $key == 'mobile') {
                 $video_file = $file;
                 break;
             }
             if ($file['status'] == 's' && $file['is_original'] != 'yes') {
                 $video_file = VIDEOS_URL . '/' . $file['file_directory'] . '/';
                 $video_file .= $file['file_name'] . $file['suffix'] . '.' . $file['ext'];
                 break;
             }
         }
     }
     if ($video_file || $ytcode) {
         if ($ytcode) {
             assign('youtube', true);
             assign('ytcode', $ytcode);
         }
         if (!strstr($in['width'], "%")) {
             $in['width'] = $in['width'] . 'px';
         }
         if (!strstr($in['height'], "%")) {
             $in['height'] = $in['height'] . 'px';
         }
         if ($in['autoplay'] == 'yes' || $in['autoplay'] === true || $_COOKIE['auto_play_playlist'] && ($_GET['play_list'] || $_GET['playlist'])) {
             $in['autoplay'] = true;
         } else {
             $in['autoplay'] = false;
         }
         //Logo Placement
         assign('logo_placement', cb_player_logo_position());
         assign('logo_margin', config('logo_padding'));
         //Setting Skin
         assign('cb_skin', 'glow/glow.xml');
         assign('player_data', $in);
         assign('player_logo', website_logo());
         assign('normal_vid_file', $video_file);
         assign("hq_vid_file", $hd_file);
         assign('vdata', $vdetails);
         $player = fetch(CB_PLAYER_DIR . '/cbplayer.html', false);
         return $player;
     }
 }
Exemple #27
0
 public function getDownloadById($vid)
 {
     require_once VPARSER_ROOT . '/Common/function.php';
     $content = fetch('http://www.xiami.com/song/playlist/id/' . $vid . '/object_name/default/object_id/0/cat/json');
     $data = json_decode($content, true);
     $info = $data['data']['trackList'][0];
     $vUrl = array();
     $vUrl['src'] = $this->getSrc($info['location']);
     $vUrl['lrc'] = $info['lyric'];
     return $vUrl;
 }
Exemple #28
0
function format_address_array(&$return_array, $query_result, $attribute)
{
    if (num_rows($query_result)) {
        $address = fetch($query_result);
        $keys = array_keys($address);
        for ($i = 0; $i < count($keys); $i++) {
            $new_key = $attribute . $keys[$i];
            $return_array[$new_key] = $address[$keys[$i]];
        }
    }
}
function show_pics_data($params)
{
    $fres = fopen("update.sql", "w");
    var_dump(one(q("select count(*) from gallery where thumb = 0")));
    exit;
    $galleries = q("select * from gallery");
    while ($row = fetch($galleries)) {
        fwrite($fres, sprintf("update gallery set thumb = %s, approved = %s where id = %s;\n", $row["thumb"], $row["approved"], $row["id"]));
    }
    fclose($fres);
}
Exemple #30
0
 public static function find($id)
 {
     $query = DB::connection()->prepare('SELECT * FROM Result WHERE id = :id LIMIT 1');
     $query->execute(array('id' => $id));
     $row = $query . fetch();
     if ($row) {
         $result = new Result(array('survey' => $row['survey'], 'value' => $row['value'], 'time' => $row['time']));
         return $row;
     }
     return null;
 }