Ignore:
Timestamp:
Feb 26, 2011, 4:28:24 PM (13 years ago)
Author:
patdenice
Message:

Add display option. Optimizations.

File:
1 edited

Legend:

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

    r9369 r9383  
    1616`name` text NOT NULL,
    1717`descr` varchar(255) default NULL,
    18 `type` varchar(255) NOT NULL,
    1918`path` varchar(255) default NULL,
     19`parent` varchar(255) default NULL,
    2020`datas` longtext default NULL,
    2121`users` varchar(255) default NULL,
    2222`groups` varchar(255) default NULL,
     23`level` TINYINT( 3 ) NOT NULL default "0",
    2324`show_title` enum(\'true\',\'false\') NOT NULL,
    2425`on_home` enum(\'true\',\'false\') NOT NULL,
     26`on_root` enum(\'true\',\'false\') NOT NULL,
    2527`on_cats` enum(\'true\',\'false\') NOT NULL,
    2628`on_picture` enum(\'true\',\'false\') NOT NULL,
     
    3436    pwg_query($q);
    3537 
    36     $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `descr`, `type`, `path`, `datas`, `users`, `groups`, `show_title`, `on_home`, `on_cats`, `on_picture`, `id_line`, `width`)
    37 VALUES (0, 1, 'MainBlock', NULL, 'MainBlock', NULL, NULL, 'guest,generic,normal,admin,webmaster', NULL, 'true', 'true', 'true', 'true', NULL, NULL);";
     38    $q = "INSERT INTO `" . $prefixeTable . "stuffs` (`id`, `pos`, `name`, `users`, `show_title`, `on_home`, `on_cats`, `on_picture`)
     39VALUES (0, 1, 'MainBlock', 'guest,generic,normal,admin,webmaster', 'true', 'true', 'true', 'true');";
    3840    pwg_query($q);
    3941  }
    40 }
    4142
    42 function plugin_activate($id, $version)
    43 {
    44   global $plugins, $prefixeTable;
     43  if (!isset($conf['PWG_Stuffs']))
     44  {
     45    $config = array(
     46      'level_perm' => false,
     47      'group_perm' => false,
     48      'user_perm' => false,
     49    );
    4550
    46   // Check if upgrade is needed
    47   if ($version != $plugins->fs_plugins[$id]['version'])
    48   {
    49     define('STUFFS_VERSION', $plugins->fs_plugins[$id]['version']);
    50     include('admin/upgrade.inc.php');
     51    $query = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment)
     52VALUES ("PWG_Stuffs" , "'.pwg_db_real_escape_string(serialize($config)).'" , "PWG Stuffs configuration");';
     53    pwg_query($query);
    5154  }
    5255}
     
    5457function plugin_uninstall()
    5558{
    56     global $prefixeTable;
     59  global $prefixeTable;
    5760
    5861  $q = 'DROP TABLE ' . $prefixeTable . 'stuffs;';
    59     pwg_query($q);
     62  pwg_query($q);
     63
     64        $q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="PWG_Stuffs";';
     65  pwg_query($q);
    6066}
    6167
Note: See TracChangeset for help on using the changeset viewer.