$s) { $core->blog->settings->addNamespace($ns); foreach ($s as $k => $v) { if ($_POST['s_type'][$ns][$k] == 'array') { $v = json_decode($v, true); } $core->blog->settings->$ns->put($k, $v); } $core->blog->triggerBlog(); } dcPage::addSuccessNotice(__('Configuration successfully updated')); http::redirect($p_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Global settings update if (!empty($_POST['gs']) && is_array($_POST['gs'])) { try { foreach ($_POST['gs'] as $ns => $s) { $core->blog->settings->addNamespace($ns); foreach ($s as $k => $v) { if ($_POST['gs_type'][$ns][$k] == 'array') { $v = json_decode($v, true); } $core->blog->settings->$ns->put($k, $v, null, null, true, true); } $core->blog->triggerBlog(); } dcPage::addSuccessNotice(__('Configuration successfully updated')); http::redirect($p_url . '&part=global'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } $part = !empty($_GET['part']) && $_GET['part'] == 'global' ? 'global' : 'local'; function settingLine($id, $s, $ns, $field_name, $strong_label) { if ($s['type'] == 'boolean') { $field = form::combo(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), array(__('yes') => 1, __('no') => 0), $s['value'] ? 1 : 0); } else { if ($s['type'] == 'array') { $field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), 40, null, html::escapeHTML(json_encode($s['value']))); } else { $field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id), 40, null, html::escapeHTML($s['value'])); } } $type = form::hidden(array($field_name . '_type' . '[' . $ns . '][' . $id . ']', $field_name . '_' . $ns . '_' . $id . '_type'), html::escapeHTML($s['type'])); $slabel = $strong_label ? '%s' : '%s'; return '
' . __('Setting ID') . ' | ' . "\n" . '' . __('Value') . ' | ' . "\n" . '' . __('Type') . ' | ' . "\n" . '' . __('Description') . ' | ' . "\n" . '
---|