Example #1
0
<?php

if (App::isLogged()) {
    $member = Member::getMemberById($_SESSION['id']);
    if (isset($_POST['delete'])) {
        if (isset($_POST['password']) && $_POST['password'] == $_POST['password-confirm']) {
            if (Bcrypt::checkPassword($_POST['password'], $member->password)) {
                Member::deleteMember($member->id);
                session_unset();
                $msg->success('Votre compte à bien été supprimé', 'index.php?page=home');
            } else {
                echo $msg->error('Le mot de passe entré est incorrect, veuillez réessayer', 'index.php?page=profile');
            }
        } else {
            echo $msg->error('Les deux mots de passe ne correspondent pas', 'index.php?page=profile');
        }
    }
    if (isset($_POST['edit'])) {
        if (isset($_POST['first_name']) && $_POST['first_name'] != "" && preg_match("#^[a-zA-Z._-]{2,32}#", $_POST['first_name']) && isset($_POST['last_name']) && $_POST['last_name'] != "" && preg_match("#^[a-zA-Z._-]{2,32}#", $_POST['last_name']) && isset($_POST['email']) && $_POST['email'] != "" && preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\\.[a-z]{2,4}\$#", $_POST['email']) && isset($_POST['password']) && $_POST['password'] != "" && isset($_POST['password-confirm']) && $_POST['password-confirm'] == $_POST['password'] && isset($_POST['way_num']) && $_POST['way_num'] != "" && preg_match("#^[0-9]{1,}\$#", $_POST['way_num']) && isset($_POST['way_type']) && $_POST['way_type'] != "" && isset($_POST['way_name']) && $_POST['way_name'] != "" && preg_match("#^[a-zA-Z0-9._-]{2,30}#", $_POST['way_name']) && isset($_POST['city']) && $_POST['city'] != "" && preg_match("#^[a-zA-Z0-9._-]{2,30}#", $_POST['city']) && isset($_POST['zip_code']) && $_POST['zip_code'] != "" && preg_match("#^[0-9]{5}\$#", $_POST['zip_code'])) {
            try {
                PDOConnexion::setParameters('phonedeals', 'root', 'root');
                $db = PDOConnexion::getInstance();
                $sql = "\n\t\t\t\t\tUPDATE member\n\t\t\t\t\tSET first_name = :first_name,\n\t\t\t\t\t\tlast_name = :last_name,\n\t\t\t\t\t\temail = :email,\n\t\t\t\t\t\tway_num = :way_num,\n\t\t\t\t\t\tway_type = :way_type,\n\t\t\t\t\t\tway_name = :way_name,\n\t\t\t\t\t\tcity = :city,\n\t\t\t\t\tWHERE id = :id\n\t\t\t\t";
                $sth = $db->prepare($sql);
                $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Phone');
                $sth->execute(array(':id' => $id, ':first_name' => $_POST['first_name'], ':last_name' => $_POST['last_name'], ':email' => $_POST['email'], ':way_num' => $_POST['way_num'], ':way_type' => $_POST['way_type'], ':way_name' => $_POST['way_name'], ':city' => $_POST['city'], ':zip_code' => $_POST['zip_code']));
                header("location:index.php?page=home");
            } catch (PDOException $e) {
                echo "<p>Erreur:" . $e->getMessage() . "</p>";
                die;
            }
Example #2
0
<div class="col-md-12">
	<h1>Liste des commandes</h1>
	<table class="table table-striped">
		<thead>
			<th>Membre</th>
			<th>Date</th>
			<th>Prix HT</th>
			<th>Prix TTC</th>
			<th>Méthode d'envoi</th>
			<th>Téléphone</th>
			<th></th>
		</thead>
		<?php 
foreach (Order::getOrdersList() as $order) {
    echo '<tr data-id="' . $order->id . '">';
    echo '<td>' . Member::getMemberById($order->member)->first_name . ' ' . Member::getMemberById($order->member)->last_name . '</td>';
    echo '<td>' . $order->date . '</td>';
    echo '<td>' . $order->paid_price . ' &euro;</td>';
    echo '<td>' . $order->paid_price_vat . ' &euro;</td>';
    echo '<td>' . $order->sent_method . '</td>';
    echo '<td>' . $order->phones . '</td>';
    echo '<td><a href="#" title="Supprimer" data-toggle="tooltip" data-action="delete" title="Supprimer"><i class="fa fa-trash"></i></a></td>';
    echo '</tr>';
}
?>
	</table>
</div>
<script>
	$('[data-action="delete"]').click(function(e) {
		e.preventDefault();
 public function actionInviteFriend($status = '')
 {
     $member = new Member();
     $memberdata = $member->getMemberById(Yii::app()->user->id);
     //echo $status;
     if (isset($_POST['email'])) {
         $emails = explode(",", $_POST['email']);
         $note = $_POST['note'];
         $membername = $_POST['membername'];
         $memberemail = $_POST['memberemail'];
         foreach ($emails as $email) {
             if (!empty($email) && preg_match('/^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)+$/', $email)) {
                 //$invitekey = sha1($email);
                 $message = new YiiMailMessage();
                 $message->view = 'sendinviteemailtemplate';
                 $message->setBody(array('name' => $membername, 'note' => $note), 'text/html');
                 $message->subject = 'Invite to Script Overflow';
                 $message->addTo($email);
                 $message->setFrom(array($memberemail => $membername . ' [ScriptOverflow]'));
                 //$message->setFrom(array(Yii::app()->params['adminEmail'] => $name));
                 //	$message->setFrom(array('*****@*****.**'=> $name));
                 Yii::app()->mail->transportOptions = array('host' => Yii::app()->params['smtpserver'], 'port' => Yii::app()->params['smtpport'], 'username' => Yii::app()->params['smtpusername'], 'password' => Yii::app()->params['smtppassword']);
                 if (Yii::app()->mail->send($message)) {
                     Yii::app()->user->setFlash("invitefriend", "Invite Sent!");
                     $resp = true;
                 } else {
                     $resp = false;
                 }
             }
         }
         $this->redirect(array('member/invitefriend?status=sent'));
     }
     // end if POST
     $this->render('invitefriend', array('memberdata' => $memberdata, 'status' => $status));
 }
Example #4
0
 public function processPageSource()
 {
     $member_id = Session::getSession(Login::$_login_admin);
     $objMember = new Member();
     $current_user = $objMember->getMemberById($member_id);
     //var_dump($current_user);
     $page_details = $this->objPage->getPages(array('id' => $this->cPage_id))[0];
     if (!empty($page_details['php_file_directory'])) {
         if (file_exists(ROOT_PATH . DS . PAGES_DIR . DS . $page_details['php_file_directory'])) {
             $cPage = $this->cPage;
             $params = $this->cPage_params;
             //var_dump($params);
             // Tao object
             $object = ucwords($cPage);
             switch ($cPage) {
                 case 'exco':
                     $objProject = new Project();
                     break;
                 default:
                     if (file_exists(ROOT_PATH . DS . CLASSES_DIR . DS . $object . '.php')) {
                         ${'obj' . $object} = new $object();
                     }
                     break;
             }
             if ($cPage == 'database') {
                 $header = 'Database :: ' . ucwords(str_replace('-', ' ', $params['table']));
             }
             if (array_key_exists('id', $params)) {
                 switch ($cPage) {
                     case 'exco':
                         $id = $params['id'];
                         $project = $objProject->getProjectById($id);
                         $result = $project;
                         break;
                     default:
                         $id = $params['id'];
                         ${$cPage} = ${'obj' . $object}->{'get' . $object . 'byId'}($id);
                         $result = ${$cPage};
                         break;
                 }
                 if (empty($result)) {
                     $error = "No record found for the ID provided.";
                 }
             }
         } else {
             $error = "The source directory is invalid.";
         }
     } else {
         $error = "The source directory is not recorded.";
     }
     if (isset($error)) {
         require_once ROOT_PATH . DS . PAGES_DIR . DS . 'error.php';
     } else {
         if ($this->objPage->canAccess($this->cPage_params, $member_id, $page_details)) {
             //echo '<h1 style="background:white;">';
             //                    var_dump($this->cPage_params);
             //                    var_dump($this->cPage_id);
             //                    echo '</h1>';
             require_once ROOT_PATH . DS . PAGES_DIR . DS . $page_details['php_file_directory'];
         } else {
             $error = 'You do not have permission to access this page';
             require_once ROOT_PATH . DS . PAGES_DIR . DS . 'error.php';
         }
     }
 }
<?php

if (isset($data['params']) && isset($data['params']['id'])) {
    $params = $data['params'];
    $id = $params['id'];
    $objProject = new Project();
    $objMember = new Member();
    $objPosition = new Position();
    $objTeam = new Team();
    $involvement = $objMember->getInvolvements(array('id' => $id));
    if (!empty($involvement)) {
        $involvement = $involvement[0];
        $project = $objProject->getProjectById($involvement['project_id']);
        $member = $objMember->getMemberById($involvement['member_id']);
        ?>
        <h2 class="borderBottom">
            Manage Involvement :: <?php 
        echo $member['name'];
        ?>
            <a class="closeInvolvementDetails h2rightlink" href="#">Close</a>
        </h2>
        
        <div class="sectionParams" data-params="id=<?php 
        echo $involvement['id'];
        ?>
"></div>
        <br />
        
        <table cellpadding="0" cellspacing="0" border="0" style="width:100%;vertical-align:middle;" class="panelTable horizontalTable" data-object="page">
            <tr>
                <td >
Example #6
0
<?php

if (isset($_GET['id']) && !empty($_GET['id'])) {
    $id = htmlentities($_GET['id']);
    $member = Member::getMemberById($id);
    if (isset($_POST['edit'])) {
        if (preg_match("#^[a-zA-Z._-]{2,32}#", $_POST['first_name']) && preg_match("#^[a-zA-Z._-]{2,32}#", $_POST['last_name']) && preg_match("#^[0-9]{1,}\$#", $_POST['way_num']) && preg_match("#^[a-zA-Z0-9._-]{2,30}#", $_POST['way_name']) && preg_match("#^[a-zA-Z0-9._-]{2,30}#", $_POST['city']) && preg_match("#^[0-9]{5}\$#", $_POST['zip_code'])) {
            PDOConnexion::setParameters('phonedeals', 'root', 'root');
            $db = PDOConnexion::getInstance();
            $sql = "\n\t\t\t\tUPDATE member\n\t\t\t\tSET first_name = :first_name,\n                last_name = :last_name,\n                way_num = :way_num,\n                way_type = :way_type,\n                way_name = :way_name,\n                city = :city,\n                zip_code = :zip_code\n\t\t\t\tWHERE id = :id\n\t\t\t";
            $sth = $db->prepare($sql);
            $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Member');
            $sth->execute(array(':id' => $id, ':first_name' => $_POST['first_name'], ':last_name' => $_POST['last_name'], ':way_num' => $_POST['way_num'], ':way_type' => $_POST['way_type'], ':way_name' => $_POST['way_name'], ':city' => $_POST['city'], ':zip_code' => $_POST['zip_code']));
            if ($sth) {
                App::success('Le profil de ce membre a bien été modifiée');
            }
        } else {
            App::error("Les champs ne sont pas valides");
        }
    }
    if ($member) {
        ?>
<div class="col-md-8">
    <div class="page-header">
        <h1>Éditer une membre</h1>
    </div>

    <form action="index.php?page=admin/member-edit&amp;id=<?php 
        echo $id;
        ?>
" method="POST">
Example #7
0
 public function generateURL($cPage = null, $params = null)
 {
     $result = '/sugarkms/';
     if (!empty($cPage)) {
         $result .= $cPage;
         if (!empty($params)) {
             if (array_key_exists('id', $params)) {
                 switch ($cPage) {
                     case 'member':
                         $objMember = new Member();
                         $member = $objMember->getMemberById($params['id']);
                         //$params['id'] = $member['entity'].'-'.$params['id'];
                         $params['entity'] = $member['entity'];
                         break;
                     case 'project':
                     case 'exco':
                         $objProject = new Project();
                         $project = $objProject->getProjectById($params['id']);
                         $params['entity'] = str_replace(' ', '-', strtolower($project['name'])) . '-' . strtolower(str_replace(' ', '', str_replace(')', '', str_replace(' (', '-', $project['project_time']))));
                         break;
                     default:
                         if (count($params) == 1) {
                             $params['action'] = 'view';
                         }
                         break;
                 }
             }
             $page_details = $this->getPageFromURL($cPage, $params);
             if (!empty($page_details)) {
                 $page_params = $this->getPageParams(array('page_id' => $page_details['id']), array('order' => 'asc'));
                 foreach ($page_params as $page_param) {
                     if (!($page_param['param'] == 'action' && $page_param['required_value'] == 'view')) {
                         $result .= '/';
                         //$result .= $page_param['param'].'/';
                         $result .= empty($page_param['required_value']) ? $params[$page_param['param']] : $page_param['required_value'];
                     }
                 }
             }
         }
         return $result;
     }
 }