Ejemplo n.º 1
0
function envoyer_message($destinataire, $texte)
{
    //var globales
    global $table_conversations, $id;
    $binome = new Binome($destinataire);
    $conversation = null;
    //recherche de conversation courante
    $sql = "SELECT * FROM " . $table_conversations . " WHERE user1 = '" . $binome->nom1 . "' AND user2 = '" . $binome->nom2 . "' AND session_1 = '" . $binome->session1 . "' AND session_2 = '" . $binome->session2 . "';";
    $resultat = mysql_query($sql);
    if (!$resultat || mysql_num_rows($resultat) == 0) {
        //on cree une nouvelle conversation
        $conversation = create_conversation($destinataire);
    } else {
        $conversation = mysql_result($resultat, 0, 'id_conversation');
    }
    echo "envoi";
    //nouveau message
    create_message($conversation, $destinataire, $id, $texte);
}
Ejemplo n.º 2
0
        ?>
" class="fa <?php 
        echo $link->getIconClass();
        ?>
"></i>
					<h4><?php 
        echo $link->getName();
        ?>
</h4>
				</a>
			</div>

		<?php 
    }
} else {
    create_message('info', 'No links exist.', true);
}
?>
	</div>

	<div class="row webex-host-links">
		<div class="col-lg-12">
			<h1>WebEx</h1>

			<a class="btn btn-lg btn-primary" href="https://venturamfg.webex.com/mw0401lsp12/mywebex/login/login.do?siteurl=venturamfg&login_return_url=%2Fmc0901lsp12%2Fmeetingcenter%2Fframe%2Fexpandurl.do%3Fsiteurl%3Dventuramfg">Host a Meeting</a>
			<a class="btn btn-lg btn-primary" href="<?php 
echo $options['site_url'];
?>
/conferencerooms.php">Join a Meeting</a>
		</div>
	</div>
Ejemplo n.º 3
0
        //echo '<br><br><br>' . $query . '<br>';
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM users WHERE id = " . $row['requesterid'];
        $result = $mysqli->query($query);
        $row2 = $result->fetch_assoc();
        $query = "SELECT * FROM achievementList WHERE id = " . $row['achievementid'];
        $result = $mysqli->query($query);
        $temprow = $result->fetch_assoc();
        $row2['name'] = $temprow['name'];
        $row2['level'] = $level;
        $row2['comment'] = $row['comment'];
        if (trim($row2['comment']) == '') {
            $row2['comment'] = 'No comment entered';
        }
        email_message('Achievement ' . $row2['name'] . ' Denied', $row2['onid'] . '@oregonstate.edu', create_message('./emails/deny.eml', $row2));
        echo '<h3><BR><BR>All Done!</h3><a href="./home.php">Go Back</a>';
        exit;
    } else {
        //Should generate an email someone is poking around
        echo '';
    }
}
if (isset($_REQUEST['reviewhash'])) {
    $hash = mysqli_real_escape_string($mysqli, $_REQUEST['reviewhash']);
    if ($userrow['userlevel'] > 2) {
        echo "<div class='row'><div style='padding-top:5em;' class='col-sm-8 col-sm-offset-2'><h3>About to process hash: {$hash}</h3></div></div>";
        $query = "SELECT * FROM requests WHERE hash = '{$hash}'";
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM users WHERE id = " . $row['requesterid'];
Ejemplo n.º 4
0
if (isset($group)) {
    $groups = $DB->GetAll("SELECT * FROM customergroups WHERE name='{$group}'");
    if (count($groups) != 1) {
        echo "Grupa {$group} nie istnieje!\n";
        exit(0);
    }
    echo "Wysyłanie powiadomień do grupy '{$group}' [" . $groups[0]['id'] . "]\n";
    $customers = $DB->GetALL("SELECT * FROM customerassignments WHERE customergroupid=" . $groups[0]['id']);
    foreach ($customers as $customer) {
        $name = $LMS->GetCustomerName($customer['customerid']);
        printf("%4d: %s\n", $customer['customerid'], $name);
    }
} else {
    $customers = $DB->GetAll('SELECT * FROM customers WHERE status=3 and deleted=0');
    if (count($customers) and !$test) {
        $msgid = create_message($tmpl['name'], $tmpl['message']);
    }
    $razem = 0;
    $ilosc = 0;
    $tresc = '';
    foreach ($customers as $customer) {
        $id = $customer['id'];
        $balance = $LMS->GetCustomerBalance($id);
        $covenant = 0;
        $oplata = 0;
        $assignments = $LMS->GetCustomerAssignments($id, true);
        #if ($customer['id']==2) print_r($assignments);
        if (is_array($assignments)) {
            foreach ($assignments as $assignment) {
                if ($assignment['liabilityid']) {
                    #print $assignment['period']."\n";
Ejemplo n.º 5
0
            $row['doc_number'] = docnumber($row['number'], $row['template'] ? $row['template'] : '%N/LMS/%Y', $row['cdate']);
            $recipient_mail = $debug_email ? $debug_email : $row['email'];
            if (!$quiet) {
                printf("[deadline] %s (%04d) %s: %s\n", $row['name'], $row['id'], $row['doc_number'], $recipient_mail);
            }
            if (!$debug) {
                send_message($msgid, $row['id'], $recipient_mail, $row['name'], $deadline_subject, parse_data($deadline_message, $row), $host, $port, $user, $pass, $auth);
            }
        }
    }
}
// Debit notes created up to 24 hours ago
if ($notes_message && (empty($types) || in_array('notes', $types))) {
    $documents = $DB->GetAll("SELECT d.id AS docid, c.id, c.pin, d.name,\n\t\td.number, n.template, d.cdate, c.email,\n\t\tCOALESCE(ca.balance, 0) AS balance, v.value\n\t\tFROM documents d\n\t\tJOIN customers c ON (c.id = d.customerid)\n\t\tJOIN (SELECT SUM(value) * -1 AS value, docid\n\t\t\tFROM cash\n\t\t\tGROUP BY docid\n\t\t) v ON (v.docid = d.id)\n\t\tLEFT JOIN numberplans n ON (d.numberplanid = n.id)\n\t\tLEFT JOIN (SELECT SUM(value) AS balance, customerid\n\t\t\tFROM cash\n\t\t\tGROUP BY customerid\n\t\t) ca ON (ca.customerid = d.customerid)\n\t\tWHERE c.email <> '' AND d.type = 5\n\t\t\tAND d.cdate > ?NOW? - 86400");
    if (!empty($documents)) {
        if (!$debug) {
            $msgid = create_message($notes_subject, $notes_message);
        }
        foreach ($documents as $row) {
            $row['doc_number'] = docnumber($row['number'], $row['template'] ? $row['template'] : '%N/LMS/%Y', $row['cdate']);
            $recipient_mail = $debug_email ? $debug_email : $row['email'];
            if (!$quiet) {
                printf("[new debit note] %s (%04d) %s: %s\n", $row['name'], $row['id'], $row['doc_number'], $recipient_mail);
            }
            if (!$debug) {
                send_message($msgid, $row['id'], $recipient_mail, $row['name'], $notes_subject, parse_data($notes_message, $row), $host, $port, $user, $pass, $auth);
            }
        }
    }
}
$DB->Destroy();
Ejemplo n.º 6
0
	
	<div class="container">
			
		<form action="login.php" method="POST" role="form">
			<legend>Login</legend>
		
			<div class="form-group">
				<label for="">Username</label>
				<input type="text" class="form-control" name="username">
			</div>

			<div class="form-group">
				<label for="">Password</label>
				<input type="password" class="form-control" name="password">
			</div>
		
			<button type="submit" class="btn btn-primary">Submit</button>
		</form>

		<?php 
if (isset($message)) {
    create_message($message);
}
?>

	</div>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>
Ejemplo n.º 7
0
            } else {
                $message = create_message(FALSE, "updating user profile");
            }
        } else {
            $message = create_message(FALSE, "updating user profile, no user specified");
        }
        break;
    case 'user_update_password':
        $user_id = $_POST['user_id'];
        $user_name = ace_user_get_display_name_by_id($user_id);
        $user_password = $_POST['password'];
        if ($user_password != '') {
            $success = ace_user_update_password($user_id, $user_password);
            $message = create_message($success, "updating user password for {$user_name}");
        } else {
            $message = create_message(FALSE, "updating user password");
        }
        break;
}
if (isset($message)) {
    $messages[] = $message;
}
unset($message);
switch ($_POST['display']) {
    default:
        $user = ace_user_get_info($_SESSION['user_id']);
        $element = '
                    <p align="center"><strong>Profile</strong></p>';
        $element_column[] = $element;
        $element = '
					<form name="user_profile_form" action="' . _USER_URL_ . '" method="post">
			<?php 
if (is_single()) {
    ?>
			
				<?php 
    $division_id = get_var('id');
    $division = $division_id ? Division::getDivision($division_id) : false;
    $division_name = $division ? $division->getName() : '';
    ?>
				
				<?php 
    if (get_var('action') != 'add' && !$division) {
        ?>
				
					<?php 
        create_message('danger', 'Division does not exist!', true);
        ?>
					
				<?php 
    } else {
        ?>
				
					<form class="form-horizontal" method="post" action="<?php 
        echo get_page_url();
        ?>
">
						<div class="form-group">
							<label class="col-sm-3 control-label" for="name">Division Name</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" id="name" name="division_name" value="<?php 
        echo $division_name;
Ejemplo n.º 9
0
    }
    return 1;
}
//First Queries
$iduser = $_SESSION['id_usuario'];
$sql2 = 'SELECT COUNT(*) FROM tmensajes WHERE id_usuario_destino="' . $iduser . '" AND estado="FALSE";';
$resultado2 = mysql_query($sql2);
$row2 = mysql_fetch_array($resultado2);
$sql3 = 'SELECT * FROM tgrupo';
$resultado3 = mysql_query($sql3);
if (isset($_GET["nuevo_mensaje"])) {
    // Create message
    $usuario_destino = get_parameter("u_destino");
    $subject = get_parameter("subject");
    $mensaje = get_parameter("mensaje");
    create_message($iduser, $usuario_destino, $subject, $mensaje);
}
if (isset($_GET["nuevo_mensaje_g"])) {
    // Create message to groups
    $grupo_destino = get_parameter("g_destino");
    $subject = get_parameter("subject");
    $mensaje = get_parameter("mensaje");
    $sql = 'SELECT id_usuario FROM tusuario_perfil WHERE id_grupo =' . $grupo_destino;
    $result = mysql_query($sql);
    if (mysql_fetch_row($result)) {
        while ($row = mysql_fetch_array($result)) {
            $error = create_message_g($iduser, $row["id_usuario"], $subject, $mensaje);
        }
        if ($error == 0) {
            echo "<h3 class='suc'>" . __('Message successfully sended') . "</h3>";
        } else {
Ejemplo n.º 10
0
 * Initialize and configure PHPMailer
 */
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = $options['email_host'];
$mail->Port = $options['email_port'];
$mail->From = $options['email_from'];
$mail->FromName = $options['email_from_name'];
$mail->SMTPAuth = false;
$mail->Username = $options['email_username'];
$mail->Password = $options['email_password'];
/**
 * Initialize EOS
*/
$eos = new jlawrence\eos\Parser();
/**
 * User Login Management
 */
$usr = new UserLogin();
if (isset($_POST['login'])) {
    $login_result = $usr->login($_POST['user_name'], $_POST['user_password']);
    if (!$login_result) {
        create_message('danger', 'The login information you provided was incorrect. Please try again.');
    } else {
        redirect(get_page_url());
    }
}
if (isset($_POST['logout'])) {
    $usr->logout();
    redirect(get_page_url());
}
Ejemplo n.º 11
0
									</td>
								</tr>			
	
							<?php 
        }
        ?>
							
						</tbody>
					</table>
							
				<?php 
    } else {
        ?>
	
					<?php 
        create_message('info', 'No users have been created yet.', true);
        ?>
		
				<?php 
    }
    ?>
			
			<?php 
}
?>
			
		</div>
	
	</div>

<?php 
Ejemplo n.º 12
0
            $requestid = $mysqli->insert_id;
            //Email the requester with information
            $query = "SELECT * FROM achievementList WHERE id = {$achievement}";
            $result = $mysqli->query($query);
            $row = $result->fetch_assoc();
            $userrow['name'] = $row['name'];
            $userrow['level'] = $level;
            email_message('Achievement Request', $userrow['onid'] . '@oregonstate.edu', create_message('./emails/request.eml', $userrow));
            //Identify reviewers
            $query = "SELECT DISTINCT users.* FROM users INNER JOIN achievements ON achievements.userid = users.id INNER JOIN levels ON levels.id = achievements.levelid WHERE achievements.achievementid = {$achievement} AND levels.level >= {$level} GROUP BY users.id LIMIT 5";
            //echo $query . '<BR>';
            $result = $mysqli->query($query);
            while ($row = $result->fetch_assoc()) {
                //echo 'Emailing: ' . $row['username'] . '<BR>';
                $userrow['reviewername'] = $row['username'];
                if (email_message('Achievement Review Request', $row['onid'] . '@oregonstate.edu', create_message('./emails/committee.eml', $userrow)) == 0) {
                    // It worked
                    $query = "INSERT INTO reviews (requestid, reviewer, emaileddate) VALUES ({$requestid}, " . $row['id'] . ", NOW())";
                    $mysqli->query($query);
                }
            }
        }
    }
}
if (isset($_REQUEST['btn-give'])) {
    $achievement = mysqli_real_escape_string($mysqli, $_REQUEST['giveachievement']);
    $level = mysqli_real_escape_string($mysqli, $_REQUEST['givelevel']);
    $employeeid = mysqli_real_escape_string($mysqli, $_REQUEST['employee']);
    addachievement($mysqli, $achievement, $level, $employeeid);
}
if (isset($_REQUEST['btn-endorse'])) {
Ejemplo n.º 13
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include_once '../phpfunctions.php';
include_once '../dbconnect.php';
if (isset($_REQUEST['room'])) {
    if ($_REQUEST['room'] != 0) {
        // For all users, currently in room, send email.
        $query = "SELECT clock.*, users.onid, users.firstname, rooms.name FROM `clock` INNER JOIN `users` ON clock.userid = users.id INNER JOIN `rooms` ON rooms.id = clock.roomid WHERE `timeout` = '0000-00-00 00:00:00'";
        $result = $mysqli->query($query);
        //echo $query . '<BR>';
        while ($row = $result->fetch_assoc()) {
            email_message('Test Message', $row['onid'] . '@oregonstate.edu', create_message('../emails/inroom.eml', $row));
        }
        echo '<h1> SUCCESS </h1>';
    }
}
Ejemplo n.º 14
0
    case 'vm_revert_to_snapshot':
        if (isset($_POST['vm_id'], $_POST['vm_snapshot_instance'])) {
            $vm_display_name = ace_vm_get_display_name_by_id($_POST['vm_id']);
            $success = ace_vm_snapshot_revert($_POST['vm_id'], $_POST['vm_snapshot_instance']);
            $message = create_message($success, "reverting to snapshot of {$vm_display_name}");
        } else {
            $message = create_message(FALSE, "reverting to snapshot, no snapshot specified");
        }
        break;
    case 'vm_delete_a_snapshot':
        if (isset($_POST['vm_id'], $_POST['vm_snapshot_instance'])) {
            $vm_display_name = ace_vm_get_display_name_by_id($_POST['vm_id']);
            $success = ace_vm_snapshot_delete($_POST['vm_id'], $_POST['vm_snapshot_instance']);
            $message = create_message($success, "deleting snapshot from {$vm_display_name}");
        } else {
            $message = create_message(FALSE, "deleting snapshot, no snapshot specified");
        }
}
if (isset($message)) {
    $messages[] = $message;
}
unset($message);
# END COMMAND PROCESSING
# BEGIN PAGE DATA
$nonce = rand();
$lab_age_display = '';
$lab_age_maximum = '';
$lab_state = FALSE;
$lab_is_published = FALSE;
if (isset($lab_id) && $lab_id != 'null' && $lab_id != NULL) {
    $valid_lab_selected = TRUE;
Ejemplo n.º 15
0
function addachievement($mysqli, $achievement, $level, $id)
{
    $empRes = $mysqli->query("SELECT achievements.*, levels.level FROM achievements INNER JOIN levels ON levels.id = achievements.levelid WHERE userid='{$id}'");
    //echo $query .'<BR>';
    $empAch = array();
    while ($empRow = $empRes->fetch_array(MYSQLI_ASSOC)) {
        $empAch[] = $empRow;
    }
    $done = false;
    foreach ($empAch as $row) {
        if ($row['achievementid'] == $achievement) {
            //Already has at least one level
            if ($level == $row['level']) {
                // Already have this exact level
                echo "<script>alert('Already has this achievement at this level.');</script>";
                $done = true;
            } else {
                if ($level < $row['level']) {
                    echo "<script>alert('Already has this achievement at a higher level. Adding this anyways.');</script>";
                    $done = false;
                } else {
                    $done = false;
                }
            }
        }
    }
    if ($done == false) {
        // We need to add this to
        $query = "SELECT * FROM levels WHERE achievementid = {$achievement} AND level = {$level}";
        $levelRes = $mysqli->query($query);
        //echo $query . '<BR>';
        $levelRow = $levelRes->fetch_array(MYSQLI_ASSOC);
        $query = "INSERT INTO `achievements` (achievementid, levelid, userid) VALUES ({$achievement}, " . $levelRow['id'] . ", {$id})";
        //echo $query . '<BR>';
        $mysqli->query($query);
        //Need to send confirmation email here
        $query = "SELECT * FROM users WHERE id = {$id}";
        $result = $mysqli->query($query);
        $row = $result->fetch_assoc();
        $query = "SELECT * FROM achievementList WHERE id = {$achievement}";
        $result = $mysqli->query($query);
        $temprow = $result->fetch_assoc();
        $row['name'] = $temprow['name'];
        $row['level'] = $level;
        email_message('Achievement ' . $row['name'] . ' Approved', $row['onid'] . '@oregonstate.edu', create_message('./emails/approved.eml', $row));
    }
}
Ejemplo n.º 16
0
    $link_id = get_var('id');
    $link = $link_id ? Link::getLink($link_id) : false;
    $link_name = $link ? $link->getName() : '';
    $link_description = $link ? $link->getDescription() : '';
    $link_url = $link ? $link->getURL() : '';
    $link_bg_color = $link ? $link->getBGColor() : '';
    $link_order = $link ? $link->getOrder() : '';
    $link_icon_class = $link ? $link->getIconClass() : '';
    ?>

				<?php 
    if (get_var('action') != 'add' && !$link) {
        ?>

					<?php 
        create_message('danger', 'Link does not exist!', true);
        ?>

				<?php 
    } else {
        ?>

					<form class="form-horizontal" method="post" action="<?php 
        echo get_page_url();
        ?>
">
						<div class="form-group">
							<label class="col-sm-3 control-label" for="name">Link Name</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" id="name" name="link_name" value="<?php 
        echo $link_name;
Ejemplo n.º 17
0
    $cell = $cell_id ? Cell::getCell($cell_id) : false;
    $cell_name = $cell ? $cell->getName() : '';
    $cell_number = $cell ? $cell->getNumber() : '';
    $app_division_id = $cell ? $cell->getDivisionID() : '';
    $app_location_id = $cell ? $cell->getLocationID() : '';
    $cell_iq_connector = $cell ? $cell->getIQConnector() : '';
    $cell_status = $cell ? $cell->getStatus() : '';
    $cell_order = $cell ? $cell->getOrder() : '';
    ?>

				<?php 
    if (get_var('action') != 'add' && !$cell) {
        ?>

					<?php 
        create_message('danger', 'Cell does not exist!', true);
        ?>

				<?php 
    } else {
        ?>

					<form class="form-horizontal" method="post" action="<?php 
        echo get_page_url();
        ?>
">
						<div class="form-group">
							<label class="col-sm-3 control-label" for="name">Cell Name</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" id="name" name="cell_name" value="<?php 
        echo $cell_name;
Ejemplo n.º 18
0
    $location_id = get_var('id');
    $location = $location_id ? Location::getLocation($location_id) : false;
    $location_name = $location ? $location->getName() : '';
    $location_country = $location ? $location->getCountry() : '';
    $location_state = $location ? $location->getState() : '';
    $location_city = $location ? $location->getCity() : '';
    $location_street = $location ? $location->getStreet() : '';
    $location_zip = $location ? $location->getZip() : '';
    ?>
				
				<?php 
    if (get_var('action') != 'add' && !$location) {
        ?>
				
					<?php 
        create_message('danger', 'Location does not exist!', true);
        ?>
					
				<?php 
    } else {
        ?>
				
					<form class="form-horizontal" method="post" action="<?php 
        echo get_page_url();
        ?>
">
						<div class="form-group">
							<label class="col-sm-3 control-label" for="name">Location Name</label>
							<div class="col-sm-9">
								<input class="form-control" type="text" id="name" name="location_name" value="<?php 
        echo $location_name;
Ejemplo n.º 19
0
$app = new App();
$app->name = 'Base';
$app->version = '1.0.0';
$app->prefix = 'apps';
$app->url = $options['site_url'];
$template = new Template($options, $app);
$template->parent_page = 'admin';
####################################################################
// Check if user is logged in and is admin
if (!$usr->isLoggedIn()) {
    $template->page_title = 'Login';
    load_template('login');
} else {
    if (!User::getUser($usr->getID())->isAdmin()) {
        $template->page_title = 'Error';
        create_message('danger', 'You do not have permission to view this page.');
        load_template('error');
    } else {
        // Build subnav
        $template->subnav = array('area' => array('dashboard' => array('title' => 'Dashboard', 'url' => $options['site_url'] . '/admin.php', 'template' => 'dashboard'), 'locations' => array('title' => 'Locations', 'url' => $options['site_url'] . '/admin.php?area=locations', 'template' => 'location'), 'divisions' => array('title' => 'Divisions', 'url' => $options['site_url'] . '/admin.php?area=divisions', 'template' => 'division'), 'cells' => array('title' => 'Cells', 'url' => $options['site_url'] . '/admin.php?area=cells', 'template' => 'cell'), 'links' => array('title' => 'Links', 'url' => $options['site_url'] . '/admin.php?area=links', 'template' => 'link'), 'roles' => array('title' => 'Roles', 'url' => $options['site_url'] . '/admin.php?area=roles', 'template' => 'role'), 'users' => array('title' => 'Users', 'url' => $options['site_url'] . '/admin.php?area=users', 'template' => 'user')));
        // Get request vars
        $id = get_var('id');
        $area = get_var('area');
        $action = get_var('action');
        if ($area) {
            switch ($area) {
                case 'locations':
                    if ($action == 'add') {
                        $template->page_title = 'Add New Location';
                        if (isset($_POST['submit'])) {
                            Location::addLocation($_POST);
Ejemplo n.º 20
0
</a>
								</td>
							</tr>
						<?php 
        }
        ?>
			
						</tbody>
					</table>
					
				<?php 
    } else {
        ?>
				
					<?php 
        create_message('info', 'No roles have been created yet.', true);
        ?>
					
				<?php 
    }
    ?>
			
			<?php 
}
?>
			
		</div>
	
	</div>

<?php 
Ejemplo n.º 21
0
                $element .= '
                            <tr>
                                <td align="right" colspan="2">
                                    <button name="operation" value="group_lab_add" type="submit">Publish</button>
                                </td>
                            </tr>
                        </table>';
            }
            $element .= '
						<input name="nonce" value=' . $nonce . ' type="hidden" />
					</form>';
            $element_column[] = $element;
            $element_table[] = $element_column;
            $element_column = array();
        } else {
            $message = create_message(FALSE, 'selecting group, no group selected');
        }
        break;
    case 'group_user_update_form':
        $group_id = $_POST['group_id'];
        $user_id = $_POST['user_id'];
        $user = ace_user_get_info($user_id);
        $element = '
					<form name="group_user_update_form" action="' . _MANAGER_URL_ . '" method="post">
						<input name="display" value="group_update_form" type="hidden" />
						<input name="group_id" value="' . $group_id . '" type="hidden" />
						<input name="user_id" value="' . $user_id . '" type="hidden" />
						<table>
							<tr>
								<td align="right">*email:</td>
								<td><input name="user_email" value="' . $user['name'] . '" type="email" /></td>
Ejemplo n.º 22
0
        }
        break;
    case 'vm_media_change':
        if (isset($_POST['vm_id'])) {
            $vm_id = $_POST['vm_id'];
            $vm_cdrom_instance = $_POST['cdrom_instance'];
            $volume_id = $_POST['volume_id'];
            $vm_display_name = ace_vm_get_display_name_by_id($vm_id);
            if ($volume_id == 'none') {
                $success = ace_vm_cdrom_eject_media($vm_id, $vm_cdrom_instance);
            } else {
                $success = ace_vm_cdrom_insert_media($vm_id, $vm_cdrom_instance, $volume_id);
            }
            $message = create_message($success, "changing media in cd{$vm_cdrom_instance} of {$vm_display_name}");
        } else {
            $message = create_message(FALSE, "changing media, no vm_id specified");
        }
        break;
}
if (isset($message)) {
    $messages[] = $message;
}
unset($message);
# END COMMAND PROCESSING
# BEGIN PAGE DATA
if (isset($lab_id) && $lab_id != 'null' && $lab_id != NULL) {
    $valid_lab_selected = TRUE;
    $lab_display_name = ace_lab_get_display_name_by_id($lab_id);
} else {
    $valid_lab_selected = FALSE;
}
Ejemplo n.º 23
0
function mailcwp_send_callback()
{
    //echo print_r($_POST, true);
    $result = array();
    $to = str_replace(";", ",", $_POST["to"]);
    $cc = str_replace(";", ",", $_POST["cc"]);
    $bcc = str_replace(";", ",", $_POST["bcc"]);
    $subject = $_POST["subject"];
    $draft_id = $_POST["draft_id"];
    if (empty($to) && empty($cc) && empty($bcc)) {
        $result["result"] = "Failed";
        $result["message"] = "Please enter an address to send the mail to.";
    } else {
        if (empty($subject)) {
            $result["result"] = "Failed";
            $result["message"] = "Please enter a subject before sending the mail.";
        } else {
            $mailcwp_session = mailcwp_get_session();
            $account = $mailcwp_session["account"];
            if (array_key_exists("smtp_host", $account)) {
                $smtp_host = $account["smtp_host"];
            } else {
                $smtp_host = '';
            }
            create_message($headers, $message, $attachments, false, !empty($smtp_host));
            if (empty($message)) {
                $result["result"] = "Failed";
                $result["message"] = "Please enter a message before sending the mail.";
            } else {
                //write_log($message);
                //write_log($headers);
                $to = stripslashes($to);
                $subject = stripslashes($subject);
                //check for smtp settings
                //$mailcwp_session = mailcwp_get_session();
                $account = $mailcwp_session["account"];
                if (array_key_exists("smtp_host", $account)) {
                    $smtp_host = $account["smtp_host"];
                    $smtp_port = $account["smtp_port"];
                    $smtp_auth = $account["smtp_auth"];
                    $smtp_username = $account["smtp_username"];
                    $smtp_password = $account["smtp_password"];
                }
                //if smtp host is set use PHPMailer to sent mail via SMTP
                if (!empty($smtp_host)) {
                    require_once "lib/class.phpmailer.php";
                    require_once "lib/class.smtp.php";
                    $options = get_option("mailcwp_settings", array());
                    $mailer = new PHPMailer();
                    if (isset($options["smtp_connect_timeout"])) {
                        $mailer->Timeout = intval($options["smtp_connect_timeout"]);
                    } else {
                        $mailer->Timeout = 10;
                    }
                    $mailer->IsSMTP();
                    $mailer->SMTPAuth = $smtp_auth;
                    $mailer->Host = $smtp_host;
                    if (!empty($smtp_port)) {
                        $mailer->Port = $smtp_port;
                    }
                    if ($smtp_auth) {
                        $mailer->Username = $smtp_username;
                        $mailer->Password = $smtp_password;
                    }
                    $mailer->SetFrom($account['email'], $account['name']);
                    $mailer->AddReplyTo($account['email'], $account['name']);
                    $mailer->Subject = $subject;
                    $mailer->AltBody = "To view the message, please use an HTML compatible email viewer!";
                    // optional, comment out and test
                    $mailer->MsgHTML(stripslashes($message));
                    $to_items = explode(",", $to);
                    foreach ($to_items as $to_item) {
                        if (($start_address = strpos($to_item, '<')) !== FALSE) {
                            $end_address = strpos($to_item, '>');
                            $name = substr($to_item, 0, $start_address - 1);
                            $to_item = substr($to_item, $start_address + 1, $end_address - $start_address - 1);
                            $mailer->AddAddress($to_item, $name);
                        } else {
                            $mailer->AddAddress($to_item);
                        }
                    }
                    $cc_items = explode(",", $cc);
                    foreach ($cc_items as $cc_item) {
                        if (($start_address = strpos($cc_item, '<')) !== FALSE) {
                            $end_address = strpos($cc_item, '>');
                            $name = substr($cc_item, 0, $start_address - 1);
                            $cc_item = substr($cc_item, $start_address + 1, $end_address - $start_address - 1);
                            $mailer->AddCC($cc_item, $name);
                        } else {
                            $mailer->AddCC($cc_item);
                        }
                    }
                    $bcc_items = explode(",", $bcc);
                    foreach ($bcc_items as $bcc_item) {
                        if (($start_address = strpos($bcc_item, '<')) !== FALSE) {
                            $end_address = strpos($bcc_item, '>');
                            $name = substr($bcc_item, 0, $start_address - 1);
                            $bcc_item = substr($bcc_item, $start_address + 1, $end_address - $start_address - 1);
                            $mailer->AddBCC($bcc_item, $name);
                        } else {
                            $mailer->AddBCC($bcc_item);
                        }
                    }
                    foreach ($attachments as $attachment) {
                        $mailer->AddAttachment($attachment);
                    }
                    $mail_sent = $mailer->Send();
                } else {
                    $mail_sent = mail($to, $subject, $message, $headers);
                }
                if ($mail_sent) {
                    $headers .= "To: {$to}\r\n" . "Subject: {$subject}\r\n";
                    $mailcwp_session = mailcwp_get_session();
                    $account = $mailcwp_session["account"];
                    //$account = $mailcwp_session["account"];
                    $from = "{$account['name']} <{$account['email']}>";
                    $mbox_name = "{$account['host']}:{$account['port']}";
                    $use_ssl = $account["use_ssl"];
                    $validate_cert = $account["validate_cert"];
                    $username = $account["username"];
                    $password = $account["password"];
                    $use_tls = $account["use_tls"];
                    $folder = $mailcwp_session["folder"];
                    $unique_id = $_POST["unique_id"];
                    $original = isset($_POST["original"]) ? $_POST["original"] : -1;
                    $use_ssl_flag = $use_ssl === "true" ? "/ssl" : "";
                    $validate_cert_flag = $validate_cert === "true" ? "" : "/novalidate-cert";
                    $use_tls_flag = $use_tls === "true" ? "/tls" : "";
                    $sent_folder = "";
                    if (is_array($account)) {
                        //keep copy in sent folder
                        $sent_folder = null;
                        if (array_key_exists("sent_folder", $account)) {
                            $sent_folder = $account["sent_folder"];
                        }
                        $mbox = mailcwp_imap_connect($account, OP_HALFOPEN, "");
                        if (empty($sent_folder)) {
                            $sent_folder = mailcwp_find_folder($mbox, $account, "Sent");
                        }
                        imap_close($mbox);
                        if (!empty($sent_folder)) {
                            $mbox = mailcwp_imap_connect($account, 0, $sent_folder);
                            //write_log(print_r(imap_check($mbox)));
                            //write_log("APPENDING TO FOLDER [$sent_folder] with HEADERS [$headers] and MESSAGE [$message]");
                            if (!imap_append($mbox, "{" . $mbox_name . $use_ssl_flag . "}" . $sent_folder, $headers . "\r\n" . $message . "\r\n", "\\Seen")) {
                                $result["result"] = "OK";
                                $result["message"] = "Message could not be copied to sent folder ({$sent_folder})";
                                $result["imap_errors"] = imap_errors();
                            }
                            imap_close($mbox);
                        }
                        if ($original != -1) {
                            $mbox = mailcwp_imap_connect($account, 0, $folder);
                            //write_log(print_r(imap_check($mbox)));
                            //write_log("MARKING MESSAGE [$original] in [$folder] ANSWERED");
                            if (!imap_setflag_full($mbox, $original, "\\Answered")) {
                                $result["result"] = "OK";
                                $result["message"] = "Unable to flag message as answered.";
                                $result["imap_errors"] = imap_errors();
                            }
                            imap_close($mbox);
                        }
                    }
                    if (empty($result)) {
                        $result["result"] = "OK";
                    }
                    $current_user_id = get_current_user_id();
                    if ($current_user_id != 0) {
                        //delete_user_meta($current_user_id, "mailcwp_contacts");
                        $options = get_option("mailcwp_settings", array());
                        $max_contacts = isset($options["max_contacts"]) ? $options["max_contacts"] : 100;
                        $user_contacts = get_user_meta($current_user_id, "mailcwp_contacts", true);
                        if ($user_contacts == null) {
                            $user_contacts = array();
                        } else {
                            if (count($user_contacts) > $max_contacts) {
                                $count = count($user_contacts);
                                $unset_index = 0;
                                while ($count > $max_contacts) {
                                    unset($user_contacts[$unset_index++]);
                                    $count -= 1;
                                }
                            }
                        }
                        if (!empty($to)) {
                            $to_items = explode(",", $to);
                            foreach ($to_items as $to_item) {
                                if (!in_array($to_item, $user_contacts)) {
                                    $user_contacts[] = $to_item;
                                }
                            }
                        }
                        if (!empty($cc)) {
                            $cc_items = explode(",", $cc);
                            foreach ($cc_items as $cc_item) {
                                if (!in_array($cc_item, $user_contacts)) {
                                    $user_contacts[] = $cc_item;
                                }
                            }
                        }
                        if (!empty($bcc)) {
                            $bcc_items = explode(",", $bcc);
                            foreach ($bcc_items as $bcc_item) {
                                if (!in_array($bcc_item, $user_contacts)) {
                                    $user_contacts[] = $bcc_item;
                                }
                            }
                        }
                        update_user_meta($current_user_id, "mailcwp_contacts", $user_contacts);
                    }
                } else {
                    $result["result"] = "Failed";
                    $result["message"] = "Message could not be sent.";
                    $result["imap_errors"] = imap_errors();
                }
            }
        }
    }
    echo json_encode($result);
    die;
}
Ejemplo n.º 24
0
?>
		
		<?php 
if (!$usr->isLoggedIn()) {
    ?>
		
			<?php 
    create_message('danger', 'You must log in.', true);
    ?>
				
			<?php 
    get_login_form();
    ?>
			
		<?php 
} else {
    ?>
		
			<?php 
    create_message('danger', 'You are already logged in!', true);
    ?>
			
		<?php 
}
?>
					
		</div>
	</div>

<?php 
get_footer();
Ejemplo n.º 25
0
                }
                if (in_array('sms', $channels) && !empty($recipient_phones)) {
                    foreach ($recipient_phones as $phone) {
                        printf("[sms/warnings] %s (%04d): %s" . PHP_EOL, $row['name'], $row['id'], $recipient_phone);
                    }
                }
            }
            if (!$debug) {
                if (in_array('mail', $channels) && !empty($recipient_mails)) {
                    $msgid = create_message(MSG_MAIL, $subject, $message);
                    foreach ($recipient_mails as $recipient_mail) {
                        send_mail($msgid, $row['id'], $recipient_mail, $row['name'], $subject, $message);
                    }
                }
                if (in_array('sms', $channels) && !empty($recipient_phones)) {
                    $msgid = create_message(MSG_SMS, $subject, $message);
                    foreach ($recipient_phones as $phone) {
                        send_sms($msgid, $row['id'], $phone, $message);
                    }
                }
            }
        }
    }
}
// send message to customers which have awaiting www messages
if (in_array('www', $channels) && (empty($types) || in_array('messages', $types))) {
    $nodes = $DB->GetAll("SELECT INET_NTOA(ipaddr) AS ip\n\t\t\tFROM nodes n\n\t\tJOIN (SELECT DISTINCT customerid FROM messageitems\n\t\t\tJOIN messages m ON m.id = messageid\n\t\t\tWHERE type = ? AND status = ?\n\t\t) m ON m.customerid = n.ownerid\n\t\tORDER BY ipaddr", array(MSG_WWW, MSG_NEW));
    if (!empty($nodes)) {
        if (!$debug) {
            if (!($fh = fopen($notifications['messages']['file'], 'w'))) {
                continue;
Ejemplo n.º 26
0
             delete_message();
             break;
         case 'get_chat_history':
             get_chat_history();
             break;
         case 'get_messages':
             get_messages();
             break;
         case 'get_visitor':
             get_visitor();
             break;
         case 'get_visitors':
             get_visitors();
             break;
         case 'create_message':
             create_message();
             break;
         case 'create_visitor':
             create_visitor();
             break;
         case 'notify':
             notify();
             break;
         default:
             $api['output']['message'] = 'Requested action "' . $api['query']['action'] . '" is invalid';
             $api['output']['status'] = 'Fail';
             break;
     }
 } else {
     $api['output']['message'] = 'Invalid osfapi_key';
     $api['output']['status'] = 'Fail';