Example #1
0
 public function postSaveFilter($p, $z)
 {
     $filterId = $_POST['id'] ? $_POST['id'] : null;
     $filter = new Filter($filterId);
     if (isset($_POST['name'])) {
         $filter->name = $_POST['name'];
     }
     $filter->content = json_encode(json_decode($_POST['content'])->subs[0]);
     $filter->save();
     echo json_encode(array('id' => $filter->id));
 }
Example #2
0
 public function executeSave()
 {
     $arr = array();
     $fid = (int) mfwRequest::get('id');
     if ($fid) {
         $arr['id'] = $fid;
     }
     $arr['enable'] = (bool) mfwRequest::get('enable', true);
     $arr['name'] = mfwRequest::get('name');
     $arr['target'] = mfwRequest::get('target');
     $arr['pattern'] = mfwRequest::get('pattern');
     $filter = new Filter($arr);
     $filter->save();
     return $this->redirect('/filters/index');
 }
Example #3
0
$quizHash = isset($_GET['quiz']) ? $_GET['quiz'] : null;
$quiz = Quiz::getByHash($quizHash);
if (empty($quiz->id) || !$quiz->hasAccess()) {
    Ajax::outputError('You don\'t have access to this quiz');
}
$filter = new Filter();
$saveType = 'insert';
if (isset($_GET['filter_id']) && !empty($_GET['filter_id'])) {
    $filter->readId($_GET['filter_id']);
    if (empty($filter->id)) {
        Ajax::outputError('Invalid filter');
    }
    if ($filter->quiz_id != $quiz->id) {
        Ajax::outputError('Invalid filter');
    }
    $saveType = 'update';
}
$data = new stdClass();
$data->question = isset($_GET['question']) ? $_GET['question'] : null;
$data->answer = isset($_GET['answer']) ? $_GET['answer'] : null;
if (!empty($_GET['name'])) {
    $filter->name = $_GET['name'];
}
$filter->setData($data);
$filter->quiz_id = $quiz->id;
$filter->save();
$out = new stdClass();
$out->name = $filter->name;
$out->id = $filter->id;
$out->saveType = $saveType;
Ajax::output($out);
Example #4
0
    $res = Issue::bulkUpdate();
    $tpl->assign('bulk_update_result', $res);
} elseif ($cat == 'set_initial_impact') {
    $res = Issue::setImpactAnalysis($iss_id);
    $tpl->assign('set_initial_impact_result', $res);
} elseif ($cat == 'add_requirement') {
    $res = Impact_Analysis::insert($iss_id);
    $tpl->assign('add_requirement_result', $res);
} elseif ($cat == 'set_impact_requirement') {
    $res = Impact_Analysis::update($isr_id);
    $tpl->assign('set_impact_requirement_result', $res);
} elseif ($cat == 'delete_requirement') {
    $res = Impact_Analysis::remove();
    $tpl->assign('requirement_delete_result', $res);
} elseif ($cat == 'save_filter') {
    $res = Filter::save();
    $tpl->assign('save_filter_result', $res);
} elseif ($cat == 'delete_filter') {
    $res = Filter::remove();
    $tpl->assign('delete_filter_result', $res);
} elseif ($cat == 'remove_support_email') {
    $res = Support::removeAssociation();
    $tpl->assign('remove_association_result', $res);
} elseif ($cat == 'delete_attachment') {
    $res = Attachment::remove($id);
    $tpl->assign('remove_attachment_result', $res);
} elseif ($cat == 'delete_file') {
    $res = Attachment::removeIndividualFile($id);
    $tpl->assign('remove_file_result', $res);
} elseif ($cat == 'remove_checkin') {
    $res = SCM::remove($items);
 /** static functions **/
 function create($vars, &$errors)
 {
     return Filter::save(0, $vars, $errors);
 }
Example #6
0
 /**
  * Add new filter to filter group
  *
  * @param Filter $filter
  */
 public function addFilter(Filter $filter)
 {
     $filter->filterGroup->set($this);
     $filter->save();
 }
Example #7
0
    /**
     * Save a created filter
     * @param sfWebRequest $request
     * @return <type>
     */
    public function executeSaveFilter(sfWebRequest $request) {
		
        $sender_id = $request->getPostParameter('filter_sender') == '' ? -1 : $request->getPostParameter('filter_sender');
        $currentStation_id = $request->getPostParameter('filter_currentstation') == '' ? -1 : $request->getPostParameter('filter_currentstation');
        $mailingList = $request->getPostParameter('filter_mailinglist') == '' ? -1 : $request->getPostParameter('filter_mailinglist');
        $documentTemplate = $request->getPostParameter('filter_documenttemplate') == '' ? -1 : $request->getPostParameter('filter_documenttemplate');

        $filter = new Filter();
        $filter->setFiltername($request->getPostParameter('filter_hiddenname',''));
        $filter->setName($request->getPostParameter('filter_name',''));
        $filter->setSenderId($sender_id);
        $filter->setDaysfrom($request->getPostParameter('filter_daysinprogress_from',''));
        $filter->setDaysto($request->getPostParameter('filter_daysinprogress_to',''));
        $filter->setSendetfrom($request->getPostParameter('filter_sendet_from',''));
        $filter->setSendetto($request->getPostParameter('filter_sendet_to',''));
        $filter->setWorkflowprocessuserId($currentStation_id);
        $filter->setMailinglistversionId($mailingList);
        $filter->setDocumenttemplateversionId($documentTemplate);
        $filter->save();
        $filterId = $filter->getId();
        // save the field grid
        if($request->hasParameter('field')) {
            $fields = $request->getParameter('field');
            $operators = $request->getParameter('operator');
            $values = $request->getParameter('value');
            foreach($fields as $key => $field) {
                $operator = $operators[$key];
                $value = $values[$key];
                if($field != '' AND $operator != '' AND $value != '') {
                    $filterField = new FilterField();
                    $filterField->setFilterId($filterId);
                    $filterField->setFieldId($field);
                    $filterField->setOperator($operator);
                    $filterField->setValue($value);
                    $filterField->save();
                }
                
            }
        }


        $this->renderText('{success:true}');
        return sfView::NONE;
    }
 public function create()
 {
     $details = Input::all();
     $validator = Validator::make(array('question' => $details['question'], 'opta' => $details['opta'], 'optb' => $details['optb'], 'optc' => $details['optc'], 'optd' => $details["optd"]), array('question' => 'required|min:4', 'opta' => 'required|min:4', 'optb' => 'required|min:4|', 'optc' => 'required|min:4', 'optd' => 'required|min:4'));
     if ($validator->fails() || $details['opta'] == $details['optb'] || $details['opta'] == $details['optc'] || $details['opta'] == $details['optd'] || $details['optb'] == $details['optc'] || $details['optb'] == $details['optd'] || $details['optc'] == $details['optd']) {
         return View::make('question_create')->with(array('msg' => "Check your form.Pls Note that the length of the text fields should be > 4", 'title' => 'Post a Question', 'head' => 'Post your question !!!'));
     } else {
         $question = new Question();
         $question->question = $details['question'];
         $question->opta = $details['opta'];
         $question->optb = $details['optb'];
         $question->optc = $details['optc'];
         $question->optd = $details['optd'];
         $question->answer = $details['answer'];
         $question->difficulty = $details['difficulty'];
         $question->category = $details['category'];
         $question->posted_by = Auth::user()->id;
         $question->save();
         $filter = new Filter();
         $filter->qid = DB::table('questions')->orderBy('qid', 'desc')->where('posted_by', Auth::user()->id)->take(1)->pluck('qid');
         $filter->uid = Auth::user()->id;
         $filter->save();
         return Redirect::to('/home');
     }
 }
 /**
  * Import zKillboard kills for the selected systems and alliances.
  */
 public function getZkillboard($systems = '')
 {
     // If this is the initial call to the function, retrieve the list of systems from the DB.
     if ($systems == '') {
         $systems_object = Setting::where('key', 'systems')->firstOrFail();
         $systems = $systems_object->value;
     }
     // Convert the comma-seperated string into an array.
     $systems_array = explode(',', $systems);
     // If there are more systems in the list than we want to pull at once, chop off the first X and call this function again.
     while (count($systems_array) > $this->api_system_limit) {
         $this->getZkillboard(implode(',', array_splice($systems_array, 0, $this->api_system_limit)));
     }
     // Retrieve the selected alliances from the database.
     $alliances = Setting::where('key', 'alliances')->firstOrFail();
     // Build the API URL.
     $url = 'https://zkillboard.com/api/xml/losses/no-attackers/' . 'allianceID/' . preg_replace('/\\s+/', '', $alliances->value) . '/' . 'solarSystemID/' . preg_replace('/\\s+/', '', $systems) . '/';
     // Send the request.
     $response = Request::get($url)->addHeader('Accept-Encoding', 'gzip')->addHeader('User-Agent', 'Eve Traders Handbook')->send();
     if (isset($response->body) && strlen($response->body) > 0) {
         $body = simplexml_load_string(gzdecode($response->body));
         $insert_count = 0;
         // Parse the response, inserting the losses into the database.
         foreach ($body->result->rowset->row as $row) {
             // First check whether this kill has not already been recorded.
             $kill = Kill::find($row['killID']);
             if (!isset($kill->killID)) {
                 // Create and save the new kill record.
                 $kill = new Kill();
                 $kill->killID = $row['killID'];
                 $kill->solarSystemID = $row['solarSystemID'];
                 $kill->characterID = $row->victim['characterID'];
                 $kill->characterName = $row->victim['characterName'];
                 $kill->allianceID = $row->victim['allianceID'];
                 $kill->corporationID = $row->victim['corporationID'];
                 $kill->shipTypeID = $row->victim['shipTypeID'];
                 $kill->killTime = $row['killTime'];
                 $kill->save();
                 $insert_count++;
                 // Insert the alliance information into the database unless it already exists.
                 $alliance = Alliance::find($kill->allianceID);
                 if (!isset($alliance->id)) {
                     $alliance = new Alliance();
                     $alliance->id = $kill->allianceID;
                     $alliance->allianceName = $row->victim['allianceName'];
                     $alliance->save();
                 }
                 // Insert the corporation information into the database unless it already exists.
                 $corporation = Corporation::find($kill->corporationID);
                 if (!isset($corporation->id)) {
                     $corporation = new Corporation();
                     $corporation->id = $kill->corporationID;
                     $corporation->corporationName = $row->victim['corporationName'];
                     $corporation->save();
                 }
                 // Insert the ship type that was lost into the database unless it already exists.
                 $ship = Ship::find($kill->shipTypeID);
                 $type = Type::find($kill->shipTypeID);
                 if (!isset($ship->id)) {
                     $ship = new Ship();
                     $ship->id = $kill->shipTypeID;
                     $ship->shipName = $type->typeName;
                     $ship->save();
                 }
                 // Insert the ship loss into the items database as well.
                 if (stristr($ship->shipName, 'Capsule') === FALSE) {
                     $item = new Item();
                     $item->killID = $row['killID'];
                     $item->typeID = $kill->shipTypeID;
                     $item->typeName = $type->typeName;
                     $item->categoryName = $type->group->category['categoryName'];
                     $item->metaGroupName = isset($type->metaType->metaGroup['metaGroupName']) ? $type->metaType->metaGroup['metaGroupName'] : '';
                     $item->allowManufacture = 1;
                     $item->qty = 1;
                     $item->save();
                 }
                 // Add the category to the list of filters available on the site.
                 $filter = Filter::find($type->group->category['categoryID']);
                 if (!isset($filter->categoryID)) {
                     $filter = new Filter();
                     $filter->categoryID = $type->group->category['categoryID'];
                     $filter->categoryName = $type->group->category['categoryName'];
                     $filter->iconID = $type->group->category['iconID'];
                     $filter->save();
                 }
                 // Loop through the items lost in the kill. Insert each one into the items table.
                 if (isset($row->rowset->row)) {
                     foreach ($row->rowset->row as $loss) {
                         $typeID = (int) $loss['typeID'];
                         $item = Item::where('typeID', '=', $typeID)->first();
                         // If this item already exists in the items table, we don't need to re-query all the additional
                         // information, we can just copy it from an existing row.
                         if (isset($item)) {
                             // This type has already been seen. Duplicate the record and save the new instance.
                             $clone = new Item();
                             $clone = $item->replicate();
                             // Update the right killID and quantity, and unset the primary key and date columns.
                             $clone->killID = $row['killID'];
                             $clone->qty = $loss['qtyDropped'] + $loss['qtyDestroyed'];
                             unset($clone->id);
                             unset($clone->created_at);
                             unset($clone->updated_at);
                             // Save the cloned row.
                             $clone->save();
                         } else {
                             // This is a never-before-seen lost item. Create a new row and look up all the related details.
                             $item = new Item();
                             $type = Type::find($typeID);
                             $item->killID = (int) $row['killID'];
                             $item->typeID = $typeID;
                             $item->typeName = $type->typeName;
                             $item->categoryName = $type->group->category['categoryName'];
                             $metaGroupName = isset($type->metaType->metaGroup['metaGroupName']) ? $type->metaType->metaGroup['metaGroupName'] : '';
                             if ($metaGroupName == 'Tech I' || $metaGroupName == '') {
                                 $metaLevel = DB::table('dgmTypeAttributes')->where('typeID', $typeID)->where('attributeID', 633)->first();
                                 if (isset($metaLevel)) {
                                     $metaGroupName = 'Meta ';
                                     $metaGroupName .= isset($metaLevel->valueInt) ? $metaLevel->valueInt : $metaLevel->valueFloat;
                                 }
                             }
                             $item->metaGroupName = $metaGroupName;
                             $blueprint = Type::where('typeName', $type->typeName . ' Blueprint')->count();
                             if ($blueprint > 0) {
                                 $item->allowManufacture = 1;
                             }
                             $item->qty = $loss['qtyDropped'] + $loss['qtyDestroyed'];
                             $item->save();
                             // Add the category to the list of filters available on the site.
                             $filter = Filter::find($type->group->category['categoryID']);
                             if (!isset($filter->categoryID)) {
                                 $filter = new Filter();
                                 $filter->categoryID = $type->group->category['categoryID'];
                                 $filter->categoryName = $type->group->category['categoryName'];
                                 $filter->iconID = $type->group->category['iconID'];
                                 $filter->save();
                             }
                         }
                     }
                 }
             }
         }
         echo "Inserted {$insert_count} new kills! ";
     } else {
         echo "No response received from zKillboard API.";
     }
 }
Example #10
0
 public function executeCreateOkFilter(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     // On récupère les informations dont on a besoin dans le formulaire
     $params = array('mode' => 'create', 'filter_id' => $request->getPostParameter('id'), 'filter_name' => $request->getPostParameter('form[name]'), 'filter_description' => $request->getPostParameter('form[description]'), 'private_blacklist_content' => $request->getPostParameter('form[PBlist]'), 'globale_blacklist_content' => $request->getPostParameter('form[GBlist]'), 'private_whitelist_content' => $request->getPostParameter('form[PWlist]'), 'globale_whitelist_content' => $request->getPostParameter('form[GWlist]'));
     // Si le champ 'name' est vide, on arrête le traitement
     if ($params['filter_name'] == null) {
         //return $params;
     }
     // création du filtre s'il n'existe pas
     if ($params['filter_id'] == null) {
         $this->menu = $this->getMenu('createFilter');
         // On créé un nouveau filtre
         $filter = new Filter();
         $filter->name = $params['filter_name'];
         $filter->description = $params['filter_description'];
         $filter->save();
         // On récupère son ID
         $params['filter_id'] = $filter->id;
         // Lien avec liste globales white
         $lfwg = new ListsFilter();
         $lfwg->filter_id = $params['filter_id'];
         $lfwg->list_id = 1;
         $lfwg->ordre = 0;
         $lfwg->save();
         // Lien avec liste global black
         $lfbg = new ListsFilter();
         $lfbg->filter_id = $params['filter_id'];
         $lfbg->list_id = 2;
         $lfbg->ordre = 1;
         $lfbg->save();
         // Création liste SI White du filtre
         $lists = new Lists();
         $lists->name = "PW" . $params['filter_id'];
         $lists->type = "W";
         $lists->origin = "SI";
         $lists->static = 0;
         $lists->save();
         $lfwp = new ListsFilter();
         $lfwp->filter_id = $params['filter_id'];
         $lfwp->list_id = $lists->id;
         $lfwp->ordre = 2;
         $lfwp->save();
         // Création liste SI Black du filtre
         $lists = new Lists();
         $lists->name = "PB" . $params['filter_id'];
         $lists->type = "B";
         $lists->origin = "SI";
         $lists->static = 0;
         $lists->save();
         $lfbp = new ListsFilter();
         $lfbp->filter_id = $params['filter_id'];
         $lfbp->list_id = $lists->id;
         $lfbp->ordre = 3;
         $lfbp->save();
     } else {
         $this->menu = $this->getMenu('index');
         $sql = "UPDATE filter SET name = '{$params['filter_name']}', description = '{$params['filter_description']}' WHERE id = '{$params['filter_id']}';";
         $dq = new Doctrine_Query();
         $conn = $dq->getConnection();
         $conn->execute($sql);
     }
     // On remet à jour les listes SI
     $private_blacklist_content_details = explode("\n", $params['private_blacklist_content']);
     $globale_blacklist_content_details = explode("\n", $params['globale_blacklist_content']);
     $private_whitelist_content_details = explode("\n", $params['private_whitelist_content']);
     $globale_whitelist_content_details = explode("\n", $params['globale_whitelist_content']);
     // Mise à jour White liste Globale
     $listGlobale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 1)->execute();
     for ($i = 0; $i < count($globale_whitelist_content_details); $i++) {
         if (trim($globale_whitelist_content_details[$i]) != "") {
             $insert = new ListsDetail();
             $insert->domain = trim($globale_whitelist_content_details[$i]);
             $insert->lists_id = 1;
             $insert->save();
         }
     }
     // Mise à jour Black liste Globale
     $listGlobale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 2)->execute();
     for ($i = 0; $i < count($globale_blacklist_content_details); $i++) {
         if (trim($globale_blacklist_content_details[$i]) != "") {
             $insert = new ListsDetail();
             $insert->domain = trim($globale_blacklist_content_details[$i]);
             $insert->lists_id = 2;
             $insert->save();
         }
     }
     // Mise à jour White liste Locale
     // Recherche de l'id de la liste
     $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('name = ?', 'PW' . $params['filter_id']);
     $lists_res = $lists_query->fetchOne();
     $id_PW = $lists_res['id'];
     // Suppression des détails
     $listLocale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', $id_PW)->execute();
     for ($i = 0; $i < count($private_whitelist_content_details); $i++) {
         if (trim($private_whitelist_content_details[$i]) != "") {
             $insert = new ListsDetail();
             $insert->domain = trim($private_whitelist_content_details[$i]);
             $insert->lists_id = $id_PW;
             $insert->save();
         }
     }
     // Mise à jour Black liste Locale
     // Recherche de l'id de la liste
     $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('name = ?', 'PB' . $params['filter_id']);
     $lists_res = $lists_query->fetchOne();
     $id_PB = $lists_res['id'];
     // Suppression des détails
     $listLocale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', $id_PB)->execute();
     for ($i = 0; $i < count($private_blacklist_content_details); $i++) {
         if (trim($private_blacklist_content_details[$i]) != "") {
             $insert = new ListsDetail();
             $insert->domain = trim($private_blacklist_content_details[$i]);
             $insert->lists_id = $id_PB;
             $insert->save();
         }
     }
     // Traitement des listes externes (Toulouse)
     // Ajout des liens
     $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('origin != ?', 'SI');
     $lists_res = $lists_query->fetchArray();
     $dq = new Doctrine_Query();
     $conn = $dq->getConnection();
     foreach ($lists_res as $list) {
         // Suppression de l'ancien lien s'il existe
         $sql = " delete from lists_filter";
         $sql .= " where list_id = {$list['id']}";
         $sql .= " and filter_id = {$params['filter_id']}";
         $conn->execute($sql);
         // Ajout du lien s'il est coché
         if ($request->getPostParameter('chBox_' . $list['id']) != null) {
             $insert = new ListsFilter();
             $insert->list_id = $list['id'];
             $insert->filter_id = $params['filter_id'];
             $insert->ordre = 4;
             $insert->save();
         }
     }
 }
    public function executeCreateOkFilter(sfWebRequest $request)
    {
        $this->menu = $this->getMenu('index');
        $this->forward404Unless($request->isMethod('post'));
        // On récupère les informations dont on a besoin dans le formulaire
        $params = array('mode' => 'create', 'filter_id' => $request->getPostParameter('id'), 'filter_name' => $request->getPostParameter('form[name]'), 'filter_description' => $request->getPostParameter('form[description]'), 'private_blacklist_content' => $request->getPostParameter('form[PBlist]'), 'globale_blacklist_content' => $request->getPostParameter('form[GBlist]'), 'private_whitelist_content' => $request->getPostParameter('form[PWlist]'), 'globale_whitelist_content' => $request->getPostParameter('form[GWlist]'));
        // Si le champ 'name' est vide, on arrête le traitement
        if ($params['filter_name'] == null) {
            //return $params;
        }
        if ($params['filter_id'] == null) {
            // On créé un nouveau filtre
            $filter = new Filter();
            $filter->name = $params['filter_name'];
            $filter->description = $params['filter_description'];
            $filter->save();
            // On récupère son ID
            $params['filter_id'] = $filter->id;
        } else {
            $params['mode'] = 'update';
            $sql = <<<SQL
\t\t\t\tSELECT ld.id, ld.lists_id
\t\t\t\tFROM lists_detail ld
\t\t\t\t\tLEFT JOIN lists li ON ld.lists_id = li.id
\t\t\t\t\tLEFT JOIN lists_filter lf ON li.id = lf.list_id
\t\t\t\tWHERE lf.filter_id = '{$params['filter_id']}'
\t\t\t\t\tAND li.origin = 'SI'
\t\t\t\tORDER BY ld.lists_id
SQL;
            $dq = new Doctrine_Query();
            $conn = $dq->getConnection();
            $lists = $conn->fetchAll($sql);
            foreach ($lists as $list) {
                $sql = <<<SQL
\t\t\t\t\tDELETE FROM lists_detail WHERE id = '{$list['id']}';
SQL;
                $dq = new Doctrine_Query();
                $conn = $dq->getConnection();
                $conn->execute($sql);
                if ($list['lists_id'] != $ancVal) {
                    $ancVal = $list['lists_id'];
                    $sql = <<<SQL
\t\t\t\t\t\tDELETE FROM lists WHERE id = '{$ancVal}';
SQL;
                    $dq = new Doctrine_Query();
                    $conn = $dq->getConnection();
                    $conn->execute($sql);
                }
            }
            $sql = "UPDATE filter SET name = '{$params['filter_name']}', description = '{$params['filter_description']}' WHERE id = '{$params['filter_id']}';";
            $dq = new Doctrine_Query();
            $conn = $dq->getConnection();
            $conn->execute($sql);
            $deleteAllListFilter = Doctrine_Query::create()->delete()->from('ListsFilter')->where('filter_id = ?', $params['filter_id'])->execute();
        }
        // On remet à jour les listes globales
        $private_blacklist_content_details = explode("\n", $params['private_blacklist_content']);
        $globale_blacklist_content_details = explode("\n", $params['globale_blacklist_content']);
        $private_whitelist_content_details = explode("\n", $params['private_whitelist_content']);
        $globale_whitelist_content_details = explode("\n", $params['globale_whitelist_content']);
        $listGlobale_whitelist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 0)->execute();
        for ($i = 0; $i < count($globale_whitelist_content_details); $i++) {
            if ($globale_whitelist_content_details[$i] != null) {
                $insert = new ListsDetail();
                $insert->domain = $globale_whitelist_content_details[$i];
                $insert->lists_id = 0;
                $insert->save();
            }
        }
        $listGlobale_blacklist = Doctrine_Query::create()->delete()->from('ListsDetail')->where('lists_id = ?', 1)->execute();
        for ($i = 0; $i < count($globale_blacklist_content_details); $i++) {
            if ($globale_blacklist_content_details[$i] != null) {
                $insert = new ListsDetail();
                $insert->domain = $globale_blacklist_content_details[$i];
                $insert->lists_id = 1;
                $insert->save();
            }
        }
        // On les attachent au filtre que l'on a créé
        $attach_global_whitelist = new ListsFilter();
        $attach_global_whitelist->list_id = 0;
        $attach_global_whitelist->filter_id = $params['filter_id'];
        $attach_global_whitelist->ordre = 0;
        $attach_global_whitelist->save();
        $attach_global_blacklist = new ListsFilter();
        $attach_global_blacklist->list_id = 1;
        $attach_global_blacklist->filter_id = $params['filter_id'];
        $attach_global_blacklist->ordre = 1;
        $attach_global_blacklist->save();
        // On créé une nouvelle liste (whitelist)
        if ($params['private_whitelist_content'] != null) {
            $whitelist = new Lists();
            $whitelist->name = 'PW' . $params['filter_id'];
            $whitelist->type = 'W';
            $whitelist->origin = 'SI';
            $whitelist->static = '1';
            $whitelist->save();
            $id = $whitelist->id;
            for ($i = 0; $i < count($private_whitelist_content_details); $i++) {
                if ($private_whitelist_content_details[$i] != null) {
                    $insert = new ListsDetail();
                    $insert->domain = $private_whitelist_content_details[$i];
                    $insert->lists_id = $whitelist->id;
                    $insert->save();
                }
            }
            $attach_whitelist = new ListsFilter();
            $attach_whitelist->list_id = $whitelist->id;
            $attach_whitelist->filter_id = $params['filter_id'];
            $attach_whitelist->ordre = 2;
            $attach_whitelist->save();
        }
        // On créé une nouvelle liste (blacklist)
        if ($params['private_blacklist_content'] != null) {
            $blacklist = new Lists();
            $blacklist->name = 'PB' . $params['filter_id'];
            $blacklist->type = 'B';
            $blacklist->origin = 'SI';
            $blacklist->static = '1';
            $blacklist->save();
            $id = $blacklist->id;
            for ($i = 0; $i < count($private_blacklist_content_details); $i++) {
                if ($private_blacklist_content_details[$i] != null) {
                    $insert = new ListsDetail();
                    $insert->domain = $private_blacklist_content_details[$i];
                    $insert->lists_id = $blacklist->id;
                    $insert->save();
                }
            }
            $attach_blacklist = new ListsFilter();
            $attach_blacklist->list_id = $blacklist->id;
            $attach_blacklist->filter_id = $params['filter_id'];
            $attach_blacklist->ordre = 3;
            $attach_blacklist->save();
        }
        // On récupère les listes provenant de Toulouse
        $lists_query = Doctrine_Query::create()->select('id')->from('Lists')->where('origin != ?', 'SI');
        $lists_res = $lists_query->fetchArray();
        foreach ($lists_res as $list) {
            if ($request->getPostParameter('chBox_' . $list['id']) != null) {
                $insert = new ListsFilter();
                $insert->list_id = $list['id'];
                $insert->filter_id = $params['filter_id'];
                $insert->ordre = 4;
                $insert->save();
            }
        }
    }