Added image.php to permit fully dynamic image path

This commit is contained in:
Benjamin Renard 2013-06-19 02:17:39 +02:00
parent c3ac277e0d
commit d791d89d1f
20 changed files with 79 additions and 39 deletions

40
public_html/image.php Normal file
View file

@ -0,0 +1,40 @@
<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* http://ldapsaisie.labs.libre-entreprise.org
*
* Author: See AUTHORS file in top-level directory.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/
require_once 'core.php';
if(LSsession :: startLSsession()) {
if (isset($_GET['i'])) {
$img_path=LStemplate :: getImagePath($_GET['i']);
if (is_file($img_path)) {
header('Content-type: '.mime_content_type($img_path));
header('Cache-Control: public');
header('Pragma: cache');
header('Expires: '. gmdate('D, d M Y H:i:s', time() + 60*60*24*30)); // one month
readfile($img_path);
exit();
}
}
else {
die(_('Missing parameter'));
}
}

View file

@ -271,7 +271,7 @@ function LStemplate_smarty_tr($params) {
function LStemplate_smarty_img($params) { function LStemplate_smarty_img($params) {
extract($params); extract($params);
echo LStemplate :: getImagePath($name); echo "image.php?i=$name";
} }
// Errors // Errors

View file

@ -164,10 +164,10 @@ var LSdefault = new Class({
this.loading_img_id++; this.loading_img_id++;
this.loading_img[this.loading_img_id] = new Element('img'); this.loading_img[this.loading_img_id] = new Element('img');
if (size=='big') { if (size=='big') {
var src = this.imagePath('loading.gif'); var src = this.imagePath('loading');
} }
else { else {
var src = this.imagePath('ajax-loader.gif'); var src = this.imagePath('ajax-loader');
} }
this.loading_img[this.loading_img_id].src=src; this.loading_img[this.loading_img_id].src=src;
if (position=='inside') { if (position=='inside') {
@ -211,7 +211,7 @@ var LSdefault = new Class({
}, },
imagePath: function(image) { imagePath: function(image) {
return this.LSjsConfig['LS_IMAGES_DIR'] + '/' + image; return 'image.php?i=' + image;
}, },
getParams: function(name) { getParams: function(name) {

View file

@ -7,7 +7,7 @@ var LSformElement_boolean = new Class({
$$('li.LSformElement_boolean').each(function(el) { $$('li.LSformElement_boolean').each(function(el) {
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('clear.png'), src: varLSdefault.imagePath('clear'),
alt: 'Clear' alt: 'Clear'
}); });
btn.addClass('btn'); btn.addClass('btn');

View file

@ -38,14 +38,14 @@ var LSformElement_date_field = new Class({
); );
this.nowBtn = new Element('img'); this.nowBtn = new Element('img');
this.nowBtn.src = varLSdefault.imagePath('now.png'); this.nowBtn.src = varLSdefault.imagePath('now');
this.nowBtn.addClass('btn'); this.nowBtn.addClass('btn');
this.nowBtn.addEvent('click',this.onNowBtnClick.bind(this)); this.nowBtn.addEvent('click',this.onNowBtnClick.bind(this));
this.nowBtn.injectAfter(this.input); this.nowBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.nowBtn,'LSformElement_date','now'); varLSdefault.addHelpInfo(this.nowBtn,'LSformElement_date','now');
this.todayBtn = new Element('img'); this.todayBtn = new Element('img');
this.todayBtn.src = varLSdefault.imagePath('calendar.png'); this.todayBtn.src = varLSdefault.imagePath('calendar');
this.todayBtn.addClass('btn'); this.todayBtn.addClass('btn');
this.todayBtn.addEvent('click',this.onTodayBtnClick.bind(this)); this.todayBtn.addEvent('click',this.onTodayBtnClick.bind(this));
this.todayBtn.injectAfter(this.nowBtn); this.todayBtn.injectAfter(this.nowBtn);

View file

@ -6,14 +6,14 @@ var LSformElement_field = new Class({
if (this.LSformElement.multiple) { if (this.LSformElement.multiple) {
this.addFieldBtn = new Element('img'); this.addFieldBtn = new Element('img');
this.addFieldBtn.src = varLSdefault.imagePath('add.png'); this.addFieldBtn.src = varLSdefault.imagePath('add');
this.addFieldBtn.addClass('btn'); this.addFieldBtn.addClass('btn');
this.addFieldBtn.addEvent('click',this.LSformElement.onAddFieldBtnClick.bind(this.LSformElement,this)); this.addFieldBtn.addEvent('click',this.LSformElement.onAddFieldBtnClick.bind(this.LSformElement,this));
this.addFieldBtn.injectInside(this.li); this.addFieldBtn.injectInside(this.li);
varLSdefault.addHelpInfo(this.addFieldBtn,'LSform','addFieldBtn'); varLSdefault.addHelpInfo(this.addFieldBtn,'LSform','addFieldBtn');
this.removeFieldBtn = new Element('img'); this.removeFieldBtn = new Element('img');
this.removeFieldBtn.src = varLSdefault.imagePath('remove.png'); this.removeFieldBtn.src = varLSdefault.imagePath('remove');
this.removeFieldBtn.addClass('btn'); this.removeFieldBtn.addClass('btn');
this.removeFieldBtn.addEvent('click',this.LSformElement.onRemoveFieldBtnClick.bind(this.LSformElement,this)); this.removeFieldBtn.addEvent('click',this.LSformElement.onRemoveFieldBtnClick.bind(this.LSformElement,this));
this.removeFieldBtn.injectInside(this.li); this.removeFieldBtn.injectInside(this.li);

View file

@ -26,7 +26,7 @@ var LSformElement_mail = new Class({
addBtnAfter: function(el) { addBtnAfter: function(el) {
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('mail.png') src: varLSdefault.imagePath('mail')
}); });
btn.addClass('btn'); btn.addClass('btn');
btn.injectAfter(el); btn.injectAfter(el);

View file

@ -21,12 +21,12 @@ var LSformElement_maildir_field = new Class({
}); });
if (this.params.LSform[varLSform.idform]) { if (this.params.LSform[varLSform.idform]) {
this.doInput.value = 1; this.doInput.value = 1;
this.doBtn.src = varLSdefault.imagePath('maildir_do.png'); this.doBtn.src = varLSdefault.imagePath('maildir_do');
varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','do'); varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','do');
} }
else { else {
this.doInput.value = 0; this.doInput.value = 0;
this.doBtn.src = varLSdefault.imagePath('maildir_nodo.png'); this.doBtn.src = varLSdefault.imagePath('maildir_nodo');
varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','nodo'); varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','nodo');
} }
this.doBtn.injectAfter(this.input); this.doBtn.injectAfter(this.input);
@ -37,12 +37,12 @@ var LSformElement_maildir_field = new Class({
onDoBtnClick: function() { onDoBtnClick: function() {
if (this.doInput.value==0) { if (this.doInput.value==0) {
this.doInput.value = 1; this.doInput.value = 1;
this.doBtn.src = varLSdefault.imagePath('maildir_do.png'); this.doBtn.src = varLSdefault.imagePath('maildir_do');
varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','do'); varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','do');
} }
else { else {
this.doInput.value = 0; this.doInput.value = 0;
this.doBtn.src = varLSdefault.imagePath('maildir_nodo.png'); this.doBtn.src = varLSdefault.imagePath('maildir_nodo');
varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','nodo'); varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','nodo');
} }
} }

View file

@ -10,7 +10,7 @@ var LSformElement_password_field = new Class({
// ViewHashBtn // ViewHashBtn
if (this.params['viewHash'] && varLSform.objectdn!= "") { if (this.params['viewHash'] && varLSform.objectdn!= "") {
this.viewHashBtn = new Element('img'); this.viewHashBtn = new Element('img');
this.viewHashBtn.src = varLSdefault.imagePath('view_hash.png'); this.viewHashBtn.src = varLSdefault.imagePath('view_hash');
this.viewHashBtn.addClass('btn'); this.viewHashBtn.addClass('btn');
this.viewHashBtn.addEvent('click',this.onViewHashBtnClick.bind(this)); this.viewHashBtn.addEvent('click',this.onViewHashBtnClick.bind(this));
this.viewHashBtn.injectAfter(this.input); this.viewHashBtn.injectAfter(this.input);
@ -21,7 +21,7 @@ var LSformElement_password_field = new Class({
if (this.params['mail']) { if (this.params['mail']) {
if ((this.params.mail['canEdit']==1)||(!$type(this.params.mail['canEdit']))) { if ((this.params.mail['canEdit']==1)||(!$type(this.params.mail['canEdit']))) {
this.editMailBtn = new Element('img'); this.editMailBtn = new Element('img');
this.editMailBtn.src = varLSdefault.imagePath('mail-edit.png'); this.editMailBtn.src = varLSdefault.imagePath('mail-edit');
this.editMailBtn.addClass('btn'); this.editMailBtn.addClass('btn');
this.editMailBtn.addEvent('click',this.onEditMailBtnClick.bind(this)); this.editMailBtn.addEvent('click',this.onEditMailBtnClick.bind(this));
this.LSmail_open = 0; this.LSmail_open = 0;
@ -39,12 +39,12 @@ var LSformElement_password_field = new Class({
}); });
if (this.params.mail['send']) { if (this.params.mail['send']) {
this.mailInput.value = 1; this.mailInput.value = 1;
this.mailBtn.src = varLSdefault.imagePath('mail.png'); this.mailBtn.src = varLSdefault.imagePath('mail');
varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','mail'); varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','mail');
} }
else { else {
this.mailInput.value = 0; this.mailInput.value = 0;
this.mailBtn.src = varLSdefault.imagePath('nomail.png'); this.mailBtn.src = varLSdefault.imagePath('nomail');
varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','nomail'); varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','nomail');
} }
this.mailBtn.injectAfter(this.input); this.mailBtn.injectAfter(this.input);
@ -54,7 +54,7 @@ var LSformElement_password_field = new Class({
// ViewBtn // ViewBtn
this.viewBtn = new Element('img'); this.viewBtn = new Element('img');
this.viewBtn.src = varLSdefault.imagePath('view.png'); this.viewBtn.src = varLSdefault.imagePath('view');
this.viewBtn.addClass('btn'); this.viewBtn.addClass('btn');
this.viewBtn.addEvent('click',this.changeInputType.bind(this)); this.viewBtn.addEvent('click',this.changeInputType.bind(this));
this.viewBtn.injectAfter(this.input); this.viewBtn.injectAfter(this.input);
@ -65,7 +65,7 @@ var LSformElement_password_field = new Class({
this.bgColor = this.input.getStyle('background-color'); this.bgColor = this.input.getStyle('background-color');
this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600}); this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600});
this.verifyBtn = new Element('img'); this.verifyBtn = new Element('img');
this.verifyBtn.src = varLSdefault.imagePath('verify.png'); this.verifyBtn.src = varLSdefault.imagePath('verify');
this.verifyBtn.addClass('btn'); this.verifyBtn.addClass('btn');
this.verifyBtn.addEvent('click',this.onVerifyBtnClick.bind(this)); this.verifyBtn.addEvent('click',this.onVerifyBtnClick.bind(this));
this.verifyBtn.injectAfter(this.input); this.verifyBtn.injectAfter(this.input);
@ -74,7 +74,7 @@ var LSformElement_password_field = new Class({
if (this.params['generate']) { if (this.params['generate']) {
this.generateBtn = new Element('img'); this.generateBtn = new Element('img');
this.generateBtn.src = varLSdefault.imagePath('generate.png'); this.generateBtn.src = varLSdefault.imagePath('generate');
this.generateBtn.addClass('btn'); this.generateBtn.addClass('btn');
this.generateBtn.addEvent('click',this.onGenerateBtnClick.bind(this)); this.generateBtn.addEvent('click',this.onGenerateBtnClick.bind(this));
this.generateBtn.injectAfter(this.input); this.generateBtn.injectAfter(this.input);
@ -94,12 +94,12 @@ var LSformElement_password_field = new Class({
onMailBtnClick: function() { onMailBtnClick: function() {
if (this.mailInput.value==0) { if (this.mailInput.value==0) {
this.mailInput.value = 1; this.mailInput.value = 1;
this.mailBtn.src = varLSdefault.imagePath('mail.png'); this.mailBtn.src = varLSdefault.imagePath('mail');
varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','mail'); varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','mail');
} }
else { else {
this.mailInput.value = 0; this.mailInput.value = 0;
this.mailBtn.src = varLSdefault.imagePath('nomail.png'); this.mailBtn.src = varLSdefault.imagePath('nomail');
varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','nomail'); varLSdefault.setHelpInfo(this.mailBtn,'LSformElement_password','nomail');
} }
}, },
@ -179,12 +179,12 @@ var LSformElement_password_field = new Class({
} }
if (this.input.type=='password') { if (this.input.type=='password') {
var newType = 'text'; var newType = 'text';
this.viewBtn.src=varLSdefault.imagePath('hide.png'); this.viewBtn.src=varLSdefault.imagePath('hide');
varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','hide'); varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','hide');
} }
else { else {
var newType = 'password'; var newType = 'password';
this.viewBtn.src=varLSdefault.imagePath('view.png'); this.viewBtn.src=varLSdefault.imagePath('view');
varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','view'); varLSdefault.setHelpInfo(this.viewBtn,'LSformElement_password','view');
} }
var newInput = new Element('input'); var newInput = new Element('input');

View file

@ -44,7 +44,7 @@ var LSformElement_postaladdress = new Class({
} }
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('map_go.png'), src: varLSdefault.imagePath('map_go'),
alt: 'View on map' alt: 'View on map'
}); });
btn.addClass('btn'); btn.addClass('btn');

View file

@ -21,7 +21,7 @@ var LSformElement_rss = new Class({
addBtnAfter: function(el) { addBtnAfter: function(el) {
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('rss.png'), src: varLSdefault.imagePath('rss'),
alt: 'File RSS' alt: 'File RSS'
}); });
btn.addClass('btn'); btn.addClass('btn');

View file

@ -7,7 +7,7 @@ var LSformElement_select = new Class({
$$('select.LSformElement_select').each(function(el) { $$('select.LSformElement_select').each(function(el) {
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('clear.png'), src: varLSdefault.imagePath('clear'),
alt: 'Reset', alt: 'Reset',
title: 'Reset' title: 'Reset'
}); });

View file

@ -54,7 +54,7 @@ var LSformElement_select_object_field = new Class({
var btn = new Element('img'); var btn = new Element('img');
btn.addClass('btn'); btn.addClass('btn');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('delete.png'), src: varLSdefault.imagePath('delete'),
alt: this.params.deleteBtns alt: this.params.deleteBtns
}); });
btn.addEvent('click',this.onDeleteBtnClick.bind(this,btn)); btn.addEvent('click',this.onDeleteBtnClick.bind(this,btn));
@ -64,7 +64,7 @@ var LSformElement_select_object_field = new Class({
addSingleAddBtn: function(insideEl) { addSingleAddBtn: function(insideEl) {
this.addBtn = new Element('img'); this.addBtn = new Element('img');
this.addBtn.setProperty('src',varLSdefault.imagePath('modify.png')); this.addBtn.setProperty('src',varLSdefault.imagePath('modify'));
this.addBtn.addClass('btn'); this.addBtn.addClass('btn');
this.addBtn.addEvent('click',this.onAddBtnClick.bindWithEvent(this)); this.addBtn.addEvent('click',this.onAddBtnClick.bindWithEvent(this));
this.addBtn.injectInside(insideEl); this.addBtn.injectInside(insideEl);
@ -73,7 +73,7 @@ var LSformElement_select_object_field = new Class({
addSearchAddBtn: function() { addSearchAddBtn: function() {
this.searchAddBtn = new Element('img'); this.searchAddBtn = new Element('img');
this.searchAddBtn.setProperty('src',varLSdefault.imagePath('add.png')); this.searchAddBtn.setProperty('src',varLSdefault.imagePath('add'));
this.searchAddBtn.addClass('btn'); this.searchAddBtn.addClass('btn');
this.searchAddBtn.addEvent('click',this.onSearchAddBtnClick.bindWithEvent(this)); this.searchAddBtn.addEvent('click',this.onSearchAddBtnClick.bindWithEvent(this));
this.searchAddBtn.injectAfter(this.addBtn); this.searchAddBtn.injectAfter(this.addBtn);

View file

@ -24,7 +24,7 @@ var LSformElement_text_field = new Class({
// GenerateBtn // GenerateBtn
this.generateBtn = new Element('img'); this.generateBtn = new Element('img');
this.generateBtn.addClass('btn'); this.generateBtn.addClass('btn');
this.generateBtn.src=varLSdefault.imagePath('generate.png'); this.generateBtn.src=varLSdefault.imagePath('generate');
this.generateBtn.addEvent('click',this.refreshValue.bind(this,true)); this.generateBtn.addEvent('click',this.refreshValue.bind(this,true));
this.generateBtn.injectAfter(this.input); this.generateBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.generateBtn,'LSformElement_text','generate'); varLSdefault.addHelpInfo(this.generateBtn,'LSformElement_text','generate');

View file

@ -13,7 +13,7 @@ var LSformElement_textarea = new Class({
el.getElements('textarea.LSform').each(function(textarea) { el.getElements('textarea.LSform').each(function(textarea) {
var btn = new Element('img'); var btn = new Element('img');
btn.addClass('btn'); btn.addClass('btn');
btn.src = varLSdefault.imagePath('clear.png'); btn.src = varLSdefault.imagePath('clear');
btn.addEvent('click',this.onClearBtnClick.bind(this,btn)); btn.addEvent('click',this.onClearBtnClick.bind(this,btn));
btn.injectAfter(textarea); btn.injectAfter(textarea);
varLSdefault.addHelpInfo(btn,'LSformElement_textarea','clear'); varLSdefault.addHelpInfo(btn,'LSformElement_textarea','clear');

View file

@ -21,7 +21,7 @@ var LSformElement_url = new Class({
addBtnAfter: function(el) { addBtnAfter: function(el) {
var btn_go = new Element('img'); var btn_go = new Element('img');
btn_go.setProperties({ btn_go.setProperties({
src: varLSdefault.imagePath('url_go.png') src: varLSdefault.imagePath('url_go')
}); });
btn_go.addClass('btn'); btn_go.addClass('btn');
btn_go.injectAfter(el); btn_go.injectAfter(el);
@ -31,7 +31,7 @@ var LSformElement_url = new Class({
if (this.isAddFavoriteSupportedBrowser()) { if (this.isAddFavoriteSupportedBrowser()) {
var btn_fav = new Element('img'); var btn_fav = new Element('img');
btn_fav.setProperties({ btn_fav.setProperties({
src: varLSdefault.imagePath('url_add.png') src: varLSdefault.imagePath('url_add')
}); });
btn_fav.addClass('btn'); btn_fav.addClass('btn');
btn_fav.injectAfter(btn_go); btn_fav.injectAfter(btn_go);

View file

@ -21,7 +21,7 @@ var LSformElement_xmpp = new Class({
addBtnAfter: function(el) { addBtnAfter: function(el) {
var btn = new Element('img'); var btn = new Element('img');
btn.setProperties({ btn.setProperties({
src: varLSdefault.imagePath('xmpp.png'), src: varLSdefault.imagePath('xmpp'),
alt: 'Chat' alt: 'Chat'
}); });
btn.addClass('btn'); btn.addClass('btn');

View file

@ -30,7 +30,7 @@ var LSrelation = new Class({
this.deleteBtnId = 0; this.deleteBtnId = 0;
$$('a.LSrelation_editable').each(function(a) { $$('a.LSrelation_editable').each(function(a) {
this.deleteBtn[this.deleteBtnId] = new Element('img'); this.deleteBtn[this.deleteBtnId] = new Element('img');
this.deleteBtn[this.deleteBtnId].src = varLSdefault.imagePath('delete.png'); this.deleteBtn[this.deleteBtnId].src = varLSdefault.imagePath('delete');
this.deleteBtn[this.deleteBtnId].setStyle('cursor','pointer'); this.deleteBtn[this.deleteBtnId].setStyle('cursor','pointer');
this.deleteBtn[this.deleteBtnId].addClass('LSrelation-btn'); this.deleteBtn[this.deleteBtnId].addClass('LSrelation-btn');
this.deleteBtn[this.deleteBtnId].addEvent('click',this.onDeleteBtnClick.bind(this,this.deleteBtn[this.deleteBtnId])); this.deleteBtn[this.deleteBtnId].addEvent('click',this.onDeleteBtnClick.bind(this,this.deleteBtn[this.deleteBtnId]));

View file

@ -320,7 +320,7 @@ var LSsmoothbox = new Class({
load: function() { load: function() {
this.frame.empty(); this.frame.empty();
this.loadingImage = new Element('img'); this.loadingImage = new Element('img');
this.loadingImage.setProperty('src',varLSdefault.imagePath('loading.gif')); this.loadingImage.setProperty('src',varLSdefault.imagePath('loading'));
this.loadingImage.setProperty('id','loadingImage-LSsmoothbox'); this.loadingImage.setProperty('id','loadingImage-LSsmoothbox');
this.openOptions.width = 120; this.openOptions.width = 120;
this.openOptions.height = 120; this.openOptions.height = 120;

View file

@ -53,7 +53,7 @@ var LSview = new Class({
onTdLSobjectListNamesOver: function(td){ onTdLSobjectListNamesOver: function(td){
td.imgEdit = new Element('img'); td.imgEdit = new Element('img');
td.imgEdit.src = varLSdefault.imagePath('view.png'); td.imgEdit.src = varLSdefault.imagePath('view');
td.imgEdit.injectInside(td); td.imgEdit.injectInside(td);
}, },