diff options
Diffstat (limited to '')
-rw-r--r-- | admin/update.php | 4 | ||||
-rw-r--r-- | admin/waiting.php | 106 | ||||
-rw-r--r-- | template/default/admin/waiting.tpl | 41 | ||||
-rw-r--r-- | template/default/admin/waiting.vtp | 42 | ||||
-rw-r--r-- | template/default/upload.tpl | 197 | ||||
-rw-r--r-- | upload.php | 3 |
6 files changed, 191 insertions, 202 deletions
diff --git a/admin/update.php b/admin/update.php index 627af7812..42683f3cd 100644 --- a/admin/update.php +++ b/admin/update.php @@ -25,6 +25,10 @@ // | USA. | // +-----------------------------------------------------------------------+ +if( !defined("PHPWG_ROOT_PATH") ) +{ + die ("Hacking attempt!"); +} include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); define('CURRENT_DATE', "'".date('Y-m-d')."'"); diff --git a/admin/waiting.php b/admin/waiting.php index feda12754..ebced6120 100644 --- a/admin/waiting.php +++ b/admin/waiting.php @@ -24,14 +24,16 @@ // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | // | USA. | // +-----------------------------------------------------------------------+ -include_once( './admin/include/isadmin.inc.php' ); +if( !defined("PHPWG_ROOT_PATH") ) +{ + die ("Hacking attempt!"); +} +include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php'); //--------------------------------------------------------------------- updates if ( isset( $_POST['submit'] ) ) { - $query = 'SELECT id,storage_category_id,file,tn_ext'; - $query.= ' FROM '.PREFIX_TABLE.'waiting'; - $query.= " WHERE validated = 'false'"; - $query.= ';'; + $query = 'SELECT * FROM '.WAITING_TABLE; + $query.= " WHERE validated = 'false';"; $result = mysql_query( $query ); while ( $row = mysql_fetch_array( $result ) ) { @@ -42,7 +44,7 @@ if ( isset( $_POST['submit'] ) ) { // The uploaded element was validated, we have to set the // "validated" field to "true" - $query = 'UPDATE '.PREFIX_TABLE.'waiting'; + $query = 'UPDATE '.WAITING_TABLE; $query.= " SET validated = 'true'"; $query.= ' WHERE id = '.$row['id']; $query.= ';'; @@ -54,7 +56,7 @@ if ( isset( $_POST['submit'] ) ) { // The uploaded element was refused, we have to delete its reference // in the database and to delete the element as well. - $query = 'DELETE FROM '.PREFIX_TABLE.'waiting'; + $query = 'DELETE FROM '.WAITING_TABLE; $query.= ' WHERE id = '.$row['id']; $query.= ';'; mysql_query( $query ); @@ -66,29 +68,37 @@ if ( isset( $_POST['submit'] ) ) $thumbnail = $conf['prefix_thumbnail']; $thumbnail.= get_filename_wo_extension( $row['file'] ); $thumbnail.= '.'.$row['tn_ext']; - $url = '.'.$dir.'thumbnail/'.$thumbnail; + $url = PHPWG_ROOT_PATH.$dir.'thumbnail/'.$thumbnail; unlink( $url ); } } } } } + //----------------------------------------------------- template initialization -$sub = $vtp->Open( './template/'.$user['template'].'/admin/waiting.vtp' ); -$tpl = array( 'category','date','author','thumbnail','file','delete', - 'submit','waiting_update' ); -templatize_array( $tpl, 'lang', $sub ); +$template->set_filenames(array('waiting'=>'admin/waiting.tpl')); +$template->assign_vars(array( + 'L_WAITING_CONFIRMATION'=>$lang['waiting_update'], + 'L_AUTHOR'=>$lang['author'], + 'L_THUMBNAIL'=>$lang['thumbnail'], + 'L_DATE'=>$lang['date'], + 'L_FILE'=>$lang['file'], + 'L_CATEGORY'=>$lang['category'], + 'L_SUBMIT'=>$lang['submit'], + 'L_DELETE'=>$lang['delete'], + + 'F_ACTION'=>add_session_id(str_replace( '&', '&', $_SERVER['REQUEST_URI'] )) + )); + //-------------------------------------------------------- confirmation message -if ( isset( $_POST['submit'] ) ) +if (isset($_POST['submit'])) { - $vtp->addSession( $sub, 'confirmation' ); - $vtp->closeSession( $sub, 'confirmation' ); + $template->assign_block_vars('confirmation' ,array()); } //---------------------------------------------------------------- form display $cat_names = array(); -$query = 'SELECT id,storage_category_id,file,username,mail_address'; -$query.= ',date,tn_ext'; -$query.= ' FROM '.PREFIX_TABLE.'waiting'; +$query = 'SELECT * FROM '.WAITING_TABLE; $query.= " WHERE validated = 'false'"; $query.= ' ORDER BY storage_category_id'; $query.= ';'; @@ -96,57 +106,45 @@ $result = mysql_query( $query ); $i = 0; while ( $row = mysql_fetch_array( $result ) ) { - $vtp->addSession( $sub, 'picture' ); - $vtp->setVar( $sub, 'picture.id', $row['id'] ); - if ( $i++ % 2 == 0 ) - { - $vtp->setVar( $sub, 'picture.class', 'row2' ); - } if ( !isset( $cat_names[$row['storage_category_id']] ) ) { $cat = get_cat_info( $row['storage_category_id'] ); $cat_names[$row['storage_category_id']] = array(); $cat_names[$row['storage_category_id']]['dir'] = - '.'.get_complete_dir( $row['storage_category_id'] ); + PHPWG_ROOT_PATH.get_complete_dir( $row['storage_category_id'] ); $cat_names[$row['storage_category_id']]['display_name'] = get_cat_display_name( $cat['name'], ' > ', 'font-weight:bold;' ); } - // category name - $vtp->setVar( $sub, 'picture.cat_name', - $cat_names[$row['storage_category_id']]['display_name'] ); - // date displayed like this (in English ) : - // Sunday 15 June 2003 21:29 - $date = format_date( $row['date'], 'unix', true ); - $vtp->setVar( $sub, 'picture.date', $date ); - // file preview link - $url = $cat_names[$row['storage_category_id']]['dir'].$row['file']; - $vtp->setVar( $sub, 'picture.preview_url', $url ); - // file name - $vtp->setVar( $sub, 'picture.file', $row['file'] ); + $preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file']; + $class='row1'; + if ( $i++ % 2== 0 ) $class='row2'; + + $template->assign_block_vars('picture' ,array( + 'WAITING_CLASS'=>$class, + 'CATEGORY_IMG'=>$cat_names[$row['storage_category_id']]['display_name'], + 'ID_IMG'=>$row['id'], + 'DATE_IMG'=>format_date( $row['date'], 'unix', true ), + 'FILE_IMG'=>$row['file'], + 'PREVIEW_URL_IMG'=>$preview_url, + 'UPLOAD_EMAIL'=>$row['mail_address'], + 'UPLOAD_USERNAME'=>$row['username'] + )); + // is there an existing associated thumnail ? - if ( isset( $row['tn_ext'] ) and $row['tn_ext'] != '' ) + if ( !empty( $row['tn_ext'] )) { - $vtp->addSession( $sub, 'thumbnail' ); $thumbnail = $conf['prefix_thumbnail']; $thumbnail.= get_filename_wo_extension( $row['file'] ); $thumbnail.= '.'.$row['tn_ext']; - $url = $cat_names[$row['storage_category_id']]['dir']; + $url = $cat_names[$row['storage_category_id']]['dir']; $url.= 'thumbnail/'.$thumbnail; - $vtp->setVar( $sub, 'thumbnail.preview_url', $url ); - $vtp->setVar( $sub, 'thumbnail.file', $thumbnail ); - $vtp->closeSession( $sub, 'thumbnail' ); + + $template->assign_block_vars('picture.thumbnail' ,array( + 'PREVIEW_URL_TN_IMG'=>$url, + 'FILE_TN_IMG'=>$thumbnail + )); } - else - { - $vtp->addSession( $sub, 'no_thumbnail' ); - $vtp->closeSession( $sub, 'no_thumbnail' ); - } - // username and associated mail address - $vtp->setVar( $sub, 'picture.mail_address', $row['mail_address'] ); - $vtp->setVar( $sub, 'picture.username', $row['username'] ); - - $vtp->closeSession( $sub, 'picture' ); } //----------------------------------------------------------- sending html code -$vtp->Parse( $handle , 'sub', $sub ); +$template->assign_var_from_handle('ADMIN_CONTENT', 'waiting'); ?> diff --git a/template/default/admin/waiting.tpl b/template/default/admin/waiting.tpl new file mode 100644 index 000000000..ccdbfd5e7 --- /dev/null +++ b/template/default/admin/waiting.tpl @@ -0,0 +1,41 @@ +<form action="{F_ACTION}" method="post"> + <!-- BEGIN confirmation --> + <div class="info">{L_WAITING_CONFIRMATION}</div> + <!-- END confirmation --> + <table style="width:100%;" > + <tr class="throw"> + <th style="width:20%;">{L_CATEGORY}</th> + <th style="width:20%;">{L_DATE}</th> + <th style="width:20%;">{L_FILE}</th> + <th style="width:20%;">{L_THUMBNAIL}</th> + <th style="width:20%;">{L_AUTHOR}</th> + <th style="width:1px;"> </th> + </tr> + <!-- BEGIN picture --> + <tr> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;">{picture.CATEGORY_IMG}</td> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;">{picture.DATE_IMG}</td> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;"> + <a target="_blank" href="{picture.PREVIEW_URL_IMG}">{picture.FILE_IMG}</a> + </td> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;"> + <!-- BEGIN thumbnail --> + <a target="_blank" href="{picture.thumbnail.PREVIEW_URL_TN_IMG}">{picture.thumbnail.FILE_TN_IMG}</a> + <!-- END thumbnail --> + </td> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;"> + <a href="mailto:{picture.UPLOAD_EMAIL}">{picture.UPLOAD_USERNAME}</a> + </td> + <td class="{picture.WAITING_CLASS}" style="white-space:nowrap;"> + <input type="radio" name="validate-{picture.ID_IMG}" value="true" />{L_SUBMIT} + <input type="radio" name="validate-{picture.ID_IMG}" value="false" />{L_DELETE} + </td> + </tr> + <!-- END picture --> + <tr> + <td colspan="5" align="center"> + <input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" /> + </td> + </tr> + </table> +</form>
\ No newline at end of file diff --git a/template/default/admin/waiting.vtp b/template/default/admin/waiting.vtp deleted file mode 100644 index b04ab2cff..000000000 --- a/template/default/admin/waiting.vtp +++ /dev/null @@ -1,42 +0,0 @@ -<form action="{#action}" method="post"> - <!--VTP_confirmation--> - <div class="info">{#waiting_update}</div> - <!--/VTP_confirmation--> - <table style="width:100%;"> - <tr> - <th style="width:20%;">{#category}</th> - <th style="width:20%;">{#date}</th> - <th style="width:20%;">{#file}</th> - <th style="width:20%;">{#thumbnail}</th> - <th style="width:20%;">{#author}</th> - <th style="width:1px;"> </th> - </tr> - <!--VTP_picture--> - <tr> - <td class="{#class}" style="white-space:nowrap;">{#cat_name}</td> - <td class="{#class}" style="white-space:nowrap;">{#date}</td> - <td class="{#class}" style="white-space:nowrap;"> - <a target="_blank" href="{#preview_url}">{#file}</a> - </td> - <td class="{#class}" style="white-space:nowrap;"> - <!--VTP_thumbnail--> - <a target="_blank" href="{#preview_url}">{#file}</a> - <!--/VTP_thumbnail--> - <!--VTP_no_thumbnail--> - - <!--/VTP_no_thumbnail--> - </td> - <td class="{#class}" style="white-space:nowrap;"> - <a href="mailto:{#mail_address}">{#username}</a> - </td> - <td class="{#class}" style="white-space:nowrap;"> - <input type="radio" name="validate-{#id}" value="true" />{#submit} - <input type="radio" name="validate-{#id}" value="false" />{#delete} - </td> - </tr> - <!--/VTP_picture--> - <tr> - <td colspan="5" align="center"><input type="submit" name="submit" value="{#submit}" style="margin:5px;" /></td> - </tr> - </table> -</form>
\ No newline at end of file diff --git a/template/default/upload.tpl b/template/default/upload.tpl index e65714dce..b82537218 100644 --- a/template/default/upload.tpl +++ b/template/default/upload.tpl @@ -1,104 +1,93 @@ - <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>
\ No newline at end of file +<div class="titrePage">{L_TITLE}</div> +<!-- 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}" class="bouton" /> + </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 --> diff --git a/upload.php b/upload.php index eccdced6a..aa9dca431 100644 --- a/upload.php +++ b/upload.php @@ -260,9 +260,8 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) ) $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']; +$u_form = PHPWG_ROOT_PATH.'upload.php?cat='.$page['cat']; if ( isset( $page['waiting_id'] ) ) { $u_form.= '&waiting_id='.$page['waiting_id']; |