예제 #1
0
파일: render.php 프로젝트: obscurun/run-dev
 public function htmlHeader()
 {
     Debug::log("View->renderHeader:", __LINE__, __FUNCTION__, __CLASS__, __FILE__);
     Config::$PATH_LINK = UrlController::$useLanguage == true ? Config::$PATH . Config::$LANGUAGE_ACTIVE . "/" : Config::$PATH;
     $headerHTML = "";
     $headerHTML .= "<title>" . Config::$TITLE . "</title>";
     $headerHTML .= "\n\t<script> \n\t <!-- \n\t";
     $headerHTML .= "\n\t page = \"" . Config::$PATH . UrlController::getRelativePath(20) . "/\";";
     $headerHTML .= "\n\t PAGE = \"" . Config::$PATH . UrlController::getRelativePath(20) . "/\";";
     $headerHTML .= "\n\t PATH = \"" . Config::$PATH . "\";";
     $headerHTML .= "\n\t PATH_LINK = \"" . Config::$PATH_LINK . "\";";
     if (Config::$PATH_SITE != "") {
         $headerHTML .= "\n\t PATH_SITE = \"" . Config::$PATH_SITE . "\";";
     }
     $headerHTML .= "\n\t // --> \n\t</script> \n";
     /* $headerHTML .= "\n\t<script type=\"text/javascript\" src=\"". Config::$PATH ."js/jquery.js\"> </script>";
     		//$headerHTML .= "\n\t<script type=\"text/javascript\" src=\"". Config::$PATH ."js/functions.js\"></script>\n"; */
     $headerHTML .= self::$header_extras;
     $headerHTML .= "\n";
     self::$header_default = $headerHTML;
     self::$header_default .= self::googleAnalytics();
     echo self::$header_default;
 }
예제 #2
0
 function __construct()
 {
     if (UrlController::getLastLevel() == "upload_image") {
         $_POST['action'] = "insert";
         $_POST['token'] = "";
         $_POST['local'] = "";
         $_POST['status'] = 1;
         $_POST['pk_arquivo'] = "";
         $_FILES['arquivo'] = $_FILES['upload'];
         $_POST['descricao'] = "ilustração";
         $_POST['nota'] = "Imagem inserida dentro de conteúdos";
         $_POST['nome'] = Kit::$control->string->lower(Kit::$control->string->clearLatinSpecials($_FILES['arquivo']['name']));
         $_POST['extensao'] = explode('.', $_POST['nome']);
         $_POST['extensao'] = $_POST['extensao'][1];
         $_POST['mime_type'] = $_FILES['arquivo']['type'];
     }
     $this->model = new ArquivosModel();
     if (isset(Config::$_imageWidth)) {
         $this->_imageWidth = Config::$_imageWidth;
     }
     if (isset(Config::$_imageHeight)) {
         $this->_imageHeight = Config::$_imageHeight;
     }
     if (isset(Config::$_imageWidthMiddle)) {
         $this->_imageWidthMiddle = Config::$_imageWidthMiddle;
     }
     if (isset(Config::$_imageHeightMiddle)) {
         $this->_imageHeightMiddle = Config::$_imageHeightMiddle;
     }
     if (isset(Config::$_imageWidthMini)) {
         $this->_imageWidthMini = Config::$_imageWidthMini;
     }
     if (isset(Config::$_imageHeightMini)) {
         $this->_imageHeightMini = Config::$_imageHeightMini;
     }
     if (isset(Config::$_imageWidthEditor)) {
         $this->_imageWidthEditor = Config::$_imageWidthEditor;
     }
     if (isset(Config::$_imageHeightEditor)) {
         $this->_imageHeightEditor = Config::$_imageHeightEditor;
     }
     /**/
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageWidth = 591;
     }
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageHeight = 597;
     }
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageWidthMiddle = 191;
     }
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageHeightMiddle = 197;
     }
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageWidthMini = 144;
     }
     if (Kit::$control->getRequest("fk_template") == "31") {
         $this->_imageHeightMini = 133;
     }
     if (Kit::$control->getRequest("fk_template") == "35") {
         $this->_imageWidthMiddle = 145;
     }
     if (Kit::$control->getRequest("fk_template") == "35") {
         $this->_imageHeightMiddle = 87;
     }
     if (Kit::$control->getRequest("fk_template") == "38") {
         $this->_imageWidth = 660;
     }
     if (Kit::$control->getRequest("fk_template") == "38") {
         $this->_imageHeight = 241;
     }
 }
예제 #3
0
    private function _smarturl($urlmatch, $user_id)
    {
        if (preg_match('%http://.*\\.youtube\\.com/watch\\?v=([^?]+)%i', $urlmatch, $yt)) {
            return <<<YOUTUBE
\t\t\t\t<object width="425" height="344"><param name="movie" value="http://www.youtube-nocookie.com/v/{$yt[1]}&hl=en_US&fs=1&rel=0"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/{$yt[1]}&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344" wmode="transparent" ></embed></object>
YOUTUBE;
        }
        if (preg_match('%http://.*\\.viddler\\.com/explore/.+/videos/\\d+%i', $urlmatch, $vd)) {
            $v = file_get_contents($urlmatch);
            if (preg_match('%<link\\s+rel="video_src"\\s+href="([^"]+)"%', $v, $video)) {
                $url = $video[1];
                return <<<VIDDLER
\t\t\t\t\t<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler"><param name="movie" value="{$url}" /><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="{$url}" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler" wmode="transparent" ></embed></object>
VIDDLER;
            }
        }
        if (preg_match('%http://.*\\.hulu\\.com/watch/\\d+%i', $urlmatch, $vd)) {
            $v = file_get_contents($urlmatch);
            if (preg_match('%<link\\s+rel="video_src"\\s+href="([^"]+)"%', $v, $video)) {
                $url = $video[1];
                return <<<HULU
\t\t\t\t\t<object width="512" height="296"><param name="movie" value="{$url}"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent"></param><embed src="{$url}" type="application/x-shockwave-flash" allowFullScreen="true"  width="512" height="296" wmode="transparent"></embed></object>
HULU;
            }
        }
        extract($this->urlinfo($urlmatch));
        if (strtolower($ctype[1]) == 'image') {
            return '<a href="' . $urlmatch . '" target="_blank"><img onload="do_scroll();" src="' . $urlmatch . '"></a>';
        }
        if (strtolower($ctype[1]) == 'audio') {
            $audiourl = urlencode($urlmatch);
            return <<<AUDIO_PLAYER
<object type="application/x-shockwave-flash" data="/js/player.swf" width="200" height="20">
\t<param name="movie" value="/js/player.swf" />
\t<param name="wmode" value="transparent" />
\t<param name="FlashVars" value="showvolume=1&mp3={$audiourl}" />
</object>
<p><a href="{$urlmatch}">{$urlmatch}</a></p>
AUDIO_PLAYER;
        }
        if (strtolower(trim($ctype[2])) == 'x-shockwave-flash') {
            return <<<FLASH_PLAYER
<object type="application/x-shockwave-flash" data="{$urlmatch}" width="300">
\t<param name="movie" value="{$urlmatch}" />
\t<param name="wmode" value="transparent" />
</object>
<p><a href="{$urlmatch}">{$urlmatch}</a></p>
FLASH_PLAYER;
        }
        if (strpos($host, 'drp.ly') !== false) {
            $href = $content->find('img', 0)->src;
            return '<a href="' . $urlmatch . '" class="dragfloat drply" target="_blank"><img onload="do_scroll();" src="' . $href . '" style="width: 30%;"></a>';
        }
        if (strpos($host, 'd.pr') !== false) {
            $href = $content->find('img', 0)->src;
            return '<a href="' . $urlmatch . '" class="dragfloat drply" target="_blank"><img onload="do_scroll();" src="' . $href . '" style="width: 30%;"></a>';
        }
        if (strpos($host, 'awesomescreenshot.com') !== false) {
            $href = $content->find('#screenshot', 0)->src;
            return '<a href="' . $urlmatch . '" class="dragfloat awesomescreenshot" target="_blank"><img onload="do_scroll();" src="' . $href . '" style="width: 30%;"></a>';
        }
        if (strpos($host, 'screencast.com') !== false) {
            switch ($content->find('.embeddedObject', 0)->tag) {
                case 'img':
                    $href = $content->find('.embeddedObject', 0)->src;
                    $href = UrlController::tos3($href);
                    return '<a href="' . $urlmatch . '" class="dragfloat screencast" target="_blank"><img onload="do_scroll();" src="' . $href . '" style="width: 30%;"></a>';
                case 'object':
                    $rooturl = str_replace('www.screencast.com', 'content.screencast.com', $cururl) . '/';
                    $thumburl = $rooturl . 'FirstFrame.jpg';
                    $flashvars = $content->find('.embeddedObject param[name=flashVars]', 0)->value;
                    if (preg_match('%[^&/]+\\.(swf|mp4)%i', $flashvars, $swfmatch)) {
                        preg_match('%containerwidth=(\\d+)%', $flashvars, $matchwidth);
                        preg_match('%containerheight=(\\d+)%', $flashvars, $matchheight);
                        $containerwidth = $matchwidth[1];
                        $containerheight = $matchheight[1];
                        $swf = $rooturl . $swfmatch[0];
                        $width = $content->find('.embeddedObject', 0)->width;
                        $height = $content->find('.embeddedObject', 0)->height;
                        if ($width > 640) {
                            $height = round($height * (640 / $width));
                            $width = 640;
                        }
                        if ($height > 300) {
                            $width = round($width * (300 / $height));
                            $height = 300;
                        }
                        return <<<SCREENCAST
<object width="{$width}" height="{$height}">
\t<param name="movie" value="{$swf}"></param>
\t<param name="quality" value="high"></param>
\t<param name="bgcolor" value="#FFFFFF"></param>
\t<param name="flashVars" value="thumb={$thumburl}&containerwidth={$containerwidth}&containerheight={$containerheight}&content={$swf}"></param>
\t<param name="allowFullScreen" value="true"></param>
\t<param name="scale" value="showall"></param>
\t<param name="allowScriptAccess" value="always"></param>
  <param name="base" value="{$rooturl}"></param>
\t<param name="wmode" value="transparent"></param>
\t<embed
\t\tsrc="{$rooturl}jingswfplayer.swf"
\t\tquality="high"
\t\tbgcolor="#FFFFFF"
\t\twidth="{$width}"
\t\theight="{$height}"
\t\ttype="application/x-shockwave-flash"
\t\tallowScriptAccess="always"
\t\tflashVars="thumb={$thumburl}&containerwidth={$containerwidth}&containerheight={$containerheight}&content={$swf}"
\t\tallowFullScreen="true"
\t\tscale="showall"
\t\tbase="{$rooturl}"
\t\twmode="transparent">
\t</embed>
</object>
\t\t\t\t\t<br><a href="{$urlmatch}">View on Screencast</a>
SCREENCAST;
                        return $swf;
                    } else {
                        $thumburl = UrlController::tos3($thumburl);
                        return '<a href="' . $urlmatch . '"><img onload="do_scroll();" src="' . $thumburl . '" style="width: 30%;"></a>';
                    }
            }
        }
        $thumbjob = UrlController::get_thumbnail($urlmatch);
        do {
            sleep(5);
            $img = UrlController::cache_thumb($thumbjob, $user_id);
        } while ($img == false && $count++ < 10);
        if ($img) {
            $smart->operation = '';
            $imgtag = '<img src="' . $img . '" class="smartthumb noresize" onload="thumbload(this);">';
            $class = 'withthumb';
        } else {
            $imgtag = '';
            $class = 'withoutthumb';
        }
        switch ($status) {
            case 200:
                if ($pagetitle = $content->find('title', 0)->innertext) {
                    return '<a class="' . $class . '" href="' . $urlmatch . '" target="_blank">' . $imgtag . '</a>' . implode('<wbr/>', str_split($pagetitle, 10)) . '<br><a href="' . $urlmatch . '" target="_blank">' . implode('<wbr/>', str_split($urlmatch, 10)) . '</a><hr style="clear:both;visibility:hidden;height:1px;" />';
                }
                $pagetitle = implode('<wbr/>', str_split($urlmatch, 10));
                return '<a class="' . $class . '" href="' . $urlmatch . '" target="_blank">' . $imgtag . '</a><a href="' . $urlmatch . '" target="_blank">' . $pagetitle . '</a><br><a href="' . $urlmatch . '" target="_blank">' . implode('<wbr/>', str_split($urlmatch, 10)) . '</a><hr style="clear:both;visibility:hidden;height:1px;" />';
            default:
                $pagetitle = implode('<wbr/>', str_split($urlmatch, 10));
                return '<a class="' . $class . '" href="' . $urlmatch . '" target="_blank">' . $imgtag . '</a><a href="' . $urlmatch . '" target="_blank">' . $pagetitle . '</a><br><a href="' . $urlmatch . '" target="_blank">' . implode('<wbr/>', str_split($urlmatch, 10)) . '</a><hr style="clear:both;visibility:hidden;height:1px;" />';
        }
    }
예제 #4
0
<?php

error_reporting(0);
//controller
require_once 'controller/urlcontroller.php';
//model
require_once 'model/scrapemodel.php';
require_once 'model/handlermodel.php';
require_once 'model/sessionmodel.php';
require_once 'model/infomodel.php';
//view
require_once 'view/layoutview.php';
require_once 'view/mainview.php';
require_once 'view/urlview.php';
$infomodel = new InfoModel();
$sessionmodel = new SessionModel();
$scrapemodel = new ScrapeModel($sessionmodel);
$handlermodel = new HandlerModel($sessionmodel, $scrapemodel);
//view
$layoutview = new LayoutView();
$mainview = new MainView($infomodel);
$urlview = new UrlView();
//controller
$urlcontroller = new UrlController($handlermodel, $scrapemodel, $urlview, $mainview);
$ifclicked = $urlcontroller->init();
$layoutview->render($mainview, $urlview, $ifclicked);