public function formAction() { $smarty = Zend_Registry::get('view'); $request = $this->getRequest(); $id = (int) $request->getParam('id', 0); $log = new SessionLAG(); $form = $this->_getBugForm($id, $log->_getType()); $model = $this->_getModel(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $dataform = $form->getValues(); function decode(&$value) { $value = utf8_decode($value); } array_walk($dataform, 'decode'); $model->save($id, $dataform); if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) { return $this->_helper->redirector('indexadmin'); } else { $this->sendMail($form->getValues()); return $this->_helper->redirector('remerciement'); } } } else { if ($id > 0 && $log->_getTypeConnected('admin')) { $data = $model->fetchEntry($id); $form->populate($data); } } if ($id > 0) { $smarty->assign('title', 'Bug'); } else { $smarty->assign('title', 'Signaler un bug'); } $smarty->assign('form', $form); $smarty->display('bug/form.tpl'); }
public function formAction() { $smarty = Zend_Registry::get('view'); $log = new SessionLAG(); if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin') || $log->_getTypeConnected('joueur')) { $request = $this->getRequest(); if ($log->_getTypeConnected('joueur')) { $this->redirection = 'accueil/index'; $id = $log->_getUser(); } else { if ($log->_getInterfaceAdmin()) { $this->redirection = 'admin/compte/indexadmin'; $id = (int) $request->getParam('id', 0); } else { $this->redirection = 'accueil/index'; $id = $log->_getUser(); } } $form = $this->_getCompteForm($id, $log->_getType()); $formmdp = $this->_getMdpForm($id, $log->_getType()); $model = $this->_getModel(); $modelNewsletterMail = $this->_getModelNewsletterMail(); $modelNewsletterMailType = $this->_getModelNewsletterMailType(); if ($this->getRequest()->isPost()) { if ($request->getParam('f') != 'mdp') { if ($form->isValid($request->getPost())) { $dataform = $form->getValues(); $datenaissance = $dataform['datenaissance']; $dataform['datenaissance'] = substr($datenaissance, 6, 4) . "-" . substr($datenaissance, 3, 2) . "-" . substr($datenaissance, 0, 2) . " 00:00:00"; if (empty($dataform['img'])) { unset($dataform['img']); } else { $nom_image = $dataform["login"]; require_once '../library/My/Utils.php'; $chaine_valide = valideChaine($nom_image); $ext = explode('.', $dataform["img"]); $ancien_nom = $dataform['img']; $dataform['img'] = $chaine_valide . '.' . $ext[1]; } $dataform['nom'] = utf8_decode($dataform['nom']); $dataform['prenom'] = utf8_decode($dataform['prenom']); $dataform['jeuxprefere'] = utf8_decode($dataform['jeuxprefere']); $dataform['configpc'] = utf8_decode($dataform['configpc']); $dataform['citationpreferee'] = utf8_decode($dataform['citationpreferee']); $dataform['description'] = utf8_decode($dataform['description']); $dataform['ville'] = utf8_decode($dataform['ville']); $dataform['login'] = utf8_decode($dataform['login']); $dataform['email'] = utf8_decode($dataform['email']); $save = $model->fetchEntryField($id, array('email')); $model->save($id, $dataform); // Ajout du mail dans la table Newsletter si il n'est pas d�j� pr�sent dedans $record = $modelNewsletterMail->fetchEntryByMail($dataform['email']); if ($record == -1) { $ancien_mail = $modelNewsletterMail->fetchEntryByMail($save['email']); $modelNewsletterMail->save($ancien_mail['idNewsletterMail'], array('mail' => $dataform['email'])); } // resize picture si image dans formulaire if (!empty($dataform['img'])) { require_once '../library/My/PhpThumb/ThumbLib.inc.php'; $thumb = PhpThumbFactory::create('../www/images/comptes/tmp/' . $ancien_nom); $thumb->resize(100, 100)->save('../www/images/comptes/' . $dataform["img"]); $thumb->resize(25, 25)->save('../www/images/comptes/thumb/' . $dataform["img"]); if (file_exists('../www/images/comptes/tmp/' . $ancien_nom)) { unlink('../www/images/comptes/tmp/' . $ancien_nom); } } return $this->_redirect($this->redirection); } } else { if ($formmdp->isValid($request->getPost())) { $val = $formmdp->getValues(); $val2['password'] = sha1('l@g8?' . $val['newpassword'] . 'pe6r!e8'); $model->save($id, $val2); return $this->_redirect($this->redirection); } } } else { if ($id > 0) { $data = $model->fetchEntry($id); $date = new Zend_Date($data['datenaissance']); $data['datenaissance'] = $date->toString('dd/MM/Y'); $data['nom'] = utf8_encode($data['nom']); $data['prenom'] = utf8_encode($data['prenom']); $data['jeuxprefere'] = utf8_encode($data['jeuxprefere']); $data['configpc'] = utf8_encode($data['configpc']); $data['citationpreferee'] = utf8_encode($data['citationpreferee']); $data['description'] = utf8_encode($data['description']); $data['ville'] = utf8_encode($data['ville']); $data['login'] = utf8_encode($data['login']); $form->populate($data); $smarty->assign('img', $data['img']); } } if ($log->_getTypeConnected('admin')) { if ($id > 0) { $smarty->assign('title', 'Modification Compte'); } else { $smarty->assign('title', 'Ajout Compte'); } } else { $smarty->assign('title', 'Modifier mon compte'); } $smarty->assign('base_url', $request->getBaseUrl()); $smarty->assign('form', $form); $smarty->assign('formmdp', $formmdp); $smarty->display('compte/form.tpl'); } else { $smarty->display('error/errorconnexion.tpl'); } }
public function resoudreAction() { $smarty = Zend_Registry::get('view'); $request = $this->getRequest(); $id = (int) $request->getParam('id', 0); $log = new SessionLAG(); $form = $this->_getBugForm($id, $log->_getType()); $model = $this->_getModel(); if ($this->getRequest()->isPost()) { if ($form->isValid($request->getPost())) { $dataform = $form->getValues(); $model->save($id, $form->getValues()); if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) { return $this->_helper->redirector('indexadmin'); } else { $smarty->display('error/errorconnexion.tpl'); } } } else { if ($id > 0 && ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin'))) { $data = $model->fetchEntry($id); $form->populate($data); } } if ($id > 0) { $smarty->assign('title', 'Resoudre un Bug'); } $smarty->assign('data', $data); $smarty->assign('form', $form); $smarty->display('bug/resoudre.tpl'); }