ok

Mini Shell

Direktori : /usr/local/sitepad/www/themes/default/
Upload File :
Current File : //usr/local/sitepad/www/themes/default/top_themes_theme.php

<?php

//////////////////////////////////////////////////////////////
//===========================================================
// categories_theme.php
//===========================================================
// SOFTACULOUS 
// Version : 1.1
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       10th Jan 2009
// Time:       21:00 hrs
// Site:       http://www.softaculous.com/ (SOFTACULOUS)
// ----------------------------------------------------------
// Please Read the Terms of use at http://www.softaculous.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Inc.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('SITEPAD') && !defined('SITEMUSH')){

	die('Hacking Attempt');

}

function top_themes_theme(){

global $theme, $globals, $user, $l, $langs, $skins, $error, $saved, $themes, $featured, $nupanel;
	
	if($globals['nupanel'] == 'directadmin'){
		$fullurl = 'CMD_PLUGINS/sitepad';
		$cat_image_path = 'images/themes/default/images/cats/';
	}elseif($globals['nupanel'] == 'cpanel'){
		$fullurl = '../../3rdparty/sitepad';
	}elseif($globals['nupanel'] == 'plesk'){
		$fullurl = '/modules/sitepad';
	}else{
		$fullurl = 'http://localhost/ampps';
	}
	
	
	if($globals['nupanel'] == 'plesk'){
		$width = '450px';
		$s_width = '455px';
	}else{ 
		$width = 'auto';
		$s_width = 'auto';
	}
	
$str = '
<style type="text/css">
#sitepad_div1{
font-size: 11px;
padding: 0px;
width:500px;
font-family: Verdana, Tahoma, Arial, "Trebuchet MS", "Times New Roman", Georgia, sans-serif, serif;
}

.smush_theme_header{
color: #777;
font-size: 18px;
text-overflow: ellipsis;
padding:5px;
}
</style>';

	if($globals['nupanel'] == 'directadmin'){
		$str .= '<img src="'.$fullurl.'/'.$theme['images'].'da.gif" align="left"/><br /><br /><br />
		<div style="margin-left:70px;margin-right:15px"><br /><br />';
	}

	if($globals['nupanel'] == 'plesk'){
		$str .= '<center><img src="'.$fullurl.'/'.$theme['images'].'plesk.gif" /></center>';
	}
	
	$str .= '<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed;" width="100%"><tr>
	<td width="15px" onmouseover="sitepad_mousemove(\'themes_div\', event);" onmouseout="sitepad_stop(\'themes_div\', event);" align="center">
		<img src="'.$fullurl.'/'.$theme['images'].'move_left.png" alt="Left" border="0"/>
	</td>
	<td>
	<div style="overflow:hidden;display: block;width:'.$s_width.';" id="themes_div" onclick="sitepad_stop(this.id, event);">
	<table border="0" cellpadding="3" cellspacing="0" id="themes_table" style="table-layout: fixed;" width="100%"><tr>';
	
	$i = 0;
	if(!empty($featured)){
		foreach($featured as $k => $v){
		
			// Show only 9 themes
			if($i >= 9){
				break;
			}
			
			// We have to make some changes as per the theme (i.e for x3 and paper_lantern)
			if(is_cp_theme('paper_lantern')){
				$img_path = fastestmirror().'/files/themes/'.$k.'/'.$k.'_275.jpg';
				$td_width = 295;
				$td_height = 315;
			}else{
				$img_path = fastestmirror().'/files/themes/'.$k.'/'.$k.'_275.jpg';
				$td_width = 295;
				$td_height = 315;
			}
			
			$str .= '<td width="'.$td_width.'" valign="middle" align="center" height="'.$td_height.'"><a href="'.$fullurl.'/'.$globals['ind'].(!empty($globals['sitepad_editor_new']) ? 'act=new_site&': '').'theme='.$k.'" style="text-decoration:none;" target="_blank"><div style="border:1px solid #ccc;box-shadow:0 1px 2px #777;width:98%;"><div class="smush_theme_header">'.$v['name'].'</div><img src="'.$img_path.'" /></div></a></td>';
			
			$i++;
		
		}
	}else{
		foreach($themes as $k => $v){
		
		// Show only 9 themes
		if($i >= 9){
			break;
		}
		
		// We have to make some changes as per the theme (i.e for x3 and paper_lantern)
		if(is_cp_theme('paper_lantern')){
			$img_path = fastestmirror_img($k).'/'.$k.'_275.jpg';
			$td_width = 295;
			$td_height = 315;
		}else{
			$img_path = fastestmirror_img($k).'/'.$k.'_275.jpg';
			$td_width = 295;
			$td_height = 315;
		}
		
		$str .= '<td width="'.$td_width.'" valign="middle" align="center" height="'.$td_height.'"><a href="'.$fullurl.'/'.$globals['ind'].(!empty($globals['sitepad_editor_new']) ? 'act=new_site&': '').'theme='.$k.'" style="text-decoration:none;" target="_blank"><div style="border:1px solid #ccc;box-shadow:0 1px 2px #777;width:98%;"><div class="smush_theme_header">'.$v['name'].'</div><img src="'.$img_path.'" /></div></a></td>';
		
		$i++;
		
		}
	}
	
	
	$str .= '</tr></table></div></td>
		<td width="15px" onmouseover="sitepad_mousemove(\'themes_div\', event);" onmouseout="sitepad_stop(\'themes_div\', event);" align="center">
		<img src="'.$fullurl.'/'.$theme['images'].'move_right.png" alt="Right" border="0"/>
		</td>
		</tr></table>';
	
	// If its Dirctadmin than Closing the DIV
	if($globals['nupanel'] == 'directadmin'){
		$str .= '</div>';	
	}

echo 'var sitepadOffsets = function(e){
	e = e || window.event;
	 
	var
	//cache document variables
	_d = document, _dBody = _d.body, _dDocEl = _d.documentElement, _o = null,
	 
	//calculate scroll values
	_scroll_left = _dDocEl.scrollLeft ? _dDocEl.scrollLeft : 0 + _dBody.scrollLeft ? _dBody.scrollLeft : 0,
	_scroll_top = _dDocEl.scrollTop ? _dDocEl.scrollTop : 0 + _dBody.scrollTop ? _dBody.scrollTop : 0,
	 
	
	window_pos = {
	_x: (e.pageX || e.clientX) + _scroll_left, _y: (e.pageY || e.clientY) + _scroll_top
	},
	 
	
	viewport_pos = {
	_x: (e.pageX || e.clientX), _y: (e.pageY || e.clientY)
	},
	 
	
	_console = function(o, type) {
	o = (typeof o === "object") ? o : _d.getElementById(o);
	o.innerHTML = type + " = [ " +
	" X: " + ((type === "viewport") ? viewport_pos._x : window_pos._x) +
	" Y: " + ((type === "viewport") ? viewport_pos._y : window_pos._y) +
	" ] Foo: " + Math.random()
	};
	 
	return {
	ViewPortX: viewport_pos._x,
	ViewPortY: viewport_pos._y,
	 
	WindowX: window_pos._x,
	WindowY: window_pos._y,
	 
	ViewPort: [viewport_pos._x, viewport_pos._y],
	Window: [window_pos._x, window_pos._y],
	 
	ToString: _console
	};
};

//Finds the position of the element
function sitepad_findelpos(ele){
	var curleft = 0;
	var curtop = 0;
	if(ele.offsetParent){
		while(1){
			curleft += ele.offsetLeft;
			curtop += ele.offsetTop;
			if(!ele.offsetParent){
				break;
			}
			ele = ele.offsetParent;
		}
	}else if(ele.x){
		curleft += ele.x;
		curtop += ele.y;
	}
	return [curleft,curtop];
};

function sitepad_mousemove(id, e){

	if(typeof sitem[id+"left"] == "undefined"){
		sitem[id+"right"] = "";
		sitem[id+"left"] = "";
		sitem[id+"entered"] = false;
	}
	
	if(sitem[id+"entered"] == true){
		return false;
	}
	
	sitem[id+"entered"] = true;
	
	var ele = document.getElementById(id);
	var mouse = sitepadOffsets(e);
	mouse[0] = mouse.ViewPortX;	
	sitem[id+"elpos"] = sitepad_findelpos(ele);	
	sitem[id+"menuwidth"] = ele.offsetWidth;	
	sitem[id+"leftbound"] =((sitem[id+"menuwidth"]-20)/2) + sitem[id+"elpos"][0];
	sitem[id+"rightbound"] =((sitem[id+"menuwidth"]+20)/2) + sitem[id+"elpos"][0];
	
	//alert(sitem[id+"leftbound"]+" "+sitem[id+"rightbound"]+" "+mouse[0]);	
	//document.getElementById("aaa").innerHTML = mouse[0]+"<br />"+document.getElementById("aaa").innerHTML;
	
	if (mouse[0]>sitem[id+"rightbound"]){
		sitepad_Left(id);
	}else if (mouse[0]<sitem[id+"leftbound"]){
		sitepad_Right(id);
	}else{
		sitepad_stop(id, e);
	}
}
	
var sitem = new Object();

function sitepad_Left(id){
	clearTimeout(sitem[id+"right"]);
	document.getElementById(id).scrollLeft += 1;
	sitem[id+"right"] = setTimeout("sitepad_Left(\'"+id+"\')",5);
};

function sitepad_Right(id){	
	clearTimeout(sitem[id+"left"]);
	document.getElementById(id).scrollLeft -= 1;//alert(document.getElementById(id).scrollLeft);return;
	sitem[id+"left"] = setTimeout("sitepad_Right(\'"+id+"\')",5);
};

function sitepad_stop(id, e){	
	clearTimeout(sitem[id+"right"]); 
	clearTimeout(sitem[id+"left"]);
	sitem[id+"entered"] = false;
};';

echo 'var sitepad_html = \''.str_replace(array('\'', "
", "\r"), array('\\\'', '\'+"\n"+\'', '\'+"\n"+\''),$str).'\';

';

if($globals['nupanel'] == 'directadmin'){
	echo 'document.getElementById("sitepad_div1").innerHTML = sitepad_html;';
}elseif($globals['nupanel'] == 'plesk'){
	echo 'document.getElementById("secondary").innerHTML = "<div class=\'applications-dashboard-box\'>" + sitepad_html+ "</div>"+document.getElementById("secondary").innerHTML;';
}else{
	
	echo 'function show_top_themes(){';
	
	if(!empty($globals['show_top_themes'])){
		echo 'document.getElementById("sitepad_div-body").innerHTML = sitepad_html;';
	}
		
	echo '};
	
	window.addEventListener("load", 
		function() {
			//Top Themes were loaded before the div sitepad_div-body creation
			setTimeout(show_top_themes, 1000);
		}, false);
	';
	
}

}

?>

Zerion Mini Shell 1.0