private function build_table()
 {
     $number_admins = UserService::count_admin_members();
     $table_model = new SQLHTMLTableModel(DB_TABLE_MEMBER, 'table', array(new HTMLTableColumn($this->lang['display_name'], 'display_name'), new HTMLTableColumn($this->lang['level'], 'level'), new HTMLTableColumn($this->lang['email']), new HTMLTableColumn($this->lang['registration_date'], 'registration_date'), new HTMLTableColumn($this->lang['last_connection'], 'last_connection_date'), new HTMLTableColumn($this->lang['approbation'], 'approved'), new HTMLTableColumn('')), new HTMLTableSortingRule('display_name', HTMLTableSortingRule::ASC));
     $table = new HTMLTable($table_model);
     $table_model->set_caption(LangLoader::get_message('members.members-management', 'admin-user-common'));
     $results = array();
     $result = $table_model->get_sql_results('m LEFT JOIN ' . DB_TABLE_INTERNAL_AUTHENTICATION . ' ia ON ia.user_id = m.user_id');
     foreach ($result as $row) {
         $user = new User();
         $user->set_properties($row);
         $edit_link = new LinkHTMLElement(UserUrlBuilder::edit_profile($user->get_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit');
         if ($user->get_level() != User::ADMIN_LEVEL || $user->get_level() == User::ADMIN_LEVEL && $number_admins > 1) {
             $delete_link = new LinkHTMLElement(AdminMembersUrlBuilder::delete($user->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => 'delete-element'), 'fa fa-delete');
         } else {
             $delete_link = new LinkHTMLElement('', '', array('title' => LangLoader::get_message('delete', 'common'), 'onclick' => 'return false;'), 'fa fa-delete icon-disabled');
         }
         $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
         $results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level()))), new HTMLTableRowCell(UserService::get_level_lang($user->get_level())), new HTMLTableRowCell(new LinkHTMLElement('mailto:' . $user->get_email(), $this->lang['email'], array(), 'basic-button smaller')), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR)), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell($row['approved'] ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($edit_link->display() . $delete_link->display())));
     }
     $table->set_rows($table_model->get_number_of_matching_rows(), $results);
     $this->view->put_all(array('FORM' => $this->build_form()->display(), 'table' => $table->display()));
 }
$user = new User();
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
$data['page_title'] = 'World Music Listing: Forgot Your Password?';
$data['musicListing'] = $directory->getMusicDirectoryListing();
$data['special_head'] = true;
$step = isset($_GET['step']) ? 0 + $_GET['step'] : 0;
if ($step > 0) {
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        header('Location: ' . $url . '/wml_password.php');
        exit;
    }
}
switch ($step) {
    case '1':
        $email = $_POST['su_email'];
        $isvalid = $user->get_email($email);
        if (!$isvalid) {
            $_SESSION['error'] = 'Email not found in our system. Please try again.';
            header('Location: ' . $url . '/wml_password.php');
            exit;
        }
        $data['question'] = $isvalid['vsecques'];
        $data['forgtid'] = $isvalid['iuserid'];
        break;
    case '2':
        $frget_id = isset($_POST['forgtid']) ? $_POST['forgtid'] : null;
        $answer = isset($_POST['su_answer']) ? $_POST['su_answer'] : null;
        $is_valid = $user->get_dataById($frget_id);
        if ($is_valid) {
            if ($is_valid['vsecans'] == trim($answer)) {
                $data['forgtid'] = $frget_id;
Example #3
0
     }
 }
 // We have to have found both this user in the invite list and the reservation owner or else it makes no sense to participate
 if ($found_user && $owner_id !== false) {
     $translate_index = 'reservation ' . ($action == INVITE_ACCEPT ? 'accepted' : 'declined');
     // Update the invite record
     $failed = $res->update_users($memberid, $action, isset($_POST['update_all']), $max_participants);
     if (is_array($failed) && $failed !== false) {
         // Let the owner know the user accepted/declined
         $owner = new User($owner_id);
         $mailer = new PHPMailer();
         $mailer->From = $conf['app']['adminEmail'];
         $mailer->FromName = $conf['app']['title'];
         $mailer->Subject = translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date)));
         $mailer->IsHTML(false);
         $mailer->AddAddress($owner->get_email());
         $mailer->Body = translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date)));
         $mailer->Send();
         if (count($failed) > 0) {
             echo '<p>' . translate('You are not participating on the following reservation dates because they are at full capacity.') . '</p>';
             for ($i = 0; $i < count($failed); $i++) {
                 echo '<p>' . Time::formatDate($failed[$i]['start_date']) . '</p>';
             }
         }
         $msg = '';
         $msg .= translate($translate_index, array($user->get_name(), Time::formatDate($res->start_date))) . '<br/>';
         if (Auth::is_logged_in()) {
             $msg .= Link::getLink('ctrlpnl.php', translate('Return to My Control Panel'));
         } else {
             $msg .= Link::getLink('index.php', translate('Login to manage all of your invitiations'));
         }
<div class="form-panel">

	<fieldset>
		
		<legend>User profile</legend>
		
		<form name="form_user_profile" id="form_user_profile" method="post" enctype='application/x-www-form-urlencoded' accept-charset="utf-8">

			<div class="fleft">
				<div class="input-block">
					<label for='email' class='required'>Email</label>
					<input name='email' type='text' disabled='disabled' value="<?php 
echo User::get_email();
?>
" />
					<br />
				</div>
				<div class="input-block">
					<label for='username'>Username</label>
					<input name='username' type='text' disabled='disabled'  value="<?php 
echo User::get_username();
?>
" />
				</div>
				<div class="input-block">
					<label for='name'>Name</label>
					<input name='name' type='text' value="<?php 
echo isset($p_name) ? $p_name : User::get_name();
?>
" />
				</div>
Example #5
0
function create_user($name, $email, $password)
{
    if (is_null(get_user_by_name($name))) {
        $user = new User();
        $user->set_name($name)->set_email($email)->set_password($password);
        $mysqli = new mysqli(get_db_host(), get_db_user(), get_db_password(), get_db_database());
        $stmt = $mysqli->prepare("INSERT INTO user(name, email, password_hash) VALUES (?, ?, ?)");
        $stmt->bind_param("sss", $user->get_name(), $user->get_email(), $user->get_password_hash());
        $stmt->execute();
        $stmt->close();
    }
}
            $log->error("Could not connect to redis at " . $redis_server['host'] . ", autentication failed");
            die('Check log\\n');
        }
    }
} else {
    $redis = false;
}
require "Modules/user/user_model.php";
$user = new User($mysqli, $redis, null);
include "Modules/feed/feed_model.php";
$feed = new Feed($mysqli, $redis, $feed_settings);
require_once "Modules/feed/engine/shared_helper.php";
$helperclass = new SharedHelper();
$session['userid'] = $userid;
// required
$emailto = $user->get_email($session['userid']);
$usertimezone = $user->get_timezone($session['userid']);
$now = DateTime::createFromFormat("U", $time);
$now->setTimezone(new DateTimeZone($usertimezone));
$now->setTime(23, 59, 59);
// at 23:59:59
$now->modify("last day of previous month");
$end = $now->format("U");
$endText = $now->format("YmdHis");
// today
$now->setTime(0, 0);
// at 00:00
$now->modify("first day of this month");
$start = $now->format("U");
$startText = $now->format("YmdHis");
// Get user feeds
Example #7
0
 public function get_user_email()
 {
     return parent::get_email();
 }
Example #8
0
function findUser($userid)
{
    $found_user = false;
    if (!empty($userid)) {
        $user = new User($userid);
        if ($user != null) {
            $userid = $user->get_id();
            $fname = $user->get_fname();
            $lname = $user->get_lname();
            $email_address = $user->get_email();
            $found_user = true;
        } else {
            $found_user = false;
        }
    }
    return $found_user;
}
 }
 if ($p_terms < 1) {
     $success = false;
     array_push($errors, "You should agree with the Terms and Conditions.");
 }
 if ($success) {
     $ipaddr = $_SERVER['REMOTE_ADDR'];
     if (UserBanned::exists(0, array(), "(email='{$p_email}' OR ipaddr='{$ipaddr}')")) {
         $last = 666666;
     } else {
         $postedon = date("Y-m-d H:i:s", time());
         $expiry = date("Y-m-d", time() + $p_expiry * 24 * 60 * 60);
         $code = md5(uniqid(rand(), true));
         if (User::is_logged_in()) {
             $p_name = User::get_name();
             $p_email = User::get_email();
         }
         $last = Ad::create(array('user_id' => User::get_id(), 'name' => $p_name, 'email' => $p_email, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'picture' => $p_picture, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'expiry' => $expiry, 'webpage' => $p_webpage, 'code' => $code, 'ipaddr' => $ipaddr, 'postedon' => $postedon, 'lastmodified' => $postedon));
         if (User::is_logged_in()) {
             Ad::activate($last);
         } else {
             if (!($user_exists = User::exists(0, array('email' => $p_email)))) {
                 $p_em = explode('@', $p_email);
                 $username = substr($p_em[0], 0, 6);
                 $active = 0;
                 $createdon = date("Y-m-d H:i:s", time());
                 $password = substr($code, 0, 6);
                 $userid = User::create(array('email' => $p_email, 'username' => $username, 'password' => $password, 'name' => $p_name, 'active' => $active, 'createdon' => $createdon, 'ipaddr' => $ipaddr, 'code' => $code));
                 $registration_message = StaticContent::get_content('user-registration-email');
                 eval("\$registration_message = \"{$registration_message}\";");
             } else {
Example #10
0
/**
* Send a notification email that the password has been reset
* @param string $memberid id of member
* @param string $password new password for user
*/
function send_pwdreset_email($memberid, $password)
{
    global $conf;
    $adminemail = $conf['app']['adminEmail'];
    $appTitle = $conf['app']['title'];
    $user = new User($memberid);
    $subject = $appTitle . ' ' . translate('Password Reset');
    $msg = $user->get_fname() . ",\r\n" . translate_email('password_reset', $appTitle, $password, $appTitle, CmnFns::getScriptURL(), $adminemail);
    $mailer = new PHPMailer();
    $mailer->AddAddress($user->get_email(), $user->get_name());
    $mailer->From = $adminemail;
    $mailer->FromName = $conf['app']['title'];
    $mailer->Subject = $subject;
    $mailer->Body = $msg;
    $mailer->Send();
}
Example #11
0
/**
 * Developed by Jay Gaha
 * http://jaygaha.com.np
 */
/* AJAX check  */
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    include 'includes/inc-public.php';
    include "includes/classes/class.user.php";
    $user = new User();
    $email_check = isset($_POST['su_email']) ? $_POST['su_email'] : null;
    $com_email = isset($_POST['com_email']) ? $_POST['com_email'] : null;
    $frget_id = isset($_POST['forget_id']) ? $_POST['forget_id'] : null;
    $answer = isset($_POST['su_answer']) ? $_POST['su_answer'] : null;
    //email check for normal
    if (!is_null($email_check)) {
        $is_valid = $user->get_email($email_check);
        if ($is_valid) {
            echo "false";
        } else {
            echo "true";
        }
    }
    //email check for company
    if (!is_null($com_email)) {
        $is_valid = $user->get_company_email($com_email);
        // echo 'asd';print_r($is_valid);exit;
        if ($is_valid) {
            echo "false";
        } else {
            echo "true";
        }
	<fieldset>
		
		<legend>Post an Ad</legend>
		
		<form name="form_ad_placement" id="form_ad_placement" method="post" enctype='multipart/form-data' accept-charset="utf-8">
				
			<div class="fleft">

				<div class="input-block">
					<label for='name' class="required">Name</label>
					<input name='name' type='text' value='<?if(isset($p_name)) print $p_name; else if(User::is_logged_in()) print User::get_name()?>' <?if(User::is_logged_in()):?>readonly='readonly'<?endif?> />
				</div>
				
				<div class="input-block">
					<label for='email' class="required">Email</label>
					<input name='email' type='text' value='<?if(isset($p_email)) print $p_email; else if(User::is_logged_in()) print User::get_email()?>' <?if(User::is_logged_in()):?>readonly='readonly'<?endif?> />
				</div>

				<div class="input-block">
					<label for='telephone'>Telephone</label>
					<input name='telephone' type='text' value='<?if(isset($p_telephone)) print $p_telephone; else if(User::is_logged_in()) print User::get_prop('telephone')?>' />
				</div>
									
			</div>				

			<br />

			<div class="fleft">
				
				<div class="input-block">
					<label for='title' class="required">Title</label>
Example #13
0
 /**
  * Verify that the user entered all data properly
  * @param array $data array of data to check
  * @param boolean $is_edit whether this is an edit or not
  */
 function check_all_values(&$data, $is_edit)
 {
     global $conf;
     $use_logonname = (bool) $conf['app']['useLogonName'];
     $msg = '';
     if ($use_logonname && empty($data['logon_name'])) {
         $msg .= translate('Valid username is required') . '<br/>';
     } else {
         if ($use_logonname) {
             $data['logon_name'] = htmlspecialchars($data['logon_name']);
         }
     }
     if (empty($data['emailaddress']) || !preg_match("/^[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]\$/", $data['emailaddress'])) {
         $msg .= translate('Valid email address is required.') . '<br/>';
     }
     if (empty($data['fname'])) {
         $msg .= translate('First name is required.') . '<br/>';
     } else {
         $data['fname'] = htmlspecialchars($data['fname']);
     }
     if (empty($data['lname'])) {
         $msg .= translate('Last name is required.') . '<br/>';
     } else {
         $data['lname'] = htmlspecialchars($data['lname']);
     }
     if (!empty($data['phone'])) {
         $data['phone'] = htmlspecialchars($data['phone']);
     }
     if (!empty($data['institution'])) {
         $data['institution'] = htmlspecialchars($data['institution']);
     }
     if (!empty($data['position'])) {
         $data['position'] = htmlspecialchars($data['position']);
     }
     if (!$conf['ldap']['authentication']) {
         // Make sure email isnt in database (and is not current users email)
         if ($is_edit) {
             $user = new User($data['memberid']);
             if (!$use_logonname) {
                 if ($this->db->userExists($data['emailaddress']) && $data['emailaddress'] != $user->get_email()) {
                     $msg .= translate('That email is taken already.') . '<br/>';
                 }
             } else {
                 if ($this->db->userExists($data['logon_name'], true) && $data['logon_name'] != $user->get_logon_name()) {
                     $msg .= translate('That logon name is taken already.') . '<br/>';
                 }
             }
             if (!empty($data['password'])) {
                 if (strlen($data['password']) < $conf['app']['minPasswordLength']) {
                     $msg .= translate('Min 6 character password is required.', array($conf['app']['minPasswordLength'])) . '<br/>';
                 }
                 if ($data['password'] != $data['password2']) {
                     $msg .= translate('Passwords do not match.') . '<br/>';
                 }
             }
             unset($user);
         } else {
             if (empty($data['password']) || strlen($data['password']) < $conf['app']['minPasswordLength']) {
                 $msg .= translate('Min 6 character password is required.', array($conf['app']['minPasswordLength'])) . '<br/>';
             }
             if ($data['password'] != $data['password2']) {
                 $msg .= translate('Passwords do not match.') . '<br/>';
             }
             if ($this->db->userExists($data['emailaddress'])) {
                 $msg .= translate('That email is taken already.') . '<br/>';
             }
             if ($use_logonname && $this->db->userExists($data['logon_name'], true)) {
                 $msg .= translate('That logon name is taken already.') . '<br/>';
             }
         }
     }
     return $msg;
 }
Example #14
0
 /**
  * @desc Update user
  * @param User $user 
  * @param string $condition the SQL condition update user
  * @param array $parameters 
  */
 public static function update(User $user, $extended_fields = null)
 {
     $condition = 'WHERE user_id=:user_id';
     $parameters = array('user_id' => $user->get_id());
     self::$querier->update(DB_TABLE_MEMBER, array('display_name' => TextHelper::htmlspecialchars($user->get_display_name()), 'level' => $user->get_level(), 'groups' => implode('|', $user->get_groups()), 'email' => $user->get_email(), 'show_email' => (int) $user->get_show_email(), 'locale' => $user->get_locale(), 'timezone' => $user->get_timezone(), 'theme' => $user->get_theme(), 'editor' => $user->get_editor()), $condition, $parameters);
     if ($extended_fields !== null) {
         if ($extended_fields instanceof MemberExtendedFieldsService) {
             $fields_data = $extended_fields->get_data($user->get_id());
         } elseif (is_array($extended_fields)) {
             $fields_data = $extended_fields;
         } else {
             $fields_data = array();
         }
         self::$querier->update(DB_TABLE_MEMBER_EXTENDED_FIELDS, $fields_data, $condition, $parameters);
     }
     SessionData::recheck_cached_data_from_user_id($user->get_id());
     self::regenerate_cache();
 }
Example #15
0
?>
</td>
      <td><button class="btn editbtn">Edit</button></td>
    </tr>
    <tr>
      <td><strong>Username</strong></td>
      <td><?php 
$user->get_username($id);
?>
</td>
      <td><button class="btn editbtn">Edit</button></td>
    </tr>                 
    <tr>
      <td><strong>Email</strong></td>
      <td><?php 
$user->get_email($id);
?>
</td>
      <td><button class="btn editbtn">Edit</button></td>
    </tr>
  </tbody>
</table>
         
      </div>
      <div id="right_content">
          <h1 style="margin: 20px;">Changing Password</h1>
           <form method="post" enctype="multipart/form-data" action="editprofile.php"> 
            <table id ="tableright">
                <thead>
                
                    <th colspan="2"><h2>Changing your password</h2></th>
Example #16
0
function displayUserManagement()
{
    global $tool, $propertyForm;
    $users = User::get_users();
    echo "<style>";
    foreach ($users as $id => $value) {
        echo "#modalBox #dialog" . $id;
        echo "{\n\t\t\twidth:auto;\n\t\t\tmax-width: 80%;\n\t\t\tmin-width:40%;\n\t\t\theight:auto;\n\t\t\tpadding:10px;\n\t\t\tpadding-top:10px;\n\t\t\toverflow:auto;\n\t\t}";
    }
    echo "</style>";
    $toolNames = array("Add User");
    $toolIcons = array("add");
    $formType = array("newDialog");
    echo $tool->createNewModal($toolNames, $toolIcons, $formType);
    echo "<form method='post' action='' style='width:1024px;'>";
    echo "<table id=\"sortDataTable\" class='sortable' cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style='width:100%; clear:left;'>\n\t\t<thead>\n\t\t<tr><th style='text-align:left;'>Full Name</th>\n\t\t<th style='text-align:left;'>User Name</th>\n\t\t<th style='text-align:left;'>Email</th>\n\t\t<th style='text-align:left;'>User Type</th>\n\t\t<th style='text-align:left;'>Group</th>\n\t\t<th style='text-align:left;'>Action</th>\n\t\t<th style='text-align:left;'>Last Login</th></tr>\n\t\t</thead>\n\t\t<tbody>";
    foreach ($users as $id => $value) {
        echo "<tr>";
        $curUser = new User($id);
        echo "<td><input type='checkbox' name='list[]' value='" . $curUser->get_user_id() . "' />" . $curUser->get_full_name() . "</td>\n\t\t<td>" . $curUser->get_user_name() . "</td>\n\t\t<td>" . $curUser->get_email() . "</td>\n\t\t<td>" . $curUser->get_user_type() . "</td>";
        $group = $curUser->get_groups();
        if (count($group) == 0) {
            $group = array("None");
        }
        echo "<td>";
        foreach ($group as $gid => $value) {
            echo $value . ", ";
        }
        echo "</td>\n\t\t<td><a name='modal' href='#dialog" . $id . "'>Edit</a></td>";
        echo "<td>" . $curUser->get_last_login() . " (" . $curUser->get_last_ip() . ")</td>";
        echo "</tr>";
    }
    echo "</tbody>\n\t</table>";
    echo "<input type='submit' name='delUser' value='Delete Checked Users' style='float:left; clear:left; margin-bottom:5px;' />";
    echo "<select name='groups' style='float:right; margin-bottom:5px;'>";
    $groups = Group::get_groups();
    foreach ($groups as $id => $value) {
        $curGroup = new Group($id);
        echo "<option value=" . $id . ">" . $curGroup->get_name() . "</option>";
    }
    echo "</select>";
    echo "<input type='submit' name='userToGroup' value='Add Users to Group' style='float:right; margin-bottom:5px; margin-right: 5px;' />";
    echo "</form>";
    $heading = array("User Information");
    $title = array("Full Name", "User Name", "Password", "Email");
    $key = array("full", "user", "password", "email");
    foreach ($users as $id => $value) {
        $curUser = new User($id);
        $info = array($id, $curUser->get_full_name(), $curUser->get_user_name(), $curUser->get_email());
        $heading2 = array("User Information");
        $title2 = array("ID", "Full Name", "User Name", "Email");
        $key2 = array("id", "full", "user", "email");
        $fieldType = array("static");
        //create a new modal form for a new interface ports
        $propertyForm->setFieldType($fieldType);
        echo $propertyForm->editModalForm($heading2, $title2, $info, $key2, "dialog" . $id, "updateUser");
    }
    //create a new modal form for a new interface ports
    $fieldType = array();
    $propertyForm->setFieldType($fieldType);
    echo $propertyForm->newModalForm($heading, $title, $key, "addUser");
}