Example #1
0
 *
 * Textpattern is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>.
 */
if (!defined('TXP_UPDATE')) {
    exit("Nothing here. You can't access this file directly.");
}
safe_alter('textpattern', "CHANGE COLUMN `textile_body` `textile_body` VARCHAR(32) NOT NULL DEFAULT '1', CHANGE COLUMN `textile_excerpt` `textile_excerpt` VARCHAR(32) NOT NULL DEFAULT '1';");
safe_update('txp_prefs', "name = 'pane_article_textfilter_help_visible'", "name = 'pane_article_textile_help_visible'");
// Rejig preferences panel.
$core_ev = doQuote(join("','", array('site', 'admin', 'publish', 'feeds', 'custom', 'comments')));
// 1) Increase event column size.
safe_alter('txp_prefs', "MODIFY event VARCHAR(255) NOT NULL default 'publish', MODIFY html VARCHAR(255) NOT NULL default 'text_input'");
// 2) Remove basic/advanced distinction.
safe_update('txp_prefs', "type = '" . PREF_CORE . "'", "type = '" . PREF_PLUGIN . "' AND event IN (" . $core_ev . ")");
// 3) Consolidate existing prefs into better groups.
safe_update('txp_prefs', "event = 'site'", "name in ('sitename', 'siteurl', 'site_slogan', 'production_status', 'gmtoffset', 'auto_dst', 'is_dst', 'dateformat', 'archive_dateformat', 'permlink_mode', 'doctype', 'logging', 'use_comments', 'expire_logs_after')");
// 4) Reorder existing prefs into a more logical progression.
safe_update('txp_prefs', "position = '230'", "name = 'expire_logs_after'");
safe_update('txp_prefs', "position = '340'", "name = 'max_url_len'");
safe_update('txp_prefs', "position = '160'", "name = 'comments_sendmail'");
safe_update('txp_prefs', "position = '180'", "name = 'comments_are_ol'");
safe_update('txp_prefs', "position = '200'", "name = 'comment_means_site_updated'");
safe_update('txp_prefs', "position = '220'", "name = 'comments_require_name'");
safe_update('txp_prefs', "position = '240'", "name = 'comments_require_email'");
safe_update('txp_prefs', "position = '260'", "name = 'never_display_email'");
Example #2
0
 /**
  * Gets an SQL clause for this method based on the criteria.
  *
  * @todo Case-sensitive searches
  *
  * @param string $search_term The value to search for
  * @param int    $verbatim    Whether the search term is in quotes (1) or not (0)
  */
 public function getCriteria($search_term, $verbatim)
 {
     $clause = array();
     foreach ($this->columns as $column) {
         if (isset($this->aliases[$column])) {
             foreach ($this->aliases[$column] as $dbval => $aliases) {
                 $terms = do_list($search_term);
                 foreach ($terms as $idx => $term) {
                     if ($this->findAlias($term, $aliases, $this->type) !== false) {
                         $terms[$idx] = $dbval;
                     }
                 }
                 $search_term = join(',', $terms);
             }
         }
         if ($this->options['can_list']) {
             $operator = ' in ';
             $value = '(' . join(',', quote_list(do_list($search_term))) . ')';
         } elseif ($this->type === 'boolean') {
             $clause[] = "convert(" . $column . ", char) = '" . $search_term . "'";
             continue;
         } elseif ($verbatim && !$this->options['always_like']) {
             $operator = ' = ';
             $value = doQuote($search_term);
         } elseif ($this->type === 'find_in_set') {
             $clause[] = "find_in_set('" . $search_term . "', " . $column . " )";
             continue;
         } elseif ($this->type === 'numeric') {
             $clause[] = "convert(" . $column . ", char) = '" . $search_term . "'";
             continue;
         } else {
             $operator = ' like ';
             $value = doQuote("%{$search_term}%");
         }
         $clause[] = join($operator, array($column, $value));
     }
     return $clause;
 }