=')) { $core->blog->settings->addNamespace('comListe'); $blog_settings =& $core->blog->settings->comListe; $system_settings = $core->blog->settings->system; } else { $core->blog->settings->setNamespace('comListe'); $blog_settings =& $core->blog->settings; $system_settings =& $core->blog->settings; } // initilisation des variables $action = !empty($_REQUEST['action']) ? $_REQUEST['action'] : null; // Setting default parameters if missing configuration if (is_null($blog_settings->comliste_enable)) { try { $blog_settings->put('comliste_enable',false,'boolean','Enable comListe'); $core->blog->triggerBlog(); http::redirect(http::getSelfURI()); } catch (Exception $e) { $core->error->add($e->getMessage()); } } // Getting current parameters $comliste_enable = (boolean)$blog_settings->comliste_enable; $comliste_page_title = $blog_settings->comliste_page_title; $comliste_nb_comments_per_page = $blog_settings->comliste_nb_comments_per_page; $comliste_comments_order = $blog_settings->comliste_comments_order; if ($comliste_page_title === null) { $comliste_page_title = __('List of comments'); } if ($comliste_nb_comments_per_page === null) { $comliste_nb_comments_per_page = 10; } if ($comliste_comments_order === null) { $comliste_comments_order = 'desc'; } // Saving new configuration if ($action == 'saveconfig') { try { // Enable plugin $comliste_enable = (empty($_POST['comliste_enable']))?false:true; // Title page $comliste_page_title = $_POST['comliste_page_title']; if (empty($_POST['comliste_page_title'])) { throw new Exception(__('No page title.')); } // Number of comments per page $comliste_nb_comments_per_page = !empty($_POST['comliste_nb_comments_per_page'])?$_POST['comliste_nb_comments_per_page']:$comliste_nb_comments_per_page; // Order $comliste_comments_order = !empty($_POST['comliste_comments_order'])?$_POST['comliste_comments_order']:$comliste_comments_order; // Insert settings values $blog_settings->put('comliste_enable',$comliste_enable,'boolean','Enable comListe'); $blog_settings->put('comliste_page_title',$comliste_page_title,'string','Title page'); $blog_settings->put('comliste_nb_comments_per_page',$comliste_nb_comments_per_page,'integer','Number of comments per page'); $blog_settings->put('comliste_comments_order',$comliste_comments_order,'string','Comments order'); $core->blog->triggerBlog(); http::redirect($p_url.'&saveconfig=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } ?>