Viewing file: index.php (15.83 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('app/core.php'); $post_path = "/var/www/media/uploads/";
if (!$_SESSION['active_user']) { header('location: login.php'); }
if($_POST) { $post_id = $_POST['postId']; $post_title = $_POST['postTitle']; $post_content = $_POST['postContent']; $post_date = $_POST['postDate']; $up_file = $_FILES['postFile']['tmp_name']; $status_id = $_POST['statusId']; //die(var_dump($_POST)); }
if($_FILES['postFile']['name']) { $file_name = $_FILES['postFile']['name']; } else { if($_POST['postExistingFile']) { $file_name = $_POST['postExistingFile']; } }
if($_GET) { if($_GET['page']) { set_page_status($_GET['page']); } if($_GET['del']) { $del_id = $_GET['del']; } if($_GET['delfile']) { $delfile_id = $_GET['delfile']; } }
if($del_id) // delete any upload files and remove post if del_id is set { $filename = get_upload_name($del_id); if($filename) $test = file_delete($post_path.$filename); post_drop($del_id, false); }
if($delfile_id) // delete any upload files and remove post filename if delfile_id is set { $filename = get_upload_name($delfile_id); if($filename) $test = file_delete($post_path.$filename); post_drop($delfile_id, true); }
if($up_file) //move and chmod uploaded file { $filetest1 = move_uploaded_file($up_file, $post_path.$file_name); $filetest2 = chmod($post_path.$file_name, 0755); }
if ($post_title && $post_content && $post_date) // check if user has created or edited a post. { if($post_id) { $postupdate = post_write($post_id, $post_title, $post_content, $post_date, $file_name); } else { $postupdate = post_write("", $post_title, $post_content, $post_date, $file_name); } if($postupdate) { //then maybe indicate success} } }
if ($_POST['statusTitle']) // check if user has created or edited the status. { if($status_id) { main_status_write($status_id, $_POST['statusTitle']); } else { main_status_write("", $_POST['statusTitle']); } }
if ($_POST['statusMsg']) // check if user has created or edited the status. { if($status_id) { msg_status_write($status_id, $_POST['statusMsg']); } else { msg_status_write("", $_POST['statusMsg']); } }
if ($_POST['aTitle']) // check if user has created or edited the status. { if($status_id) { multi_status_write($status_id, $_POST['aTitle'], $_POST['bTitle'], $_POST['cTitle'], $_POST['dTitle'], $_POST['aRadios'], $_POST['bRadios'], $_POST['cRadios'], $_POST['dRadios']); } else { multi_status_write("", $_POST['aTitle'], $_POST['bTitle'], $_POST['cTitle'], $_POST['dTitle'], $_POST['aRadios'], $_POST['bRadios'], $_POST['cRadios'], $_POST['dRadios']); } }
$nickname = $_SESSION['active_user']; $postdata = post_read_new(); $modalblock = post_modals(); $statusmain = status_modal("main"); $statusmulti = status_modal("multi"); $statusmsg = status_modal("msg"); $postmodaljs = post_modal_js(); $jsecho = js_echo(); $status = status_read();
if($status['page'] == 0) { $pbutton = '<div class="pull-right"><a class="btn btn-success btn-sm" href="index.php?page=on" ><span class="glyphicon glyphicon-off"></span> ENABLE</a></div>'; $pstat = "<span style='color: red;'>The page is currently disabled!</span>"; } else { $pbutton = '<div class="pull-right"><a class="btn btn-danger btn-sm" href="index.php?page=off" ><span class="glyphicon glyphicon-off"></span> DISABLE</a></div>'; $pstat = "The page is currently enabled!"; } ?>
<!DOCTYPE html> <html lang="en">
<head>
<meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content="">
<title>TriSUD Website Administration</title>
<!-- Bootstrap Core CSS --> <link href="css/bootstrap.css" rel="stylesheet">
<!-- Custom CSS --> <link href="css/main.css" rel="stylesheet"> <link href="css/datepicker.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <style type="text/css"> table { width: 100%; } th, td { padding-top: 5px; padding-bottom: 5px; padding-left: 15px; padding-right: 15px; } tr:nth-child(even) { background-color: #f2f2f2; } th { font-weight: bold; } </style> </head>
<!-- The #page-top ID is part of the scrolling feature - the data-spy and data-target are part of the built-in Bootstrap scrollspy function -->
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<!-- Navigation --> <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header page-scroll"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand page-scroll" href="index.php">TriSUD Website Administration</a> </div>
<!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <!-- Hidden li included to remove active class from about link when scrolled up past about section --> <li class="hidden"> <a class="page-scroll" href="#page-top"></a> </li>
</ul> <ul class="nav navbar-nav pull-right"> <li>
<a class="pull-right" href="logout.php">LOGOUT</a> <a class="pull-right" href="http://www.trisud.com" target="_blank">LAUNCH SITE</a> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container --> </nav>
<!-- Intro Section --> <section id="intro" class="intro-section"> <div class="container"> <div class="row"> <div class="col-lg-12"> <!-- Page Content --> <div class="container">
<div class="row"> <div class="col-lg-12"> <p class="lead pull-left">Welcome back, <?php echo $nickname;?>. </p> </div> </div> <div class="row"> <div class="col-sm-12 header"> <h1 class="page-header">Status </h1> </div> </div>
<div class="well"> <div class="row"> <div class="col-md-12"> <div class="col-md-2 status">Status Page</div> <div class="col-md-8 status"><span style="color: <?php echo $status['light'];?>;"><?php echo $pstat;?></span></div> <div class="col-md-2"> <?php echo $pbutton;?> </div> </div> </div> </div> <div class="well"> <div class="row" style="padding-bottom: 10px;"> <div class="col-md-12"> <div class="col-md-2 status pull-left"><?php echo $status['a'];?>:</div> <div class="status-go col-md-8"><?php echo $status['a-stat'];?></div> <div class="col-md-2"> <!--<div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editPostModal'.$row['id'].'"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div> --> </div> </div> </div>
<div class="row" style="padding-bottom: 10px;"> <div class="col-md-12"> <div class="col-md-2 status pull-left"><?php echo $status['b'];?>:</div> <div class="status-go col-md-8"><?php echo $status['b-stat'];?></div> <div class="col-md-2"> <!--<div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editPostModal'.$row['id'].'"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div>--> </div> </div> </div>
<div class="row" style="padding-bottom: 10px;"> <div class="col-md-12"> <div class="col-md-2 status pull-left"><?php echo $status['c'];?>:</div> <div class="status-go col-md-8"><?php echo $status['c-stat'];?></div> <div class="col-md-2"> <!--<div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editPostModal'.$row['id'].'"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div>--> </div> </div> </div>
<div class="row"> <div class="col-md-12"> <div class="col-md-2 status pull-left"><?php echo $status['d'];?>:</div> <div class="status-go col-md-8"><?php echo $status['d-stat'];?></div> <div class="col-md-2"> <div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editStatus3Modal"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div> </div> </div> </div> </div>
<div class="well"> <div class="row"> <div class="col-md-12"> <div class="col-md-2 status">Main Status Block:</div> <div class="col-md-8 status"><span style="color: <?php echo $status['light'];?>;"><?php echo $status['main'];?></span></div> <div class="col-md-2"> <div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editStatusModal"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div> </div> </div> </div> </div> <div class="well"> <div class="row"> <div class="col-md-12"> <div class="col-md-2 status">Status Message:</div> <div class="col-md-8 status"><span style="color: <?php echo $status['light'];?>;"><?php echo $status['msg'];?></span></div> <div class="col-md-2"> <div class="pull-right"><a class="btn btn-default btn-sm" href="#" data-toggle="modal" data-target="#editStatus2Modal"><span class="glyphicon glyphicon-pencil"></span> EDIT</a></div> </div> </div> </div> </div> </div> </div> </div>
<div class="row"> <div class="col-lg-12">
<div class="container"> <div class="row"> <div class="col-sm-12 header"> <h1 class="page-header">Notices </h1> <div class="header-controls"> <button data-toggle="modal" data-target="#newPostModal" class="btn btn-default btn-sm">NEW NOTICE</button> </div> </div> </div> <div class="row"> <?php echo $postdata; ?> </div> </div> </div> </div> </div> </section>
<!-- New Post Modal --> <div class="modal fade" id="newPostModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <h3 class="modal-title" id="lineModalLabel">New Post</h3> </div> <div class="modal-body">
<form enctype="multipart/form-data" method="POST" action=""> <div class="form-group"> <label for="postTitle">Post Title</label> <input type="text" class="form-control" id="postTitle" name="postTitle" placeholder="Post Title"> </div> <div class="form-group"> <label for="Post Content">Post Content</label> <textarea class="form-control" id="postContent" name="postContent" placeholder="Post Content"></textarea> </div> <div class="form-group"> <label for="postFile">Upload File</label> <input class="btn btn-default" style="font-size: 13px" type="file" id="postFile" name="postFile"> </div> <div class="form-group"> <label for="postDate">Date</label><br> <input type="datetime" id="postDate" name="postDate" data-provide="datepicker" value="<?php echo date('m/d/Y');?>"> </div>
</div> <div class="modal-footer"> <div class="btn-group btn-group-justified" role="group" aria-label="group button"> <div class="btn-group" role="group"> <button type="submit" class="btn btn-default" role="button">Save</button>
</form> </div> </div> </div> </div> </div> </div>
<!-- Edit Post Modal --> <?php echo $modalblock; ?>
<!-- Edit Status Main --> <?php echo $statusmain; ?>
<!-- Edit Status Multi --> <?php echo $statusmulti; ?>
<!-- Edit Status Msg --> <?php echo $statusmsg; ?>
<?php // js libs echo $jsecho; echo('<script>'); // jquery to manage modal windows echo $postmodaljs; echo('</script>');
?>
</body>
</html>
|