<?php if (isset ($_GET['js'])) { Header('Content-Type: text/javascript; charset=UTF-8'); ?>
var lastImageHref;
$(document).ready(function(){
 $.getJSON('admin/apps/opinergallery.php?json', function(data){
  $('#opinergallery').html('');
  var form = $('<form>').css('display', 'none').submit(function(){
   return false;
  });
  $('<input>').attr('type', 'text').bind('click focus', function(){
   return false;
  }).addClass('opigalinput').appendTo(form);
  $('<input>').attr('type', 'submit').bind('click', function(){
   $.getJSON('admin/apps/opinergallery.php', {save:'1',image:$('.opigalinput').attr('value')}, function(data){
    alert(data.message);
   });
   return false;
  }).addClass('opigalsubmit').appendTo(form);
  $(form).appendTo('#opinergallery').slideDown('slow');
  for(i=0;i<data.wallpapers;++i){
   var image = data.wallpaper[i];
   var div = $('<div>').addClass('opigalwall').attr('id', image.file).click(function(){
    $('.opigalinput').attr('value', $(this).attr('id'));
   });
   $('<img>').attr('src', image.thumb).attr('alt', data.name).addClass('opigallimage').appendTo(div);
   $(div).appendTo('#opinergallery').slideDown('medium');
  };
  $('<div>').addClass('cleaner').appendTo('#content');
 });
});
<?php } else if (isset ($_GET['css'])) { Header('Content-Type: text/css; charset=UTF-8'); ?>
#opinergallery { text-align: center; width: 100%; }
.opigalwall { display: none; height: 150px; width: 240px; float: left; padding: 10px; border: 1px solid #ddd; margin: 5px; cursor: pointer; background: #f7f7f7; }
<?php } else if (isset ($_GET['json'])) { Header('Content-Type: text/json; charset=UTF-8'); ?>
{"name":"Opiner Gallery","version":"1.0","published":"20110701","wallpapers":"14","wallpaper":[{"id":"001","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/001.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/001.jpg"},{"id":"002","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/002.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/002.jpg"},{"id":"003","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/003.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/003.jpg"},{"id":"004","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/004.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/004.jpg"},{"id":"005","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/005.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/005.jpg"},{"id":"006","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/006.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/006.jpg"},{"id":"007","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/007.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/007.jpg"},{"id":"008","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/008.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/008.jpg"},{"id":"009","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/009.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/009.jpg"},{"id":"010","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/010.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/010.jpg"},{"id":"011","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/011.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/011.jpg"},{"id":"012","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/012.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/012.jpg"},{"id":"013","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/013.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/013.jpg"},{"id":"014","file":"http:\/\/feedback.opiner-cms.net\/gallery\/wallpaper\/014.jpg","thumb":"http:\/\/feedback.opiner-cms.net\/gallery\/thumb\/014.jpg"}]}
<?php } else if (isset ($_GET['save'])) {
Header('Content-Type: text/json; charset=UTF-8');
define('in', true);
include_once('../../media/get-config.php');
include_once('../includes/default-functions.php');
$json['message'] = ConfigUpdate ('loginback', $_GET['image']) ? 'Uložené' : 'Nepodarilo sa uložiť';
echo json_encode($json);
} else { class opinergalleryapp extends plugin {
	protected function load () {
	        global $translate;
		$this -> title = 'Opiner ' . $translate['links.gallery'];
		$this -> version = '1.0';
		$this -> author = 'Ovalio';
		$this -> url = 'http://opiner-cms.net/';
		$this -> description = 'Nastavte si nejaký pekný obrázok na pozadie prihlasovania do administrácie.';
		$this -> modes = array ('application');
		$this -> cache = false;
		$this -> redactors = false;
		$this -> values = array ();
		$this -> tables = array ();
	}
	
	protected function application () {
	        if(ajaxmode) Header();
		global $tohead;
		$tohead[] = '<link rel="stylesheet" href="admin/apps/opinergallery.php?css" type="text/css" />';
		$tohead[] = '<script src="admin/apps/opinergallery.php?js" type="text/javascript" charset="utf-8"></script>';
		return '<div id="opinergallery"><img src="http://feedback.opiner-cms.net/gallery/loader.gif" alt="" class="ajaxloader" /></div>';
	}
};
};
?>