2009-11-24 14:48:34 +00:00
< ? php
/*
* e107 website system
*
* Copyright ( c ) 2008 - 2009 e107 Inc ( e107 . org )
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
2009-12-08 17:21:36 +00:00
* Custom Featurebox install / uninstall / update routines
2009-11-24 14:48:34 +00:00
*
* $Source : / cvs_backup / e107_0 . 8 / e107_plugins / featurebox / featurebox_setup . php , v $
2010-02-10 18:18:01 +00:00
* $Revision $
* $Date $
* $Author $
2009-11-24 14:48:34 +00:00
*
*/
2009-12-08 17:21:36 +00:00
if ( ! defined ( 'e107_INIT' )) { exit ; }
2009-11-24 14:48:34 +00:00
class featurebox_setup
{
/*
function install_pre ( $var )
{
// print_a($var);
// echo "custom install 'pre' function<br /><br />";
}
*/
function install_post ( $var )
{
2009-12-08 17:21:36 +00:00
e107 :: includeLan ( e_PLUGIN . 'featurebox/languages/' . e_LANGUAGE . '_admin_featurebox.php' );
2009-11-24 14:48:34 +00:00
$mes = e107 :: getMessage ();
2013-03-28 01:04:01 -07:00
$e107_featurebox_category = array (
2019-07-01 09:07:25 +02:00
array ( 'fb_category_id' => 1 , 'fb_category_title' => FBLAN_35 , 'fb_category_icon' => '' , 'fb_category_template' => 'bootstrap3_carousel' , 'fb_category_random' => '0' , 'fb_category_class' => '0' , 'fb_category_limit' => '0' , 'fb_category_parms' => '' ),
array ( 'fb_category_id' => 2 , 'fb_category_title' => FBLAN_36 , 'fb_category_icon' => '' , 'fb_category_template' => 'bootstrap_tabs' , 'fb_category_random' => '0' , 'fb_category_class' => '0' , 'fb_category_limit' => '0' , 'fb_category_parms' => '' ),
array ( 'fb_category_id' => 3 , 'fb_category_title' => FBLAN_34 , 'fb_category_icon' => '' , 'fb_category_template' => 'unassigned' , 'fb_category_random' => '0' , 'fb_category_class' => '255' , 'fb_category_limit' => '0' , 'fb_category_parms' => '' )
2013-03-28 01:04:01 -07:00
);
2013-03-13 09:47:48 +02:00
2013-03-28 01:04:01 -07:00
$count = 0 ;
foreach ( $e107_featurebox_category as $insert )
{
2014-01-06 07:52:13 -08:00
$count = e107 :: getDb () -> insert ( 'featurebox_category' , $insert ) ? $count + 1 : $count ;
2013-03-28 01:04:01 -07:00
}
$status = ( $count == 3 ) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR ;
2014-01-06 07:52:13 -08:00
2018-08-18 11:48:10 -07:00
$mes -> add ( LAN_DEFAULT_TABLE_DATA . " <strong>featurebox_category</strong> " , $status );
2009-11-24 14:48:34 +00:00
2013-03-28 01:04:01 -07:00
if ( $status )
2009-12-08 17:21:36 +00:00
{
2014-01-06 07:52:13 -08:00
$e107_featurebox = array (
array ( 'fb_id' => '4' , 'fb_title' => 'Slide 1' , 'fb_text' => 'Default Message - this is the default' , 'fb_mode' => '0' , 'fb_class' => '0' , 'fb_rendertype' => '0' , 'fb_template' => 'bootstrap_carousel_default' , 'fb_order' => '3' , 'fb_image' => '' , 'fb_imageurl' => '' , 'fb_category' => '1' ),
array ( 'fb_id' => '6' , 'fb_title' => 'Slide 2' , 'fb_text' => ' Suspendisse ac dui purus . Cras eleifend , velit sed dapibus pharetra , elit dolor mattis tellus , ac luctus nisi massa at ligula . Ut sagittis , neque consequat elementum convallis , lorem nulla molestie arcu , eu rutrum velit quam at metus ! Nullam eu eleifend magna . Praesent eget leo felis , vel euismod nibh . Morbi sem eros , pellentesque eu scelerisque id , pretium id enim . Mauris aliquet molestie dui vel ultricies . Etiam consequat quam sed tellus facilisis sollicitudin . Vivamus malesuada iaculis metus .
',' fb_mode '=>' 0 ',' fb_class '=>' 0 ',' fb_rendertype '=>' 0 ',' fb_template '=>' bootstrap_carousel_left ',' fb_order '=>' 4 ',' fb_image '=>' ',' fb_imageurl '=>' ',' fb_category '=>' 1 ' ),
array ( 'fb_id' => '10' , 'fb_title' => 'Slide 3' , 'fb_text' => ' Suspendisse ac dui purus . Cras eleifend , velit sed dapibus pharetra , elit dolor mattis tellus , ac luctus nisi massa at ligula . Ut sagittis , neque consequat elementum convallis , lorem nulla molestie arcu , eu rutrum velit quam at metus ! Nullam eu eleifend magna . Praesent eget leo felis , vel euismod nibh . Morbi sem eros , pellentesque eu scelerisque id , pretium id enim . Mauris aliquet molestie dui vel ultricies . Etiam consequat quam sed tellus facilisis sollicitudin . Vivamus malesuada iaculis metus .
',' fb_mode '=>' 0 ',' fb_class '=>' 0 ',' fb_rendertype '=>' 0 ',' fb_template '=>' bootstrap_carousel_right ',' fb_order '=>' 4 ',' fb_image '=>' ',' fb_imageurl '=>' ',' fb_category '=>' 1 ' )
);
2013-03-28 01:04:01 -07:00
2014-01-06 07:52:13 -08:00
foreach ( $e107_featurebox as $qry )
{
$status = e107 :: getDb ( 'sql2' ) -> insert ( 'featurebox' , $qry ) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR ;
}
2018-08-18 11:48:10 -07:00
$mes -> add ( LAN_DEFAULT_TABLE_DATA . " <strong>featurebox</strong> " , $status );
2009-12-08 17:21:36 +00:00
}
else
{
2018-08-18 11:48:10 -07:00
$mes -> addError ( LAN_DEFAULT_TABLE_DATA );
2009-12-08 17:21:36 +00:00
}
2014-01-06 07:52:13 -08:00
2009-11-24 14:48:34 +00:00
}
/*
function uninstall_options ()
{
}
function uninstall_post ( $var )
{
// print_a($var);
}
2013-03-13 09:47:48 +02:00
*/
2013-04-19 02:03:45 -07:00
function upgrade_required ()
{
2015-07-07 13:02:34 -07:00
if ( ! e107 :: getDb () -> isTable ( 'featurebox_category' ))
2013-04-19 02:03:45 -07:00
{
return true ; // true to trigger an upgrade alert, and false to not.
}
}
function upgrade_pre ( $var )
{
e107 :: getDb () -> gen ( " CREATE TABLE #featurebox_category (
`fb_category_id` tinyint ( 3 ) unsigned NOT NULL AUTO_INCREMENT ,
`fb_category_title` varchar ( 200 ) NOT NULL DEFAULT '' ,
`fb_category_icon` varchar ( 255 ) NOT NULL DEFAULT '' ,
`fb_category_template` varchar ( 50 ) NOT NULL DEFAULT 'default' ,
`fb_category_random` tinyint ( 1 ) unsigned NOT NULL DEFAULT '0' ,
`fb_category_class` smallint ( 5 ) NOT NULL DEFAULT '0' ,
`fb_category_limit` tinyint ( 3 ) unsigned NOT NULL DEFAULT '1' ,
`fb_category_parms` text NOT NULL ,
PRIMARY KEY ( `fb_category_id` ),
UNIQUE KEY `fb_category_template` ( `fb_category_template` )
) ENGINE = MyISAM ; " );
}
2009-11-24 14:48:34 +00:00
function upgrade_post ( $var )
{
2013-03-13 09:47:48 +02:00
$sql = e107 :: getDb ();
$currentVersion = $var -> current_plug [ 'plugin_version' ];
//$newVersion = $var->plug_vars['@attributes']['version'];
if ( $currentVersion == '1.0' )
{
$query = array ();
$query [ 'fb_category_id' ] = 0 ;
2022-09-05 20:14:12 +02:00
$query [ 'fb_category_title' ] = FBLAN_34 ;
2013-03-13 09:47:48 +02:00
$query [ 'fb_category_template' ] = 'unassigned' ;
$query [ 'fb_category_random' ] = 0 ;
$query [ 'fb_category_class' ] = e_UC_NOBODY ;
$query [ 'fb_category_limit' ] = 0 ;
2013-04-19 02:03:45 -07:00
$inserted = $sql -> insert ( 'featurebox_category' , $query );
2013-03-13 09:47:48 +02:00
$status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR ;
e107 :: getMessage () -> add ( FBLAN_INSTALL_01 , $status );
if ( $sql -> getLastErrorNumber ())
{
e107 :: getMessage () -> addDebug ( $sql -> getLastErrorText () . '<br /><pre>' . $sql -> getLastQuery () . '</pre>' );
}
}
2009-11-24 14:48:34 +00:00
}
}