/** * Constructor. * */ public function __construct($okt) { $this->okt = $okt; // TODO : idéalement il faudrait faire des redirections vers la page demandée dans la langue demandée //$this->sRequestedLanguage = $this->setUserRequestLanguage(); if ($this->setUserRequestLanguage()) { http::redirect($this->okt->page->getBaseUrl()); } }
public static function checkSuper() { global $core; if (!$core->auth->isSuperAdmin()) { if (session_id()) { $core->session->destroy(); } http::redirect(DC_AUTH_PAGE); } }
public function gui($url) { # Create list if (!empty($_POST['createlist'])) { try { $this->defaultWordsList(); http::redirect($url . '&list=1'); } catch (Exception $e) { $this->okt->error->set($e->getMessage()); } } # Adding a word if (!empty($_POST['swa'])) { try { $this->addRule($_POST['swa']); http::redirect($url . '&added=1'); } catch (Exception $e) { $okt->error->add($e->getMessage()); } } # Removing spamwords if (!empty($_POST['swd']) && is_array($_POST['swd'])) { try { $this->removeRule($_POST['swd']); http::redirect($url . '&removed=1'); } catch (Exception $e) { $okt->error->add($e->getMessage()); } } /* DISPLAY ---------------------------------------------- */ global $okt; $okt->page->messages->success('list', __('m_antispam_Words_successfully_added')); $okt->page->messages->success('added', __('m_antispam_Word_successfully_added')); $okt->page->messages->success('removed', __('m_antispam_Words_successfully_removed')); $res = ''; $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<fieldset><legend>' . __('m_antispam_Add_word') . '</legend>' . '<p>' . form::text('swa', 20, 128) . ' '; $res .= adminPage::formtoken() . '<input type="submit" value="' . __('c_c_action_Add') . '"/></p>' . '</fieldset>' . '</form>'; $rs = $this->getRules(); if ($rs->isEmpty()) { $res .= '<p><strong>' . __('m_antispam_No_word_in_list') . '</strong></p>'; } else { $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<fieldset><legend>' . __('m_antispam_List') . '</legend>' . '<div style="' . $this->style_list . '">'; while ($rs->fetch()) { $disabled_word = false; $p_style = $this->style_p; $res .= '<p style="' . $p_style . '"><label class="classic">' . form::checkbox(array('swd[]'), $rs->rule_id, false) . ' ' . html::escapeHTML($rs->rule_content) . '</label></p>'; } $res .= '</div>' . '<p>' . form::hidden(array('spamwords'), 1) . adminPage::formtoken() . '<input type="submit" value="' . __('m_antispam_Delete_selected_words') . '"/></p>' . '</fieldset></form>'; } $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<p><input type="submit" value="' . __('m_antispam_Create_default_wordlist') . '" />' . form::hidden(array('spamwords'), 1) . form::hidden(array('createlist'), 1) . adminPage::formtoken() . '</p>' . '</form>'; return $res; }
public function process($do) { if ($do == 'ok') { $this->status = true; return; } if (empty($_POST['feed_url'])) { return; } $this->feed_url = $_POST['feed_url']; $feed = feedReader::quickParse($this->feed_url); if ($feed === false) { throw new Exception(__('Cannot retrieve feed URL.')); } if (count($feed->items) == 0) { throw new Exception(__('No items in feed.')); } if ($this->core->plugins->moduleExists('metadata')) { $meta = new dcMeta($this->core); } $cur = $this->core->con->openCursor($this->core->prefix . 'post'); $this->core->con->begin(); foreach ($feed->items as $item) { $cur->clean(); $cur->user_id = $this->core->auth->userID(); $cur->post_content = $item->content ? $item->content : $item->description; $cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content), 60); $cur->post_format = 'xhtml'; $cur->post_status = -2; $cur->post_dt = strftime('%Y-%m-%d %H:%M:%S', $item->TS); try { $post_id = $this->core->blog->addPost($cur); } catch (Exception $e) { $this->core->con->rollback(); throw $e; } if (isset($meta)) { foreach ($item->subject as $subject) { $meta->setPostMeta($post_id, 'tag', dcMeta::sanitizeMetaID($subject)); } } } $this->core->con->commit(); http::redirect($this->getURL() . '&do=ok'); }
public function gui($url) { $bls = $this->getServers(); if (isset($_POST['bls'])) { try { $this->core->blog->settings->setNameSpace('antispam'); $this->core->blog->settings->put('antispam_dnsbls', $_POST['bls'], 'string', 'Antispam DNSBL servers', true, false); http::redirect($url . '&upd=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY ---------------------------------------------- */ $res = ''; $res .= '<form action="' . html::escapeURL($url) . '" method="post">' . '<fieldset><legend>' . __('IP Lookup servers') . '</legend>' . '<p>' . __('Add here a coma separated list of servers.') . '</p>' . '<p>' . form::textarea('bls', 40, 3, html::escapeHTML($bls), 'maximal') . '</p>' . '<p><input type="submit" value="' . __('Save') . '" />' . $this->core->formNonce() . '</p>' . '</fieldset>' . '</form>'; return $res; }
public function gui($url) { $bls = $this->getServers(); if (isset($_POST['bls'])) { try { $this->core->blog->settings->addNamespace('antispam'); $this->core->blog->settings->antispam->put('antispam_dnsbls', $_POST['bls'], 'string', 'Antispam DNSBL servers', true, false); dcPage::addSuccessNotice(__('The list of DNSBL servers has been succesfully updated.')); http::redirect($url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY ---------------------------------------------- */ $res = dcPage::notices(); $res .= '<form action="' . html::escapeURL($url) . '" method="post" class="fieldset">' . '<h3>' . __('IP Lookup servers') . '</h3>' . '<p><label for="bls">' . __('Add here a coma separated list of servers.') . '</label>' . form::textarea('bls', 40, 3, html::escapeHTML($bls), 'maximal') . '</p>' . '<p><input type="submit" value="' . __('Save') . '" />' . $this->core->formNonce() . '</p>' . '</form>'; return $res; }
public function gui($url) { global $default_tab; $core =& $this->core; # Set current type and tab $ip_type = 'black'; if (!empty($_REQUEST['ip_type']) && $_REQUEST['ip_type'] == 'white') { $ip_type = 'white'; } $default_tab = 'tab_' . $ip_type; # Add IP to list if (!empty($_POST['addip'])) { try { $global = !empty($_POST['globalip']) && $core->auth->isSuperAdmin(); $this->addIP($ip_type, $_POST['addip'], $global); http::redirect($url . '&added=1&ip_type=' . $ip_type); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Remove IP from list if (!empty($_POST['delip']) && is_array($_POST['delip'])) { try { $this->removeRule($_POST['delip']); http::redirect($url . '&removed=1&ip_type=' . $ip_type); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY ---------------------------------------------- */ $res = ''; if (!empty($_GET['added'])) { $res .= '<p class="message">' . __('IP address has been successfully added.') . '</p>'; } if (!empty($_GET['removed'])) { $res .= '<p class="message">' . __('IP addresses have been successfully removed.') . '</p>'; } $res .= $this->displayForms($url, 'black', __('Blacklist')) . $this->displayForms($url, 'white', __('Whitelist')); return $res; }
} try { # --BEHAVIOR-- adminBeforeCommentUpdate $core->callBehavior('adminBeforeCommentUpdate', $cur, $comment_id); $core->blog->updComment($comment_id, $cur); # --BEHAVIOR-- adminAfterCommentUpdate $core->callBehavior('adminAfterCommentUpdate', $cur, $comment_id); http::redirect('comment.php?id=' . $comment_id . '&upd=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } if (!empty($_POST['delete']) && $can_delete) { try { $core->blog->delComment($comment_id); http::redirect($core->getPostAdminURL($rs->post_type, $rs->post_id) . '&co=1#c' . $comment_id, false); } catch (Exception $e) { $core->error->add($e->getMessage()); } } if (!$can_edit) { $core->error->add(__("You can't edit this comment.")); } } /* DISPLAY -------------------------------------------------------- */ dcPage::open(__('Edit comment'), dcPage::jsConfirmClose('comment-form') . dcPage::jsToolBar() . dcPage::jsLoad('js/_comment.js')); if ($comment_id) { if (!empty($_GET['upd'])) { echo '<p class="message">' . __('Comment has been successfully updated.') . '</p>'; }
$pings_uris = array(); } if (isset($_POST['pings_srv_name'])) { $pings_srv_name = is_array($_POST['pings_srv_name']) ? $_POST['pings_srv_name'] : array(); $pings_srv_uri = is_array($_POST['pings_srv_uri']) ? $_POST['pings_srv_uri'] : array(); $pings_uris = array(); foreach ($pings_srv_name as $k => $v) { if (trim($v) && trim($pings_srv_uri[$k])) { $pings_uris[trim($v)] = trim($pings_srv_uri[$k]); } } $core->blog->settings->addNamespace('pings'); $core->blog->settings->pings->put('pings_active', !empty($_POST['pings_active']), null, null, true, true); $core->blog->settings->pings->put('pings_uris', serialize($pings_uris), null, null, true, true); dcPage::addSuccessNotice(__('Settings have been successfully updated.')); http::redirect($p_url); } } catch (Exception $e) { $core->error->add($e->getMessage()); } ?> <html> <head> <title><?php echo __('Pings'); ?> </title> </head> <body> <?php
/** * Affichage d'une galerie. * */ public function galleriesGallery($aMatches) { # module actuel $this->okt->page->module = 'galleries'; $this->okt->page->action = 'gallery'; # récupération de la galerie en fonction du slug if (!empty($aMatches[0])) { $slug = $aMatches[0]; } else { $this->serve404(); } # récupération de la galerie $rsGallery = $this->okt->galleries->tree->getGalleries(array('slug' => $slug, 'active' => 1, 'language' => $this->okt->user->language)); if ($rsGallery->isEmpty()) { $this->serve404(); } # formatage des données avant affichage $this->okt->galleries->tree->prepareGallery($rsGallery); # un mot de passe ? $bGalleryRequirePassword = false; if (!empty($rsGallery->password)) { # il y a un mot de passe en session if (!empty($_SESSION['okt_gallery_password_' . $rsGallery->id])) { if ($_SESSION['okt_gallery_password_' . $rsGallery->id] != $rsGallery->password) { $this->okt->error->set('Le mot de passe ne correspond pas à celui de la galerie.'); $bGalleryRequirePassword = true; } } elseif (!empty($_POST['okt_gallery_password'])) { $p_password = trim($_POST['okt_gallery_password']); if ($p_password != $rsGallery->password) { $this->okt->error->set('Le mot de passe ne correspond pas à celui de la galerie.'); $bGalleryRequirePassword = true; } else { $_SESSION['okt_gallery_password_' . $rsGallery->id] = $p_password; http::redirect(html::escapeHTML($rsGallery->getGalleryUrl())); } } else { $bGalleryRequirePassword = true; } } # Récupération de la liste des sous-galeries $rsSubGalleriesList = $this->okt->galleries->tree->getGalleries(array('active' => 1, 'parent_id' => $rsGallery->id, 'language' => $this->okt->user->language)); # formatage des données avant affichage $this->okt->galleries->tree->prepareGalleries($rsSubGalleriesList); # Récupération des éléments de la galerie $rsItems = $this->okt->galleries->items->getItems(array('gallery_id' => $rsGallery->id, 'active' => 1, 'language' => $this->okt->user->language)); # meta description if (!empty($rsGallery->meta_description)) { $this->okt->page->meta_description = $rsGallery->meta_description; } elseif (!empty($this->okt->galleries->config->meta_description[$this->okt->user->language])) { $this->okt->page->meta_description = $this->okt->galleries->config->meta_description[$this->okt->user->language]; } else { $this->okt->page->meta_description = util::getSiteMetaDesc(); } # meta keywords if (!empty($rsGallery->meta_keywords)) { $this->okt->page->meta_description = $rsGallery->meta_keywords; } elseif (!empty($this->okt->galleries->config->meta_keywords[$this->okt->user->language])) { $this->okt->page->meta_keywords = $this->okt->galleries->config->meta_keywords[$this->okt->user->language]; } else { $this->okt->page->meta_keywords = util::getSiteMetaKeywords(); } # title tag $this->okt->page->addTitleTag(!empty($rsGallery->title_tag) ? $rsGallery->title_tag : $rsGallery->title); # fil d'ariane if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug)) { $this->okt->page->breadcrumb->add($this->okt->galleries->getName(), $this->okt->galleries->config->url); $rsPath = $this->okt->galleries->tree->getPath($rsGallery->id, true, $this->okt->user->language); while ($rsPath->fetch()) { $this->okt->page->breadcrumb->add($rsPath->title, galleriesHelpers::getGalleryUrl($rsPath->slug)); } } # titre de la page $this->okt->page->setTitle($rsGallery->title); # titre SEO de la page $this->okt->page->setTitleSeo($rsGallery->title_seo); # affichage du template echo $this->okt->tpl->render('galleries/gallery/' . $this->okt->galleries->config->templates['gallery']['default'] . '/template', array('bGalleryRequirePassword' => $bGalleryRequirePassword, 'rsGallery' => $rsGallery, 'rsSubGalleries' => $rsSubGalleriesList, 'rsItems' => $rsItems)); }
$tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255); $tb_excerpt = preg_replace('/\\s+/ms', ' ', $tb_excerpt); # Send pings if ($post && !$post->isEmpty() && !empty($_POST['tb_urls'])) { $tb_urls = $_POST['tb_urls']; $tb_urls = str_replace("\r", '', $tb_urls); $post_title = html::escapeHTML(trim(html::clean($post_title))); foreach (explode("\n", $tb_urls) as $tb_url) { try { $TB->ping($tb_url, $id, $post_title, $tb_excerpt, $post_url); } catch (Exception $e) { $core->error->add($e->getMessage()); } } if (!$core->error->flag()) { http::redirect('trackbacks.php?id=' . $id . '&sent=1'); } } $page_title = __('Ping blogs'); /* DISPLAY -------------------------------------------------------- */ dcPage::open($page_title, dcPage::jsLoad('js/_trackbacks.js')); # Exit if we cannot view page if (!$can_view_page) { dcPage::close(); exit; } if (!empty($_GET['sent'])) { echo '<p class="message">' . __('All pings sent.') . '</p>'; } echo '<h2>' . html::escapeHTML($core->blog->name) . ' › ' . $page_title . '</h2>';
public function gui($url) { $blog =& $this->core->blog; $ak_key = $blog->settings->ak_key; $ak_verified = null; if (isset($_POST['ak_key'])) { try { $ak_key = $_POST['ak_key']; $blog->settings->setNameSpace('akismet'); $blog->settings->put('ak_key', $ak_key, 'string'); http::redirect($url . '&up=1'); } catch (Exception $e) { $this->core->error->add($e->getMessage()); } } if ($blog->settings->ak_key) { try { $ak = new akismet($blog->url, $blog->settings->ak_key); $ak_verified = $ak->verify(); } catch (Exception $e) { $this->core->error->add($e->getMessage()); } } $res = '<form action="' . html::escapeURL($url) . '" method="post">' . '<p><label class="classic">' . __('Akismet API key:') . ' ' . form::field('ak_key', 12, 128, $ak_key) . '</label>'; if ($ak_verified !== null) { if ($ak_verified) { $res .= ' <img src="images/check-on.png" alt="" /> ' . __('API key verified'); } else { $res .= ' <img src="images/check-off.png" alt="" /> ' . __('API key not verified'); } } $res .= '</p>'; $res .= '<p><a href="http://wordpress.com/api-keys/">' . __('Get your own API key') . '</a></p>' . '<p><input type="submit" value="' . __('save') . '" />' . $this->core->formNonce() . '</p>' . '</form>'; return $res; }
/** * Affichage d'un article d'actualités. * */ public function newsItem($aMatches) { # module actuel $this->okt->page->module = 'news'; $this->okt->page->action = 'item'; # récupération de la page en fonction du slug if (!empty($aMatches[0])) { $sPostSlug = $aMatches[0]; } else { $this->serve404(); } # récupération de l'article $rsPost = $this->okt->news->getPost($sPostSlug, 1); if ($rsPost->isEmpty()) { $this->serve404(); } # is default route ? $bIsDefaultRoute = $this->isDefaultRoute(__CLASS__, __FUNCTION__, $sPostSlug); # permission de lecture ? if (!$this->okt->news->isPublicAccessible() || !$rsPost->isReadable()) { if ($this->okt->user->is_guest) { http::redirect(html::escapeHTML(usersHelpers::getLoginUrl($rsPost->url))); } else { $this->serve404(); } } # meta description if ($rsPost->meta_description != '') { $this->okt->page->meta_description = $rsPost->meta_description; } else { if ($this->okt->news->config->meta_description[$this->okt->user->language] != '') { $this->okt->page->meta_description = $this->okt->news->config->meta_description[$this->okt->user->language]; } else { $this->okt->page->meta_description = util::getSiteMetaDesc(); } } # meta keywords if ($rsPost->meta_keywords != '') { $this->okt->page->meta_keywords = $rsPost->meta_keywords; } else { if ($this->okt->news->config->meta_keywords[$this->okt->user->language] != '') { $this->okt->page->meta_keywords = $this->okt->news->config->meta_keywords[$this->okt->user->language]; } else { $this->okt->page->meta_keywords = util::getSiteMetaKeywords(); } } # title tag du module $this->okt->page->addTitleTag($this->okt->news->getTitle()); # début du fil d'ariane if (!$bIsDefaultRoute) { $this->okt->page->breadcrumb->add($this->okt->news->getName(), $this->okt->news->config->url); } # si les rubriques sont activées if ($this->okt->news->config->categories['enable'] && $rsPost->category_id) { # title tag de la rubrique $this->okt->page->addTitleTag($rsPost->category_title); # ajout de la hiérarchie des rubriques au fil d'ariane if (!$bIsDefaultRoute) { $rsPath = $this->okt->news->categories->getPath($rsPost->category_id, true, $this->okt->user->language); while ($rsPath->fetch()) { $this->okt->page->breadcrumb->add($rsPath->title, newsHelpers::getCategoryUrl($rsPath->slug)); } unset($rsPath); } } # title tag de la page $this->okt->page->addTitleTag($rsPost->title_tag == '' ? $rsPost->title : $rsPost->title_tag); # titre de la page $this->okt->page->setTitle($rsPost->title); # titre SEO de la page $this->okt->page->setTitleSeo($rsPost->title_seo); # fil d'ariane de la page if (!$bIsDefaultRoute) { $this->okt->page->breadcrumb->add($rsPost->title, $rsPost->url); } # affichage du template echo $this->okt->tpl->render($this->okt->news->getItemTplPath($rsPost->tpl, $rsPost->category_items_tpl), array('rsPost' => $rsPost)); }
$add_email = !empty($_POST['add_email']) ? $_POST['add_email'] : ''; $add_timezone = !empty($_POST['add_timezone']) ? $_POST['add_timezone'] : ''; $add_language = !empty($_POST['add_language']) ? $_POST['add_language'] : ''; # peuplement et vérification des champs personnalisés obligatoires if ($okt->users->config->enable_custom_fields) { $okt->users->fields->getPostData($rsFields, $aPostedData); } $add_params = array('civility' => $add_civility, 'active' => $add_active, 'username' => $add_username, 'lastname' => $add_lastname, 'firstname' => $add_firstname, 'password' => $add_password, 'password_confirm' => $add_password_confirm, 'email' => $add_email, 'timezone' => $add_timezone, 'language' => $add_language); if ($okt->error->isEmpty() && ($new_id = $okt->users->addUser($add_params)) !== false) { if ($okt->users->config->enable_custom_fields) { while ($rsFields->fetch()) { $okt->users->fields->setUserValues($new_id, $rsFields->id, $aPostedData[$rsFields->id]); } } $okt->page->flashMessages->addSuccess(__('m_users_user_added')); http::redirect('module.php?m=users&action=edit&id=' . $new_id); } } /* Affichage ----------------------------------------------------------*/ # Langues $rs = $okt->languages->getLanguages(); $aLanguages = array(); while ($rs->fetch()) { $aLanguages[html::escapeHTML($rs->title)] = $rs->code; } # Civilités $aCivilities = array_merge(array(' ' => 0), module_users::getCivilities(true)); # Titre de la page $okt->page->addGlobalTitle(__('c_c_action_Add')); # Validation javascript
$db->query($query); # insertion superadmin (id 2) $query = 'INSERT INTO `' . OKT_DB_PREFIX . 'core_users` (' . '`id`, `username`, `group_id`, `salt`, `password`, `language`, `timezone`, `email`, `registered`, `last_visit`' . ') VALUES ( ' . '2, ' . '\'' . $db->escapeStr($sudo_user) . '\', ' . '1, ' . '\'' . $db->escapeStr(util::random_key(12)) . '\', ' . '\'' . $db->escapeStr(password::hash($sudo_password, PASSWORD_DEFAULT)) . '\', ' . '\'fr\', ' . '\'Europe/Paris\', ' . '\'' . $db->escapeStr($sudo_email) . '\', ' . $current_timestamp . ', ' . $current_timestamp . ' ' . ');'; $db->query($query); # insertion admin id 3 $query = 'INSERT INTO `' . OKT_DB_PREFIX . 'core_users` (' . '`id`, `username`, `group_id`, `salt`, `password`, `language`, `timezone`, `email`, `registered`, `last_visit`' . ') VALUES ( ' . '3, ' . '\'' . $db->escapeStr($admin_user) . '\', ' . '2, ' . '\'' . $db->escapeStr(util::random_key(12)) . '\', ' . '\'' . $db->escapeStr(password::hash($admin_password, PASSWORD_DEFAULT)) . '\', ' . '\'fr\', ' . '\'Europe/Paris\', ' . '\'' . $db->escapeStr($admin_email) . '\', ' . $current_timestamp . ', ' . $current_timestamp . ' ' . ');'; $db->query($query); $_SESSION['okt_install_sudo_user'] = $sudo_user; $_SESSION['okt_install_sudo_password'] = $sudo_password; $_SESSION['okt_install_admin_user'] = $admin_user; $_SESSION['okt_install_admin_password'] = $admin_password; # Inclusion du prepend require_once __DIR__ . '/../../../oktInc/prepend.php'; # login $okt->user->login($sudo_user, $sudo_password, 1); http::redirect('index.php?step=' . $stepper->getNextStep()); } } /* Affichage ------------------------------------------------------------*/ # En-tête $title = __('i_supa_title'); require OKT_INSTAL_DIR . '/header.php'; ?> <form action="index.php" method="post"> <div class="two-cols"> <div class="col"> <h3><?php _e('i_supa_account_sudo');
if (!empty($_POST['save_settings'])) { try { $core->blog->settings->maintenance->put('plugin_message', !empty($_POST['settings_plugin_message']), 'boolean', 'Display alert message of late tasks on plugin page', true, true); foreach ($tasks as $t) { if (!$t->id()) { continue; } if (!empty($_POST['settings_recall_type']) && $_POST['settings_recall_type'] == 'all') { $ts = $_POST['settings_recall_time']; } else { $ts = empty($_POST['settings_ts_' . $t->id()]) ? 0 : $_POST['settings_ts_' . $t->id()]; } $core->blog->settings->maintenance->put('ts_' . $t->id(), abs((int) $ts), 'integer', sprintf('Recall time for task %s', $t->id()), true, $t->blog()); } dcPage::addSuccessNotice(__('Maintenance plugin has been successfully configured.')); http::redirect($p_url . '&tab=' . $tab . '#' . $tab); } catch (Exception $e) { $core->error->add($e->getMessage()); } } // Combos $combo_ts = array(__('Never') => 0, __('Every week') => 604800, __('Every two weeks') => 1209600, __('Every month') => 2592000, __('Every two months') => 5184000); // Display page echo '<html><head> <title>' . __('Maintenance') . '</title>' . dcPage::jsPageTabs($tab) . dcPage::jsLoad(dcPage::getPF('maintenance/js/settings.js')); if ($task && $task->ajax()) { echo '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . dcPage::jsVar('dotclear.msg.wait', __('Please wait...')) . "//]]>\n" . '</script>' . dcPage::jsLoad(dcPage::getPF('maintenance/js/dc.maintenance.js')); } echo $maintenance->getHeaders() . ' </head> <body>';
$blog_settings->put('media_img_t_size', $media_img_t_size); $blog_settings->put('media_img_s_size', $media_img_s_size); $blog_settings->put('media_img_m_size', $media_img_m_size); $blog_settings->put('media_img_title_pattern', $_POST['media_img_title_pattern']); $blog_settings->put('nb_post_per_feed', $nb_post_per_feed); $blog_settings->put('nb_comment_per_feed', $nb_comment_per_feed); $blog_settings->put('short_feed_items', !empty($_POST['short_feed_items'])); if (isset($_POST['robots_policy'])) { $blog_settings->put('robots_policy', $_POST['robots_policy']); } # --BEHAVIOR-- adminBeforeBlogSettingsUpdate $core->callBehavior('adminBeforeBlogSettingsUpdate', $blog_settings); if ($core->auth->isSuperAdmin() && in_array($_POST['url_scan'], $url_scan_combo)) { $blog_settings->put('url_scan', $_POST['url_scan']); } http::redirect(sprintf($redir, $blog_id)); } catch (Exception $e) { $core->error->add($e->getMessage()); } } dcPage::open(__('Blog settings'), dcPage::jsConfirmClose('blog-form') . $core->callBehavior('adminBlogPreferencesHeaders') . dcPage::jsPageTabs()); if ($blog_id) { echo '<h2>' . (!$standalone ? '<a href="blogs.php">' . __('Blogs') . '</a> › ' : '') . html::escapeHTML($blog_name) . ' › ' . __('Blog settings') . '</h2>'; if (!empty($_GET['add'])) { echo '<p class="message">' . __('Blog has been successfully created.') . '</p>'; } if (!empty($_GET['upd'])) { echo '<p class="message">' . __('Blog has been successfully updated.') . '</p>'; } echo '<div class="multi-part" id="params" title="' . __('Parameters') . '">' . '<h3>' . __('Parameters') . '</h3>' . '<form action="' . $action . '" method="post" id="blog-form">'; echo '<fieldset><legend>' . __('Blog details') . '</legend>' . $core->formNonce();
if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) { if (!$pwd_check) { throw new Exception(__('If you want to change your email or password you must provide your current password.')); } if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { throw new Exception(__("Passwords don't match")); } $cur->user_pwd = $_POST['new_pwd']; } # --BEHAVIOR-- adminBeforeUserUpdate $core->callBehavior('adminBeforeUserUpdate', $cur, $core->auth->userID()); # Udate user $core->updUser($core->auth->userID(), $cur); # --BEHAVIOR-- adminAfterUserUpdate $core->callBehavior('adminAfterUserUpdate', $cur, $core->auth->userID()); http::redirect('preferences.php?upd=1'); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY -------------------------------------------------------- */ dcPage::open($page_title, dcPage::jsLoad('js/_preferences.js') . dcPage::jsConfirmClose('user-form') . $core->callBehavior('adminPreferencesHeaders')); if (!empty($_GET['upd'])) { echo '<p class="message">' . __('Personal information has been successfully updated.') . '</p>'; } echo '<h2>' . $page_title . '</h2>'; echo '<form action="preferences.php" method="post" id="user-form">' . '<fieldset><legend>' . __('User preferences') . '</legend>' . '<div class="two-cols">' . '<div class="col">' . '<p><label>' . __('Last Name:') . form::field('user_name', 20, 255, html::escapeHTML($user_name), '', 2) . '</label></p>' . '<p><label>' . __('First Name:') . form::field('user_firstname', 20, 255, html::escapeHTML($user_firstname), '', 3) . '</label></p>' . '<p><label>' . __('Display name:') . form::field('user_displayname', 20, 255, html::escapeHTML($user_displayname), '', 4) . '</label></p>' . '<p><label>' . __('Email:') . form::field('user_email', 20, 255, html::escapeHTML($user_email), '', 5) . '</label></p>' . '<p><label>' . __('URL:') . form::field('user_url', 30, 255, html::escapeHTML($user_url), '', 6) . '</label></p>' . '</div>' . '<div class="col">' . '<p><label>' . __('Preferred format:') . form::combo('user_post_format', $formaters_combo, $user_options['post_format'], '', 7) . '</label></p>' . '<p><label>' . __('Default entry status:') . form::combo('user_post_status', $status_combo, $user_post_status, '', 8) . '</label></p>' . '<p><label>' . __('Entry edit field height:') . form::field('user_edit_size', 5, 4, (int) $user_options['edit_size'], '', 9) . '</label></p>' . '<p><label>' . __('User language:') . form::combo('user_lang', $lang_combo, $user_lang, 'l10n', 10) . '</label></p>' . '<p><label>' . __('User timezone:') . form::combo('user_tz', dt::getZones(true, true), $user_tz, '', 11) . '</label></p>' . '<p><label class="classic">' . form::checkbox('user_wysiwyg', 1, $user_options['enable_wysiwyg'], '', 12) . ' ' . __('Enable WYSIWYG mode') . '</label></p>' . '</div>' . '</div>' . '<br class="clear" />' . '</fieldset>'; # --BEHAVIOR-- adminPreferencesForm $core->callBehavior('adminPreferencesForm', $core); if ($core->auth->allowPassChange()) {
/** * retrieves a URL given its name, and optional parameters * * @param string $name URL Name * @param array $params query string parameters, given as an associative array * @param boolean $urlencode set to true if url may not be encoded * @param string $suffix suffix to be added to the QS parameters * @return string the forged url */ public function redirect($name, $params = array(), $suffix = "") { if (!isset($this->urls[$name])) { throw new exception('Unknown URL handler for ' . $name); } http::redirect($this->get($name, $params, '&') . $suffix); }
* */ # Accès direct interdit if (!defined('ON_FAQ_MODULE')) { die; } /* Initialisations ----------------------------------------------------------*/ # initialisation des filtres $okt->faq->filtersStart('admin'); /* Traitements ----------------------------------------------------------*/ # switch question statut if (!empty($_GET['switch_status'])) { if ($okt->faq->setQuestionStatus($_GET['switch_status'])) { http::redirect('module.php?m=faq&action=index&switched=1'); } } # Ré-initialisation filtres if (!empty($_GET['init_filters'])) { $okt->faq->filters->initFilters(); $okt->redirect('module.php?m=faq&action=index'); } /* Affichage ----------------------------------------------------------*/ # initialisation des filtres $params = array('language' => $okt->user->language, 'active' => 2); $okt->faq->filters->setQuestionsParams($params); # création des filtres $okt->faq->filters->getFilters(); # initialisation de la pagination
* it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK *****/ require_once dirname(__FILE__) . '/inc/prepend.php'; if ($core->auth->sessionExists()) { http::redirect(BP_PLANET_URL . '/index.php'); exit; } $scripts = array(); $scripts[] = "javascript/functions.js"; include dirname(__FILE__) . '/tpl.php'; # header('Content-type: text/html; charset=utf-8'); $form_values = array("user_id" => "", "fullname" => "", "email" => "", "password" => ""); $flash = ''; session_start(); require_once dirname(__FILE__) . '/inc/lib/recaptchalib.php'; $privatekey = "6LdEeQgAAAAAABrweqchK5omdyYS_fUeDqvDRq3Q"; $publickey = "6LdEeQgAAAAAACLccbiO8TNaptSmepfMFEDL3hj2"; if (isset($_POST) && isset($_POST['submit'])) { $captcha = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
public function process($do) { if ($do == 'single' || $do == 'full') { $this->status = $do; return; } $to_unlink = false; # Single blog import $files = $this->getPublicFiles(); $single_upl = null; if (!empty($_POST['public_single_file']) && in_array($_POST['public_single_file'], $files)) { $single_upl = false; } elseif (!empty($_FILES['up_single_file'])) { $single_upl = true; } if ($single_upl !== null) { if ($single_upl) { files::uploadStatus($_FILES['up_single_file']); $file = DC_TPL_CACHE . '/' . md5(uniqid()); if (!move_uploaded_file($_FILES['up_single_file']['tmp_name'], $file)) { throw new Exception(__('Unable to move uploaded file.')); } $to_unlink = true; } else { $file = $_POST['public_single_file']; } try { $bk = new dcImport($this->core, $file); $bk->importSingle(); } catch (Exception $e) { if ($to_unlink) { @unlink($file); } throw $e; } if ($to_unlink) { @unlink($file); } http::redirect($this->getURL() . '&do=single'); } # Full import $full_upl = null; if (!empty($_POST['public_full_file']) && in_array($_POST['public_full_file'], $files)) { $full_upl = false; } elseif (!empty($_FILES['up_full_file'])) { $full_upl = true; } if ($full_upl !== null && $this->core->auth->isSuperAdmin()) { if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY, $_POST['your_pwd']))) { throw new Exception(__('Password verification failed')); } if ($full_upl) { files::uploadStatus($_FILES['up_full_file']); $file = DC_TPL_CACHE . '/' . md5(uniqid()); if (!move_uploaded_file($_FILES['up_full_file']['tmp_name'], $file)) { throw new Exception(__('Unable to move uploaded file.')); } $to_unlink = true; } else { $file = $_POST['public_full_file']; } try { $bk = new dcImport($this->core, $file); $bk->importFull(); } catch (Exception $e) { if ($to_unlink) { @unlink($file); } throw $e; } if ($to_unlink) { @unlink($file); } http::redirect($this->getURL() . '&do=full'); } header('content-type:text/plain'); var_dump($_POST); exit; $this->status = true; }
} elseif (!empty($_POST['filters_order'])) { $order = explode(',', trim($_POST['filters_order'], ',')); } if (isset($order)) { foreach ($order as $i => $f) { $filters_opt[$f][1] = $i; } } # Set auto delete flag if (isset($_POST['filters_auto_del']) && is_array($_POST['filters_auto_del'])) { foreach ($_POST['filters_auto_del'] as $v) { $filters_opt[$v][2] = true; } } oktAntispam::$filters->saveFilterOpts($filters_opt); http::redirect('module.php?m=antispam&upd=1'); } } catch (Exception $e) { $okt->error->set($e->getMessage()); } /* Affichage ----------------------------------------------------------*/ # Confirmations $okt->page->messages->success('upd', __('m_antispam_Filters_configuration_successfully_saved')); //echo //dcPage::jsToolMan(). //dcPage::jsPageTabs($default_tab). //dcPage::jsLoad('index.php?pf=antispam/antispam.js'); # En-tête include OKT_ADMIN_HEADER_FILE; # affichage de la configuration d’un filtre
# Update thumbnails if (!empty($_POST['thumbs']) && $file->media_type == 'image' && $file->editable && $core_media_writable) { try { $okt->media->imageThumbCreate(null, $file->basename); $okt->page->flashMessages->addSuccess(__('Thumbnails have been successfully updated.')); http::redirect($page_url . '&id=' . $id); } catch (Exception $e) { $okt->error->set($e->getMessage()); } } # Unzip file if (!empty($_POST['unzip']) && $file->type == 'application/zip' && $file->editable && $core_media_writable) { try { $unzip_dir = $okt->media->inflateZipFile($file, $_POST['inflate_mode'] == 'new'); $okt->page->flashMessages->addSuccess(__('Zip file has been successfully extracted.')); http::redirect($media_page_url . '&d=' . $unzip_dir); } catch (Exception $e) { $okt->error->set($e->getMessage()); } } # Function to get image title based on meta function dcGetImageTitle($file, $pattern) { return $file->media_title; $res = array(); $pattern = preg_split('/\\s*;;\\s*/', $pattern); $sep = ', '; foreach ($pattern as $v) { if ($v == 'Title') { $res[] = $file->media_title; } elseif ($file->media_meta->{$v}) {
/** * Checks all modules dependencies, and disable unmet dependencies * @param string $redir_url URL to redirect if modules are to disable * @return boolean, true if a redirection has been performed */ public function disableDepModules($redir_url) { if (isset($_GET['dep'])) { // Avoid infinite redirects return false; } $reason = array(); foreach ($this->to_disable as $module) { try { $this->deactivateModule($module['name']); $reason[] = sprintf("<li>%s : %s</li>", $module['name'], join(',', $module['reason'])); } catch (Exception $e) { } } if (count($reason)) { $message = sprintf("<p>%s</p><ul>%s</ul>", __('The following extensions have been disabled :'), join('', $reason)); dcPage::addWarningNotice($message, array('divtag' => true, 'with_ts' => false)); $url = $redir_url . (strpos($redir_url, "?") ? '&' : '?') . 'dep=1'; http::redirect($url); return true; } return false; }
protected function guiprocess($do) { switch ($do) { case 'step1': $this->vars['db_host'] = $_POST['db_host']; $this->vars['db_name'] = $_POST['db_name']; $this->vars['db_user'] = $_POST['db_user']; $this->vars['db_pwd'] = $_POST['db_pwd']; $this->vars['post_limit'] = abs((int) $_POST['post_limit']) > 0 ? $_POST['post_limit'] : 0; $this->vars['db_prefix'] = $_POST['db_prefix']; $db = $this->db(); $db->close(); $this->step = 2; echo $this->progressBar(1); break; case 'step2': $this->step = 2; $this->importUsers(); $this->step = 3; echo $this->progressBar(3); break; case 'step3': $this->step = 3; $this->importCategories(); if ($this->core->plugins->moduleExists('blogroll')) { $this->step = 4; echo $this->progressBar(5); } else { $this->step = 5; echo $this->progressBar(7); } break; case 'step4': $this->step = 4; $this->importLinks(); $this->step = 5; echo $this->progressBar(7); break; case 'step5': $this->step = 5; $this->post_offset = !empty($_REQUEST['offset']) ? abs((int) $_REQUEST['offset']) : 0; if ($this->importPosts($percent) === -1) { http::redirect($this->getURL() . '&do=ok'); } else { echo $this->progressBar(ceil($percent * 0.93) + 7); } break; case 'ok': $this->resetVars(); $this->core->blog->triggerBlog(); $this->step = 6; echo $this->progressBar(100); break; } }
if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY, $_POST['your_pwd']))) { throw new Exception(__('Password verification failed')); } files::uploadStatus($_FILES['pkg_file']); $dest = DC_L10N_ROOT . '/' . $_FILES['pkg_file']['name']; if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) { throw new Exception(__('Unable to move uploaded file.')); } try { $ret_code = dc_lang_install($dest); } catch (Exception $e) { @unlink($dest); throw $e; } @unlink($dest); http::redirect('langs.php?added=' . $ret_code); } catch (Exception $e) { $core->error->add($e->getMessage()); } } /* DISPLAY Main page -------------------------------------------------------- */ dcPage::open(__('Languages management'), dcPage::jsLoad('js/_langs.js')); echo '<h2>' . __('Languages management') . '</h2>'; if (!empty($_GET['removed'])) { echo '<p class="message">' . __('Language has been successfully deleted.') . '</p>'; } if (!empty($_GET['added'])) { echo '<p class="message">' . ($_GET['added'] == 2 ? __('Language has been successfully upgraded') : __('Language has been successfully installed.')) . '</p>'; } echo '<p>' . __('Here you can install, upgrade or remove languages for your Dotclear ' . 'installation.') . '</p>' . '<p>' . sprintf(__('You can change your user language in your <a href="%1$s">preferences</a> or ' . 'change your blog\'s main language in your <a href="%2$s">blog settings</a>.'), 'preferences.php', 'blog_pref.php') . '</p>';
* published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK *****/ require_once dirname(__FILE__) . '/inc/prepend.php'; # If contact page is disable if (!$blog_settings->get('planet_contact_page')) { http::redirect('index.php'); } $scripts = array(); $scripts[] = "javascript/functions.js"; include dirname(__FILE__) . '/tpl.php'; # header('Content-type: text/html; charset=utf-8'); $flash = ''; if (isset($_POST) && isset($_POST['submit'])) { require_once dirname(__FILE__) . '/inc/lib/recaptchalib.php'; $privatekey = "6LdEeQgAAAAAABrweqchK5omdyYS_fUeDqvDRq3Q"; $captcha = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$captcha->is_valid) { $flash = array('type' => 'error', 'msg' => sprintf(T_("The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: %s)"), $captcha->error)); } else { # On recupere les infos
<?php /** * @ingroup okt_module_users * @brief Fichier principal des pages d'administration du module. * */ # Accès direct interdit if (!defined('ON_USERS_MODULE')) { die; } # Perm ? if (!$okt->checkPerm('users') && $okt->page->action !== 'profil') { http::redirect(OKT_ADMIN_LOGIN_PAGE); } if ($okt->page->action === 'profil') { require __DIR__ . '/inc/admin/profil.php'; } else { # titre de la page $okt->page->addGlobalTitle(__('Users'), 'module.php?m=users'); # button set $okt->page->setButtonset('users', array('id' => 'users-buttonset', 'type' => '', 'buttons' => array(array('permission' => $okt->page->action === 'add' || $okt->page->action === 'edit', 'title' => __('c_c_action_Go_back'), 'url' => 'module.php?m=users&action=index', 'ui-icon' => 'arrowreturnthick-1-w'), array('permission' => !$okt->page->action || $okt->page->action === 'index' || $okt->page->action === 'edit', 'title' => __('m_users_Add_user'), 'url' => 'module.php?m=users&action=add', 'ui-icon' => 'plusthick')))); # inclusion du fichier requis if (!$okt->page->action || $okt->page->action === 'index') { require __DIR__ . '/inc/admin/index.php'; } elseif ($okt->page->action === 'add') { require __DIR__ . '/inc/admin/add.php'; } elseif ($okt->page->action === 'edit') { require __DIR__ . '/inc/admin/edit.php'; } elseif ($okt->page->action === 'groups' && $okt->checkPerm('groups')) { require __DIR__ . '/inc/admin/groups.php';
<div id="BP_page" class="page"> <div class="inpage"> <div id="flash-log" style="display:none;"> <div id="flash-msg"><!-- spanner --></div> </div> <fieldset><legend><?php echo T_('Manage user permissions'); ?> </legend> <div class="message"> <p><?php echo T_('Check user statuses and configure their permissions'); ?> </p> </div> <div id="users-list"></div> </fieldset> <script type="text/javascript" src="meta/js/manage-permissions.js"></script> <script type="text/javascript" src="meta/js/jquery.boxy.js"></script> <?php include dirname(__FILE__) . '/footer.php'; } else { $page_url = urlencode(http::getHost() . $_SERVER['REQUEST_URI']); http::redirect('../auth.php?came_from=' . $page_url); }