Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $root_path = './../';
- $gallery_path = './';
- define('PHPBB_ROOT_PATH', $root_path);
- define('IN_PHPBB', true);
- define('IN_GALLERY', true);
- $phpbb_root_path = PHPBB_ROOT_PATH;
- $phpEx = substr(strrchr(__FILE__, '.'), 1);
- include($root_path . 'common_site.php');
- $template->assign_vars(array(
- 'PAGE_TITLE' => 'Art Gallery - NintendoLand',
- 'BREADCRUMBS' => '» <a href="index.php">Art Gallery</a>',
- 'U_SUBMIT' => append_sid("{$gallery_path}index.$phpEx", 'mode=agreement'),
- 'U_BROWSE' => append_sid("{$gallery_path}index.$phpEx", 'mode=browse'),
- ));
- if($user->data['user_id'] == ANONYMOUS)
- {
- $template->assign_vars(array(
- 'NOT_ALLOWED' => true,
- ));
- }
- $submit = request_var('submit', '');
- $mode = request_var('mode', '');
- if($mode != '')
- {
- switch($mode)
- {
- case 'upload' :
- if($submit != '')
- {
- include( $root_path . 'includes/functions_posting.' . $phpEx );
- include( $root_path . 'includes/message_parser.' . $phpEx );
- include( $root_path . 'includes/mcp/mcp_queue.' . $phpEx );
- $aMimeAllowed = array(
- 'image/gif' => 0,
- 'image/jpeg' => 0,
- 'image/png' => 0,
- 'image/bmp' => 0,
- 'image/pjpeg' => 0
- );
- $sError = '';
- if(!in_array($aMimeAllowed, $_FILES['file']['type']))
- {
- $sError = 'File type '.$_FILES['file']['type'].' is not allowed.';
- }
- else
- {
- if($_FILES['file']['error'] == 0 )
- {
- // Reduce redundancy, use variables for same concatenations
- $sTarget= 'artwork/' . $_FILES['file']['name'];
- if(!file_exists($sTarget))
- {
- $template-> assign_vars(array(
- 'FNAME' => $_FILES['file']['name'],
- 'FTYPE'=> $_FILES['file']['type'],
- 'FSIZE'=> sprintf( '%.2f KiB', $_FILES['file']['size']/ 1024 ) // Always print 2 decimals
- ));
- if(!move_uploaded_file($_FILES['file']['tmp_name'], $sTarget))
- {
- $sError = 'Error moving file on server!';
- }
- else
- {
- }
- }
- else
- {
- $sError= $_FILES['file']['name'] . ' already exists.';
- }
- }
- else
- {
- $sError= 'Error: ' . $_FILES['file']['error'] . '<br />';
- }
- }
- }
- $template->assign_vars(array(
- 'IN_UPLOAD' => true,
- ));
- break;
- case 'browse' :
- break;
- case 'agreement' :
- $template->assign_vars(array(
- 'IN_AGREEMENT' => true,
- 'U_ART_SUBMISSION' => append_sid("{$gallery_path}index.$phpEx", 'mode=upload'),
- ));
- $sql = 'SELECT * FROM phpbb_gallery_types';
- $result = $db->sql_query($sql);
- while($row = $db->sql_fetchrow($result))
- {
- $template->assign_block_vars('types', array(
- 'S_TYPE_ID' => $row['type_id'],
- 'S_TYPE_NAME' => $row['type_name'],
- ));
- }
- $count = 1;
- $sql = 'SELECT * FROM phpbb_gallery_genres';
- $result = $db->sql_query($sql);
- while($row = $db->sql_fetchrow($result))
- {
- if($count % 2)
- {
- $template->assign_vars(array(
- 'IS_EVEN' => true,
- ));
- }
- else
- {
- $template->assign_vars(array(
- 'IS_ODD' => true,
- ));
- }
- $template->assign_block_vars('genres', array(
- 'S_GENRE_ID' => $row['genre_id'],
- 'S_GENRE_NAME' => $row['genre_name'],
- ));
- $count++;
- }
- break;
- default :
- $template->assign_vars(array(
- 'IN_DEFAULT' => true,
- ));
- break;
- }
- }
- else
- {
- $template->assign_vars(array(
- 'IN_DEFAULT' => true,
- ));
- $sql = "SELECT g.*, u.username, u.user_id
- FROM phpbb_gallery g
- JOIN " . USERS_TABLE . " u
- ON g.art_author = u.user_id";
- $result = $db->sql_query($sql);
- while($row = $db->sql_fetchrow($result))
- {
- $template->assign_block_vars('recent2', array(
- 'A_ID' => $row['art_id'],
- 'A_TITLE' => $row['art_title'],
- 'A_AUTHOR' => $row['username'],
- 'A_ART' => $row['art_filename'],
- 'A_DATE' => $user->format_date($row['art_time'], 'D M, Y'),
- ));
- }
- }
- /* ----------- End Mode ----------- */
- $template->set_filenames(array(
- 'body' => 'gallery/index.html'
- ));
- page_footer(false);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement