コード例 #1
0
 public function formAction()
 {
     $smarty = Zend_Registry::get('view');
     $log = new SessionLAG();
     if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) {
         $request = $this->getRequest();
         $id = (int) $request->getParam('id', 0);
         $form = $this->_getInformationForm($id);
         $model = $this->_getModel();
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($request->getPost())) {
                 $dataform = $form->getValues();
                 if (empty($dataform['img'])) {
                     unset($dataform['img']);
                 } else {
                     $nom_image = $dataform["titre"];
                     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];
                 }
                 $model->save($id, $dataform);
                 // resize picture si image dans formulaire
                 if (!empty($dataform['img'])) {
                     require_once '../library/My/PhpThumb/ThumbLib.inc.php';
                     $thumb = PhpThumbFactory::create('../public/images/info/' . $ancien_nom);
                     $thumb->adaptiveResize(475, 225)->save('../public/images/info/' . $dataform["img"]);
                     $thumb->adaptiveResize(75, 50)->save('../public/images/info/thumb/' . $dataform["img"]);
                     if (file_exists('../public/images/info/' . $ancien_nom)) {
                         unlink('../public/images/info/' . $ancien_nom);
                     }
                 }
                 return $this->_helper->redirector('indexadmin');
             }
         } else {
             if ($id > 0) {
                 $data = $model->fetchEntry($id);
                 $form->populate($data);
             }
         }
         if ($id > 0) {
             $smarty->assign('title', 'Modification Information');
         } else {
             $smarty->assign('title', 'Ajout Information');
         }
         $smarty->assign('form', $form);
         $smarty->display('information/form.tpl');
     } else {
         $smarty->display('error/errorconnexion.tpl');
     }
 }
コード例 #2
0
 public function formAction()
 {
     $smarty = Zend_Registry::get('view');
     $log = new SessionLAG();
     if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) {
         $request = $this->getRequest();
         $id = (int) $request->getParam('id', 0);
         $form = $this->_getPlansiteForm($id);
         $model = $this->_getModel();
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($request->getPost())) {
                 $dataform = $form->getValues();
                 if ($id == 0) {
                     $nb = $model->countEntries();
                     $dataform['ordre'] = $nb + 1;
                 }
                 if (empty($dataform['logo'])) {
                     unset($dataform['logo']);
                 } else {
                     $nom_image = $dataform["titre"];
                     require_once '../library/My/Utils.php';
                     $chaine_valide = valideChaine($nom_image);
                     $ext = explode('.', $dataform["logo"]);
                     $ancien_nom = $dataform['logo'];
                     $dataform['logo'] = $chaine_valide . '.' . $ext[1];
                 }
                 if (!empty($dataform["creer_type"])) {
                     $dataform["type"] = $dataform["creer_type"];
                 }
                 unset($dataform["creer_type"]);
                 $model->save($id, $dataform);
                 return $this->_helper->redirector('indexadmin');
             }
         } else {
             if ($id > 0) {
                 $data = $model->fetchEntry($id);
                 $form->populate($data);
             }
         }
         $form->RemplirType($model->fetchEntriesTypes());
         if ($id > 0) {
             $smarty->assign('title', 'Modification Plan du Site');
         } else {
             $smarty->assign('title', 'Ajout Plan du Site');
         }
         $smarty->assign('form', $form);
         $smarty->display('plansite/form.tpl');
     } else {
         $smarty->display('error/errorconnexion.tpl');
     }
 }
コード例 #3
0
 public function formAction()
 {
     $smarty = Zend_Registry::get('view');
     $log = new SessionLAG();
     if ($log->_getTypeConnected('superadmin') || $log->_getTypeConnected('admin')) {
         $request = $this->getRequest();
         $id = (int) $request->getParam('id', 0);
         $form = $this->_getMultimediaForm($id);
         $model = $this->_getModel();
         $data = $model->fetchEntry($id);
         if ($this->getRequest()->isPost()) {
             $dataform = $form->getValues();
             $dataform["titre"] = utf8_decode($dataform["titre"]);
             $dataform["dossier"] = valideChaine($dataform["dossier"]);
             if ($id == 0 && !file_exists('images/photos/' . $dataform["dossier"] . '/')) {
                 mkdir('images/photos/' . $dataform["dossier"] . '/', 755, true);
             } else {
                 if ($id > 0 && !file_exists('images/photos/' . $dataform["dossier"] . '/')) {
                     rename($data["dossier"], $dataform["dossier"]);
                 }
             }
             $model->save($id, $dataform);
             return $this->_helper->redirector('indexadmin');
         } else {
             if ($id > 0) {
                 $data['titre'] = utf8_encode($data['titre']);
                 $form->populate($data);
             }
         }
         if ($id > 0) {
             $smarty->assign('title', 'Modification Album Photo');
         } else {
             $smarty->assign('title', 'Ajout Album Photo');
         }
         $smarty->assign('form', $form);
         $smarty->display('multimedia/form.tpl');
     } else {
         $smarty->display('error/errorconnexion.tpl');
     }
 }
コード例 #4
0
 public function formAction()
 {
     $smarty = Zend_Registry::get('view');
     $log = new SessionLAG();
     if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) {
         $request = $this->getRequest();
         $id = (int) $request->getParam('id', 0);
         $form = $this->_getNewsForm($id);
         $model = $this->_getModel();
         $modelPartenaire = $this->_getModelPartenaire();
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($request->getPost())) {
                 $dataform = $form->getValues();
                 if (!empty($dataform["creer_type_n"])) {
                     $dataform["type_n"] = $dataform["creer_type_n"];
                 }
                 unset($dataform["creer_type_n"]);
                 if (empty($dataform['img'])) {
                     unset($dataform['img']);
                 } else {
                     $nom_image = $dataform["titre"];
                     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['titre'] = utf8_decode($dataform['titre']);
                 $model->save($id, $dataform);
                 // resize picture si image dans formulaire
                 if (!empty($dataform['img'])) {
                     require_once '../library/My/PhpThumb/ThumbLib.inc.php';
                     $thumb = PhpThumbFactory::create('../www/images/news/' . $ancien_nom);
                     if ($dataform['idPartenaire'] != 0) {
                         $thumb->resize(300, 300)->save('../www/images/news/' . $dataform["img"]);
                     } else {
                         $thumb->resize(140, 140)->save('../www/images/news/' . $dataform["img"]);
                     }
                     if (file_exists('../www/images/news/' . $ancien_nom)) {
                         unlink('../www/images/news/' . $ancien_nom);
                     }
                 }
                 if (!empty($dataform['idPartenaire'])) {
                     return $this->_helper->redirector('indexadminpartenaire');
                 } else {
                     return $this->_helper->redirector('indexadmin');
                 }
             }
         } else {
             if ($id > 0) {
                 $data = $model->fetchEntry($id);
                 $data['titre'] = utf8_encode($data['titre']);
                 $form->populate($data);
             }
         }
         $form->RemplirType($model->fetchEntriesTypes());
         $form->RemplirPartenaire($modelPartenaire->fetchEntries());
         if ($id > 0) {
             $smarty->assign('title', 'Modification News');
         } else {
             $smarty->assign('title', 'Ajout News');
         }
         $smarty->assign('form', $form);
         $smarty->display('news/form.tpl');
     } else {
         $smarty->display('error/errorconnexion.tpl');
     }
 }
コード例 #5
0
 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');
     }
 }
コード例 #6
0
 public function inscriptionmembreAction()
 {
     $smarty = Zend_Registry::get('view');
     $modelLan = $this->_getModelLan();
     $request = $this->getRequest();
     $lan = $modelLan->fetchEntryOuverte();
     $modelCompte = $this->_getModelCompte();
     $login = $modelCompte->fetchEntryByLogin('toti');
     $form = $this->_getCompteForm();
     $smarty->assign('test', $login);
     $login_existant = 0;
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($request->getPost())) {
             $modelCompte = $this->_getModelCompte();
             $modelLanJoueur = $this->_getModelLanJoueur();
             $modelNewsletterMail = $this->_getModelNewsletterMail();
             $modelNewsletterMailType = $this->_getModelNewsletterMailType();
             $dataform = $form->getValues();
             $login = $modelCompte->fetchEntryByLogin($dataform['login']);
             if ($login == -1) {
                 $datenaissance = $dataform['datenaissance'];
                 $dataform['datenaissance'] = substr($datenaissance, 6, 4) . "-" . substr($datenaissance, 3, 2) . "-" . substr($datenaissance, 0, 2) . " 00:00:00";
                 $passwordsave = $dataform['password'];
                 $dataform['password'] = sha1('l@g8?' . $dataform['password'] . 'pe6r!e8');
                 $dataform['keyvalidation'] = sha1(time() + rand());
                 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']);
                 $new_id = $modelCompte->save(0, $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) {
                     $id_mail = $modelNewsletterMail->save(0, array('mail' => $dataform['email']));
                     // li� automatiquement au groupe "Joueurs" des newsletters
                     $modelNewsletterMailType->save(0, array('idNewsletterType' => 2, 'idNewsletterMail' => $id_mail));
                 }
                 // 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);
                     }
                 }
                 $compte = $modelCompte->fetchEntryByLogin($dataform['login']);
                 $modelFonctionCompte = $this->_getModelFonctionCompte();
                 $f['idCompte'] = $compte['idCompte'];
                 $f['idFonction'] = 3;
                 $modelFonctionCompte->save(0, $f);
                 $dataform['passwordsave'] = $passwordsave;
                 $this->sendMailInscriptionMembre($dataform);
                 return $this->_redirect('/inscription/validation');
                 /* Code permettant l'inscription � une LAN
                                       Ce morceau de code doit etre d�plac� � l'endroit voulu
                                       $compte = $modelCompte->fetchEntryByLogin($dataform['login']);
                                       $insc['idLan']=$lan['idLan'];
                                       $insc['idCompte']=$compte['idCompte'];
                                       $insc['paiement']=0;
                                       $insc['validation']=false;
                 
                                       $modelLanJoueur->save(0,$insc);
                                      */
             } else {
                 $login_existant = 1;
             }
         }
     }
     $smarty->assign('login_existant', $login_existant);
     $smarty->assign('titre', 'Inscription sur le site de la LAG');
     $smarty->assign('form', $form);
     $smarty->display('inscription/inscriptionMembre.tpl');
 }
コード例 #7
0
 public function formAction()
 {
     $smarty = Zend_Registry::get('view');
     $log = new SessionLAG();
     if ($log->_getTypeConnected('admin') || $log->_getTypeConnected('superadmin')) {
         $request = $this->getRequest();
         $id = (int) $request->getParam('id', 0);
         $form = $this->_getNewsletterForm($id);
         $model = $this->_getModel();
         $modelType = $this->_getModelType();
         $types = $modelType->fetchEntries();
         $form->RemplirType($types);
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($request->getPost())) {
                 $dataform = $form->getValues();
                 $dataform['idAdmin'] = $log->_getUser();
                 $model->save($id, $dataform);
                 if (!empty($dataform['img'])) {
                     $nom_image = $dataform["titre"];
                     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];
                     require_once '../library/My/PhpThumb/ThumbLib.inc.php';
                     $thumb = PhpThumbFactory::create('../www/images/newsletter/tmp/' . $ancien_nom);
                     $thumb->resize(400, 400)->save('../www/images/newsletter/' . $dataform["img"]);
                     if (file_exists('../www/images/newsletter/tmp/' . $ancien_nom)) {
                         unlink('../www/images/newsletter/tmp/' . $ancien_nom);
                     }
                 }
                 $this->sendMail($dataform);
                 return $this->_helper->redirector('indexadmin');
             }
         } else {
             if ($id > 0) {
                 $data = $model->fetchEntry($id);
                 $form->populate($data);
             }
         }
         if ($id > 0) {
             $smarty->assign('title', 'Lire Newsletter');
         } else {
             $smarty->assign('title', 'Envoyer Newsletter');
         }
         $smarty->assign('form', $form);
         $smarty->display('newsletter/form.tpl');
     } else {
         $smarty->display('error/errorconnexion.tpl');
     }
 }