From dcbaefafdfb955f61c9b83eb8d2e15eea2880694 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 19 Aug 2008 23:58:35 +0000 Subject: - 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 --- admin/include/functions.php | 5 +++-- include/ws_core.inc.php | 31 ++++++++++++++++++------------- language/en_UK/common.lang.php | 2 +- language/nl_NL/common.lang.php | 2 +- tags.php | 16 +++++++++------- template/yoga/picture_nav_buttons.tpl | 34 +++++++++++++++++----------------- 6 files changed, 49 insertions(+), 41 deletions(-) diff --git a/admin/include/functions.php b/admin/include/functions.php index 2a7214974..59c63ff0c 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -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) { global $page; - + $tag_name = trim($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 $query = 'OPTIMIZE TABLE '.implode(', ', $all_tables).';'; $mysql_rc = $mysql_rc && pwg_query($query); - if ($mysql_rc) + if ($mysql_rc) { array_push( $page['infos'], diff --git a/include/ws_core.inc.php b/include/ws_core.inc.php index c78d4f402..71a10b06d 100644 --- a/include/ws_core.inc.php +++ b/include/ws_core.inc.php @@ -344,12 +344,10 @@ class PwgServer var $_responseEncoder; var $_responseFormat; - var $_methods; - var $_methodSignatures; + var $_methods = array(); function PwgServer() { - $methods = array(); } /** @@ -435,9 +433,6 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder." */ function addMethod($methodName, $callback, $params=array(), $description, $include_file='') { - $this->_methods[$methodName] = $callback; - $this->_methodDescriptions[$methodName] = $description; - if (!is_array($params)) { $params = array(); @@ -469,7 +464,13 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder." $params[$param] = $options; } } - $this->_methodSignatures[$methodName] = $params; + + $this->_methods[$methodName] = array( + 'callback' => $callback, + 'description' => $description, + 'signature' => $params, + 'include' => $include_file, + ); } function hasMethod($methodName) @@ -479,13 +480,13 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder." function getMethodDescription($methodName) { - $desc = @$this->_methodDescriptions[$methodName]; + $desc = @$this->_methods[$methodName]['description']; return isset($desc) ? $desc : ''; } function getMethodSignature($methodName) { - $signature = @$this->_methodSignatures[$methodName]; + $signature = @$this->_methods[$methodName]['signature']; return isset($signature) ? $signature : array(); } @@ -517,15 +518,15 @@ Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder." */ 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'); } // parameter check and data coercion ! - $signature = @$this->_methodSignatures[$methodName]; + $signature = $method['signature']; $missing_params = array(); 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); 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; } diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php index a18883052..f8c1297d0 100644 --- a/language/en_UK/common.lang.php +++ b/language/en_UK/common.lang.php @@ -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_thumbnail'] = 'Optional, but recommended : choose a thumbnail to associate to '; $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_err_username'] = 'the username must be given'; $lang['upload_file_exists'] = 'A picture\'s name already used'; diff --git a/language/nl_NL/common.lang.php b/language/nl_NL/common.lang.php index 063610cd2..6d2fba933 100644 --- a/language/nl_NL/common.lang.php +++ b/language/nl_NL/common.lang.php @@ -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_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_author'] = 'Auteur (eg "Pierrick LE GALL")'; +$lang['upload_author'] = 'Auteur'; $lang['upload_cannot_upload'] = 'kan de afbeelding niet op de server plaatsen'; $lang['upload_err_username'] = 'de gebruikersnaam moet ingevuld zijn'; $lang['upload_file_exists'] = 'De naam is al in gebruik'; diff --git a/tags.php b/tags.php index 3b7337ca6..3932ded84 100644 --- a/tags.php +++ b/tags.php @@ -67,13 +67,15 @@ if (isset($_GET['display_mode'])) } } -$template->assign( - array( - 'U_CLOUD' => get_root_url().'tags.php?display_mode=cloud', - 'U_LETTERS' => get_root_url().'tags.php?display_mode=letters', - 'display_mode' => $page['display_mode'], - ) - ); +foreach (array('cloud', 'letters') as $mode) +{ + $template->assign( + 'U_'.strtoupper($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 $tags = get_available_tags(); diff --git a/template/yoga/picture_nav_buttons.tpl b/template/yoga/picture_nav_buttons.tpl index 081696ee2..aca9b10bd 100644 --- a/template/yoga/picture_nav_buttons.tpl +++ b/template/yoga/picture_nav_buttons.tpl @@ -2,61 +2,61 @@