Ignore:
Timestamp:
Apr 1, 2011, 10:54:39 PM (13 years ago)
Author:
mistic100
Message:

[extentions] BBCode Bar

  • uses markItUp!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/bbcode_bar/maintain.inc.php

    r9682 r9965  
    11<?php
    2 
    32if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    43
    54function plugin_install()
    65
    7         global $conf;
     6        global $conf, $default;
     7       
     8        $BBcode_default = array(
     9                'b' => true,
     10                'i' => true,
     11                'u' => true,
     12                's' => true,
     13                'p' => true,
     14                'center' => true,
     15                'right' => true,
     16                'quote' => true,
     17                'ul' => true,
     18                'ol' => true,
     19                'img' => true,
     20                'url' => true,
     21                'email' => true,
     22                'size' => true,
     23                'color' => true,
     24        );
    825
    926        if (!isset($conf['bbcode_bar']))
    1027        {
    11                 $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
    12                         VALUES ("bbcode_bar","1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,plugins/bbcode_bar/icon","Parametres BBCode_bar");';
     28                $q = "INSERT INTO " . CONFIG_TABLE . " (param,value,comment)
     29                        VALUES ('bbcode_bar','" . serialize($BBcode_default) . "','Parametres BBCode Bar');";
     30                pwg_query($q);
     31        }
     32}
     33
     34function plugin_activate()
     35{
     36        global $conf;
     37       
     38        if (strpos($conf['bbcode_bar'],',') !== false)
     39        {
     40                $conf_bbcode_bar = explode(',', $conf['bbcode_bar']);
     41               
     42                $new_bbcode_bar =  array(
     43                        'b' => $conf_bbcode_bar[1] == '1' ? true : false,
     44                        'i' => $conf_bbcode_bar[2] == '1' ? true : false,
     45                        'u' => $conf_bbcode_bar[3] == '1' ? true : false,
     46                        's' => $conf_bbcode_bar[4] == '1' ? true : false,
     47                        'p' => $conf_bbcode_bar[0] == '1' ? true : false,
     48                        'center' => $conf_bbcode_bar[5] == '1' ? true : false,
     49                        'right' => $conf_bbcode_bar[6] == '1' ? true : false,
     50                        'quote' => $conf_bbcode_bar[9] == '1' ? true : false,
     51                        'ul' => $conf_bbcode_bar[7] == '1' ? true : false,
     52                        'ol' => $conf_bbcode_bar[8] == '1' ? true : false,
     53                        'img' => $conf_bbcode_bar[10] == '1' ? true : false,
     54                        'url' => $conf_bbcode_bar[11] == '1' ? true : false,
     55                        'email' => $conf_bbcode_bar[12] == '1' ? true : false,
     56                        'size' => $conf_bbcode_bar[13] == '1' ? true : false,
     57                        'color' => $conf_bbcode_bar[14] == '1' ? true : false,
     58                );
     59               
     60                $q = "UPDATE " . CONFIG_TABLE . "
     61                        SET value='" . serialize($new_bbcode_bar) . "'
     62                        WHERE param='bbcode_bar';";
    1363                pwg_query($q);
    1464        }
     
    2171        if (isset($conf['bbcode_bar']))
    2272        {
    23                 pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="bbcode_bar" LIMIT 1;');
     73                pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="bbcode_bar";');
    2474        }
    2575}
Note: See TracChangeset for help on using the changeset viewer.