2016-03-28 16:29:05 +02:00
< ? php
require_once ( 'view/theme/frio/php/Image.php' );
2017-01-09 13:06:08 +01:00
function theme_content ( App $a ) {
2016-12-20 11:56:34 +01:00
if ( ! local_user ()) {
return ;
}
2016-03-28 16:29:05 +02:00
$arr = array ();
$arr [ " schema " ] = get_pconfig ( local_user (), 'frio' , 'schema' );
$arr [ " nav_bg " ] = get_pconfig ( local_user (), 'frio' , 'nav_bg' );
$arr [ " nav_icon_color " ] = get_pconfig ( local_user (), 'frio' , 'nav_icon_color' );
$arr [ " link_color " ] = get_pconfig ( local_user (), 'frio' , 'link_color' );
$arr [ " bgcolor " ] = get_pconfig ( local_user (), 'frio' , 'background_color' );
$arr [ " contentbg_transp " ] = get_pconfig ( local_user (), 'frio' , 'contentbg_transp' );
$arr [ " background_image " ] = get_pconfig ( local_user (), 'frio' , 'background_image' );
$arr [ " bg_image_option " ] = get_pconfig ( local_user (), 'frio' , 'bg_image_option' );
2017-01-09 13:06:08 +01:00
return frio_form ( $arr );
2016-03-28 16:29:05 +02:00
}
2017-01-09 13:06:08 +01:00
function theme_post ( App $a ) {
2016-12-20 11:56:34 +01:00
if ( ! local_user ()) {
return ;
}
2016-03-28 16:29:05 +02:00
if ( isset ( $_POST [ 'frio-settings-submit' ])) {
set_pconfig ( local_user (), 'frio' , 'schema' , $_POST [ " frio_schema " ]);
set_pconfig ( local_user (), 'frio' , 'nav_bg' , $_POST [ " frio_nav_bg " ]);
set_pconfig ( local_user (), 'frio' , 'nav_icon_color' , $_POST [ " frio_nav_icon_color " ]);
set_pconfig ( local_user (), 'frio' , 'link_color' , $_POST [ " frio_link_color " ]);
set_pconfig ( local_user (), 'frio' , 'background_color' , $_POST [ " frio_background_color " ]);
set_pconfig ( local_user (), 'frio' , 'contentbg_transp' , $_POST [ " frio_contentbg_transp " ]);
set_pconfig ( local_user (), 'frio' , 'background_image' , $_POST [ " frio_background_image " ]);
set_pconfig ( local_user (), 'frio' , 'bg_image_option' , $_POST [ " frio_bg_image_option " ]);
}
}
2017-01-09 13:06:08 +01:00
function frio_form ( $arr ) {
2016-04-29 01:49:09 +02:00
require_once ( " view/theme/frio/php/schema.php " );
2017-01-09 13:06:08 +01:00
2016-04-29 01:49:09 +02:00
$scheme_info = get_schema_info ( $arr [ " schema " ]);
$disable = $scheme_info [ " overwrites " ];
2016-05-27 15:50:51 +02:00
if ( ! is_array ( $disable )) $disable = array ();
2016-04-29 01:49:09 +02:00
2016-03-28 16:29:05 +02:00
$scheme_choices = array ();
$scheme_choices [ " --- " ] = t ( " Default " );
$files = glob ( 'view/theme/frio/schema/*.php' );
if ( $files ) {
foreach ( $files as $file ) {
$f = basename ( $file , " .php " );
if ( $f != 'default' ) {
$scheme_name = $f ;
$scheme_choices [ $f ] = $scheme_name ;
}
}
}
2016-05-10 17:30:06 +02:00
$background_image_help = " <strong> " . t ( " Note: " ) . " </strong> " . t ( " Check image permissions if all users are allowed to visit the image " );
2016-03-28 16:29:05 +02:00
$t = get_markup_template ( 'theme_settings.tpl' );
$o .= replace_macros ( $t , array (
'$submit' => t ( 'Submit' ),
2016-12-19 14:26:13 +01:00
'$baseurl' => App :: get_baseurl (),
2016-03-28 16:29:05 +02:00
'$title' => t ( " Theme settings " ),
'$schema' => array ( 'frio_schema' , t ( " Select scheme " ), $arr [ " schema " ], '' , $scheme_choices ),
2016-04-29 01:49:09 +02:00
'$nav_bg' => array_key_exists ( " nav_bg " , $disable ) ? " " : array ( 'frio_nav_bg' , t ( 'Navigation bar background color' ), $arr [ 'nav_bg' ]),
'$nav_icon_color' => array_key_exists ( " nav_icon_color " , $disable ) ? " " : array ( 'frio_nav_icon_color' , t ( 'Navigation bar icon color ' ), $arr [ 'nav_icon_color' ]),
'$link_color' => array_key_exists ( " link_color " , $disable ) ? " " : array ( 'frio_link_color' , t ( 'Link color' ), $arr [ 'link_color' ], '' , $link_colors ),
'$bgcolor' => array_key_exists ( " bgcolor " , $disable ) ? " " : array ( 'frio_background_color' , t ( 'Set the background color' ), $arr [ 'bgcolor' ]),
'$contentbg_transp' => array_key_exists ( " contentbg_transp " , $disable ) ? " " : array ( 'frio_contentbg_transp' , t ( " Content background transparency " ), ( $arr [ " contentbg_transp " ] ? $arr [ " contentbg_transp " ] : 0 )),
2016-05-10 17:30:06 +02:00
'$background_image' => array_key_exists ( " background_image " , $disable ) ? " " : array ( 'frio_background_image' , t ( 'Set the background image' ), $arr [ 'background_image' ], $background_image_help ),
2016-03-28 16:29:05 +02:00
'$bg_image_options' => Image :: get_options ( $arr ),
));
return $o ;
}