diff options
author | rvelices <rv-github@modusoptimus.com> | 2012-03-06 20:43:18 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2012-03-06 20:43:18 +0000 |
commit | 679e2bf5fdfb59ec237d3768f3ab5ea578649340 (patch) | |
tree | f47fdd639a812a42805632e0258ea94edde70565 | |
parent | 8495df013d3e513345dc921a7f7904503a8a4ac5 (diff) |
added event for src image url
simplify js in picture.tpl
action.php fix history saving
git-svn-id: http://piwigo.org/svn/trunk@13489 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | action.php | 8 | ||||
-rw-r--r-- | include/derivative.inc.php | 7 | ||||
-rw-r--r-- | themes/default/template/picture.tpl | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/action.php b/action.php index 827bdb392..fb2287ac3 100644 --- a/action.php +++ b/action.php @@ -22,6 +22,7 @@ // +-----------------------------------------------------------------------+ define('PHPWG_ROOT_PATH','./'); +session_cache_limiter('public'); include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); // Check Access and exit when user status is not ok @@ -70,8 +71,7 @@ SELECT * FROM '. IMAGES_TABLE.' WHERE id='.$_GET['id'].' ;'; -$result = pwg_query($query); -$element_info = pwg_db_fetch_assoc($result); +$element_info = pwg_db_fetch_assoc(pwg_query($query)); if ( empty($element_info) ) { do_error(404, 'Requested id not found'); @@ -105,7 +105,7 @@ switch ($_GET['part']) case 'e': if ( $user['enabled_high']!='true' ) { - do_error(401, 'Access denied h'); + do_error(401, 'Access denied e'); } $file = get_element_path($element_info); break; @@ -119,7 +119,7 @@ if ( empty($file) ) do_error(404, 'Requested file not found'); } -if ($_GET['part'] == 'h') { +if ($_GET['part'] == 'e') { pwg_log($_GET['id'], 'high'); } else if ($_GET['part'] == 'e') diff --git a/include/derivative.inc.php b/include/derivative.inc.php index 6fbde63a2..144e76a27 100644 --- a/include/derivative.inc.php +++ b/include/derivative.inc.php @@ -76,7 +76,12 @@ final class SrcImage function get_url() { - return embellish_url(get_root_url().$this->rel_path); + $url = get_root_url().$this->rel_path; + if ($this->flags & self::IS_ORIGINAL) + { + $url = trigger_event('get_src_image_url', $url, $this); + } + return embellish_url($url); } function has_size() diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl index bad2fd60b..e0472ca51 100644 --- a/themes/default/template/picture.tpl +++ b/themes/default/template/picture.tpl @@ -20,15 +20,13 @@ {if count($current.unique_derivatives)>1} {footer_script}{literal} -function changeImgSrc(url,typeSave,typeMap,typeDisplay) +function changeImgSrc(url,typeSave,typeMap) { var theImg = document.getElementById("theMainImage"); if (theImg) { theImg.removeAttribute("width");theImg.removeAttribute("height"); theImg.src = url; - var elt = document.getElementById("derivativeSwitchLink"); - /* if (elt) elt.innerHTML = typeDisplay; */ theImg.useMap = "#map"+typeMap; } document.cookie = 'picture_deriv='+typeSave+';path={/literal}{$COOKIE_PATH}{literal}'; @@ -53,7 +51,7 @@ function toggleDerivativeSwitchBox() <span class="pwg-icon pwg-icon-sizes"> </span><span class="pwg-button-text">{'Photo sizes'|@translate}</span></a> <div id="derivativeSwitchBox" onclick="toggleDerivativeSwitchBox()" style="display:none"> {foreach from=$current.unique_derivatives item=derivative key=derivative_type} -<a href="javascript:changeImgSrc('{$derivative->get_url()|@escape:javascript}','{$derivative_type}','{$derivative->get_type()}','{$derivative->get_type()|@translate|@escape:javascript}')">{$derivative->get_type()|@translate} ({$derivative->get_size_hr()})</a><br> +<a href="javascript:changeImgSrc('{$derivative->get_url()|@escape:javascript}','{$derivative_type}','{$derivative->get_type()}')">{$derivative->get_type()|@translate} ({$derivative->get_size_hr()})</a><br> {/foreach} {if isset($U_ORIGINAL)} <a href="javascript:phpWGOpenWindow('{$U_ORIGINAL}','xxx','scrollbars=yes,toolbar=no,status=no,resizable=yes')" rel="nofollow">{'Original'|@translate}</a> |