Template migration
git-svn-id: http://piwigo.org/svn/trunk@369 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
d339037b1e
commit
60b84a9db5
13 changed files with 208 additions and 247 deletions
|
@ -33,7 +33,7 @@ include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
|||
// Start output of page
|
||||
//
|
||||
$title= $lang['about_page_title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames(array('about'=>'about.tpl'));
|
||||
initialize_template();
|
||||
|
@ -47,5 +47,5 @@ $template->assign_vars(array(
|
|||
);
|
||||
|
||||
$template->pparse('about');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -115,7 +115,7 @@ $page['structure'] = update_structure( $page['structure'] );
|
|||
// Start output of page
|
||||
//
|
||||
$title = $page['title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames( array('category'=>'category.tpl') );
|
||||
initialize_template();
|
||||
|
@ -482,5 +482,5 @@ pwg_log( 'category', $page['title'] );
|
|||
mysql_close();
|
||||
|
||||
$template->pparse('category');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -42,7 +42,7 @@ $array_cat_site_id = array();
|
|||
// Start output of page
|
||||
//
|
||||
$title= $lang['title_comments'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames( array('comments'=>'comments.tpl') );
|
||||
initialize_template();
|
||||
|
@ -167,5 +167,5 @@ while ( $row = mysql_fetch_array( $result ) )
|
|||
}
|
||||
//----------------------------------------------------------- html code display
|
||||
$template->pparse('comments');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -57,7 +57,7 @@ if ( isset( $_POST['login'] ) )
|
|||
// Start output of page
|
||||
//
|
||||
$title = $lang['ident_page_title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames( array('identification'=>'identification.tpl') );
|
||||
initialize_template();
|
||||
|
@ -95,5 +95,5 @@ if ( $conf['access'] == 'free' )
|
|||
}
|
||||
//----------------------------------------------------------- html code display
|
||||
$template->pparse('identification');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -273,7 +273,6 @@ $lang['infoimage_keyword_separation'] = '(separate with coma ",")';
|
|||
$lang['infoimage_addtoall'] = 'add to all';
|
||||
$lang['infoimage_removefromall'] = 'remove from all';
|
||||
$lang['infoimage_associate'] = 'Associate to the category';
|
||||
$lang['update_wrong_dirname'] = 'The name of directories and files must be composed of letters, figures, "-", "_" or "."';
|
||||
$lang['stats_pages_seen'] = 'pages seen';
|
||||
$lang['stats_visitors'] = 'guests';
|
||||
$lang['stats_empty'] = 'empty history';
|
||||
|
|
|
@ -232,5 +232,6 @@ $lang['title_comments'] = 'Users comments';
|
|||
$lang['stats_last_days'] = 'last days';
|
||||
$lang['hint_comments'] = 'See last users comments';
|
||||
$lang['menu_login'] = 'login';
|
||||
$lang['update_wrong_dirname'] = 'The name of directories and files must be composed of letters, figures, "-", "_" or "."';
|
||||
|
||||
?>
|
|
@ -232,7 +232,7 @@ else
|
|||
$picture_size = get_picture_size( $original_width, $original_height,
|
||||
$user['maxwidth'], $user['maxheight'] );
|
||||
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
$template->set_filenames(array('picture'=>'picture.tpl'));
|
||||
initialize_template();
|
||||
|
||||
|
@ -584,5 +584,5 @@ pwg_log( 'picture', $title_img, $picture['current']['file'] );
|
|||
mysql_close();
|
||||
|
||||
$template->pparse('picture');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
26
profile.php
26
profile.php
|
@ -131,7 +131,7 @@ if ( isset( $_POST['submit'] ) )
|
|||
// Start output of page
|
||||
//
|
||||
$title = $lang['customize_page_title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames(array('profile'=>'profile.tpl'));
|
||||
initialize_template();
|
||||
|
@ -223,29 +223,7 @@ $template->assign_block_vars('radio',array(
|
|||
'F_OPTIONS'=>make_radio('show_nb_comments', array(true=>$lang['yes'], false=>$lang['no']), $user['show_nb_comments'], true)
|
||||
));
|
||||
|
||||
//--------------------------------------------------------------- create cookie
|
||||
if ( $conf['authorize_cookies'] )
|
||||
{
|
||||
$vtp->addSession( $handle, 'cookie' );
|
||||
$options = array(
|
||||
array( 'message' => '1 '.$lang['customize_day'],
|
||||
'value' => time() + 24*60*60 ),
|
||||
array( 'message' => '1 '.$lang['customize_week'],
|
||||
'value' => time() + 7*24*60*60 ),
|
||||
array( 'message' => '1 '.$lang['customize_month'],
|
||||
'value' => time() + 30*24*60*60 ),
|
||||
array( 'message' => '1 '.$lang['customize_year'],
|
||||
'value' => time() + 365*24*60*60 )
|
||||
);
|
||||
foreach ( $options as $option ) {
|
||||
$vtp->addSession( $handle, 'expiration_option' );
|
||||
$vtp->setVar( $handle, 'expiration_option.option', $option['message'] );
|
||||
$vtp->setVar( $handle, 'expiration_option.value', $option['value'] );
|
||||
$vtp->closeSession( $handle, 'expiration_option' );
|
||||
}
|
||||
$vtp->closeSession( $handle, 'cookie' );
|
||||
}
|
||||
//----------------------------------------------------------- html code display
|
||||
$template->pparse('profile');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -59,7 +59,7 @@ $email = empty($_POST['login'])?$_POST['login']:'';
|
|||
// Start output of page
|
||||
//
|
||||
$title= $lang['register_page_title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames( array('register'=>'register.tpl') );
|
||||
initialize_template();
|
||||
|
@ -89,5 +89,5 @@ if ( sizeof( $errors ) != 0 )
|
|||
}
|
||||
|
||||
$template->pparse('register');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
|
@ -66,7 +66,7 @@ if ( isset( $_POST['search'] ) )
|
|||
// Start output of page
|
||||
//
|
||||
$title= $lang['search_title'];
|
||||
include('include/page_header.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
|
||||
$template->set_filenames( array('search'=>'search.tpl') );
|
||||
initialize_template();
|
||||
|
@ -100,5 +100,5 @@ if ( sizeof( $error ) != 0 )
|
|||
pwg_log( 'search', $title );
|
||||
mysql_close();
|
||||
$template->pparse('search');
|
||||
include('include/page_tail.php');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
104
template/default/upload.tpl
Normal file
104
template/default/upload.tpl
Normal file
|
@ -0,0 +1,104 @@
|
|||
<table style="width:100%;height:100%">
|
||||
<tr align="center" valign="middle">
|
||||
<td>
|
||||
{T_START}1px{T_BEGIN}
|
||||
<div class="titrePage">{L_TITLE}</div>
|
||||
{T_END}
|
||||
<div style="margin-bottom:5px;"> </div>
|
||||
{T_START}50%{T_BEGIN}
|
||||
<!-- BEGIN upload_not_successful -->
|
||||
<form enctype="multipart/form-data" method="post" action="{F_ACTION}">
|
||||
<table style="width:80%;margin-left:auto;margin-right:auto;">
|
||||
<!-- BEGIN errors -->
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!-- BEGIN error -->
|
||||
<li>{upload_not_successful.errors.error.ERROR}</li>
|
||||
<!-- END error -->
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END errors -->
|
||||
<tr>
|
||||
<td colspan="2" class="menu">
|
||||
<div style="text-align:center;">{ADVISE_TITLE}</div>
|
||||
<ul>
|
||||
<!-- BEGIN advise -->
|
||||
<li>{upload_not_successful.advise.ADVISE}</li>
|
||||
<!-- END advise -->
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center" style="padding:10px;">
|
||||
<input name="picture" type="file" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- BEGIN fields -->
|
||||
<!-- username -->
|
||||
<tr>
|
||||
<td class="menu">{L_USERNAME} <span style="color:red;">*</span></td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="username" type="text" value="{NAME}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- mail address -->
|
||||
<tr>
|
||||
<td class="menu">{L_EMAIL} <span style="color:red;">*</span></td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="mail_address" type="text" value="{EMAIL}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- name of the picture -->
|
||||
<tr>
|
||||
<td class="menu">{L_NAME_IMG}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="name" type="text" value="{NAME_IMG}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- author -->
|
||||
<tr>
|
||||
<td class="menu">{L_AUTHOR}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="author" type="text" value="{AUTHOR_IMG}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- date of creation -->
|
||||
<tr>
|
||||
<td class="menu">{L_CREATION_DATE}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="date_creation" type="text" value="{DATE_IMG}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- comment -->
|
||||
<tr>
|
||||
<td class="menu">{L_COMMENT}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<textarea name="comment" rows="3" cols="40" style="overflow:auto">{COMMENT_IMG}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END fields -->
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<input name="submit" type="submit" value="{L_SUBMIT}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!-- END upload_not_successful -->
|
||||
<!-- BEGIN upload_successful -->
|
||||
{L_UPLOAD_DONE}<br />
|
||||
<!-- END upload_successful -->
|
||||
<div style="text-align:center;">
|
||||
<a href="{U_RETURN}">[ {L_RETURN} ]</a>
|
||||
</div>
|
||||
<!-- BEGIN note -->
|
||||
<div style="text-align:left;"><span style="color:red;">*</span> : {L_MANDATORY}</div>
|
||||
<!-- END note -->
|
||||
{T_END}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -1,104 +0,0 @@
|
|||
<table style="width:100%;height:100%">
|
||||
<tr align="center" valign="middle">
|
||||
<td>
|
||||
{#frame_start}1px{#frame_begin}
|
||||
<div class="titrePage">{#upload_title}</div>
|
||||
{#frame_end}
|
||||
<div style="margin-bottom:5px;"> </div>
|
||||
{#frame_start}50%{#frame_begin}
|
||||
<!--VTP_upload_not_successful-->
|
||||
<form enctype="multipart/form-data" method="post" action="{#form_action}">
|
||||
<table style="width:80%;margin-left:auto;margin-right:auto;">
|
||||
<!--VTP_errors-->
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="errors">
|
||||
<ul>
|
||||
<!--VTP_li-->
|
||||
<li>{#li}</li>
|
||||
<!--/VTP_li-->
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!--/VTP_errors-->
|
||||
<tr>
|
||||
<td colspan="2" class="menu">
|
||||
<div style="text-align:center;">{#advise_title}</div>
|
||||
<ul>
|
||||
<!--VTP_advise-->
|
||||
<li>{#content}</li>
|
||||
<!--/VTP_advise-->
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center" style="padding:10px;">
|
||||
<input name="picture" type="file" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<!--VTP_fields-->
|
||||
<!-- username -->
|
||||
<tr>
|
||||
<td class="menu">{#upload_username} <span style="color:red;">*</span></td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="username" type="text" value="{#username}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- mail address -->
|
||||
<tr>
|
||||
<td class="menu">{#mail_address} <span style="color:red;">*</span></td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="mail_address" type="text" value="{#user_mail_address}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- name of the picture -->
|
||||
<tr>
|
||||
<td class="menu">{#upload_name}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="name" type="text" value="{#name}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- author -->
|
||||
<tr>
|
||||
<td class="menu">{#upload_author}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="author" type="text" value="{#author}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- date of creation -->
|
||||
<tr>
|
||||
<td class="menu">{#upload_creation_date}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<input name="date_creation" type="text" value="{#date_creation}" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- comment -->
|
||||
<tr>
|
||||
<td class="menu">{#upload_comment}</td>
|
||||
<td align="center" style="padding:10px;">
|
||||
<textarea name="comment" rows="3" cols="40" style="overflow:auto">{#comment}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<!--/VTP_fields-->
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<input name="submit" type="submit" value="{#submit}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<!--/VTP_upload_not_successful-->
|
||||
<!--VTP_upload_successful-->
|
||||
{#upload_successful}<br />
|
||||
<!--/VTP_upload_successful-->
|
||||
<div style="text-align:center;">
|
||||
<a href="{#return_url}">[ {#search_return_main_page} ]</a>
|
||||
</div>
|
||||
<!--VTP_note-->
|
||||
<div style="text-align:left;"><span style="color:red;">*</span> : {#mandatory}</div>
|
||||
<!--/VTP_note-->
|
||||
{#frame_end}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
191
upload.php
191
upload.php
|
@ -132,20 +132,6 @@ if ( $page['cat_site_id'] != 1
|
|||
exit();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------- template initialization
|
||||
//
|
||||
// Start output of page
|
||||
//
|
||||
$title= $lang['upload_title'];
|
||||
include('include/page_header.php');
|
||||
$handle = $vtp->Open( './template/'.$user['template'].'/upload.vtp' );
|
||||
initialize_template();
|
||||
|
||||
$tpl = array( 'upload_title', 'upload_username', 'mail_address', 'submit',
|
||||
'upload_successful', 'search_return_main_page','upload_author',
|
||||
'upload_name','upload_creation_date','upload_comment',
|
||||
'mandatory' );
|
||||
templatize_array( $tpl, 'lang', $handle );
|
||||
|
||||
$error = array();
|
||||
$page['upload_successful'] = false;
|
||||
|
@ -163,7 +149,7 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
|
|||
array_push( $error, $lang['upload_file_exists'] );
|
||||
}
|
||||
// test de la présence des champs obligatoires
|
||||
if ( $_FILES['picture']['name'] == '' )
|
||||
if ( empty($_FILES['picture']['name']))
|
||||
{
|
||||
array_push( $error, $lang['upload_filenotfound'] );
|
||||
}
|
||||
|
@ -172,13 +158,13 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
|
|||
{
|
||||
array_push( $error, $lang['reg_err_mail_address'] );
|
||||
}
|
||||
if ( $_POST['username'] == '' )
|
||||
if ( empty($_POST['username']) )
|
||||
{
|
||||
array_push( $error, $lang['upload_err_username'] );
|
||||
}
|
||||
|
||||
$date_creation = '';
|
||||
if ( $_POST['date_creation'] != '' )
|
||||
if ( !empty($_POST['date_creation']) )
|
||||
{
|
||||
list( $day,$month,$year ) = explode( '/', $_POST['date_creation'] );
|
||||
// int checkdate ( int month, int day, int year)
|
||||
|
@ -205,9 +191,6 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
|
|||
|
||||
if ( !preg_match( '/^[a-zA-Z0-9-_.]+$/', $_FILES['picture']['name'] ) )
|
||||
{
|
||||
// reload language file with administration labels
|
||||
$isadmin = true;
|
||||
include( './language/'.$user['language'].'.php' );
|
||||
array_push( $error, $lang['update_wrong_dirname'] );
|
||||
}
|
||||
|
||||
|
@ -224,7 +207,7 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
|
|||
|
||||
if ( sizeof( $error ) == 0 )
|
||||
{
|
||||
$query = 'insert into '.PREFIX_TABLE.'waiting';
|
||||
$query = 'insert into '.WAITING_TABLE;
|
||||
$query.= ' (storage_category_id,file,username,mail_address,date,infos)';
|
||||
$query.= ' values ';
|
||||
$query.= '('.$page['cat'].",'".$_FILES['picture']['name']."'";
|
||||
|
@ -240,12 +223,13 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------ thumbnail upload
|
||||
if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
|
||||
{
|
||||
// upload of the thumbnail
|
||||
$query = 'select file';
|
||||
$query.= ' from '.PREFIX_TABLE.'waiting';
|
||||
$query.= ' from '.WAITING_TABLE;
|
||||
$query.= ' where id = '.$_GET['waiting_id'];
|
||||
$query.= ';';
|
||||
$result= mysql_query( $query );
|
||||
|
@ -263,7 +247,7 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
|
|||
}
|
||||
if ( sizeof( $error ) == 0 )
|
||||
{
|
||||
$query = 'update '.PREFIX_TABLE.'waiting';
|
||||
$query = 'update '.WAITING_TABLE;
|
||||
$query.= " set tn_ext = '".$extension."'";
|
||||
$query.= ' where id = '.$_GET['waiting_id'];
|
||||
$query.= ';';
|
||||
|
@ -272,129 +256,128 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Start output of page
|
||||
//
|
||||
$title= $lang['upload_title'];
|
||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||
$template->set_filenames(array('upload'=>'upload.tpl'));
|
||||
initialize_template();
|
||||
|
||||
$u_form = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
|
||||
if ( isset( $page['waiting_id'] ) )
|
||||
{
|
||||
$u_form.= '&waiting_id='.$page['waiting_id'];
|
||||
}
|
||||
|
||||
if ( isset( $page['waiting_id'] ) )
|
||||
{
|
||||
$advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$advise_title = $lang['upload_advise'];
|
||||
$advise_title.= get_cat_display_name( $page['cat_name'], ' - ', 'font-style:italic;' );
|
||||
}
|
||||
|
||||
$username = !empty($_POST['username'])?$_POST['username']:$user['username'];
|
||||
$mail_address = !empty($_POST['mail_address'])?$_POST['mail_address']:$user['mail_address'];
|
||||
$name = !empty($_POST['name'])?$_POST['name']:'';
|
||||
$author = !empty($_POST['author'])?$_POST['author']:'';
|
||||
$date_creation = !empty($_POST['date_creation'])?$_POST['date_creation']:'';
|
||||
$comment = !empty($_POST['comment'])?$_POST['comment']:'';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ADVISE_TITLE' => $advise_title,
|
||||
'NAME' => $username,
|
||||
'EMAIL' => $mail_address,
|
||||
'NAME_IMG' => $name,
|
||||
'AUTHOR_IMG' => $author,
|
||||
'DATE_IMG' => $date_creation,
|
||||
'COMMENT_IMG' => $comment,
|
||||
|
||||
'L_TITLE' => $lang['upload_title'],
|
||||
'L_USERNAME' => $lang['upload_username'],
|
||||
'L_EMAIL' => $lang['mail_address'],
|
||||
'L_NAME_IMG' => $lang['upload_name'],
|
||||
'L_SUBMIT' => $lang['submit'],
|
||||
'L_AUTHOR' => $lang['upload_author'],
|
||||
'L_CREATION_DATE' => $lang['upload_creation_date'],
|
||||
'L_COMMENT' => $lang['upload_comment'],
|
||||
'L_RETURN' => $lang['search_return_main_page'],
|
||||
'L_UPLOAD_DONE' => $lang['upload_successful'],
|
||||
'L_MANDATORY' => $lang['mandatory'],
|
||||
|
||||
'F_ACTION' => add_session_id( $u_form ),
|
||||
|
||||
'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'])
|
||||
));
|
||||
|
||||
if ( !$page['upload_successful'] )
|
||||
{
|
||||
$vtp->addSession( $handle, 'upload_not_successful' );
|
||||
$template->assign_block_vars('upload_not_successful',array());
|
||||
//-------------------------------------------------------------- errors display
|
||||
if ( sizeof( $error ) != 0 )
|
||||
if ( sizeof( $error ) != 0 )
|
||||
{
|
||||
$template->assign_block_vars('upload_not_successful.errors',array());
|
||||
for ( $i = 0; $i < sizeof( $error ); $i++ )
|
||||
{
|
||||
$vtp->addSession( $handle, 'errors' );
|
||||
for ( $i = 0; $i < sizeof( $error ); $i++ )
|
||||
{
|
||||
$vtp->addSession( $handle, 'li' );
|
||||
$vtp->setVar( $handle, 'li.li', $error[$i] );
|
||||
$vtp->closeSession( $handle, 'li' );
|
||||
}
|
||||
$vtp->closeSession( $handle, 'errors' );
|
||||
$template->assign_block_vars('upload_not_successful.errors.error',array('ERROR'=>$error[$i]));
|
||||
}
|
||||
//----------------------------------------------------------------- form action
|
||||
$url = './upload.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
|
||||
if ( isset( $page['waiting_id'] ) )
|
||||
{
|
||||
$url.= '&waiting_id='.$page['waiting_id'];
|
||||
}
|
||||
$vtp->setGlobalVar( $handle, 'form_action', add_session_id( $url ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------- advises
|
||||
if ( $conf['upload_maxfilesize'] != '' )
|
||||
if ( !empty($conf['upload_maxfilesize']) )
|
||||
{
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_filesize'];
|
||||
$content.= $conf['upload_maxfilesize'].' KB';
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
|
||||
}
|
||||
|
||||
if ( isset( $page['waiting_id'] ) )
|
||||
{
|
||||
$advise_title=$lang['upload_advise_thumbnail'].$_FILES['picture']['name'];
|
||||
$vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
|
||||
|
||||
if ( $conf['upload_maxwidth_thumbnail'] != '' )
|
||||
{
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_width'];
|
||||
$content = $lang['upload_advise_width'];
|
||||
$content.= $conf['upload_maxwidth_thumbnail'].' px';
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
|
||||
}
|
||||
if ( $conf['upload_maxheight_thumbnail'] != '' )
|
||||
{
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_height'];
|
||||
$content.= $conf['upload_maxheight_thumbnail'].' px';
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$advise_title = $lang['upload_advise'];
|
||||
$advise_title.= get_cat_display_name( $page['cat_name'], ' - ',
|
||||
'font-style:italic;' );
|
||||
$vtp->setGlobalVar( $handle, 'advise_title', $advise_title );
|
||||
|
||||
if ( $conf['upload_maxwidth'] != '' )
|
||||
{
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_width'];
|
||||
$content.= $conf['upload_maxwidth'].' px';
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
|
||||
}
|
||||
if ( $conf['upload_maxheight'] != '' )
|
||||
{
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_height'];
|
||||
$content.= $conf['upload_maxheight'].' px';
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$content));
|
||||
}
|
||||
}
|
||||
$vtp->addSession( $handle, 'advise' );
|
||||
$content = $lang['upload_advise_filetype'];
|
||||
$vtp->setVar( $handle, 'advise.content', $content );
|
||||
$vtp->closeSession( $handle, 'advise' );
|
||||
$template->assign_block_vars('upload_not_successful.advise',array('ADVISE'=>$lang['upload_advise_filetype']));
|
||||
|
||||
//----------------------------------------- optionnal username and mail address
|
||||
if ( !isset( $page['waiting_id'] ) )
|
||||
{
|
||||
$vtp->addSession( $handle, 'fields' );
|
||||
// username
|
||||
if ( isset( $_POST['username'] ) ) $username = $_POST['username'];
|
||||
else $username = $user['username'];
|
||||
$vtp->setVar( $handle, 'fields.username', $username );
|
||||
// mail address
|
||||
if ( isset( $_POST['mail_address'] ) )$mail_address=$_POST['mail_address'];
|
||||
else $mail_address=$user['mail_address'];
|
||||
$vtp->setGlobalVar( $handle, 'user_mail_address',$user['mail_address'] );
|
||||
// name of the picture
|
||||
if (isset($_POST['name']))
|
||||
$vtp->setVar( $handle, 'fields.name', $_POST['name'] );
|
||||
// author
|
||||
if (isset($_POST['author']))
|
||||
$vtp->setVar( $handle, 'fields.author', $_POST['author'] );
|
||||
// date of creation
|
||||
if (isset($_POST['date_creation']))
|
||||
$vtp->setVar( $handle, 'fields.date_creation', $_POST['date_creation'] );
|
||||
// comment
|
||||
if (isset($_POST['comment']))
|
||||
$vtp->setVar( $handle, 'fields.comment', $_POST['comment'] );
|
||||
|
||||
$vtp->closeSession( $handle, 'fields' );
|
||||
|
||||
$vtp->addSession( $handle, 'note' );
|
||||
$vtp->closeSession( $handle, 'note' );
|
||||
$template->assign_block_vars('upload_not_successful.fields',array());
|
||||
$template->assign_block_vars('note',array());
|
||||
}
|
||||
$vtp->closeSession( $handle, 'upload_not_successful' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$vtp->addSession( $handle, 'upload_successful' );
|
||||
$vtp->closeSession( $handle, 'upload_successful' );
|
||||
$template->assign_block_vars('upload_successful',array());
|
||||
}
|
||||
//----------------------------------------------------- return to main page url
|
||||
$url = './category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
|
||||
$vtp->setGlobalVar( $handle, 'return_url', add_session_id( $url ) );
|
||||
//----------------------------------------------------------- html code display
|
||||
$code = $vtp->Display( $handle, 0 );
|
||||
echo $code;
|
||||
include('include/page_tail.php');
|
||||
$template->pparse('upload');
|
||||
include(PHPWG_ROOT_PATH.'include/page_tail.php');
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue