Merge branch 'master' into translation

This commit is contained in:
plegall 2016-03-08 10:48:00 +01:00
commit f9fecd0be0
108 changed files with 813 additions and 144 deletions

View file

@ -50,7 +50,7 @@ else
$page['start'] = 0;
}
$types = array('none', 'picture', 'high', 'other');
$types = array_merge(array('none'), get_enums(HISTORY_TABLE, 'image_type'));
$display_thumbnails = array('no_display_thumbnail' => l10n('No display'),
'display_thumbnail_classic' => l10n('Classic display'),

View file

@ -405,11 +405,7 @@ DELETE FROM '.$table.'
}
// purge of sessions
$query = '
DELETE FROM '.SESSIONS_TABLE.'
WHERE data LIKE \'pwg_uid|i:'.(int)$user_id.';%\'
;';
pwg_query($query);
delete_user_sessions($user_id);
// destruction of the user
$query = '
@ -2080,6 +2076,8 @@ function cat_admin_access($category_id)
*/
function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_agent='Piwigo', $step=0)
{
global $conf;
// Try to retrieve data from local file?
if (!url_is_remote($src))
{
@ -2115,6 +2113,17 @@ function fetchRemote($src, &$dest, $get_data=array(), $post_data=array(), $user_
if (function_exists('curl_init') && function_exists('curl_exec'))
{
$ch = @curl_init();
if (isset($conf['use_proxy']) && $conf['use_proxy'])
{
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
@curl_setopt($ch, CURLOPT_PROXY, $conf['proxy_server']);
if (isset($conf['proxy_auth']) && !empty($conf['proxy_auth']))
{
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $conf['proxy_auth']);
}
}
@curl_setopt($ch, CURLOPT_URL, $src);
@curl_setopt($ch, CURLOPT_HEADER, 1);
@curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);

View file

@ -173,8 +173,24 @@ function get_sync_metadata($infos)
$infos['filesize'] = floor($fs/1024);
$is_tiff = false;
if (isset($infos['representative_ext']))
{
if ($image_size = @getimagesize($file))
{
$type = $image_size[2];
if (IMAGETYPE_TIFF_MM == $type or IMAGETYPE_TIFF_II == $type)
{
// in case of TIFF files, we want to use the original file and not
// the representative for EXIF/IPTC, but we need the representative
// for width/height (to compute the multiple size dimensions)
$is_tiff = true;
}
}
$file = original_to_representative($file, $infos['representative_ext']);
}
@ -184,6 +200,12 @@ function get_sync_metadata($infos)
$infos['height'] = $image_size[1];
}
if ($is_tiff)
{
// back to original file
$file = PHPWG_ROOT_PATH.$infos['path'];
}
if ($conf['use_exif'])
{
$exif = get_sync_exif_data($file);

View file

@ -535,7 +535,7 @@ function upload_file_video($representative_ext, $file_path)
$ffmpeg_video_exts = array( // extensions tested with FFmpeg
'wmv','mov','mkv','mp4','mpg','flv','asf','xvid','divx','mpeg',
'avi','rm',
'avi','rm', 'm4v', 'ogg', 'ogv', 'webm', 'webmv',
);
if (!in_array(strtolower(get_extension($file_path)), $ffmpeg_video_exts))

View file

@ -25,25 +25,9 @@
// | Photo selection |
// +-----------------------------------------------------------------------+
$upload_max_filesize = min(
get_ini_size('upload_max_filesize'),
get_ini_size('post_max_size')
);
if ($upload_max_filesize == get_ini_size('upload_max_filesize'))
{
$upload_max_filesize_shorthand = get_ini_size('upload_max_filesize', false);
}
else
{
$upload_max_filesize_shorthand = get_ini_size('post_max_filesize', false);
}
$template->assign(
array(
'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
'upload_max_filesize' => $upload_max_filesize,
'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand,
'chunk_size' => $conf['upload_form_chunk_size'],
)
);
@ -222,6 +206,16 @@ if (!isset($_SESSION['upload_hide_warnings']))
get_ini_size('post_max_size', false)
);
}
if (get_ini_size('upload_max_filesize') < $conf['upload_form_chunk_size']*1024)
{
$setup_warnings[] = sprintf(
'Piwigo setting upload_form_chunk_size (%ukB) should be smaller than PHP configuration setting upload_max_filesize (%ukB)',
$conf['upload_form_chunk_size'],
ceil(get_ini_size('upload_max_filesize') / 1024)
);
}
$template->assign(
array(
'setup_warnings' => $setup_warnings,

View file

@ -109,6 +109,46 @@ DELETE
case 'sessions' :
{
pwg_session_gc();
// delete all sessions associated to invalid user ids (it should never happen)
$query = '
SELECT
id,
data
FROM '.SESSIONS_TABLE.'
;';
$sessions = query2array($query);
$query = '
SELECT
'.$conf['user_fields']['id'].' AS id
FROM '.USERS_TABLE.'
;';
$all_user_ids = query2array($query, 'id', null);
$sessions_to_delete = array();
foreach ($sessions as $session)
{
if (preg_match('/pwg_uid\|i:(\d+);/', $session['data'], $matches))
{
if (!isset($all_user_ids[ $matches[1] ]))
{
$sessions_to_delete[] = $session['id'];
}
}
}
if (count($sessions_to_delete) > 0)
{
$query = '
DELETE
FROM '.SESSIONS_TABLE.'
WHERE id IN (\''.implode("','", $sessions_to_delete).'\')
;';
pwg_query($query);
}
break;
}
case 'feeds' :

View file

@ -21,7 +21,7 @@
{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'}
{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"}
{combine_script id='piecon' load='footer' path='themes/default/js/plugins/piecon.min.js'}
{combine_script id='piecon' load='footer' path='themes/default/js/plugins/piecon.js'}
{footer_script}
{* <!-- CATEGORIES --> *}
@ -282,10 +282,9 @@ jQuery(document).ready(function(){
<p class="uploadInfo">{'The picture dimensions will be reduced to %dx%d pixels.'|@translate:$original_resize_maxwidth:$original_resize_maxheight}</p>
{/if}
<p id="uploadWarningsSummary">{$upload_max_filesize_shorthand}B. {$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if} <a class="icon-info-circled-1 showInfo" title="{'Learn more'|@translate}"></a></p>
<p id="uploadWarningsSummary">{$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if} <a class="icon-info-circled-1 showInfo" title="{'Learn more'|@translate}"></a></p>
<p id="uploadWarnings">
{'Maximum file size: %sB.'|@translate:$upload_max_filesize_shorthand}
{'Allowed file types: %s.'|@translate:$upload_file_types}
{if isset($max_upload_resolution)}
{'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|@translate:$max_upload_resolution:$max_upload_width:$max_upload_height}

View file

@ -28,6 +28,7 @@ var selection = [{$selection}];
var pwg_token = "{$PWG_TOKEN}";
var protectedUsers = [{$protected_users}];
var passwordProtectedUsers = [{$password_protected_users}];
var guestUser = {$guest_user};
var truefalse = {
@ -247,6 +248,7 @@ jQuery(document).ready(function() {
user.isGuest = (parseInt(userId) == guestUser);
user.isProtected = (protectedUsers.indexOf(parseInt(userId)) != -1);
user.isPasswordProtected = (passwordProtectedUsers.indexOf(parseInt(userId)) != -1);
user.registeredOn_string = sprintf(
registeredOn_pattern,
@ -1051,7 +1053,7 @@ span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border
<script type="text/template" class="userDetails">
<form>
<div class="userActions">
<% if (!user.isGuest) { %>
<% if (!user.isPasswordProtected) { %>
<span class="changePasswordDone infos" style="display:none">&#x2714; {'Password updated'|translate}</span>
<span class="changePassword" style="display:none">{'New password'|translate} <input type="text"> <a href="#" class="buttonLike updatePassword"><img src="themes/default/images/ajax-loader-small.gif" style="margin-bottom:-1px;margin-left:1px;display:none;"><span class="text">{'Submit'|translate}</span></a> <a href="#" class="cancel">{'Cancel'|translate}</a></span>
<a class="icon-key changePasswordOpen" href="#">{'Change password'|translate}</a>

View file

@ -100,6 +100,8 @@ $protected_users = array(
$conf['webmaster_id'],
);
$password_protected_users = array($conf['guest_id']);
// an admin can't delete other admin/webmaster
if ('admin' == $user['status'])
{
@ -109,7 +111,12 @@ SELECT
FROM '.USER_INFOS_TABLE.'
WHERE status IN (\'webmaster\', \'admin\')
;';
$protected_users = array_merge($protected_users, query2array($query, null, 'user_id'));
$admin_ids = query2array($query, null, 'user_id');
$protected_users = array_merge($protected_users, $admin_ids);
// we add all admin+webmaster users BUT the user herself
$password_protected_users = array_merge($password_protected_users, array_diff($admin_ids, array($user['id'])));
}
$template->assign(
@ -123,6 +130,7 @@ $template->assign(
'language_selected' => get_default_language(),
'association_options' => $groups,
'protected_users' => implode(',', array_unique($protected_users)),
'password_protected_users' => implode(',', array_unique($password_protected_users)),
'guest_user' => $conf['guest_id'],
)
);
@ -135,7 +143,7 @@ foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
$pref_status_options = $label_of_status;
// a simple "admin" can set/remove statuses webmaster/admin
// a simple "admin" can't set/remove statuses webmaster/admin
if ('admin' == $user['status'])
{
unset($pref_status_options['webmaster']);

View file

@ -832,4 +832,18 @@ $conf['log_level'] = 'DEBUG';
// Keep logs file during X days
$conf['log_archive_days'] = 30;
// +-----------------------------------------------------------------------+
// | Proxy Settings |
// +-----------------------------------------------------------------------+
// If piwigo needs a http-proxy to connect to the internet, set this to true
$conf['use_proxy'] = false;
// Connection string of the proxy
$conf['proxy_server'] = 'proxy.domain.org:port';
// If the http-proxy requires authentication, set username and password here
// e.g. username:password
$conf['proxy_auth'] = '';
?>

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
// Default settings
define('PHPWG_VERSION', '2.8.0RC1');
define('PHPWG_VERSION', '2.8.0RC2');
define('PHPWG_DEFAULT_LANGUAGE', 'en_UK');
define('PHPWG_DEFAULT_TEMPLATE', 'elegant');

View file

@ -434,6 +434,17 @@ function pwg_log($image_id = null, $image_type = null, $format_id = null)
$tags_string = implode(',', $page['tag_ids']);
}
$ip = $_SERVER['REMOTE_ADDR'];
// In case of "too long" ipv6 address, we take only the 15 first chars.
//
// It would be "cleaner" to increase length of history.IP to 50 chars, but
// the alter table is very long on such a big table. We should plan this
// for a future version, once history table is kept "smaller".
if (strpos($ip,':') !== false and strlen($ip) > 15)
{
$ip = substr($ip, 0, 15);
}
$query = '
INSERT INTO '.HISTORY_TABLE.'
(
@ -454,7 +465,7 @@ INSERT INTO '.HISTORY_TABLE.'
CURRENT_DATE,
CURRENT_TIME,
'.$user['id'].',
\''.$_SERVER['REMOTE_ADDR'].'\',
\''.$ip.'\',
'.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
'.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').',
'.(isset($image_id) ? $image_id : 'NULL').',

View file

@ -90,7 +90,7 @@ function get_sql_search_clause($search)
}
}
if (isset($search['fields']['allwords']))
if (isset($search['fields']['allwords']) and count($search['fields']['allwords']['fields']) > 0)
{
$fields = array('file', 'name', 'comment');
@ -98,7 +98,7 @@ function get_sql_search_clause($search)
{
$fields = array_intersect($fields, $search['fields']['allwords']['fields']);
}
// in the OR mode, request bust be :
// ((field1 LIKE '%word1%' OR field2 LIKE '%word1%')
// OR (field1 LIKE '%word2%' OR field2 LIKE '%word2%'))
@ -199,7 +199,10 @@ function get_sql_search_clause($search)
*/
function get_regular_search_results($search, $images_where='')
{
global $conf;
global $conf, $logger;
$logger->debug(__FUNCTION__, 'search', $search);
$forbidden = get_sql_condition_FandF(
array
(
@ -213,12 +216,35 @@ function get_regular_search_results($search, $images_where='')
$items = array();
$tag_items = array();
if (isset($search['fields']['search_in_tags']))
{
$word_clauses = array();
foreach ($search['fields']['allwords']['words'] as $word)
{
$word_clauses[] = "name LIKE '%".$word."%'";
}
$query = '
SELECT
id
FROM '.TAGS_TABLE.'
WHERE '.implode(' OR ', $word_clauses).'
;';
$tag_ids = query2array($query, null, 'id');
$search_in_tags_items = get_image_ids_for_tags($tag_ids, 'OR');
$logger->debug(__FUNCTION__.' '.count($search_in_tags_items).' items in $search_in_tags_items');
}
if (isset($search['fields']['tags']))
{
$tag_items = get_image_ids_for_tags(
$search['fields']['tags']['words'],
$search['fields']['tags']['mode']
);
$logger->debug(__FUNCTION__.' '.count($tag_items).' items in $tag_items');
}
$search_clause = get_sql_search_clause($search);
@ -237,6 +263,18 @@ SELECT DISTINCT(id)
$query .= $forbidden.'
'.$conf['order_by'];
$items = array_from_query($query, 'id');
$logger->debug(__FUNCTION__.' '.count($items).' items in $items');
}
if (isset($search_in_tags_items))
{
$items = array_unique(
array_merge(
$items,
$search_in_tags_items
)
);
}
if ( !empty($tag_items) )
@ -244,7 +282,7 @@ SELECT DISTINCT(id)
switch ($search['mode'])
{
case 'AND':
if (empty($search_clause))
if (empty($search_clause) and !isset($search_in_tags_items))
{
$items = $tag_items;
}
@ -254,7 +292,6 @@ SELECT DISTINCT(id)
}
break;
case 'OR':
$before_count = count($items);
$items = array_unique(
array_merge(
$items,

View file

@ -260,4 +260,20 @@ function pwg_unset_session_var($var)
return true;
}
/**
* delete all sessions for a given user (certainly deleted)
*
* @since 2.8
* @param int $user_id
* @return null
*/
function delete_user_sessions($user_id)
{
$query = '
DELETE
FROM '.SESSIONS_TABLE.'
WHERE data LIKE \'%pwg_uid|i:'.(int)$user_id.';%\'
;';
pwg_query($query);
}
?>

View file

@ -945,10 +945,13 @@ function log_user($user_id, $remember_me)
{ // make sure we clean any remember me ...
setcookie($conf['remember_me_name'], '', 0, cookie_path(),ini_get('session.cookie_domain'));
}
if ( session_id()!="" and (version_compare(PHP_VERSION, '7') <= 0 or version_compare(PHP_VERSION, '7.0.3') >= 0))
if ( session_id()!="" )
{ // we regenerate the session for security reasons
// see http://www.acros.si/papers/session_fixation.pdf
session_regenerate_id(true);
if (version_compare(PHP_VERSION, '7') <= 0)
{
session_regenerate_id(true);
}
}
else
{
@ -1593,4 +1596,22 @@ SELECT
return create_user_auth_key($user_id, $user_status);
}
}
/**
* Deactivates authentication keys
*
* @since 2.8
* @param int $user_id
* @return null
*/
function deactivate_user_auth_keys($user_id)
{
$query = '
UPDATE '.USER_AUTH_KEYS_TABLE.'
SET expired_on = NOW()
WHERE user_id = '.$user_id.'
AND expired_on > NOW()
;';
pwg_query($query);
}
?>

View file

@ -193,7 +193,7 @@ function ws_std_get_image_xml_attributes()
function ws_std_get_category_xml_attributes()
{
return array(
'id', 'url', 'nb_images', 'total_nb_images', 'nb_categories', 'date_last', 'max_date_last',
'id', 'url', 'nb_images', 'total_nb_images', 'nb_categories', 'date_last', 'max_date_last', 'status',
);
}
@ -235,4 +235,4 @@ function categories_flatlist_to_tree($categories)
return $tree;
}
?>
?>

View file

@ -181,6 +181,11 @@ function ws_categories_getList($params, &$service)
{
global $user, $conf;
if (!in_array($params['thumbnail_size'], array_keys(ImageStdParams::get_defined_type_map())))
{
return new PwgError(WS_ERR_INVALID_PARAM, "Invalid thumbnail_size");
}
$where = array('1=1');
$join_type = 'INNER';
$join_user = $user['id'];
@ -226,7 +231,7 @@ function ws_categories_getList($params, &$service)
$query = '
SELECT
id, name, comment, permalink,
id, name, comment, permalink, status,
uppercats, global_rank, id_uppercat,
nb_images, count_images AS total_nb_images,
representative_picture_id, user_representative_picture_id, count_images, count_categories,
@ -366,7 +371,7 @@ SELECT id, path, representative_ext, level
{
if ($row['level'] <= $user['level'])
{
$thumbnail_src_of[$row['id']] = DerivativeImage::thumb_url($row);
$thumbnail_src_of[$row['id']] = DerivativeImage::url($params['thumbnail_size'], $row);
}
else
{
@ -411,7 +416,7 @@ SELECT id, path, representative_ext
while ($row = pwg_db_fetch_assoc($result))
{
$thumbnail_src_of[ $row['id'] ] = DerivativeImage::thumb_url($row);
$thumbnail_src_of[ $row['id'] ] = DerivativeImage::url($params['thumbnail_size'], $row);
}
}
}
@ -489,7 +494,7 @@ SELECT category_id, COUNT(*) AS counter
$nb_images_of = query2array($query, 'category_id', 'counter');
$query = '
SELECT id, name, comment, uppercats, global_rank, dir
SELECT id, name, comment, uppercats, global_rank, dir, status
FROM '. CATEGORIES_TABLE .'
;';
$result = pwg_query($query);
@ -529,7 +534,7 @@ SELECT id, name, comment, uppercats, global_rank, dir
'categories' => new PwgNamedArray(
$cats,
'category',
array('id', 'nb_images', 'name', 'uppercats', 'global_rank')
array('id', 'nb_images', 'name', 'uppercats', 'global_rank', 'status')
)
);
}
@ -586,6 +591,33 @@ function ws_categories_add($params, &$service)
*/
function ws_categories_setInfo($params, &$service)
{
// does the category really exist?
$query = '
SELECT *
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$params['category_id'].'
;';
$categories = query2array($query);
if (count($categories) == 0)
{
return new PwgError(404, 'category_id not found');
}
$category = $categories[0];
if (!empty($params['status']))
{
if (!in_array($params['status'], array('private','public')))
{
return new PwgError(WS_ERR_INVALID_PARAM, "Invalid status, only public/private");
}
if ($params['status'] != $category['status'])
{
set_cat_status(array($params['category_id']), $params['status']);
}
}
$update = array(
'id' => $params['category_id'],
);

View file

@ -426,6 +426,27 @@ function ws_users_setInfo($params, &$service)
if (!empty($params['password']))
{
if (!is_webmaster())
{
$password_protected_users = array($conf['guest_id']);
$query = '
SELECT
user_id
FROM '.USER_INFOS_TABLE.'
WHERE status IN (\'webmaster\', \'admin\')
;';
$admin_ids = query2array($query, null, 'user_id');
// we add all admin+webmaster users BUT the user herself
$password_protected_users = array_merge($password_protected_users, array_diff($admin_ids, array($user['id'])));
if (in_array($params['user_id'][0], $password_protected_users))
{
return new PwgError(403, 'Only webmasters can change password of other "webmaster/admin" users');
}
}
$updates[ $conf['user_fields']['password'] ] = $conf['password_hash']($params['password']);
}
}
@ -531,6 +552,11 @@ SELECT
array($conf['user_fields']['id'] => $params['user_id'][0])
);
if (isset($updates[ $conf['user_fields']['password'] ]))
{
deactivate_user_auth_keys($params['user_id'][0]);
}
if (isset($update_status) and count($params['user_id_for_status']) > 0)
{
$query = '

View file

@ -348,8 +348,12 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment)
pwg_query($query);
conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
conf_update_param('gallery_title', l10n('Just another Piwigo gallery'));
conf_update_param('page_banner', '<h1>%gallery_title%</h1>'."\n\n<p>".l10n('Welcome to my photo gallery').'</p>');
conf_update_param('gallery_title', pwg_db_real_escape_string(l10n('Just another Piwigo gallery')));
conf_update_param(
'page_banner',
'<h1>%gallery_title%</h1>'."\n\n<p>".pwg_db_real_escape_string(l10n('Welcome to my photo gallery')).'</p>'
);
// fill languages table
foreach ($languages->fs_languages as $language_code => $fs_language)

View file

@ -122,5 +122,5 @@ echo '</pre>';
ob_end_clean();
// now we upgrade from 2.7.0
// include_once(PHPWG_ROOT_PATH.'install/upgrade_2.7.0.php');
include_once(PHPWG_ROOT_PATH.'install/upgrade_2.7.0.php');
?>

126
install/upgrade_2.7.0.php Normal file
View file

@ -0,0 +1,126 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2016 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License 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. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die ('This page cannot be loaded directly, load upgrade.php');
}
else
{
if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
{
die ('Hacking attempt!');
}
}
// +-----------------------------------------------------------------------+
// | Fill upgrade table without applying upgrade |
// +-----------------------------------------------------------------------+
// retrieve already applied upgrades
$query = '
SELECT id
FROM '.PREFIX_TABLE.'upgrade
;';
$applied = array_from_query($query, 'id');
// retrieve existing upgrades
$existing = get_available_upgrade_ids();
// which upgrades need to be applied?
$to_apply = array_diff($existing, $applied);
$inserts = array();
foreach ($to_apply as $upgrade_id)
{
if ($upgrade_id >= 145) // TODO change on each release
{
break;
}
array_push(
$inserts,
array(
'id' => $upgrade_id,
'applied' => CURRENT_DATE,
'description' => '[migration from 2.7.0 to '.PHPWG_VERSION.'] not applied', // TODO change on each release
)
);
}
if (!empty($inserts))
{
mass_inserts(
'`'.UPGRADE_TABLE.'`',
array_keys($inserts[0]),
$inserts
);
}
// +-----------------------------------------------------------------------+
// | Perform upgrades |
// +-----------------------------------------------------------------------+
ob_start();
echo '<pre>';
for ($upgrade_id = 145; $upgrade_id <= 148; $upgrade_id++) // TODO change on each release
{
if (!file_exists(UPGRADES_PATH.'/'.$upgrade_id.'-database.php'))
{
continue;
}
// maybe the upgrade task has already been applied in a previous and
// incomplete upgrade
if (in_array($upgrade_id, $applied))
{
continue;
}
unset($upgrade_description);
echo "\n\n";
echo '=== upgrade '.$upgrade_id."\n";
// include & execute upgrade script. Each upgrade script must contain
// $upgrade_description variable which describe briefly what the upgrade
// script does.
$up_start = get_moment();
include(UPGRADES_PATH.'/'.$upgrade_id.'-database.php');
// notify upgrade (TODO change on each release)
$query = '
INSERT INTO `'.PREFIX_TABLE.'upgrade`
(id, applied, description)
VALUES
(\''.$upgrade_id.'\', NOW(), \'[migration from 2.7.0 to '.PHPWG_VERSION.', '.get_elapsed_time($up_start, get_moment()).'] '.$upgrade_description.'\')
;';
pwg_query($query);
}
echo '</pre>';
ob_end_clean();
// now we upgrade from 2.8.0
// include_once(PHPWG_ROOT_PATH.'install/upgrade_2.8.0.php');
?>

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Afrikaans [ZA]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=572
Author: Marius Loots and Mignon Smit
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: العربية (مصر) [EG]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=779
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: العربية [MA]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: العربية [AR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=412
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Azərbaycanca [AZ]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=618
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Български [BG]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=510
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: বাংলা[IN]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=657
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Brezhoneg [FR]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=698
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Català [CA]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=413
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -25,7 +25,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Česky [CZ]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=414
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Dansk [DK]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=415
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Deutsch [DE]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=416
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Dhivehi [MV]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=570
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Ελληνικά [GR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=508
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: English [GB]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=716
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: English [UK]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=417
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: English [US]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=717
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Esperanto [EO]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=596
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Argentina [AR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=418
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Español [ES]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=169
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: México [MX]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=726
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Estonian [EE]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=569
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Euskara [ES]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=725
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: پارسی [IR]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=419
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Finnish [FI]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=686
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Français [QC]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=420
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Français [FR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=421
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Gaeilge [IE]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=708
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Galego [ES]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=681
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: ગુજરાતી[IN]
Version: 2.6.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=767
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: עברית [IL]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=457
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Hrvatski [HR]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=422
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Magyar [HU]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=423
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Bahasa Indonesia [ID]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=707
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Íslenska [IS]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=518
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Italiano [IT]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=424
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: 日本語 [JP]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=425
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: ქართული [GE]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=426
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: ខ្មែរ [KH]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=579
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: ಕನ್ನಡ [IN]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=693
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: 한국어 [KR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=509
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: कोंकणी [IN]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=660
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Lëtzebuergesch [LU]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=715
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Lietuviu [LT]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=648
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Latviešu [LV]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=427
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Македонски [MK]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=428
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Монгол [MN]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=696
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Malay [MY]
Version: 2.5.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=645
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Norsk bokmål [NO]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=483
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Nederlands [NL]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=429
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Norwegian nynorsk [NO]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=689
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Polski [PL]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=430
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Brasil [BR]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=431
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Português [PT]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=432
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Română [RO]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=433
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Русский [RU]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=434
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Srpski [SR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=435
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -25,7 +25,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Slovensky [SK]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=452
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Slovenšcina [SI]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=453
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Српски [SR]
Version: 2.7.2
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=458
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Svenska [SE]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=451
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: தமிழ் [IN]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=638
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: ภาษาไทย [TH]
Version: 2.7.1
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=519
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Türkçe [TR]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=436
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Українська [UA]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=523
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Tiếng Việt [VN]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=437
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: Wolof [SN]
Version: 2.6.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=737
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: 简体中文 [CN]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=438
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: 中文 (香港) [HK]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=614
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -22,7 +22,7 @@
// +-----------------------------------------------------------------------+
/*
Language Name: 中文 (繁體) [TW]
Version: 2.7.0
Version: auto
Language URI: http://piwigo.org/ext/extension_view.php?eid=524
Author: Piwigo team
Author URI: http://piwigo.org

View file

@ -260,6 +260,8 @@ function reset_password()
array('user_id' => $user_id)
);
deactivate_user_auth_keys($user_id);
$page['infos'][] = l10n('Your password has been reset');
$page['infos'][] = '<a href="'.get_root_url().'identification.php">'.l10n('Login').'</a>';

View file

@ -207,6 +207,8 @@ function save_profile_from_post($userdata, &$errors)
$fields[] = $conf['user_fields']['password'];
// password is hashed with function $conf['password_hash']
$data{$conf['user_fields']['password']} = $conf['password_hash']($_POST['use_new_pwd']);
deactivate_user_auth_keys($userdata['id']);
}
// username is updated only if allowed

View file

@ -72,6 +72,11 @@ if (isset($_POST['submit']))
'mode' => $_POST['mode'],
'fields' => $_POST['fields'],
);
if (isset($_POST['search_in_tags']))
{
$search['fields']['search_in_tags'] = true;
}
}
if (isset($_POST['tags']))

View file

@ -1,7 +1,7 @@
<?php
/*
Theme Name: Sylvia
Version: 2.7.0
Version: auto
Description: Dark background, flora and pink decorations.
Theme URI: http://piwigo.org/ext/extension_view.php?eid=368
Author: Piwigo team

View file

@ -1,7 +1,7 @@
<?php
/*
Theme Name: clear
Version: 2.7.0
Version: auto
Description: White background, soft gray.
Theme URI: http://piwigo.org/ext/extension_view.php?eid=9
Author: Piwigo team

View file

@ -1,7 +1,7 @@
<?php
/*
Theme Name: dark
Version: 2.7.0
Version: auto
Description: Dark background, grayscale.
Theme URI: http://piwigo.org/ext/extension_view.php?eid=369
Author: Piwigo team

View file

@ -0,0 +1,189 @@
//
// piecon.js
//
// https://github.com/lipka/piecon
//
// Copyright (c) 2015 Lukas Lipka <lukaslipka@gmail.com>. All rights reserved.
//
(function(){
var Piecon = {};
var currentFavicon = null;
var originalFavicon = null;
var originalTitle = null;
var canvas = null;
var options = {};
var defaults = {
color: '#ff0084',
background: '#bbb',
shadow: '#fff',
fallback: false
};
var isRetina = window.devicePixelRatio > 1;
var ua = (function () {
var agent = navigator.userAgent.toLowerCase();
return function (browser) {
return agent.indexOf(browser) !== -1;
};
}());
var browser = {
ie: ua('msie'),
chrome: ua('chrome'),
webkit: ua('chrome') || ua('safari'),
safari: ua('safari') && !ua('chrome'),
mozilla: ua('mozilla') && !ua('chrome') && !ua('safari')
};
var getFaviconTag = function() {
var links = document.getElementsByTagName('link');
for (var i = 0, l = links.length; i < l; i++) {
if (links[i].getAttribute('rel') === 'icon' || links[i].getAttribute('rel') === 'shortcut icon') {
return links[i];
}
}
return false;
};
var removeFaviconTag = function() {
var links = Array.prototype.slice.call(document.getElementsByTagName('link'), 0);
var head = document.getElementsByTagName('head')[0];
for (var i = 0, l = links.length; i < l; i++) {
if (links[i].getAttribute('rel') === 'icon' || links[i].getAttribute('rel') === 'shortcut icon') {
head.removeChild(links[i]);
}
}
};
var setFaviconTag = function(url) {
removeFaviconTag();
var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'icon';
link.href = url;
document.getElementsByTagName('head')[0].appendChild(link);
};
var getCanvas = function () {
if (!canvas) {
canvas = document.createElement("canvas");
if (isRetina) {
canvas.width = 32;
canvas.height = 32;
} else {
canvas.width = 16;
canvas.height = 16;
}
}
return canvas;
};
var drawFavicon = function(percentage) {
var canvas = getCanvas();
var context = canvas.getContext("2d");
percentage = percentage || 0;
if (context) {
context.clearRect(0, 0, canvas.width, canvas.height);
// Draw shadow
context.beginPath();
context.moveTo(canvas.width / 2, canvas.height / 2);
context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2), 0, Math.PI * 2, false);
context.fillStyle = options.shadow;
context.fill();
// Draw background
context.beginPath();
context.moveTo(canvas.width / 2, canvas.height / 2);
context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2) - 2, 0, Math.PI * 2, false);
context.fillStyle = options.background;
context.fill();
// Draw pie
if (percentage > 0) {
context.beginPath();
context.moveTo(canvas.width / 2, canvas.height / 2);
context.arc(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2, canvas.height / 2) - 2, (-0.5) * Math.PI, (-0.5 + 2 * percentage / 100) * Math.PI, false);
context.lineTo(canvas.width / 2, canvas.height / 2);
context.fillStyle = options.color;
context.fill();
}
setFaviconTag(canvas.toDataURL());
}
};
var updateTitle = function(percentage) {
if (percentage > 0) {
document.title = '(' + percentage + '%) ' + originalTitle;
} else {
document.title = originalTitle;
}
};
Piecon.setOptions = function(custom) {
options = {};
for (var key in defaults){
options[key] = custom.hasOwnProperty(key) ? custom[key] : defaults[key];
}
return this;
};
Piecon.setProgress = function(percentage) {
if (!originalTitle) {
originalTitle = document.title;
}
if (!originalFavicon || !currentFavicon) {
var tag = getFaviconTag();
originalFavicon = currentFavicon = tag ? tag.getAttribute('href') : '/favicon.ico';
}
if (!isNaN(parseFloat(percentage)) && isFinite(percentage)) {
if (!getCanvas().getContext || browser.ie || browser.safari || options.fallback === true) {
// Fallback to updating the browser title if unsupported
return updateTitle(percentage);
} else if (options.fallback === 'force') {
updateTitle(percentage);
}
return drawFavicon(percentage);
}
return false;
};
Piecon.reset = function() {
if (originalTitle) {
document.title = originalTitle;
}
if (originalFavicon) {
currentFavicon = originalFavicon;
setFaviconTag(currentFavicon);
}
};
Piecon.setOptions(defaults);
if(typeof define === 'function' && define.amd) {
define(Piecon);
} else if (typeof module !== 'undefined') {
module.exports = Piecon;
} else {
window.Piecon = Piecon;
}
})();

View file

@ -1 +0,0 @@
!function(){var a={},b=null,c=null,d=null,e=null,f={},g={color:"#ff0084",background:"#bbb",shadow:"#fff",fallback:!1},h=window.devicePixelRatio>1,i=function(){var a=navigator.userAgent.toLowerCase();return function(b){return-1!==a.indexOf(b)}}(),j={ie:i("msie"),chrome:i("chrome"),webkit:i("chrome")||i("safari"),safari:i("safari")&&!i("chrome"),mozilla:i("mozilla")&&!i("chrome")&&!i("safari")},k=function(){for(var a=document.getElementsByTagName("link"),b=0,c=a.length;c>b;b++)if("icon"===a[b].getAttribute("rel")||"shortcut icon"===a[b].getAttribute("rel"))return a[b];return!1},l=function(){for(var a=document.getElementsByTagName("link"),b=document.getElementsByTagName("head")[0],c=0,d=a.length;d>c;c++)("icon"===a[c].getAttribute("rel")||"shortcut icon"===a[c].getAttribute("rel"))&&b.removeChild(a[c])},m=function(a){l();var b=document.createElement("link");b.type="image/x-icon",b.rel="icon",b.href=a,document.getElementsByTagName("head")[0].appendChild(b)},n=function(){return e||(e=document.createElement("canvas"),h?(e.width=32,e.height=32):(e.width=16,e.height=16)),e},o=function(a){var b=n(),c=b.getContext("2d");a=a||0,c&&(c.clearRect(0,0,b.width,b.height),c.beginPath(),c.moveTo(b.width/2,b.height/2),c.arc(b.width/2,b.height/2,Math.min(b.width/2,b.height/2),0,2*Math.PI,!1),c.fillStyle=f.shadow,c.fill(),c.beginPath(),c.moveTo(b.width/2,b.height/2),c.arc(b.width/2,b.height/2,Math.min(b.width/2,b.height/2)-2,0,2*Math.PI,!1),c.fillStyle=f.background,c.fill(),a>0&&(c.beginPath(),c.moveTo(b.width/2,b.height/2),c.arc(b.width/2,b.height/2,Math.min(b.width/2,b.height/2)-2,-.5*Math.PI,(-.5+2*a/100)*Math.PI,!1),c.lineTo(b.width/2,b.height/2),c.fillStyle=f.color,c.fill()),m(b.toDataURL()))},p=function(a){document.title=a>0?"("+a+"%) "+d:d};a.setOptions=function(a){f={};for(var b in g)f[b]=a.hasOwnProperty(b)?a[b]:g[b];return this},a.setProgress=function(a){if(d||(d=document.title),!c||!b){var e=k();c=b=e?e.getAttribute("href"):"/favicon.ico"}return!isNaN(parseFloat(a))&&isFinite(a)?!n().getContext||j.ie||j.safari||f.fallback===!0?p(a):("force"===f.fallback&&p(a),o(a)):!1},a.reset=function(){d&&(document.title=d),c&&(b=c,m(b))},a.setOptions(g),window.Piecon=a}();

View file

@ -1,10 +1,10 @@
<div class="navigationBar">
{if isset($navbar.URL_FIRST)}
<a href="{$navbar.URL_FIRST}" rel="first">{'First'|@translate}</a> |
<a href="{$navbar.URL_PREV}" rel="prev">{'Previous'|@translate}</a> |
<span class="navFirstLast"><a href="{$navbar.URL_FIRST}" rel="first">{'First'|@translate}</a> |</span>
<span class="navPrevNext"><a href="{$navbar.URL_PREV}" rel="prev">{'Previous'|@translate}</a> |</span>
{else}
{'First'|@translate} |
{'Previous'|@translate} |
<span class="navFirstLast">{'First'|@translate} |</span>
<span class="navPrevNext">{'Previous'|@translate} |</span>
{/if}
{assign var='prev_page' value=0}
@ -19,10 +19,10 @@
{/foreach}
{if isset($navbar.URL_NEXT)}
| <a href="{$navbar.URL_NEXT}" rel="next">{'Next'|@translate}</a>
| <a href="{$navbar.URL_LAST}" rel="last">{'Last'|@translate}</a>
<span class="navPrevNext">| <a href="{$navbar.URL_NEXT}" rel="next">{'Next'|@translate}</a></span>
<span class="navFirstLast">| <a href="{$navbar.URL_LAST}" rel="last">{'Last'|@translate}</a></span>
{else}
| {'Next'|@translate}
| {'Last'|@translate}
<span class="navPrevNext">| {'Next'|@translate}</span>
<span class="navFirstLast">| {'Last'|@translate}</span>
{/if}
</div>

Some files were not shown because too many files have changed in this diff Show more