blog->settings->addNamespace('construction'); $s =& dcCore::app()->blog->settings->construction; $flag = $s->construction_flag; $allowed_ip = array(); $myip = http::realIP(); // editeur pour le message $post_format = dcCore::app()->auth->getOption('post_format'); $post_editor = dcCore::app()->auth->getOption('editor'); $admin_post_behavior = ''; if ($post_editor && !empty($post_editor[$post_format])) { $admin_post_behavior = dcCore::app()->callBehavior('adminPostEditor', $post_editor[$post_format], 'user_desc', array('#user_desc') ); } if (!empty($_POST['saveconfig'])) { try { $flag = (empty($_POST['construction_flag']))?false:true; $s->put('construction_flag',$flag,'boolean','Construction blog flag'); $all_ip = explode("\n",$_POST['construction_allowed_ip']); foreach ($all_ip as $ip) { $allowed_ip[] = trim($ip); } $urls = explode(",",$_POST['construction_extra_urls']); foreach ($urls as $url) { $extra_urls[] = trim($url); } $s->put('construction_allowed_ip',serialize($allowed_ip),'string','Construction blog allowed ip'); $s->put('construction_title',$_POST['construction_title'],'string','Construction blog title'); $s->put('construction_message',$_POST['construction_message'],'string','Construction blog message'); $s->put('construction_extra_urls',serialize($extra_urls),'string','Construction extra allowed URLs'); dcCore::app()->blog->triggerBlog(); http::redirect($p_url.'&saved=1'); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } $nb_rows = count(unserialize($s->construction_allowed_ip)); if ($nb_rows < 2) { $nb_rows = 2; } elseif ($nb_rows > 10) { $nb_rows = 10; } ?> <?php echo $page_title; ?> blog->name) => '', ''.$page_title.'' => '' )); if (!empty($msg)) { dcPage::message($msg);} if (!empty($_GET['saved'])) { dcPage::success(__('Configuration successfully updated.')); } echo '

'.__('Configuration').'

'. form::checkbox('construction_flag', 1, $s->construction_flag). '

'. form::textarea('construction_allowed_ip',20,$nb_rows,html::escapeHTML(implode("\n",unserialize($s->construction_allowed_ip)))). '

'.sprintf(__('Your IP is %s - the allowed IP can view the blog normally.'),$myip).'

'. form::field('construction_extra_urls',20,255,html::escapeHTML(implode(',',unserialize($s->construction_extra_urls))),'maximal'). '

'.__('Presentation').'

'. form::field('construction_title',20,255,html::escapeHTML($s->construction_title),'maximal'). '

'. form::textarea('construction_message',40,10,html::escapeHTML($s->construction_message)). '

'.form::hidden(array('p'),'construction'). dcCore::app()->formNonce(). '

'; ?>