Twitter Updates

    Based on:
    JW Player 5.8
    PHPmotion V3.5 - Rev 115
    CentOS release 5.7 (Final) 64 bit

    PHPmotion was installed not into sub directory (directly installed at /var/www/html/)

    1. Download JW Player at http://www.longtailvideo.com/ and extract content

    2. Create directory `jwplayer` at `/var/www/html/` (/var/www/html/jwplayer). Copy file `jwplayer.js` and `player.swf` from the JW Player downloaded earlier into the `jwplayer` folder.

    3. Modify the `Now Playing` video player. Edit `/var/www/html/themes/default/templates/make_player.html`.

    Replace below:

    var flashvars = {};
    var params = {};
    var attributes = {};
    flashvars.player_mode = "normal";
    flashvars.playlist = "no";
    flashvars.logo = "top_right";
    flashvars.floating_navbar = "false";
    flashvars.color_nav_bar_top = "0x478dc2";
    flashvars.color_nav_bar_bottom = "0xE7EBEC";
    flashvars.ads_background_color = "0x00CCFF";
    flashvars.ads_border_color = "0xCCCCCC";
    flashvars.scrubber_position_color = "0x6AA1CE";
    flashvars.scrubber_load_color = "0x888888";
    flashvars.scrubber_background_color = "0xBBBBBB";
    flashvars.volume_bar_color = "0xBBBBBB";
    flashvars.aspect_ratio="stretch";
    params.allowfullscreen = "true";
    params.allowscriptaccess = "sameDomain";
    params.wmode = "transparent";

    //___dynamic settings________
    flashvars.flvsource = "[var.base_url]/uploads/[var.video_play]";
    flashvars.preview_image = "[var.base_url]/[var.thumb_file]";
    flashvars.url_logo = "[var.base_url]/images/playerlogos/logo-player.png";
    flashvars.buffering_time = [var.video_buffer_time];
    flashvars.autoplay = "[var.auto_play]";
    flashvars.display_ads = "[var.player_defaults_ads]";
    [var.player_defaults_ads_xml]
    //___dynamic settings end ______

    swfobject.embedSWF("[var.base_url]/player.swf", "myAlternativeContent", "560", "420", "9.0.0", false, flashvars, params, attributes);


    With this:

    var flashvars = {};
    var params = {};
    var attributes = {};

    flashvars.file = "[var.base_url]/uploads/[var.video_play]";
    flashvars.autostart = "true";
    flashvars.bufferlength = "[var.video_buffer_time]";
    flashvars.stretching = "fill";
    flashvars.image = "[var.base_url]/[var.thumb_file]";
    flashvars.smoothing = "true";
    flashvars.volume = "90";

    params.allowfullscreen = "true";
    params.allowscriptaccess = "always";
    params.wmode = "transparent";


    swfobject.embedSWF('[var.base_url]/jwplayer/player.swf','myAlternativeContent','560','420','9.0.115','false',flashvars, params, attributes);


    4. Modify the `Latest Videos` video player (Home). Edit `/var/www/html/themes/default/templates/make_player.html`.

    Replace below:

    var flashvars = {};
    var params = {};
    var attributes = {};
    flashvars.player_mode = "playlist";
    flashvars.display_ads = "no";
    flashvars.playlist = "yes";
    flashvars.playlist_xml = "[var.base_url]/playlist.php";
    flashvars.logo = "top_right";
    flashvars.url_logo = "[var.base_url]/images/playerlogos/logo-player.png";
    flashvars.autoplay = "false";
    flashvars.color_nav_bar_top = "0x478dc2";
    flashvars.color_nav_bar_bottom = "0xE7EBEC";
    flashvars.ads_background_color = "0x00CCFF";
    flashvars.ads_border_color = "0xCCCCCC";
    flashvars.scrubber_position_color = "0x6AA1CE";
    flashvars.scrubber_load_color = "0x888888";
    flashvars.scrubber_background_color = "0xBBBBBB";
    flashvars.volume_bar_color = "0xBBBBBB";
    flashvars.buffering_time = 1;
    flashvars.aspect_ratio="stretch";
    params.allowfullscreen = "true";
    params.allowscriptaccess = "sameDomain";
    swfobject.embedSWF("[var.base_url]/player.swf", "myAlternativeContent", "710", "350", "9.0.0", false, flashvars, params, attributes);


    With this:

    var flashvars = {};
    var params = {};
    var attributes = {};

    flashvars.playlistfile = "[var.base_url]/playlist.php";
    flashvars.playlist = "right";
    flashvars.showmute = "true";

    flashvars.autostart = "false";
    flashvars.bufferlength = 1;
    flashvars.stretching = "fill";
    flashvars.smoothing = "true";
    flashvars.volume = "90";

    params.allowfullscreen = "true";
    params.allowscriptaccess = "sameDomain";

    swfobject.embedSWF("[var.base_url]/jwplayer/player.swf", "myAlternativeContent", "710", "420", "9.0.115", false, flashvars, params, attributes);


    5. There is a playlist on the `Latest Videos` video player (Home). The playlist need to be amended to suite JW Player. Edit `/var/www/html/playlist.php`. Replace the whole file with the code below (for this sequence, look for 'print' syntax and replace symbol '[' to '<', and ']' to '>'):

    include_once ('classes/config.php');
    //____get video limit________
    function GetVideoLimit() {
    $limit = (is_numeric($_GET['limit']))?$_GET['limit']:12;
    return $limit;
    }

    //____get the type $sql________
    function GetVideoType() {
    switch($_GET['type']) {
    case 'featured':
    $add_sql = " AND featured = 'yes'";
    break;

    case 'promoted':
    $add_sql = " AND promoted = 'yes'";
    break;
    }
    return $add_sql;
    }


    //____get search query_________
    function GetVideoSearch() {

    if($_GET['search'] != '') {
    $keywords = str_replace('+',' ',$_GET['search']);
    $keywords = str_replace('%20',' ',$keywords);
    $keywords = str_replace('%26','&',$keywords);

    $safety = array('UNION','=',"'",'?');
    $keywords = str_replace($safety,'',$keywords);
    $search = " AND (title LIKE '%$keywords%' OR tags LIKE '%$keywords%' OR description LIKE '%$keywords%')";
    return $search;
    } else {

    return;
    }


    }

    //____some cleanup___________
    function CleanTitle($txt = '') {
    $txt = trim($txt);
    $txt = str_replace('"',"",$txt);
    $txt = str_replace("'","",$txt);
    $txt = str_replace('?','',$txt);
    return $txt;
    }


    //____run sql query__________
    $limit = GetVideoLimit();
    $search = GetVideoSearch();
    $type = ($search == '')?GetVideoType():''; //set type only if search is blank

    $sql = "SELECT indexer, video_id, title, description, video_length
    FROM videos
    WHERE approved = 'yes'
    AND public_private = 'public'
    AND video_type = 'uploaded'
    $type $search
    ORDER BY RAND()
    LIMIT $limit";
    $query = @mysql_query($sql);


    //____start xml file headers____________
    header("Content-Type: text/xml; charset=UTF-8");
    header("Expires: 0");
    print "[rss version="\"2.0\"" media="\"http://website.com/media/\""]\n";
    print "[channel]\n";
    print "[title]JW Player Playlist[/title]\n";

    //_____loop through all results____________
    while($result = @mysql_fetch_array($query)) {

    $title = CleanTitle($result['title']);
    $title_seo = CleanTitle($result['title_seo']);
    $vid = $result['indexer'];
    $file_name = $result['video_id'];
    $external_url = $config["site_base_url"].'/videos/'.$vid.'/'.$title_seo;
    $source_url = $config["site_base_url"].'/uploads/'.$file_name.'.flv';
    $thumb_path = $base_path.'/uploads/player_thumbs/'.$file_name.'.jpg';
    $source_path = $base_path.'/uploads/'.$file_name.'.flv';
    $desc = $result['description'];
    $video_length = $result['video_length'];

    //cant find big thumb file
    if(file_exists($thumb_path)) {
    $thumb_url = $config["site_base_url"].'/uploads/player_thumbs/'.$file_name.'.jpg';
    } else {
    $thumb_url = $config["site_base_url"].'/uploads/thumbs/'.$file_name.'.jpg';
    $thumb_path = $base_path.'/uploads/thumbs/'.$file_name.'.jpg';
    }

    //only list if the video file and imagae exist
    if(file_exists($source_path) && file_exists($thumb_path)) {
    print "[item]\n";
    print "[title]$title[/title]\n";
    print "[link]$external_url\n";
    print "[description]$desc[/description]\n";
    print "[media:content url="\"$source_url\"" duration="\"$video_length\""]\n";
    print "[media:thumbnail url="\"$thumb_url\""]\n";
    print "[/media:thumbnail][/media:content][/item]\n";

    }
    }

    print "[/channel]\n";
    print "[/rss]";


    That is all, now try to play your video and the playlist using the JW Player, you can purchase the JW Player if you want more extra features. Have fun and play safe lads.

    For those using PHPmotion with release version 3.5 - Rev 115, please check for the `images` folder:

    /var/www/html/addons/albums/images


    I was using this release and when I tried to upload images as media, seems that only thumbnails appeared. Eventually the picture wasn't uploaded since the `images` folder is missing under the `albums` folder. If you a missing as such, just create the `images` folder and the image upload will work just fine.

    Configure PHP without php.ini

    Assalamualaikum, I would like to take this opportunity to wish all fellow Muslims a blessed Ramadhan and may this holy month leads us to humbleness, forgiveness, more good deeds, changing for a greater good, enhance our life and make us more pious. Happy Fasting and Worshipping lads.

    Back to the agenda brought upon today, there might come a situation where you need to re-configure PHP’s setup on a web server. But here is the catch, for some unknown circumstances or some how you are restricted to do it on the php.ini (e.g: can’t find the php.ini file) file that is the configuration file for PHP.

    Lets start with an example, for instance say we need the web server to temporarily display error that occurs on the running script. Basically you can do this by opening the php.ini and change

    display_errors = Off

    to

    display_errors = On

    Save the php.ini file and restart the web server will surely do the trick. But then since the situation is that you can’t get through the php.ini file. You might do it via PHP Runtime Configuration.

    Open your desired PHP script and add:

    //Set Display Error On
    ini_set("display_errors","1");

    or

    //Set Display Error Off
    ini_set("display_errors","0");


    Save your script and re-run it and errors will start to show.

    Bear in mind that not all of PHP’s configuration can be overwrite like this. This page here will list and show what and where can PHP’s configuration can be changed.

    Based on the ‘PHP: List of php.ini directives’ page as stated above, you might notice under the ‘Changeable’ column they are labeled as:

    PHP_INI_USER
    PHP_INI_PERDIR
    PHP_INI_SYSTEM
    PHP_INI_ALL

    Each of this label means different ways of configuration.

    The steps using ini_set() as we did earlier wont work for configurations such as:

    upload_max_filesize (PHP_INI_PERDIR)
    post_max_size (PHP_INI_PERDIR)

    As you can see these configuration are labeled as PHP_INI_PERDIR.
    Based on the ‘PHP: Where a configuration setting may be set’ page here.

    PHP_INI_PERDIR means ‘Entry can be set in php.ini, .htaccess or httpd.conf

    So for the case of ‘upload_max_filesize’, ‘post_max_size’ and all configurations labeled as PHP_INI_PERDIR can be set in your .htaccess file or the httpd.conf file (Apache’s configuration file).

    Open up your .htacess file or your httpd.conf and add in as below:

    php_value upload_max_filesize 20M
    php_value post_max_size 30M

    Save and restart your web server and you are all good. So long story short, you can also configure PHP without php.ini by doing it at the .htaccess or the httpd.conf.

    p/s:
    >./configure -prefix=/month/ramadhan/1432h
    -enable-sahur
    -enable-fast
    -enable-brake-of-fast
    -enable-tarawih
    -enable-quran-recite
    -enable-zakat-al-fitr

    >make
    >make install



    Recent Posts

    Recent Comments

    Recommended Links