function create($sitemap_name = '') { if(!$sitemap_name) $sitemap_name = SS_ADMIN_TO_USERFILE . "/sitemap.xml"; if(empty($sitemap_name)) $sitemap_name = "sitemap_" . $rep_name . ".xml"; $changefreq = array('daily', 'weekly', 'monthly'); $priority = array('0.1', '0.5', '1.0'); $tab_archive = array(); rsort($tab_archive); $xml = simplexml_load_file(SS_ADMIN_TO_USERFILE . '/google/sitemap_base.xml'); //scan bdd $sql = "SELECT * FROM page WHERE etat = 1"; $res = CBdd::select($sql); while($page = mysql_fetch_array($res)) { $url = $xml->addChild('url'); $url->addChild('loc', CUrl::get_urlsite() . "/" . CFunction::formate_chaine(utf8_decode($page['nom']), '-') . "_p" . $page['id']. ".html"); $url->addChild('lastmod', CDate::formate_date($page['date'])); $url->addChild('changefreq', $changefreq[rand(0, 2)]); $url->addChild('priority', $priority[rand(0, 2)]); } $html = $xml->asXML(); file_put_contents($sitemap_name, $html); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AUser(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AUser'])) { $model->attributes = $_POST['AUser']; $model->password = CFunction::encrypt($_POST['AUser']['password'], Yii::app()->params->hashkey); $model->user_group_id = $_REQUEST['group_id']; $model->created_date = time(); if ($_REQUEST['group_id'] == 4) { $listTrainee = Yii::app()->session->get('listTrainee') ? json_decode(Yii::app()->session->get('listTrainee'), true) : array(); } if ($model->save()) { if ($_REQUEST['group_id'] == 4) { if (!empty($listTrainee)) { foreach ($listTrainee as $item) { $modelTraineeTeam = ATrainingTeam::model()->find('team_leader_id=' . $model->id . ' AND trainee_id=' . $item['id']); if (empty($modelTraineeTeam)) { $modelTraineeTeam = new ATrainingTeam(); $modelTraineeTeam->team_leader_id = $model->id; $modelTraineeTeam->trainee_id = $item['id']; } if ($modelTraineeTeam->save()) { unset($_SESSION['listTrainee']); } } } } Yii::app()->user->setFlash('success', 'Đã tạo mới thành công'); $this->redirect(array('admin', 'group_id' => $_REQUEST['group_id'])); } } $this->render('create', array('model' => $model)); }
static function get_option($rep="SS_ADMIN_TO_USERFILE/userfiles/file/reference", $selectval) { $rep = str_replace('SS_ADMIN_TO_USERFILE', SS_ADMIN_TO_USERFILE, $rep); $res = CFunction::list_doc($rep); foreach($res as $tabfile) { echo "<option " . CFormFile::get_selected($tabfile, $selectval) . " >" . $tabfile . "</option>"; } }
static function get_option($rep="SS_ADMIN_TO_USERFILE/userfiles/image/bandeau", $selectval) { $rep = str_replace('SS_ADMIN_TO_USERFILE', SS_ADMIN_TO_USERFILE, $rep); $res = CFunction::list_doc($rep); $html = ''; foreach($res as $tabimg) { $html .= "<option " . CFormImg::get_selected($tabimg, $selectval) . " >" . $tabimg . "</option>"; } return $html; }
static function get_option($rep="SS_ADMIN_TO_USERFILE/userfiles/template", $selectval) { $rep = str_replace('SS_ADMIN_TO_USERFILE', SS_ADMIN_TO_USERFILE, $rep); $res = CFunction::list_doc($rep); $html = ''; foreach($res as $tabimg) { if(in_array(CFile::get_extension($tabimg), array('png', 'gif', 'jpg'))) { $html .= "<option " . CFormImg::get_selected($tabimg, $selectval) . " >" . $tabimg . "</option>"; } } return $html; }
static function page_protect($url_redirection='../src/login.php') { if(!CLogin::est_logue()) { CFunction::redirection($url_redirection); } else if(!CTableUser::is_admin($_SESSION['idmbr'])) { if(!in_array(basename($_SERVER['SCRIPT_NAME']), array('categorie.php', 'article.php', 'page.php', 'fichier.php', 'dossier.php', 'login.php', 'index.php', 'menu_semaine.php', 'image_menu.php'))) { CFunction::redirection('../src/index.php'); } } }
function delete_user($md5_id) { $sql = "SELECT email FROM user WHERE md5(id) = '".$md5_id."'"; $user_email = CBdd::select_one($sql, 'email'); $sql = "SELECT * FROM email WHERE destinataire LIKE '%".$email."%'"; $result = CBdd::select($sql); $count = mysql_num_rows($result); if(count($count)) { while($email = mysql_fetch_array($result, MYSQL_ASSOC)) { $destinataire = $email['destinataire']; $destinataire = str_replace($user_email, '', $destinataire); $destinataire = str_replace(array(',,', ';;', ';'), ",", $destinataire); $email['destinataire'] = trim($destinataire, ','); if(empty($destinataire)) { $_email = new CTableEmail(array('id'=>$email['id'])); $_email->delete(); } else { //unset($email[id]); $email['text'] = CFunction::addslashes($email['text']); if(empty($email['id_campagne'])) { $email['id_campagne'] = 0; } if(empty($email['id_groupe'])) { $email['id_groupe'] = 0; } $_email = new CTableEmail($email); $_email->update(); } } } $sql = "DELETE FROM user WHERE md5(id) = '" . $md5_id . "'"; return CBdd::delete($sql); }
public function actionCreateTrainee() { $cs = Yii::app()->getClientScript(); //$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/ckeditor/ckeditor.js'); $cs->registerCssFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.css'); $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/bootstrap-datepicker/bootstrap-datetimepicker.js', CClientScript::POS_END); $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.ui.widget.js', CClientScript::POS_END); $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.js', CClientScript::POS_END); $model = new WUser(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['WUser'])) { $model->attributes = $_POST['WUser']; $model->password = CFunction::encrypt(Yii::app()->params->password_default, Yii::app()->params->hashkey); $model->supervisor_code = Yii::app()->user->id; $model->status = 1; if ($model->save()) { $this->redirect(array('AllTrainee')); } } $this->render('createtrainee', array('model' => $model)); }
public function actionActivation() { $email = $_GET['email']; $activekey = $_GET['activekey']; if ($email && $activekey) { $model = new wUsers(); $find = wUsers::model()->findByAttributes(array('email' => $email)); if (isset($find) && $find->status) { $this->render('message', array('title' => Yii::t('web/app', 'active_user'), 'content' => Yii::t("web/app", "actived"))); } elseif (isset($find->active_key) && $find->active_key == $activekey) { $find->active_key = CFunction::random_generator(Yii::app()->params->number_active); $find->status = 1; if ($model->updateActive(1, $find->activekey, $email)) { $this->render('message', array('title' => Yii::t('web/app', 'active_user'), 'content' => Yii::t("web/app", "actived_success"))); } } else { $this->render('message', array('title' => Yii::t('web/app', 'active_user'), 'content' => Yii::t("web/app", "actived_url_failed"))); } } else { $this->render('/users/message', array('title' => Yii::t('web/app', 'active_user'), 'content' => Yii::t("web/app", "actived_url_failed"))); } }
public static function highlight_keywords($text, $keyword) { $color = Yii::app()->params->color; $tag_start = "<span style='background-color:" . $color . "'>"; $tag_end = "</span>"; if ($text != '' && $keyword != '') { $original = $text; $text = CFunction::vn_str_filter(strtolower($text)); $tagLen = strlen($tag_start) + strlen($tag_end); $keyword = CFunction::vn_str_filter(strtolower($keyword)); $current = $offset = $delta = 0; $len = mb_strlen($keyword, "utf-8"); $total = mb_strlen($text, "utf-8"); while (false !== ($pos = strpos($text, $keyword, $offset))) { $original = mb_substr($original, 0, $pos + $delta, "utf-8") . $tag_start . mb_substr($original, $pos + $delta, $len, "utf-8") . $tag_end . mb_substr($original, $pos + $delta + $len, $total, "utf-8"); $delta += $tagLen; $offset = $pos + 1; } return $original; } else { return $text; } }
case 5 : // Modifier 1 //$tconfig = new CTableConfiguration(array('id'=>$id)); if(!empty($_GET['id'])) $id = $_GET['id']; $Zsql = "SELECT * FROM configuration WHERE id = ".$id; //print_r($Zsql); $configuration = CBdd::select_row($Zsql) ; //$configuration = $tconfig->select_row(); $nom = $configuration['nom']; $valeur = $configuration['valeur']; $choix = $configuration['choix']; break; case 55 : // Modifier 2 if(!empty($_POST['id'])) $id = $_POST['id']; if(!empty($_POST['valeur'])) $valeur = CFunction::addslashes(trim($_POST['valeur'])); if ($valeur=="") { $error_type = 2; $error_signe['valeur'] = "*"; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = "Champ non valide"; break; } CBdd::update("UPDATE configuration SET valeur='".$valeur."' WHERE id=".$id.""); //$tconfig = new CTableConfiguration(array('id'=>$id, 'valeur'=>$valeur)); //$tconfig ->update(); $msginfo = "configuration bien modifiée"; $a = 0;
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ASystemUser(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['ASystemUser'])) { //var_dump($_POST['SystemUser']); exit(); $model->attributes = $_POST['ASystemUser']; //var_dump(Yii::app()->params->hashkey); exit(); $model->id = Utils::GUID(); $model->created_date = date("ymdHis"); $model->password = SystemUser::encrypt($_POST['ASystemUser']['password'], Yii::app()->params->hashkey); $model->phonenumber = $_POST['ASystemUser']['phonenumber']; //$model->cp_code = $_POST['ASystemUser']['cp_code']; if (!CFunction::checkPasswordStrength($_POST['ASystemUser']['password'], 8)) { Yii::app()->user->setFlash('warning', 'Yêu cầu Mật khẩu phải chứa ít nhất 1 kí tự thường, ít nhất 1 kí tự HOA, ít nhất 1 chữ số và ít nhất 1 kí tự đặc biệt.'); $this->redirect(array('aSystemUser/create')); exit; } if ($model->save()) { Yii::app()->user->setFlash('success', Yii::t('adm/user', 'success_user') . " <b>{$model->username}</b>"); $this->redirect(array('admin')); //$modelUser = new AUser; // $modelUser->user_id = $model->id; // $modelUser->username = $model->username; // $modelUser->phone = $model->phonenumber; // $modelUser->email = $model->email; // if($modelUser->save()){ // // } } } $this->render('create', array('model' => $model)); }
if ( $envoi['type_envoi'] == 0 ){ $sql = "SELECT nom FROM groupe WHERE id = ".$envoi['id_groupe']; $groupe = CBdd::select_one($sql, 'nom'); } elseif ( $envoi['type_envoi'] == 1 ){ $sql = "SELECT nom FROM gr_groupe WHERE id = ".$envoi['id_groupe']; $gr_groupe = CBdd::select_one($sql, 'nom'); } ?> <tr> <td><?php echo $envoi['id']; ?></td> <td>Envoi <?php echo $i; ?></td> <td><?php echo $groupe;?></td> <td><?php echo $gr_groupe;?></td> <td title="<?php echo CFunction::force_stripslashes($text); ?>"><?php echo $text;?></td> <td>J<?php echo $diff?'+':'', $diff; ?></td> <td><?php echo preg_replace('/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})/', '\3/\2/\1', $envoi['date']); ?></td> <td> <span class="action" title="Envoi <?php echo $i; ?>" onclick="javascript:actionEnvoi(this, <?php echo $envoi['id']; ?>, 4)">Afficher</span> : <span class="action" title="Envoi <?php echo $i; ?>" onclick="javascript:actionEnvoi(this, <?php echo $envoi['id']; ?>, 5)">Modifier</span> </td> <td align="center"> <span class="action" title="Envoi <?php echo $i; ?>" onclick="javascript:actionEnvoi(this, <?php echo $envoi['id']; ?>, 3)">Supprimer</span> </td> </tr> <?php $i++; unset($groupe); unset($gr_groupe); } ?>
$iNbMails = 0; $zfic = ''; foreach($tab_fic as $iKey=>$tfic){ $iNbMails += CTableMoulGp::get_iEmail($tfic); CTableMoulGpFic::insert($igrp,$tfic); } $iNbFic = count($tab_fic); CTableGrpMl::update_set($iNbFic,$iNbMails,$igrp); CTableMoulGpFic::insert($igrp,$zfic); CTableMoulGpFic::delete_elmvide(); $msginfo = "Votre groupe a été bien ajouté"; } else { $msginfo = "Enregistrement de groupe non valide car il n'y avait pas de fichier choisi"; } CFunction::redirection("moul_groupe.php?a=0"); break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $iPcur = 1; $iNpp = (!empty($_SESSION['iNpp'])) ? $_SESSION['iNpp'] : "50"; $grp = (!empty($_SESSION['grp'])) ? $_SESSION['grp'] : 0; $istart = ($iPcur-1)*$iNpp; $tGroups = CTableGrpMl::get_elms(); $tGrpWOFic = CTableGrpMl::get_elms(1); $tMGp = CTableMoulGp::select($istart,$iNpp,$grp,$order); ?>
<style type="text/css"> body { padding:15px; text-align:justify; } label { color: gray; width:40px; } #message { border:1px dashed gray; padding : 5px; } </style> <style type="text/css"> <?php echo $cible['style'] ?> </style> </head> <body> <p> <label>Sujet :</label><?php echo $cible['nom'] ?> </p> <div id="message"> <?php echo CFunction::force_stripslashes($cible['text']) ?> </div> </body> </html>
$art = $tart->select_row(); $old_nom = $art['nom']; if ($nom=="") { $error_type = 1; $error_signe['nom'] = "*"; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = "Champ non valide"; $a = 5; break; } $tart= new CTableGroupe(array('id'=>$id, 'nom'=>CFunction::addslashes($nom), 'etat'=>$etat)); $tart->update(); CBdd::update("UPDATE email SET destinataire = '".$nom."' WHERE destinataire = '".$old_nom."'"); $msginfo = "groupe bien modifié"; $a = 0; break; case 555 : // Vider if(!empty($_GET['id'])) $id = $_GET['id']; $tgroupe= new CTableGroupe(array('id'=>$id, 'text'=>'')); $_group = $tgroupe->select_row(); $nom = $_group['nom']; $etat = $_group ['etat'];
function export($separator = ',') { $id_groupe = $this->table['id']; $nom_groupe = self::get_element($id_groupe); $nom_csv = CFunction::formate_chaine($nom_groupe) . ".csv"; header("Content-Type: application/csv-tab-delimited-table"); header("Content-disposition: filename=" . $nom_csv); $resQuery = CBdd::select("SELECT civilite, nom, prenom, societe, adresse, cp, ville, pays, email, telephone, mobile, web FROM user WHERE id IN (" . implode(",", self::get_array_id_user($id_groupe)) . ")"); if ($resQuery) { // titre des colonnes $fields = mysql_num_fields($resQuery); $i = 0; $field_name = ''; while ($i < $fields) { $field_name .= '"' . mysql_field_name($resQuery, $i).'"'.$separator; $i++; } $field_name = trim($field_name, $separator); echo $field_name . "\r\n"; // donn�es de la table while ($arrSelect = mysql_fetch_array($resQuery, MYSQL_ASSOC)) { $data = ''; foreach($arrSelect as $key=>$elem) { if($key == "civilite") { $elem = CTableCivilite::get_name($elem); } elseif ($key == "pays") { $elem = CTablePays::get_name($elem); } $data .= '"' . html_entity_decode($elem) . '"'.$separator; } $data = trim($data, $separator); echo $data . "\r\n"; } return 1; } else { return 0; } }
function create_login($nom) { $login = ''; $id = null; do { list($usec, $sec) = explode(' ', microtime()); $init = (float) $sec + ((float) $usec * 100000); mt_srand($init); $rand = mt_rand(); $salt = strtolower(substr(md5($rand),0,5)); $login = CFunction::chaine_to_ascii($nom).'_'.$salt; $id = CTableUser::get_id($login); } while($id); return $login; }
$ttzDatas =$oDataCsv->get_data(); foreach ($ttzDatas as $iKey=>$tzDatas) { $test = 0; for($i = 0; $i<$count; $i++){ if($tzDatas[0] == $testDoublement[$i]['mtp_zMail']) { $test += 1; } } if($test == 0){ CTableMoultmp::insert($tzDatas[0],$iIdFic['idmax']); } } $msginfo = 'Fichier bien ajouté'; CFunction::redirection("moulinette.php?a=0"); break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $oDatas = CTableMoultmp::select($order); ?> <!-- InstanceEndEditable --> <div id="mainwrap"> <div id="header"><?php include("../nav/header.php"); ?></div> <div id="top"><?php include("../nav/menu_h.php"); ?></div> <div id="filet"> <div id="zonetitre"> <div id="signe"></div>
<style type="text/css"> body { margin: 5mm 25mm; } table { width: 100%; } </style> </head> <body> <?php foreach($destinataires as $destinataire) { $destinataire = preg_replace("/.*<body[^>]*>|<\/body>.*/si", "", $destinataire); ?> <div style="text-align: left;"><?php echo $expediteur; ?></div> <div style="text-align: right;"><?php echo $destinataire; ?></div> <div style="text-align: left;"><?php echo $objet; ?></div> <div style="text-align: right;"><?php echo $date; ?></div> <div style="margin-top: 25mm;"> <?php echo CFunction::force_stripslashes($message); ?> </div> <table style="page-break-after: always;"><tr><td> </td></tr></table> <?php } ?> </body> </html>
} if(!empty($submit_lg)) { if(!empty($_POST['login_lg'])) $login_lg = $_POST['login_lg']; else if(!empty($_GET['login_lg'])) $login_lg = $_GET['login_lg'] ; if(!empty($_POST['passe_lg'])) $passe_lg = $_POST['passe_lg']; else if(!empty($_GET['passe'])) $passe_lg = $_GET['passe_lg'] ; if(!($id_membre = CLogin::login_ok($login_lg, $passe_lg, " and (type = 1 or type = 2) and etat = 1"))) { $errmsg_lg = "Login erroné ou ne donnant droit a l'administration"; } else { $_SESSION['login'] = $login_lg; $_SESSION['passe'] = $passe_lg; $_SESSION['idmbr'] = $id_membre; CFunction::redirection("../src/index.php"); } } ?> <!-- InstanceEndEditable --> <div id="mainwrap"> <div id="header"><?php include("../nav/header.php"); ?></div> <div id="top"><?php include("../nav/menu_h.php"); ?></div> <div id="filet"> <div id="zonetitre"> <div id="signe"></div> <div id="titre"><!-- InstanceBeginEditable name="titre" -->Login<!-- InstanceEndEditable --></div> </div> </div> <div id="contentarea"> <div id="left"><?php include("../nav/menu_g.php"); ?></div>
$rdv->reverse_etat(); break; case 3 : // Modifier etat if(!empty($_GET['id'])) $id = $_GET['id']; break; case 33 : // Supprimer if(!empty($_GET['id'])) $id = $_GET['id']; $rdv = new CTableGrRdv(array('table'=>'gr_rdv', 'id'=>$id)); $rdv->delete(); break; case 5 : // Modifier 1 if(!empty($_GET['id'])) $id = $_GET['id']; CFunction::redirection("../src/gr_user.php?a=5&id=" . $id); break; case 6 : // Filtrer CSession::save($_GET); break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $filtre_etat = CSession::get('filtre_etat', $etat); $filtre_date_debut = CDate::date_switch(CSession::get('filtre_date_debut')); $filtre_date_fin = CDate::date_switch(CSession::get('filtre_date_fin')); if ($_GET['filtre_id_periode']!='%%'){
if ($nom=='') { $error_type = 1; $error_signe['nom'] = '*'; } if ($pays=='') { $error_type = 2; $error_signe['pays'] = '*'; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = 'Champ non valide'; break; } $values = array('id_dep'=>$id, 'nom'=>CFunction::addslashes($nom), 'pays'=>CFunction::addslashes($pays)); $tcat = new CTableDepartement($values); $tcat->update(); $msginfo = 'Menu bien modifié'; $a = 0; break; case 6 : // Filtrer Menu if(isset($_GET['idpays'])) $idpays = $_GET['idpays']; $_SESSION['idpays'] = $idpays; break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/
case 555 : //Suppr dans modif if(!empty($_GET['idtmp'])) $idtmp = $_GET['idtmp']; CTableMoulGrpTmp::update($idtmp); CFunction::redirection("moul_groupe_mail.php?a=5555&id=".$_SESSION['id']); break; case 5555 : //Liste dans modif if(!empty($_GET['id'])) $id = $_GET['id']; $oFics = CTableMoulGrpTmp::select_not_null(); break; case 55555 : //Suppr check box dans modif foreach($tab_fic as $tab){ CTableMoulGrpTmp::update($tab); } CFunction::redirection("moul_groupe_mail.php?a=5555&id=".$_SESSION['id']); break; case 6 : // Vider un groupe if(!empty($_GET['id'])) $id = $_GET['id']; break; case 66: //Vider un groupe : validation if(!empty($_GET['id'])) $id = $_GET['id']; CTableMoulGpFic::delete_elm($id); CTableGrpMl::update_set(0,0,$id); $a = 0; break; } /**-----------------
if(!empty($_POST['etat'])) $etat = $_POST['etat']; if(!empty($_POST['pieId'])) $pieId = $_POST['pieId']; if(!empty($_POST['texId'])) $texId = $_POST['texId']; if ($nom=="") { $error_type = 1; $error_signe['nom'] = "*"; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = "Champ non valide"; $a = 5; break; } $tart= new CTableOpportunite(array('id'=>$id, 'nom'=>CFunction::addslashes($nom), 'pieId'=>$pieId, 'texId'=>$texId, 'etat'=>$etat)); $tart->update(); $msginfo = "opportunité bien modifiée"; $a = 0; break; case 6 : // Filtrer if(!empty($_GET['idcat'])) $idcat = $_GET['idcat']; $_SESSION['idcat'] = $idcat; break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $select = "*";
<?php include("../inc/init.php"); $imap = new CImap("cyber-consult.ch", "*****@*****.**", "n8bk0QaE"); $imap->connect(); CFunction::print_r($imap->download_file($_GET['message_number'], $_GET['filename'])); ?>
if(!empty($_POST['etat'])) $etat = $_POST['etat']; if(!empty($_POST['text'])) $text = trim($_POST['text']); if(!empty($_POST['style'])) $style = trim($_POST['style']); if ($nom=="") { $error_type = 1; $error_signe['nom'] = "*"; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = "Champ non valide"; $a = 5; break; } $tdes = new CTableTexte(array('id'=>$id, 'nom'=>CFunction::addslashes($nom), CTableUser::is_admin($_SESSION['idmbr']) ? "'etat'=>$etat" : "", 'text'=>CFunction::addslashes($text), 'style'=>CFunction::addslashes($style))); $tdes->update(); $msginfo = "texte bien modifié"; $a = 0; break; case 6 : // Filtrer 1 if(!empty($_GET['idcat'])) $idcat = $_GET['idcat']; $_SESSION['idcat'] = $idcat; $_SESSION['idart'] = 0; break; case 66 : // Filtrer 2 if(!empty($_GET['idart'])) $idart = $_GET['idart']; $_SESSION['idart'] = $idart; break;
public function actionChangepassupdate() { // check login if (empty(Yii::app()->user->id)) { $this->redirect(Yii::app()->createurl('')); } $id_user = Yii::app()->user->id; $model = WUserUpdate::model()->findByPk($id_user); if (!empty($id_user)) { $criteria = new CDbCriteria(); $criteria->select = array('*'); $criteria->addCondition('id=' . $id_user); $data = WUser::model()->find($criteria); $data = CJSON::decode(CJSON::encode($data)); // print_r($data);die; } if (!empty($data)) { $check_save = 1; $old_pass = ''; $new_pass = ''; if (!empty($_REQUEST['currentpass'])) { $pass = CFunction::encrypt($_REQUEST['currentpass'], Yii::app()->params->hashkey); // $pass = $_REQUEST['currentpass']; // var_dump($pass); if ($data['password'] == $pass) { $check_save = 1; } else { $check_save = 0; $old_pass = '******'; } } else { $check_save = 0; $old_pass = '******'; } if ($check_save == 1) { if (!empty($_REQUEST['newpass'])) { if ($_REQUEST['newpass'] == $_REQUEST['re_newpass']) { $model->password = CFunction::encrypt($_REQUEST['newpass'], Yii::app()->params->hashkey); $new_pass = '******'; if ($model->save()) { } else { $new_pass = '******'; } } else { $new_pass = '******'; $check_save = 0; } } } } $this->render('change_pass', array('old_pass' => $old_pass, 'new_pass' => $new_pass)); }
if ($nom=="") { $error_type = 1; $error_signe['nom'] = "*"; } if (empty($idcat)) { $error_type = 2; $error_signe['idcat'] = "*"; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = "Champ non valide"; $a = 5; break; } $tart= new CTableArticle(array('id'=>$id, 'nom'=>CFunction::addslashes($nom), 'etat'=>$etat, 'idcat'=>$idcat)); $tart->update(); $msginfo = "sous-menu bien modifié"; $a = 0; break; case 6 : // Filtrer if(!empty($_GET['idcat'])) $idcat = $_GET['idcat']; $_SESSION['idcat'] = $idcat; break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $select = "*";
if(!empty($_POST['id'])) $id = $_POST['id']; if(!empty($_POST['question'])) $question = trim($_POST['question']); if(!empty($_POST['reponse'])) $reponse = trim($_POST['reponse']); if(!empty($_POST['etat'])) $etat = $_POST['etat']; if ($question=='') { $error_type = 2; $error_signe['question'] = '*'; } if ($error_type > 0) { //erreur de type champ non valide $msginfo = 'Champ non valide'; break; } $values = array('id'=>$id, 'etat'=>$etat, 'question'=>CFunction::addslashes($question), 'reponse'=>CFunction::addslashes($reponse)); $tfaq = new CTableFaq($values); $tfaq->update(); $msginfo = 'FAQ bien modifié'; $a = 0; break; } /*------------------------------------------------------ A FAIRE DANS TOUS LES CAS --------------------------------------------------------*/ $r_faq = CTableFaq::select("*", 1, $order); ?> <!-- InstanceEndEditable -->