Upload button setup

TODO: add files to database
TODO: hash folder to stick files in
This commit is contained in:
botanic 2014-09-04 19:58:04 -07:00
parent 49370fb5a4
commit 460298c773
9 changed files with 2059 additions and 10 deletions

View file

@ -250,3 +250,4 @@ code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
code/web/public_php/config.php code/web/public_php/config.php
code/web/public_php/is_installed code/web/public_php/is_installed
code/web/public_php/ams/files

View file

@ -80,6 +80,9 @@ class Helpers {
$smarty -> assign( $key, $value); $smarty -> assign( $key, $value);
} }
$id = session_id();
$smarty -> assign( "sessionid", $id );
// smarty inheritance for loading the matching wrapper layout (with the matching menu bar) // smarty inheritance for loading the matching wrapper layout (with the matching menu bar)
if ( isset( $vars['permission'] ) && $vars['permission'] == 3 ) { if ( isset( $vars['permission'] ) && $vars['permission'] == 3 ) {
$inherited = "extends:layout_admin.tpl|"; $inherited = "extends:layout_admin.tpl|";

View file

@ -0,0 +1,37 @@
<?php
require( '../../config.php' );
require_once( $AMS_LIB . '/libinclude.php' );
$id = $_POST['PHPSESSID'];
session_id($id);
session_start();
global $FILE_STORAGE_PATH;
// Set permission
if ( isset( $_SESSION['ticket_user'] ) ) {
$return['permission'] = unserialize( $_SESSION['ticket_user'] ) -> getPermission();
} else {
// default permission
$return['permission'] = 0;
}
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
$ticket_id = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
$target_ticket = new Ticket();
$target_ticket->load_With_TId($ticket_id);
if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetFile = $FILE_STORAGE_PATH . $_FILES['Filedata']['name'];
$fileParts = pathinfo($_FILES['Filedata']['name']);
move_uploaded_file($tempFile,$targetFile);
}
}
}
?>

View file

@ -28,6 +28,7 @@ require( '../config.php' );
require_once( $AMS_LIB . '/libinclude.php' ); require_once( $AMS_LIB . '/libinclude.php' );
session_start(); session_start();
// Running Cron // Running Cron
if ( isset( $_GET["cron"] ) ) { if ( isset( $_GET["cron"] ) ) {
if ( $_GET["cron"] == "true" ) { if ( $_GET["cron"] == "true" ) {

View file

@ -0,0 +1,13 @@
$(document).ready(function () {
//other things to do on document ready, separated for ajax calls
docReady();
});
function docReady() {
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -22,12 +22,6 @@
<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet"> <link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">
<link href="css/charisma-app.css" rel="stylesheet"> <link href="css/charisma-app.css" rel="stylesheet">
<link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
<link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
<link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
<link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
<link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
<link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
<link href='css/jquery.noty.css' rel='stylesheet'> <link href='css/jquery.noty.css' rel='stylesheet'>
<link href='css/noty_theme_default.css' rel='stylesheet'> <link href='css/noty_theme_default.css' rel='stylesheet'>
<link href='css/elfinder.min.css' rel='stylesheet'> <link href='css/elfinder.min.css' rel='stylesheet'>
@ -36,6 +30,9 @@
<link href='css/uploadify.css' rel='stylesheet'> <link href='css/uploadify.css' rel='stylesheet'>
<link href='css/animate.min.css' rel='stylesheet'> <link href='css/animate.min.css' rel='stylesheet'>
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements --> <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@ -165,7 +162,7 @@
</footer> </footer>
{/if} {/if}
</div><!--/.fluid-container--> </div><!--/.fluid-container-->
</div>
<!-- external javascript <!-- external javascript
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
@ -304,7 +301,8 @@
<!-- <script src="js/charisma.js"></script> --> <!-- <script src="js/charisma.js"></script> -->
<!-- help script for page help --> <!-- help script for page help -->
<script src="js/help.js"></script> <script src="js/help.js"></script>
<!-- application script for Charisma demo -->
<script src="js/custom.js"></script>
</div>
</body> </body>
</html> </html>

View file

@ -112,6 +112,25 @@
{/if} {/if}
<input type="hidden" name="function" value="reply_on_ticket"> <input type="hidden" name="function" value="reply_on_ticket">
<input type="hidden" name="ticket_id" value="{$ticket_id}"> <input type="hidden" name="ticket_id" value="{$ticket_id}">
<h3>Upload Attachment</h3>
<input data-no-uniform="true" type="file" name="file_upload" id="file_upload">
{literal}
<script language='JavaScript'>
$(document).ready( function () {
$('#file_upload').uploadify({
'formData' : {'PHPSESSID': '{/literal}{$sessionid}{literal}'},
'auto' : true,
'multi' : true,
'method' : 'post',
'swf': 'misc/uploadify.swf',
'uploader': 'func/upload.php?id='+{/literal}{$ticket_id}{literal}
});
});
</script>
{/literal}
<div class="control-group"> <div class="control-group">
<label class="control-label"></label> <label class="control-label"></label>
<div class="controls"> <div class="controls">