diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-08-19 23:58:35 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-08-19 23:58:35 +0000 |
commit | dcbaefafdfb955f61c9b83eb8d2e15eea2880694 (patch) | |
tree | 0e35d4a8466e3b0f8027059dbe81979ad5baab0f | |
parent | 9a346cc2378bf752c7099a1875b10919f0f7235e (diff) |
- 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
-rw-r--r-- | admin/include/functions.php | 5 | ||||
-rw-r--r-- | include/ws_core.inc.php | 31 | ||||
-rw-r--r-- | language/en_UK/common.lang.php | 2 | ||||
-rw-r--r-- | language/nl_NL/common.lang.php | 2 | ||||
-rw-r--r-- | tags.php | 16 | ||||
-rw-r--r-- | 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'; @@ -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 @@ <div class="navButtons"> {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} - <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 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} - <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 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 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 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 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} - <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 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} - <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 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 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 isset($slideshow)} {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} - <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 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} - <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} |