Premium Media Script Documentation

Posted by | November 01, 2014 | | No Comments




Quick Guide

The installation of this script is very trivial. Simply follow the instructions below and you will be ready to launch your new media site in about 5 minutes from now.

  1. Upload and extract the compressed file main.zip to the root of your server.
  2. Make sure that the folder content and all of its sub-folders are writable (Permission 755)
  3. Point your browser to your site and you should be redirected to the installer. If not point your browser to http://yoursite.com/install.php
  4. Once on the installer, read and follow instructions as the installer will guide through the installation of this script.
    • On the Database Configuration page, the field Database Prefix is optional. Fill this only if you have multiple tables in the same database
    • The field Server Timezone is the timezone of your server! This is used to provide accurate consistent time server-wide. If you don’t know your server’s timezone, you can pick anything then change it later via the file includes/Config.php
    • The Security Key is a random string that is used to encode data with. This should not be changed after the installation.
    • Note If you get blank page in step 3 then the script was not able to open the file includes/Config.sample.php or it wasn’t able to rename it to includes/Config.php. You will need to do this manually!

Upgrading

All upgrading instructions are detailed in “upgrade.html” located in the same folder as this file. Simply open that and follow the instructions according to the version of the script. Please note that some update may require you to replace all files while others only a couple of files. In both cases it is strongly recommended that you first backup all your existing files and download it to your computer.

 

Features

Here is a glimpse of some of the most awesome features this script has to offer.

Import. Import. Import.

Import what ever you want and however you want. A lot of effort has went into the import system so you can import anything from some majors sites like Youtube, Vine, Vimeo, Dailymotion, etc. Here is how you can import media.

  1. Import using the URL to the video
  2. Import using the Bookmarklet that is found in the admin panel > Import a Single Video
  3. Mass Import from Youtube using the live admin interface

Add Custom Media

You would rather upload a custom media? No problem. Use the interface to upload video and image files of the following format: mp4, jpg, png and gif. Please note that this script doesn’t convert videos nor does it generate thumbnails from videos!

Featured and NSFW

You can tag a media file as featured and/or NSFW to make them stand from other media. Featuring a video will prioritize that video while tagging it as NSFW will prevent users who have NSFW option disabled to view them. Regarding NSFW, you will have to make sure that you add the minimum age required to register in your TOS because if a user registers they will have access to NSFW content.

Report

Registered users can report any content. Whether it is a media file, user or comment, it can be reported. You will be able to moderate reports via the admin panel.

Categories and Types

One of the most important feature of this script is the ability to assign a type. Assigning a type to media makes a big difference so you have to make sure to properly assign it. For example don’t assign a picture the video category or vice versa. The built-in types are video, music, vine and picture. This gives you the ability to run a one-script-multimedia-site with ease. You also have to properly assign a type of the categories.

User Profile and Subscription

User can subscribe to each other and receive notification when there is a new media.

Script Configuration

Once you have successfully installed the script, you will be able to fully customize it before importing/adding media. Login as admin then you will see your own admin bar at the very top of the script. This admin is dynamic meaning that the content will change depending on which page you are. Look at the right side to find Configuration and click that to configure the script.

General Settings

Under this tab you will find all of the important settings you will need for your site. Fill these as you wish. Notice the email field is used for many things. It first of all used as the sender when the script sends an email. So you will want to make sure you provide a good email. Also filling the social links will activate sidebar widgets. Please make sure that the link you provide is working and is of the proper format.

Application Settings

This tab groups the main settings you will need to customize your site. Their function is very easy to understand so there is not much to say more. Notice the “Blacklist Words” field as this is used to filter bad words and replace them by an asterisk *. You will need to separate words with a comma. Example badword1,badword2,badword3

Security Settings

You can enabled catpha to prevent bots from creating accounts or submitting forms. To do so you have options: reCaptcha or Solvemedia. reCaptcha is a very popular captcha system provided by Google. It is free and you can use you Google account to create keys. Solvemedia is another alternative however this system allows you to monetize on captchas. Once you create your account they will give three keys. You will need to add those keys in the file includes/library/Solvemedia.php.

Media Settings

These settings allows you to change how media looks and upload settings. The display mode setting will switch the script from being a more Youtube-style to a 9gag-style.

Local Thumbnails

This a very important setting so you will want to clear your mind on whether you want to store them locally or link to them. You must not change this after your have upload/imorted your first media! All thumbnail are stored in the /content/thumbs folder.

Maximum Upload Size

This is another important setting. The maximum upload size is determined by your server configuration. Look under this field to determine what is your maximum upload limit. Note that if you set a size higher than this, the script will set the lower limit as the size limit. Example if you set 100MB and your server’s limit is 10 MB then the script will set it as 10 MB.

User Configuration

Facebook Connect

You will notice that Facebook connected has now been integrated to this application. Users can now login with their Facebook and bookmark their favorite sites. To set up your app, first go to https://developers.facebook.com and set up a new app by clicking “Apps”. Then click “Create New App”; Facebook will ask you to configure your app. The most important fields you must fill out are App Domains and Site URL. Following that Facebook will generate two keys for you. Go to admin settings and paste those keys. That’s it. If you did everything correctly Facebook connect should work.

Twitter Connect

In this version, twitter connect has been added. Now users can login using twitter the same way they use Facebook. You must enable twitter connect for it to appear and function. You can do that on the admin panel. You must register your website on Twitter.com.

Instructions

  1. Go to https://dev.twitter.com/apps and Login.
  2. Then click “Create a new application” on top right
  3. Fill the required fields (with a start next to it), add this to the callback field: http://YOUSITE.com/, accept the terms and conditions and click “Create your Twitter application”.
  4. You will then be redirected to a page with your OAuth Settings
  5. Search & Find two keys: Consumer Key and Consumer Secret Copy these keys and paste them in admin settings
  6. Finally, under “settings” of your application on twitter you will see “Allow this application to be used to Sign in with Twitter”. Check that and click “Update this twitter application’s settings”.

If you did everything correctly, Twitter OAuth should work. If it doesn’t, send me an email and I will help you.

Google Connect

Google connect protocol has been changed due to restrictions from Google. For this reason you will need to set up Google connect again. Simply follow the instructions below and it should be fairly simple.

  1. Go https://code.google.com/apis/console and login using your Google Account
  2. On the left side click “Credentials”
  3. Then click “Create new Client ID” to open the popup
  4. Select “Web Application”
  5. Add your domain name as “http://yourdomainname.com” under Authorized Javascript Origins
  6. Add the URI to Google Connect under Authorized Redirect URI as “http://yourdomainname.com/user/login/google”
  7. Also make sure to create your Consent Screen

Advertisement Configuration

This script allows you to add any advertisement code you wish and it will display it wherever it fits. You can also enable or disable ads with a single click. The three main sizes are 728×90, 468×60 and 300×250. However there are also two other slots. One that is reserved for video pre-roll and the other one should be a responsive ad because it will be shown on mobile platforms. Notice if you empty the preroll ad then it will not show up otherwise it will show before the viewer is able to click play. You can also change the time the viewer has to wait before being able to play a video.

You can easily display any of the ads anywhere you want to by using the following php code:

<?php echo $this->ads('SIZE'); ?>

where SIZE can be any of the following: 728, 468, 300, rep

Themes and Editors

This script comes with a powerful yet easy theming system that allows you to easily modify the theme or create your own. It also comes with a powerful theme editor and translation generator.

Themes

You can easily activate any themes in the admin panel by just clicking the activate button. If you want to build your own theme but don’t want to touch the default theme, just clone it and activate it.

Theme Editor

You can use the the theme editor to directly edit any of the theme files very easily. You also get a powerful code editor built-in so you can safely code your way to success. As a side note, you should not be editing the PHP in the theme. The PHP code is formatted in a black color so you can easily identify it.

Translation Generator

You can easily translate the site to any languages you want by using the built-in language editor. Simply open the generator and translate each strings. Make sure to save periodically in order to prevent loss of data.

Plugins and Functions (Beta)

This script includes a powerful plugin API so you can extend the script without having to touch any of the core files. This feature is currently in beta and the API documentation will be available after the script has been released.

Tools

The script comes with a couple of tools to allow you to maintain your site.

Sitemap

Sitemaps are an important strategy for you to get indexed quickly. Use this tool to generate an XML sitemap and then submit it search engines. Notice that the script will automatically ping Google and Bing to index the main sitemap once you generate it.

Digests/Newsletters

This script allows to you send automatic digests and newsletters to your users by using this tool. Digests are a summary of new media on your site. Note that if you abuse this tool you will be in trouble with either your host or spam databases! So it is recommended to not use this too often.

Export Data

If for some reason you want to export your users’ list, you can use this tool. This allows you to define what you want to export. Simply follow the instructions.

Optimize Database

Optimizing database should be a thing you do regularly as it is inevitable for data to get lost. This tool will optimize the database and remove old notifications..

Frequently Asked Questions

The installer is stuck at step 3 and I am seeing a blank page.

Although this can be caused by many reasons, a common cause is that the script was not able to open and write in the file includes/Config.sample.php. Open this file and check if your DB info has been saved. If not manually replace the placeholders (like RHOST,RUSER) by the actual info. Another reason you may see a blank page at step 3 is that the script wasn’t able to rename the file includes/Config.sample.php to includes/Config.php. You will need to do this manually.

The time is showing as a negative or huge value.

If the time is shown correctly then that means your server’s timezone was not set correctly. You will need set the correct timezone to fix this. To set the timezone, open the file includes/Config.php and add your timezone on right side of arrow. You can get your timezone from https://php.net/manual/en/timezones.php.

I keep getting a 404 page whenever I click on something.

If you get a 404 page (the one generated by your server) then that means you did not upload the file .htaccess or your server doesn’t support the mod rewrite module. If you did not upload the file .htaccess then you will need to upload to the root of your server. If for some reason you cannot see that file in the package, you will need to create that file using cpanel’s editor (or equivalent) to create a new file named .htaccess and put the following code in it.

AddType video/mp4 .mp4
RewriteEngine On
Rewritebase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin/(.*)?$ admin/index.php?a=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)?$ index.php?a=$1	[QSA,NC,L]
ErrorDocument 404 /index.php?a=404