示例#1
0
     } else {
         $i = new Infos('t_' . $type);
         $i->loadInfos('id', $item['id']);
         $i->setAllInfos($item);
         $i->save('id', 'this', false, false);
     }
     $data['error'] = "OK";
     $data['message'] = "OK! '{$type}' " . $LANG['Updated'];
 }
 if ($action === 'deleteSetting') {
     if (!isset($type)) {
         throw new Exception("Missing the type of setting to delete (labels, devs, projectInfo?)");
     }
     $i = new Infos('t_' . $type);
     $i->loadInfos('id', $itemID);
     $i->delete();
     $data['error'] = "OK";
     $data['message'] = $LANG['Item_remove_OK'] . " {$type}.";
 }
 if ($action === 'updatePW') {
     if (!isset($newPW)) {
         throw new Exception("Missing the new password!");
     }
     if (strlen($newPW) < 4) {
         throw new Exception($LANG['Err_PW_too_short']);
     }
     $newPass = md5(PASSWORD_SALT . $newPW);
     $iC = new Infos('t_config');
     $iC->loadInfos('nom', 'password_access');
     $iC->setInfo('value', $newPass);
     $iC->save('id', 'this', false, false);
示例#2
0
 /**
  * Delete a comment and remove it from bug's comment list
  * @param INT $idComm Comment ID
  */
 public function deleteComment($idComm)
 {
     if (!is_int($idComm)) {
         throw new Exception("Bug::updateComment() : comment ID not a integer!");
     }
     $iC = new Infos('t_comments');
     $iC->loadInfos('id', $idComm);
     $iC->delete();
     $commList = json_decode($this->bugData['FK_comment_ID']);
     $commListOK = array();
     foreach ($commList as $comm) {
         if ($comm == $idComm) {
             continue;
         }
         $commListOK[] = $comm;
     }
     $this->bugData['FK_comment_ID'] = json_encode($commListOK);
     $this->bugInfos->setInfo('FK_comment_ID', $this->bugData['FK_comment_ID']);
     $this->save();
 }