mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 11:24:52 +00:00
Operation Cleanup Round 2 - Remove Custom Links. This should really be handled by a startpage of some sort
This commit is contained in:
@@ -153,13 +153,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="custom_links.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "custom_links.php") { echo "active"; } ?>">
|
|
||||||
<i class="nav-icon fas fa-link"></i>
|
|
||||||
<p>Custom Links</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="logs.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "logs.php") { echo "active"; } ?>">
|
<a href="logs.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "logs.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon far fa-eye"></i>
|
<i class="nav-icon far fa-eye"></i>
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
<div class="modal" id="addCustomLinkModal" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content bg-dark">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-link"></i> New Custom Link</h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
|
||||||
|
|
||||||
<div class="modal-body bg-white">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-link"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="name" placeholder="Name" required autofocus>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Icon</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="icon" placeholder="Icon">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>URL <strong class="text-danger">*</strong></label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text">https://</span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="url" placeholder="Enter URL here" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer bg-white">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="submit" name="add_custom_link" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<div class="modal" id="editCustomLinkModal<?php echo $custom_link_id; ?>" tabindex="-1">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content bg-dark">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fa fa-fw fa-link"></i> <?php echo $custom_link_name; ?></h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
|
||||||
<input type="hidden" name="custom_link_id" value="<?php echo $custom_link_id; ?>">
|
|
||||||
|
|
||||||
<div class="modal-body bg-white">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Name <strong class="text-danger">*</strong></label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-link"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="name" placeholder="Name" value="<?php echo $custom_link_name; ?>" required autofocus>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Icon</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="icon" placeholder="Icon" value="<?php echo $custom_link_icon; ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>URL <strong class="text-danger">*</strong></label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text">https://</span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="url" placeholder="Enter URL here" value="<?php echo $custom_link_url; ?>" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer bg-white">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="submit" name="edit_custom_link" class="btn btn-primary">Save</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
106
custom_links.php
106
custom_links.php
@@ -1,106 +0,0 @@
|
|||||||
<?php include("inc_all_admin.php");
|
|
||||||
|
|
||||||
if(!empty($_GET['sb'])){
|
|
||||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
|
||||||
}else{
|
|
||||||
$sb = "custom_link_name";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Rebuild URL
|
|
||||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM custom_links
|
|
||||||
WHERE custom_link_name LIKE '%$q%'
|
|
||||||
AND company_id = $session_company_id
|
|
||||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
|
||||||
);
|
|
||||||
|
|
||||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card card-dark">
|
|
||||||
<div class="card-header py-2">
|
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-link"></i> Custom Links</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCustomLinkModal"><i class="fas fa-fw fa-plus"></i> New</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form autocomplete="off">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-4 mb-2">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search custom links">
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<hr>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-borderless table-hover">
|
|
||||||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
|
||||||
<tr>
|
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=custom_link_name&o=<?php echo $disp; ?>">Name</a></th>
|
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=custom_link_url&o=<?php echo $disp; ?>">URL</a></th>
|
|
||||||
<th class="text-center">Action</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
|
||||||
$custom_link_id = $row['custom_link_id'];
|
|
||||||
$custom_link_name = $row['custom_link_name'];
|
|
||||||
$custom_link_icon = $row['custom_link_icon'];
|
|
||||||
if(empty($custom_link_icon)){
|
|
||||||
$custom_link_icon_display = "<i class='fa fa-fw fa-circle mr-2'></i>";
|
|
||||||
}else{
|
|
||||||
$custom_link_icon_display = "<i class='fa fa-fw fa-$custom_link_icon mr-2'></i>";
|
|
||||||
}
|
|
||||||
$custom_link_url = $row['custom_link_url'];
|
|
||||||
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editCustomLinkModal<?php echo $custom_link_id; ?>"><?php echo "$custom_link_icon_display $custom_link_name"; ?></a></td>
|
|
||||||
<td><?php echo $custom_link_url; ?><a href="//<?php echo $custom_link_url; ?>" target="_blank"><i class="fa fa-fw fa-link text-info"></i></a></td>
|
|
||||||
<td>
|
|
||||||
<div class="dropdown dropleft text-center">
|
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-ellipsis-h"></i>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editCustomLinkModal<?php echo $custom_link_id; ?>">Edit</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger" href="post.php?delete_custom_link=<?php echo $custom_link_id; ?>">Delete</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
include("custom_link_edit_modal.php");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<?php include("pagination.php"); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
include("custom_link_add_modal.php");
|
|
||||||
|
|
||||||
include("footer.php");
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -299,11 +299,19 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
|
|||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.6'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.6'");
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(CURRENT_DATABASE_VERSION == '0.1.6'){
|
if(CURRENT_DATABASE_VERSION == '0.1.6'){
|
||||||
// Insert queries here required to update to DB version 0.1.7
|
// Insert queries here required to update to DB version 0.1.7
|
||||||
|
//Remove custom links
|
||||||
|
mysqli_query($mysqli, "DROP TABLE custom_links");
|
||||||
|
// Then, update the database to the next sequential version
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.7'");
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(CURRENT_DATABASE_VERSION == '0.1.7'){
|
||||||
|
// Insert queries here required to update to DB version 0.1.8
|
||||||
|
|
||||||
// Then, update the database to the next sequential version
|
// Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.7'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.8'");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "0.1.6");
|
DEFINE("LATEST_DATABASE_VERSION", "0.1.7");
|
||||||
53
post.php
53
post.php
@@ -711,7 +711,6 @@ if(isset($_GET['delete_company'])){
|
|||||||
mysqli_query($mysqli,"DELETE FROM clients WHERE company_id = $company_id");
|
mysqli_query($mysqli,"DELETE FROM clients WHERE company_id = $company_id");
|
||||||
|
|
||||||
mysqli_query($mysqli,"DELETE FROM contacts WHERE company_id = $company_id");
|
mysqli_query($mysqli,"DELETE FROM contacts WHERE company_id = $company_id");
|
||||||
mysqli_query($mysqli,"DELETE FROM custom_links WHERE company_id = $company_id");
|
|
||||||
mysqli_query($mysqli,"DELETE FROM documents WHERE company_id = $company_id");
|
mysqli_query($mysqli,"DELETE FROM documents WHERE company_id = $company_id");
|
||||||
mysqli_query($mysqli,"DELETE FROM domains WHERE company_id = $company_id");
|
mysqli_query($mysqli,"DELETE FROM domains WHERE company_id = $company_id");
|
||||||
mysqli_query($mysqli,"DELETE FROM events WHERE company_id = $company_id");
|
mysqli_query($mysqli,"DELETE FROM events WHERE company_id = $company_id");
|
||||||
@@ -2286,58 +2285,6 @@ if(isset($_GET['delete_tax'])){
|
|||||||
|
|
||||||
//End Tax
|
//End Tax
|
||||||
|
|
||||||
//Custom Link
|
|
||||||
if(isset($_POST['add_custom_link'])){
|
|
||||||
|
|
||||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
|
||||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
|
||||||
$url = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['url'])));
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO custom_links SET custom_link_name = '$name', custom_link_icon = '$icon', custom_link_url = '$url', company_id = $session_company_id");
|
|
||||||
|
|
||||||
//Logging
|
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Create', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
|
||||||
|
|
||||||
$_SESSION['alert_message'] = "Custom link added";
|
|
||||||
|
|
||||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($_POST['edit_custom_link'])){
|
|
||||||
|
|
||||||
$custom_link_id = intval($_POST['custom_link_id']);
|
|
||||||
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
|
||||||
$icon = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['icon'])));
|
|
||||||
$url = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['url'])));
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE custom_links SET custom_link_name = '$name', custom_link_icon = '$icon', custom_link_url = '$url' WHERE custom_link_id = $custom_link_id AND company_id = $session_company_id");
|
|
||||||
|
|
||||||
//Logging
|
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Modify', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
|
||||||
|
|
||||||
$_SESSION['alert_message'] = "Custom link modified";
|
|
||||||
|
|
||||||
header("Location: custom_links.php");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($_GET['delete_custom_link'])){
|
|
||||||
$custom_link_id = intval($_GET['delete_custom_link']);
|
|
||||||
|
|
||||||
mysqli_query($mysqli,"DELETE FROM custom_links WHERE custom_link_id = $custom_link_id AND company_id = $session_company_id");
|
|
||||||
|
|
||||||
//Logging
|
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Delete', log_description = '$custom_link_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
|
||||||
|
|
||||||
$_SESSION['alert_message'] = "Custom link deleted";
|
|
||||||
$_SESSION['alert_type'] = "error";
|
|
||||||
|
|
||||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
|
||||||
|
|
||||||
}
|
|
||||||
//End Custom Link
|
|
||||||
|
|
||||||
if(isset($_GET['dismiss_notification'])){
|
if(isset($_GET['dismiss_notification'])){
|
||||||
|
|
||||||
$notification_id = intval($_GET['dismiss_notification']);
|
$notification_id = intval($_GET['dismiss_notification']);
|
||||||
|
|||||||
41
side_nav.php
41
side_nav.php
@@ -191,47 +191,6 @@
|
|||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM custom_links WHERE company_id = $session_company_id");
|
|
||||||
|
|
||||||
if(mysqli_num_rows($sql) > 0){
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<li class="nav-header mt-2">EXTERNAL LINKS</li>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM custom_links WHERE company_id = $session_company_id");
|
|
||||||
while($row = mysqli_fetch_array($sql)){
|
|
||||||
|
|
||||||
$custom_link_id = $row['custom_link_id'];
|
|
||||||
$custom_link_name = $row['custom_link_name'];
|
|
||||||
$custom_link_icon = $row['custom_link_icon'];
|
|
||||||
if(empty($custom_link_icon)){
|
|
||||||
$custom_link_icon_display = "far fa-circle";
|
|
||||||
}else{
|
|
||||||
$custom_link_icon_display = $custom_link_icon;
|
|
||||||
}
|
|
||||||
$custom_link_url = $row['custom_link_url'];
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="//<?php echo $custom_link_url; ?>" target="_blank" class="nav-link">
|
|
||||||
<i class="nav-icon fas fa-<?php echo $custom_link_icon_display; ?>"></i>
|
|
||||||
<p><?php echo $custom_link_name; ?></p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<!-- /.sidebar-menu -->
|
<!-- /.sidebar-menu -->
|
||||||
|
|||||||
Reference in New Issue
Block a user