- ws can include php file before invoking web call method

- remove "Pierrick ..." from some languages
- tags - small change to avoid increasing number of urls
- added a missing closedir
- remove some unnecessary class names and inexisting rel attributes

git-svn-id: http://piwigo.org/svn/trunk@2478 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2008-08-19 23:58:35 +00:00
parent 9a346cc237
commit dcbaefafdf
6 changed files with 49 additions and 41 deletions

View file

@ -356,6 +356,7 @@ function get_fs_directories($path, $recursive = true)
} }
} }
} }
closedir($contents);
} }
} }
@ -1496,7 +1497,7 @@ DELETE
function tag_id_from_tag_name($tag_name) function tag_id_from_tag_name($tag_name)
{ {
global $page; global $page;
$tag_name = trim($tag_name); $tag_name = trim($tag_name);
if (isset($page['tag_id_from_tag_name_cache'][$tag_name])) if (isset($page['tag_id_from_tag_name_cache'][$tag_name]))
{ {
@ -1617,7 +1618,7 @@ function do_maintenance_all_tables()
// Optimize all tables // Optimize all tables
$query = 'OPTIMIZE TABLE '.implode(', ', $all_tables).';'; $query = 'OPTIMIZE TABLE '.implode(', ', $all_tables).';';
$mysql_rc = $mysql_rc && pwg_query($query); $mysql_rc = $mysql_rc && pwg_query($query);
if ($mysql_rc) if ($mysql_rc)
{ {
array_push( array_push(
$page['infos'], $page['infos'],

View file

@ -344,12 +344,10 @@ class PwgServer
var $_responseEncoder; var $_responseEncoder;
var $_responseFormat; var $_responseFormat;
var $_methods; var $_methods = array();
var $_methodSignatures;
function PwgServer() function PwgServer()
{ {
$methods = array();
} }
/** /**
@ -435,9 +433,6 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
*/ */
function addMethod($methodName, $callback, $params=array(), $description, $include_file='') function addMethod($methodName, $callback, $params=array(), $description, $include_file='')
{ {
$this->_methods[$methodName] = $callback;
$this->_methodDescriptions[$methodName] = $description;
if (!is_array($params)) if (!is_array($params))
{ {
$params = array(); $params = array();
@ -469,7 +464,13 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
$params[$param] = $options; $params[$param] = $options;
} }
} }
$this->_methodSignatures[$methodName] = $params;
$this->_methods[$methodName] = array(
'callback' => $callback,
'description' => $description,
'signature' => $params,
'include' => $include_file,
);
} }
function hasMethod($methodName) function hasMethod($methodName)
@ -479,13 +480,13 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
function getMethodDescription($methodName) function getMethodDescription($methodName)
{ {
$desc = @$this->_methodDescriptions[$methodName]; $desc = @$this->_methods[$methodName]['description'];
return isset($desc) ? $desc : ''; return isset($desc) ? $desc : '';
} }
function getMethodSignature($methodName) function getMethodSignature($methodName)
{ {
$signature = @$this->_methodSignatures[$methodName]; $signature = @$this->_methods[$methodName]['signature'];
return isset($signature) ? $signature : array(); return isset($signature) ? $signature : array();
} }
@ -517,15 +518,15 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
*/ */
function invoke($methodName, $params) function invoke($methodName, $params)
{ {
$callback = @$this->_methods[$methodName]; $method = @$this->_methods[$methodName];
if ( $callback==null ) if ( $method==null )
{ {
return new PwgError(WS_ERR_INVALID_METHOD, 'Method name "'.$methodName.'" is not valid'); return new PwgError(WS_ERR_INVALID_METHOD, 'Method name "'.$methodName.'" is not valid');
} }
// parameter check and data coercion ! // parameter check and data coercion !
$signature = @$this->_methodSignatures[$methodName]; $signature = $method['signature'];
$missing_params = array(); $missing_params = array();
foreach($signature as $name=>$options) foreach($signature as $name=>$options)
{ {
@ -570,7 +571,11 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
$result = trigger_event('ws_invoke_allowed', true, $methodName, $params); $result = trigger_event('ws_invoke_allowed', true, $methodName, $params);
if ( strtolower( get_class($result) )!='pwgerror') if ( strtolower( get_class($result) )!='pwgerror')
{ {
$result = call_user_func_array($callback, array($params, &$this) ); if ( !empty($method['include']) )
{
include_once( $method['include'] );
}
$result = call_user_func_array($method['callback'], array($params, &$this) );
} }
return $result; return $result;
} }

View file

@ -310,7 +310,7 @@ $lang['upload_advise_filetype'] = 'the picture must be to the fileformat jpg, gi
$lang['upload_advise_height'] = 'the height of the picture must not exceed : '; $lang['upload_advise_height'] = 'the height of the picture must not exceed : ';
$lang['upload_advise_thumbnail'] = 'Optional, but recommended : choose a thumbnail to associate to '; $lang['upload_advise_thumbnail'] = 'Optional, but recommended : choose a thumbnail to associate to ';
$lang['upload_advise_width'] = 'the width of the picture must not exceed : '; $lang['upload_advise_width'] = 'the width of the picture must not exceed : ';
$lang['upload_author'] = 'Author (eg "Pierrick LE GALL")'; $lang['upload_author'] = 'Author';
$lang['upload_cannot_upload'] = 'can\'t upload the picture on the server'; $lang['upload_cannot_upload'] = 'can\'t upload the picture on the server';
$lang['upload_err_username'] = 'the username must be given'; $lang['upload_err_username'] = 'the username must be given';
$lang['upload_file_exists'] = 'A picture\'s name already used'; $lang['upload_file_exists'] = 'A picture\'s name already used';

View file

@ -310,7 +310,7 @@ $lang['upload_advise_filetype'] = 'de afbeelding moet een extensie hebbben die e
$lang['upload_advise_height'] = 'de hoogte van de afbeelding mag niet te groot zijn : '; $lang['upload_advise_height'] = 'de hoogte van de afbeelding mag niet te groot zijn : ';
$lang['upload_advise_thumbnail'] = 'Optioneel, maar aanbevolen : kies een thumbnail voor associatie'; $lang['upload_advise_thumbnail'] = 'Optioneel, maar aanbevolen : kies een thumbnail voor associatie';
$lang['upload_advise_width'] = 'de breedte van de afbeelding mag niet te groot zijn : '; $lang['upload_advise_width'] = 'de breedte van de afbeelding mag niet te groot zijn : ';
$lang['upload_author'] = 'Auteur (eg "Pierrick LE GALL")'; $lang['upload_author'] = 'Auteur';
$lang['upload_cannot_upload'] = 'kan de afbeelding niet op de server plaatsen'; $lang['upload_cannot_upload'] = 'kan de afbeelding niet op de server plaatsen';
$lang['upload_err_username'] = 'de gebruikersnaam moet ingevuld zijn'; $lang['upload_err_username'] = 'de gebruikersnaam moet ingevuld zijn';
$lang['upload_file_exists'] = 'De naam is al in gebruik'; $lang['upload_file_exists'] = 'De naam is al in gebruik';

View file

@ -67,13 +67,15 @@ if (isset($_GET['display_mode']))
} }
} }
$template->assign( foreach (array('cloud', 'letters') as $mode)
array( {
'U_CLOUD' => get_root_url().'tags.php?display_mode=cloud', $template->assign(
'U_LETTERS' => get_root_url().'tags.php?display_mode=letters', 'U_'.strtoupper($mode),
'display_mode' => $page['display_mode'], get_root_url().'tags.php'. ($conf['tags_default_display_mode']==$mode ? '' : '?display_mode='.$mode)
) );
); }
$template->assign( 'display_mode', $page['display_mode'] );
// find all tags available for the current user // find all tags available for the current user
$tags = get_available_tags(); $tags = get_available_tags();

View file

@ -2,61 +2,61 @@
<div class="navButtons"> <div class="navButtons">
{if isset($last)} {if isset($last)}
<a class="navButton prev" href="{$last.U_IMG}" title="{'last_page'|@translate} : {$last.TITLE}" rel="last"><img src="{$ROOT_URL}{$themeconf.icon_dir}/last.png" class="button" alt="{'last_page'|@translate}"></a> <a class="navButton" href="{$last.U_IMG}" title="{'last_page'|@translate} : {$last.TITLE}" rel="last"><img src="{$ROOT_URL}{$themeconf.icon_dir}/last.png" class="button" alt="{'last_page'|@translate}"></a>
{else} {else}
<a class="navButton prev"><img src="{$ROOT_URL}{$themeconf.icon_dir}/last_unactive.png" class="button" alt=""></a> <a class="navButton"><img src="{$ROOT_URL}{$themeconf.icon_dir}/last_unactive.png" class="button" alt=""></a>
{/if} {/if}
{if isset($next)} {if isset($next)}
<a class="navButton next" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next"><img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png" class="button" alt="{'next_page'|@translate}"></a> <a class="navButton" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next"><img src="{$ROOT_URL}{$themeconf.icon_dir}/right.png" class="button" alt="{'next_page'|@translate}"></a>
{else} {else}
<a class="navButton next"><img src="{$ROOT_URL}{$themeconf.icon_dir}/right_unactive.png" class="button" alt=""></a> <a class="navButton"><img src="{$ROOT_URL}{$themeconf.icon_dir}/right_unactive.png" class="button" alt=""></a>
{/if} {/if}
{if isset($slideshow.U_START_PLAY)} {if isset($slideshow.U_START_PLAY)}
<a class="navButton play" href="{$slideshow.U_START_PLAY}" title="{'start_play'|@translate}" rel="play"><img src="{$ROOT_URL}{$themeconf.icon_dir}/play.png" class="button" alt="{'start_play'|@translate}"></a> <a class="navButton" href="{$slideshow.U_START_PLAY}" title="{'start_play'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/play.png" class="button" alt="{'start_play'|@translate}"></a>
{/if} {/if}
{if isset($slideshow.U_STOP_PLAY)} {if isset($slideshow.U_STOP_PLAY)}
<a class="navButton play" href="{$slideshow.U_STOP_PLAY}" title="{'stop_play'|@translate}" rel="play"><img src="{$ROOT_URL}{$themeconf.icon_dir}/pause.png" class="button" alt="{'stop_play'|@translate}"></a> <a class="navButton" href="{$slideshow.U_STOP_PLAY}" title="{'stop_play'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/pause.png" class="button" alt="{'stop_play'|@translate}"></a>
{/if} {/if}
{if isset($U_UP) and !isset($slideshow)} {if isset($U_UP) and !isset($slideshow)}
<a class="navButton up" href="{$U_UP}" title="{'thumbnails'|@translate}" rel="up"><img src="{$ROOT_URL}{$themeconf.icon_dir}/up.png" class="button" alt="{'thumbnails'|@translate}"></a> <a class="navButton" href="{$U_UP}" title="{'thumbnails'|@translate}" rel="up"><img src="{$ROOT_URL}{$themeconf.icon_dir}/up.png" class="button" alt="{'thumbnails'|@translate}"></a>
{/if} {/if}
{if isset($previous)} {if isset($previous)}
<a class="navButton prev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev"><img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png" class="button" alt="{'previous_page'|@translate}"></a> <a class="navButton" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev"><img src="{$ROOT_URL}{$themeconf.icon_dir}/left.png" class="button" alt="{'previous_page'|@translate}"></a>
{else} {else}
<a class="navButton prev"><img src="{$ROOT_URL}{$themeconf.icon_dir}/left_unactive.png" class="button" alt=""></a> <a class="navButton"><img src="{$ROOT_URL}{$themeconf.icon_dir}/left_unactive.png" class="button" alt=""></a>
{/if} {/if}
{if isset($first)} {if isset($first)}
<a class="navButton prev" href="{$first.U_IMG}" title="{'first_page'|@translate} : {$first.TITLE}" rel="first"><img src="{$ROOT_URL}{$themeconf.icon_dir}/first.png" class="button" alt="{'first_page'|@translate}"></a> <a class="navButton" href="{$first.U_IMG}" title="{'first_page'|@translate} : {$first.TITLE}" rel="first"><img src="{$ROOT_URL}{$themeconf.icon_dir}/first.png" class="button" alt="{'first_page'|@translate}"></a>
{else} {else}
<a class="navButton prev"><img src="{$ROOT_URL}{$themeconf.icon_dir}/first_unactive.png" class="button" alt=""></a> <a class="navButton"><img src="{$ROOT_URL}{$themeconf.icon_dir}/first_unactive.png" class="button" alt=""></a>
{/if} {/if}
{if isset($slideshow.U_START_REPEAT)} {if isset($slideshow.U_START_REPEAT)}
<a class="navButton repeat" href="{$slideshow.U_START_REPEAT}" title="{'start_repeat'|@translate}" rel="repeat"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_repeat.png" class="button" alt="{'start_repeat'|@translate}"></a> <a class="navButton" href="{$slideshow.U_START_REPEAT}" title="{'start_repeat'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/start_repeat.png" class="button" alt="{'start_repeat'|@translate}"></a>
{/if} {/if}
{if isset($slideshow.U_STOP_REPEAT)} {if isset($slideshow.U_STOP_REPEAT)}
<a class="navButton repeat" href="{$slideshow.U_STOP_REPEAT}" title="{'stop_repeat'|@translate}" rel="repeat"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_repeat.png" class="button" alt="{'stop_repeat'|@translate}"></a> <a class="navButton" href="{$slideshow.U_STOP_REPEAT}" title="{'stop_repeat'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/stop_repeat.png" class="button" alt="{'stop_repeat'|@translate}"></a>
{/if} {/if}
{if isset($slideshow)} {if isset($slideshow)}
{if isset($slideshow.U_DEC_PERIOD)} {if isset($slideshow.U_DEC_PERIOD)}
<a class="navButton dec_period" href="{$slideshow.U_DEC_PERIOD}" title="{'dec_period'|@translate}" rel="repeat"><img src="{$ROOT_URL}{$themeconf.icon_dir}/dec_period.png" class="button" alt="{'dec_period'|@translate}"></a> <a class="navButton" href="{$slideshow.U_DEC_PERIOD}" title="{'dec_period'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/dec_period.png" class="button" alt="{'dec_period'|@translate}"></a>
{else} {else}
<a class="navButton dec_period"> <img src="{$ROOT_URL}{$themeconf.icon_dir}/dec_period_unactive.png" class="button" alt=""></a> <a class="navButton"> <img src="{$ROOT_URL}{$themeconf.icon_dir}/dec_period_unactive.png" class="button" alt=""></a>
{/if} {/if}
{if isset($slideshow.U_INC_PERIOD)} {if isset($slideshow.U_INC_PERIOD)}
<a class="navButton inc_period" href="{$slideshow.U_INC_PERIOD}" title="{'inc_period'|@translate}" rel="repeat"><img src="{$ROOT_URL}{$themeconf.icon_dir}/inc_period.png" class="button" alt="{'inc_period'|@translate}"></a> <a class="navButton" href="{$slideshow.U_INC_PERIOD}" title="{'inc_period'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/inc_period.png" class="button" alt="{'inc_period'|@translate}"></a>
{else} {else}
<a class="navButton inc_period"> <img src="{$ROOT_URL}{$themeconf.icon_dir}/inc_period_unactive.png" class="button" alt=""></a> <a class="navButton"> <img src="{$ROOT_URL}{$themeconf.icon_dir}/inc_period_unactive.png" class="button" alt=""></a>
{/if} {/if}
{/if} {/if}