<?php

/**
* Quick Jump Plugin - This will show quick jump option under extra menus for easily select a folders 
* author: azkha
* 24 sep 2012
*/

$plugins->add_hook("footer","quick_jump_option");


function jump_info(){
	return	array(	
	"name" => "Quick Jump Plugin",
	"author" => "azkha",
	"author_site" => "http://azkha.com",
	"description" => "This will show quick jump option under extra menus for easily select a folders",
	);
}

function quick_jump_option($value){
	global $lang,$db,$set;
	
$arrList = $db->select("SELECT * FROM `".MAI_PREFIX."files` WHERE `size`='0' ORDER BY `path`");
$option = '<div class="title2">'.$lang->quick_jump.': <select size="1" onChange="window.open(this.options[this.selectedIndex].value,\'_top\')">';
foreach($arrList as $val) {
$option .= "<option value=\"$set->url/data/$val->id/$val->name.html\">".listName($val->path)."</option>";
}
$option .= "<option value=\"http://m.azkha.com\">Multy Search</option></select></div>";
$value = str_replace("<!--footer start-->","<!--footer start-->".$option,$value);
	
	return $value;
}

function listName($q) {
$path = str_replace("/files/","",$q);
$listName = str_replace('/','&raquo;',$path);

return $listName;
}

