Many of you have noticed that the default player (CB) does not autoplay movies. While some people suggested that there was a typo in the cbplayer.plug.php, changing autoload to autoload wasn’t enough.

I’ve disassembled the CB player to check which variables it was expecting and I found out that it wasn’t autoplay, but autoPlay.

So … in order to fix this issue, open player/cbplayer/cbplayer.plug.php. Locate :

$code	.= "settingsFile: \"".PLAYER_URL."/cbplayer/settings.php?hqid=".$vdata['videoid']."&autplay=".$data['autoplay']."\"\n";
else
$code	.= "settingsFile: \"".PLAYER_URL."/cbplayer/settings.php?vid=".$vdata['videoid']."&autplay=".$data['autoplay']."\"\n";

replace by :

$code	.= "settingsFile: \"".PLAYER_URL."/cbplayer/settings.php?hqid=".$vdata['videoid']."&autoPlay=".$data['autoplay']."\"\n";
else
$code	.= "settingsFile: \"".PLAYER_URL."/cbplayer/settings.php?vid=".$vdata['videoid']."&autoPlay=".$data['autoplay']."\"\n";

Part II

If you want to use autoplay under every pages except for index (eg. to disable autoplay of editor’s pick movies), add this little snippet :

Open the same file. Locate :

function cbplayer($data,$no_video=false)
	{

Add below :

	if(constant('THIS_PAGE')=='index')
		$data['autoplay'] = 'false';

You shoud now be able to autoplay every video using the CB default player except for the ones on main page.:D

Summary: with this mod you will be able to insert any script into your clipbucket. I’m using it to manage google analytics.

1st – Open styles/cbv2new/layout/global_header.html. Find:

<!-- Setting Template Variables -->
{php}
	if(!$_COOKIE['current_style'])
    	$_COOKIE['current_style'] = 'grid_view';
{/php}

Add below:

<!-- Google Analytics -->;
{show_analytics|html_entity_decode}

2nd – includes/common.php. Find:

$Smarty-&gt;register_function('cbtitle','cbtitle');

Add below:

$Smarty-&gt;register_function('show_analytics', 'show_analytics');

3rd – Open includes/functions.php. Find:

	/**
	 * Function used to load clipbucket title
	 */
	function cbtitle($params=false)
	{

Add above:

	/**
	* Function used to load Google Analytics - me( at )davidgouveia.net
	*/
	function show_analytics()
	{
		global $Cbucket;
		// code to convert html entities back useful code.
		echo base64_decode($Cbucket-&gt;configs['google_analytics']);
 
	}

4th – Open admin_area/main.php. Find:

	'gravatars',

Add above:

	'google_analytics',

Find:

	$value = mysql_clean($_POST[$field]);
	if(in_array($field,$num_array))

Add above:

	if($field == 'google_analytics')
		$value = base64_encode($_POST['google_analytics']);
	else

(the “else” MUST be in the line immediately above “$value = mysql_clean($_POST[$field]);”).

Finally, open /admin_area/styles/cbv2/layout/main.html. Find:

            <tr>
              <td valign="top">Meta Description</td>
              <td valign="top"><textarea name="description" id="description" cols="45" rows="5">{$row.description}</textarea></td>
            </tr>

Add below:

       	    <tr>
              <td valign="top">Google Analytics</td>
              <td valign="top"><textarea name="google_analytics" id="google_analytics" cols="45" rows="5">{$row.google_analytics|base64_decode|html_entity_decode}</textarea></td>
            </tr>

Done! You shoud see another option under Web Settings.

Tested under ClipBucket 2.0.6.

PS: I’m using base64_encode/decode because I want to save the script as its original values and I need to avoid using functions like mysql_clean() to sanitize the code. By saving it as a base64 string I avoid potential malicious SQL injection problems. I’m sure there are other ways of doing it but this works OK (I think :p).

This code was tested with ClupBucket 2.0.6. This will allow you to block specific emails domains. It is partivularly useful to block all email providers used to spam (like mailinator.com or temporaryinbox.com).

1st – Open your database and add a record to your config datatable (default is cb_config) with the value “disallowed_email_providers”.
2nd – Open clipbucket Control Panel and add a new phrase with code “usr_email_blacklisted_err” and value “Invalid email”.

3rd – open the main.html from your template.

Search for :

<tr>
<td valign="top">Disallowed usernames</td>
<td valign="top"><label>
<textarea name="disallowed_usernames" id="disallowed_usernames" cols="45" rows="5">{$row.disallowed_usernames}</textarea>
<br />
separate by commas
</label></td>
</tr>

and add below:

<tr>
<td valign="top">Disallowed email providers</td>
<td valign="top"><label>
<textarea name="disallowed_email_providers" id="disallowed_email_providers" cols="45" rows="5">{$row.disallowed_email_providers}</textarea>
<br />
separate by commas
</label></td>
</tr>

4th – Open admin_area/main.php and find (around line 56):

'disallowed_usernames',

and add below :

'disallowed_email_providers',

5th – Open includes/classes/user.class.php and add this function right above the signup_user function (around line 3160) :

/**
* Function to validate email provider
*/
function blacklisted($email){
global $Cbucket;
 
$providers = explode(",", $Cbucket->configs['disallowed_email_providers']);
 
foreach($providers as $provider){
if(eregi(trim($provider) . "$", $email))
return true;
}
return false;
}

6th – Finally enter function signup_user, locate this :

//checking terms and policy agreement
if($array['agree']!='yes' && !has_access('admin_access',true))
e(lang('usr_ament_err'));

add below :

//Check if email provider is blacklisted
if($this->blacklisted($array['email']))
e(lang('usr_email_blacklisted_err'));

You should now be able to block email providers 🙂