first commit
This commit is contained in:
104
autoload/admin/factory/class.Settings.php
Normal file
104
autoload/admin/factory/class.Settings.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?
|
||||
namespace admin\factory;
|
||||
|
||||
class Settings
|
||||
{
|
||||
public static function settings_update( $param, $value )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$mdb -> delete( 'pp_settings', [ 'param' => $param ] );
|
||||
$mdb -> insert( 'pp_settings', [ 'param' => $param, 'value' => $value ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function settings_save(
|
||||
$firm_name, $firm_adress, $additional_info, $contact_form, $contact_email, $email_host, $email_port, $email_login, $email_password, $google_maps, $facebook_link, $statistic_code, $htaccess,
|
||||
$robots, $shop_bank_account_info, $update, $boot_animation, $newsletter_header, $newsletter_footer, $hotpay_api
|
||||
)
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$mdb -> query( 'TRUNCATE pp_settings' );
|
||||
|
||||
$mdb -> insert( 'pp_settings', [
|
||||
[
|
||||
'param' => 'firm_name',
|
||||
'value' => $firm_name,
|
||||
], [
|
||||
'param' => 'firm_adress',
|
||||
'value' => $firm_adress
|
||||
], [
|
||||
'param' => 'additional_info',
|
||||
'value' => $additional_info
|
||||
], [
|
||||
'param' => 'contact_form',
|
||||
'value' => $contact_form == 'on' ? 1 : 0
|
||||
], [
|
||||
'param' => 'contact_email',
|
||||
'value' => $contact_email
|
||||
], [
|
||||
'param' => 'email_host',
|
||||
'value' => $email_host
|
||||
], [
|
||||
'param' => 'email_port',
|
||||
'value' => $email_port
|
||||
], [
|
||||
'param' => 'email_login',
|
||||
'value' => $email_login
|
||||
], [
|
||||
'param' => 'email_password',
|
||||
'value' => $email_password
|
||||
], [
|
||||
'param' => 'google_maps',
|
||||
'value' => $google_maps
|
||||
], [
|
||||
"param" => 'facebook_link',
|
||||
'value' => $facebook_link
|
||||
], [
|
||||
'param' => 'statistic_code',
|
||||
'value' => $statistic_code
|
||||
], [
|
||||
'param' => 'htaccess',
|
||||
'value' => $htaccess
|
||||
], [
|
||||
'param' => 'robots',
|
||||
'value' => $robots
|
||||
], [
|
||||
'param' => 'shop_bank_account_info',
|
||||
'value' => $shop_bank_account_info
|
||||
], [
|
||||
'param' => 'update',
|
||||
'value' => $update == 'on' ? 1 : 0
|
||||
], [
|
||||
'param' => 'boot_animation',
|
||||
'value' => $boot_animation
|
||||
], [
|
||||
'param' => 'newsletter_header',
|
||||
'value' => $newsletter_header
|
||||
], [
|
||||
'param' => 'newsletter_footer',
|
||||
'value' => $newsletter_footer
|
||||
], [
|
||||
'param' => 'hotpay_api',
|
||||
'value' => $hotpay_api
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
\S::set_message( 'Ustawienia zostały zapisane' );
|
||||
|
||||
return $response = [ 'status' => 'ok', 'msg' => 'Ustawienia zostały zapisane.' ];
|
||||
}
|
||||
|
||||
public static function settings_details()
|
||||
{
|
||||
global $mdb;
|
||||
$results = $mdb -> select( 'pp_settings', '*', [ 'ORDER' => [ 'id' => 'ASC' ] ] );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$settings[ $row['param'] ] = $row['value'];
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user