Esempio n. 1
0
//set details
if ($_POST['type'] == "subnets") {
    $tmp[] = "Share type: subnet";
    $tmp[] = $Subnets->transform_to_dotted($object->subnet) . "/{$object->mask}";
    $tmp[] = $object->description;
} else {
    $tmp[] = "Share type: IP address";
    $tmp[] = $Subnets->transform_to_dotted($object->ip_addr);
    $tmp[] = $object->description;
}
$share->details = implode("<br>", $tmp);
//set code and timeframe
@($share->code = md5(time()));
$share->validity = date("Y-m-d H:i:s", strtotime("+1 day"));
# set url for printing
$url = $Result->createURL() . create_link("temp_share", $share->code);
?>


<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-datetimepicker.min.css">
<script type="text/javascript" src="js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".datetimepicker").datetimepicker( { pickDate: true, pickTime: true } );
})
</script>


<!-- header -->
<div class="pHeader"><?php 
print _('Create new temporary access');
Esempio n. 2
0
# if not install fetch settings etc
if ($_GET['page'] != "install") {
    # database object
    $Database = new Database_PDO();
    # check if this is a new installation
    require 'functions/checks/check_db_install.php';
    # initialize objects
    $Result = new Result();
    $User = new User($Database);
    $Sections = new Sections($Database);
    $Subnets = new Subnets($Database);
    $Tools = new Tools($Database);
    $Addresses = new Addresses($Database);
    $Log = new Logging($Database);
    # reset url for base
    $url = $Result->createURL();
}
/** include proper subpage **/
if ($_GET['page'] == "install") {
    require "app/install/index.php";
} elseif ($_GET['page'] == "upgrade") {
    require "app/upgrade/index.php";
} elseif ($_GET['page'] == "login") {
    require "app/login/index.php";
} elseif ($_GET['page'] == "temp_share") {
    require "app/temp_share/index.php";
} elseif ($_GET['page'] == "request_ip") {
    require "app/login/index.php";
} else {
    # verify that user is logged in
    $User->check_user_session();
Esempio n. 3
0
$new_access = json_encode(array_merge($old_access, array_filter($new_access)));
# execute
if (!$Admin->object_modify("settings", "edit", "id", array("id" => 1, "tempAccess" => $new_access))) {
    $Result->show("danger", _("Temporary share create error"), true);
} else {
    $Result->show("success", _("Temporary share created"), false);
}
# send mail
if (strlen($_POST['email']) > 0) {
    # fetch mailer settings
    $mail_settings = $Admin->fetch_object("settingsMail", "id", 1);
    # initialize mailer
    $phpipam_mail = new phpipam_mail($User->settings, $mail_settings);
    $phpipam_mail->initialize_mailer();
    // generate url
    $url = $Result->createURL() . create_link("temp_share", $_POST['code']);
    // set subject
    $subject = "New ipam share created";
    // set html content
    $content[] = "<table style='margin-left:10px;margin-top:5px;width:auto;padding:0px;border-collapse:collapse;'>";
    $content[] = "<tr><td style='padding:5px;margin:0px;color:#333;font-size:16px;text-shadow:1px 1px 1px white;border-bottom:1px solid #eeeeee;'><font face='Helvetica, Verdana, Arial, sans-serif' style='font-size:16px;'>{$subject}</font></td></tr>";
    $content[] = "<tr><td colspan='2'>Hi, new share was created on " . $User->settings->siteTitle . ", available on following address:</td></tr>";
    $content[] = "<tr><td colspan='2'><a href='{$url}'><xmp>{$url}</xmp></a></td></tr>";
    $content[] = "<tr><td colsapn='2'><br>Details:<br>" . implode("<br>", $tmp) . "<br></td></tr>";
    $content[] = "<tr><td style='padding:5px;padding-left:15px;margin:0px;font-style:italic;padding-bottom:3px;text-align:right;color:#ccc;text-shadow:1px 1px 1px white;border-top:1px solid white;'><font face='Helvetica, Verdana, Arial, sans-serif' style='font-size:11px;'>Sent by user " . $User->user->real_name . " at " . date('Y/m/d H:i') . "</font></td></tr>";
    //set al content
    $content_plain[] = "{$subject}" . "\r\n------------------------------\r\n";
    $content_plain[] = "Hi, new share was created on " . $User->settings->siteTitle . ", available on following address:\r\n " . $url;
    $content_plain[] = "\r\nDetails: \r\n" . implode("\r\n", $tmp) . "\r\n";
    $content_plain[] = "\r\n\r\n" . _("Sent by user") . " " . $User->user->real_name . " at " . date('Y/m/d H:i');
    $content[] = "</table>";