} } // User does not have permission, or saved querylist is broken if (@$QUERYLIST == NULL) { $QUERYLIST = new QueryList(); $ACTIVELIST = array(); } // check for a form POST if (is_array($_POST) && count($_POST) > 0 && $canSave) { // determine post type if (isset($_POST['save'])) { unset($_POST['save']); // create the query with the criteria in the post $query = QueryFactory::create($MODULE); $query->set_criteria_values($_POST); if (!$QUERYLIST->contains($query)) { if (count($QUERYLIST) >= $CONF['saved_searches_size']) { $MESSAGE = $STRINGS['error_saved_searches_limit']; $MESSAGE_CLASS = 'error-message'; } else { $QUERYLIST->add($query); // saved searches are 'active' by default array_unshift($ACTIVELIST, '1'); if (count($ACTIVELIST) > count($QUERYLIST)) { array_pop($ACTIVELIST); } // save the searches $USER->save_data('saved_searches', $QUERYLIST); $USER->save_data('saved_searches_active', $ACTIVELIST); $MESSAGE = $STRINGS['search_save']; $MESSAGE_CLASS = 'info-message';