public final function getURL($escape = false) { if ($escape) { return html::escapeHTML($this->url); } return $this->url; }
protected function prepend() { global $oktAutoloadPaths; # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); # autoload $oktAutoloadPaths['diaryController'] = __DIR__ . '/inc/class.diary.controller.php'; $oktAutoloadPaths['diaryRecordset'] = __DIR__ . '/inc/class.diary.recordset.php'; $oktAutoloadPaths['diaryMonthlyCalendar'] = __DIR__ . '/inc/class.diary.monthly.calendar.php'; $oktAutoloadPaths['diaryFilters'] = __DIR__ . '/inc/class.diary.filters.php'; # permissions $this->okt->addPermGroup('diary', __('m_diary_perm_group')); $this->okt->addPerm('diary', __('m_diary_perm_global'), 'diary'); $this->okt->addPerm('diary_add', __('m_diary_perm_add'), 'diary'); $this->okt->addPerm('diary_remove', __('m_diary_perm_remove'), 'diary'); $this->okt->addPerm('diary_display', __('m_diary_perm_display'), 'diary'); $this->okt->addPerm('diary_config', __('m_diary_perm_config'), 'diary'); # tables $this->table = $this->db->prefix . 'mod_diary'; # configuration $this->config = $this->okt->newConfig('conf_diary'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_list_url[$this->okt->user->language]; # définition des routes $this->okt->router->addRoute('diaryList', new oktRoute('^(?:' . html::escapeHTML(implode('|', $this->config->public_list_url)) . ')/?(.*)?$', 'diaryController', 'diaryList')); $this->okt->router->addRoute('diaryEvent', new oktRoute('^(?:' . html::escapeHTML(implode('|', $this->config->public_event_url)) . ')/(.*)$', 'diaryController', 'diaryEvent')); # répertoire upload $this->upload_dir = OKT_UPLOAD_PATH . '/diary/'; $this->upload_url = OKT_UPLOAD_URL . '/diary/'; }
protected function init() { $this->name = __('Database export'); $this->task = __('Download database of current blog'); $this->export_name = html::escapeHTML($this->core->blog->id . '-backup.txt'); $this->export_type = 'export_blog'; }
public function gui() { if ($this->status) { dcPage::success(__('Content successfully imported.')); } echo '<form action="' . $this->getURL(true) . '" method="post">' . '<p>' . sprintf(__('Add a feed content to the current blog: <strong>%s</strong>.'), html::escapeHTML($this->core->blog->name)) . '</p>' . '<p><label for="feed_url">' . __('Feed URL:') . '</label>' . form::field('feed_url', 50, 300, html::escapeHTML($this->feed_url)) . '</p>' . '<p>' . $this->core->formNonce() . form::hidden(array('do'), 1) . '<input type="submit" value="' . __('Import') . '" /></p>' . '</form>'; }
protected function prepend() { # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); global $oktAutoloadPaths; #autoload $oktAutoloadPaths['partnersController'] = __DIR__ . '/inc/class.partners.controller.php'; $oktAutoloadPaths['partnersRecordset'] = __DIR__ . '/inc/class.partners.recordset.php'; #permissions $this->okt->addPermGroup('partners', __('m_partners_perm_group')); $this->okt->addPerm('partners', __('m_partners_perm_global'), 'partners'); $this->okt->addPerm('partners_add', __('m_partners_perm_add'), 'partners'); $this->okt->addPerm('partners_remove', __('m_partners_perm_remove'), 'partners'); $this->okt->addPerm('partners_display', __('m_partners_perm_display'), 'partners'); $this->okt->addPerm('partners_config', __('m_partners_perm_config'), 'partners'); #tables $this->t_partners = $this->db->prefix . 'mod_partners'; $this->t_partners_locales = $this->db->prefix . 'mod_partners_locales'; $this->t_categories = $this->db->prefix . 'mod_partners_categories'; $this->t_categories_locales = $this->db->prefix . 'mod_partners_categories_locales'; #config $this->config = $this->okt->newConfig('conf_partners'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_url[$this->okt->user->language]; # définition des routes $this->okt->router->addRoute('partnersPage', new oktRoute('^(' . html::escapeHTML(implode('|', $this->config->public_url)) . ')$', 'partnersController', 'partnersPage')); #répertoire upload $this->upload_dir = OKT_UPLOAD_PATH . '/partners/'; $this->upload_url = OKT_UPLOAD_URL . '/partners/'; # initialisation arbre catégories $this->tree = new nestedTree($this->okt, $this->t_categories, 'id', 'parent_id', 'ord', array('active', 'ord')); }
/** * Affichage du captcha côté public * * @param object $okt * @param string $sCaptchaId */ public static function publicTplFormBottom($okt, $sCaptchaId) { if ($sCaptchaId == 'recaptcha') { $aAcceptedLanguages = array('en', 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr'); if (in_array($okt->user->language, $aAcceptedLanguages)) { $sLanguage = $okt->user->language; } elseif (in_array($okt->config->language, $aAcceptedLanguages)) { $sLanguage = $okt->config->language; } else { $sLanguage = 'en'; } echo '<script type="text/javascript"> //<![CDATA[ var RecaptchaOptions = { theme: "' . $okt->recaptcha->config->theme . '", lang: "' . $sLanguage . '" }; //]]> </script>'; require_once __DIR__ . '/recaptcha-php-1.11/recaptchalib.php'; echo recaptcha_get_html(html::escapeHTML($okt->recaptcha->config->publickey)); } }
private function postLine() { $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img, __('published'), 'check-on.png'); break; case 0: $img_status = sprintf($img, __('unpublished'), 'check-off.png'); break; case -1: $img_status = sprintf($img, __('scheduled'), 'scheduled.png'); break; case -2: $img_status = sprintf($img, __('pending'), 'check-wrn.png'); break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img, __('protected'), 'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img, __('selected'), 'selected.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png'); } $res = '<tr class="line' . ($this->rs->post_status != 1 ? ' offline' : '') . '"' . ' id="p' . $this->rs->post_id . '">'; $res .= '<td class="nowrap">' . form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()) . '</td>' . '<td class="maximal"><a href="' . $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>' . '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>' . '<td class="nowrap">' . $this->rs->user_id . '</td>' . '<td class="nowrap">' . $this->rs->nb_comment . '</td>' . '<td class="nowrap">' . $this->rs->nb_trackback . '</td>' . '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>' . '</tr>'; return $res; }
protected function prepend() { global $oktAutoloadPaths; # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); # autoload $oktAutoloadPaths['catalogController'] = __DIR__ . '/inc/class.catalog.controller.php'; $oktAutoloadPaths['catalogFilters'] = __DIR__ . '/inc/class.catalog.filters.php'; $oktAutoloadPaths['catalogRecordset'] = __DIR__ . '/inc/class.catalog.recordset.php'; # permissions $this->okt->addPermGroup('catalog', __('m_catalog_perm_group')); $this->okt->addPerm('catalog', __('m_catalog_perm_global'), 'catalog'); $this->okt->addPerm('catalog_categories', __('m_catalog_perm_categories'), 'catalog'); $this->okt->addPerm('catalog_add', __('m_catalog_perm_add'), 'catalog'); $this->okt->addPerm('catalog_remove', __('m_catalog_perm_remove'), 'catalog'); $this->okt->addPerm('catalog_display', __('m_catalog_perm_display'), 'catalog'); $this->okt->addPerm('catalog_config', __('m_catalog_perm_config'), 'catalog'); # tables $this->t_products = $this->db->prefix . 'mod_catalog_products'; $this->t_categories = $this->db->prefix . 'mod_catalog_categories'; # config $this->config = $this->okt->newConfig('conf_catalog'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_catalog_url; # définition des routes $this->okt->router->addRoute('catalogList', new oktRoute(html::escapeHTML($this->config->public_catalog_url), 'catalogController', 'catalogList')); $this->okt->router->addRoute('catalogCategory', new oktRoute('^' . html::escapeHTML($this->config->public_catalog_url) . '/(.*)$', 'catalogController', 'catalogCategory')); $this->okt->router->addRoute('catalogItem', new oktRoute('^' . html::escapeHTML($this->config->public_product_url) . '/(.*)$', 'catalogController', 'catalogItem')); # répertoire upload $this->upload_dir = OKT_UPLOAD_PATH . '/catalog/'; $this->upload_url = OKT_UPLOAD_URL . '/catalog/'; # categories if ($this->config->categories_enable) { $this->tree = new nestedTree($this->okt, $this->t_categories, 'id', 'parent_id', 'ord', array('active', 'name', 'slug', 'ord')); } }
/** * Chargée à l'initialisation des modules * * @see inc/classes/modules/oktModule#prepend() */ protected function prepend() { global $oktAutoloadPaths; # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); # autoload $oktAutoloadPaths['faqController'] = __DIR__ . '/inc/class.faq.controller.php'; $oktAutoloadPaths['faqFilters'] = __DIR__ . '/inc/class.faq.filters.php'; $oktAutoloadPaths['faqRecordset'] = __DIR__ . '/inc/class.faq.recordset.php'; # permissions $this->okt->addPermGroup('faq', __('m_faq_perm_group')); $this->okt->addPerm('faq', __('m_faq_perm_global'), 'faq'); $this->okt->addPerm('faq_add', __('m_faq_perm_add'), 'faq'); $this->okt->addPerm('faq_remove', __('m_faq_perm_remove'), 'faq'); $this->okt->addPerm('faq_categories', __('m_faq_perm_categories'), 'faq'); $this->okt->addPerm('faq_display', __('m_faq_perm_display'), 'faq'); $this->okt->addPerm('faq_config', __('m_faq_perm_config'), 'faq'); # tables $this->t_faq = $this->db->prefix . 'mod_faq'; $this->t_faq_locales = $this->db->prefix . 'mod_faq_locales'; $this->t_faq_cat = $this->db->prefix . 'mod_faq_cat'; $this->t_faq_cat_locales = $this->db->prefix . 'mod_faq_cat_locales'; $this->t_users = $this->db->prefix . 'core_users'; # config $this->config = $this->okt->newConfig('conf_faq'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_faq_url[$this->okt->user->language]; # définition des routes $this->okt->router->addRoute('faqList', new oktRoute('^(' . html::escapeHTML(implode('|', $this->config->public_faq_url)) . ')$', 'faqController', 'faqList')); $this->okt->router->addRoute('faqQuestion', new oktRoute('^(?:' . html::escapeHTML(implode('|', $this->config->public_question_url)) . ')/(.*)$', 'faqController', 'faqQuestion')); # répertoire upload $this->upload_dir = OKT_UPLOAD_PATH . '/faq/'; $this->upload_url = OKT_UPLOAD_URL . '/faq/'; }
public function gui() { if ($this->status) { echo '<p class="message">' . __('Content successfully imported.') . '</p>'; } echo '<h3>' . __('Import from a feed') . '</h3>' . '<p>' . sprintf(__('This will import a feed (RSS or Atom) a as new content in the current blog: %s.'), '<strong>' . html::escapeHTML($this->core->blog->name) . '</strong>') . '</p>' . '<form action="' . $this->getURL(true) . '" method="post">' . '<fieldset>' . $this->core->formNonce() . form::hidden(array('do'), 1) . '<p><label>' . __('Feed URL:') . ' ' . form::field('feed_url', 40, 300, html::escapeHTML($this->feed_url)) . '</label></p>' . '<p><input type="submit" value="' . __('Send') . '" /></p>' . '</fieldset>' . '</form>'; }
protected function prepend() { global $oktAutoloadPaths; # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); # autoload $oktAutoloadPaths['galleriesController'] = __DIR__ . '/inc/class.galleries.controller.php'; $oktAutoloadPaths['galleriesHelpers'] = __DIR__ . '/inc/class.galleries.helpers.php'; $oktAutoloadPaths['galleriesItems'] = __DIR__ . '/inc/class.galleries.items.php'; $oktAutoloadPaths['galleriesItemsRecordset'] = __DIR__ . '/inc/class.galleries.items.recordset.php'; $oktAutoloadPaths['galleriesRecordset'] = __DIR__ . '/inc/class.galleries.recordset.php'; $oktAutoloadPaths['galleriesTree'] = __DIR__ . '/inc/class.galleries.tree.php'; # permissions $this->okt->addPermGroup('galleries', __('m_galleries_perm_group')); $this->okt->addPerm('galleries', __('m_galleries_perm_global'), 'galleries'); $this->okt->addPerm('galleries_manage', __('m_galleries_perm_manage'), 'galleries'); $this->okt->addPerm('galleries_add', __('m_galleries_perm_add'), 'galleries'); $this->okt->addPerm('galleries_remove', __('m_galleries_perm_remove'), 'galleries'); $this->okt->addPerm('galleries_display', __('m_galleries_perm_display'), 'galleries'); $this->okt->addPerm('galleries_config', __('m_galleries_perm_config'), 'galleries'); # tables $this->t_galleries = $this->db->prefix . 'mod_galleries'; $this->t_galleries_locales = $this->db->prefix . 'mod_galleries_locales'; $this->t_items = $this->db->prefix . 'mod_galleries_items'; $this->t_items_locales = $this->db->prefix . 'mod_galleries_items_locales'; # répertoire upload $this->upload_dir = OKT_UPLOAD_PATH . '/galleries/'; $this->upload_url = OKT_UPLOAD_URL . '/galleries/'; # déclencheurs $this->triggers = new oktTriggers(); # config $this->config = $this->okt->newConfig('conf_galleries'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_list_url[$this->okt->user->language]; $this->config->feed_url = $this->okt->config->app_path . $this->config->public_feed_url[$this->okt->user->language]; # définition des routes $this->okt->router->addRoute('galleriesList', new oktRoute('^(' . html::escapeHTML(implode('|', $this->config->public_list_url)) . ')$', 'galleriesController', 'galleriesList')); $this->okt->router->addRoute('galleriesGallery', new oktRoute('^(?:' . html::escapeHTML(implode('|', $this->config->public_gallery_url)) . ')/(.*)$', 'galleriesController', 'galleriesGallery')); $this->okt->router->addRoute('galleriesItem', new oktRoute('^(?:' . html::escapeHTML(implode('|', $this->config->public_item_url)) . ')/(.*)$', 'galleriesController', 'galleriesItem')); # galleries tree $this->tree = new galleriesTree($this->okt, $this->t_items, $this->t_items_locales, $this->t_galleries, $this->t_galleries_locales, 'id', 'parent_id', 'ord', 'gallery_id', 'language', array('active', 'ord', 'locked', 'password', 'tpl', 'items_tpl'), array('title', 'title_tag', 'title_seo', 'slug', 'content', 'meta_description', 'meta_keywords'), $this->upload_dir, $this->upload_url); /* THE OLD ONE (remenber the fields names) $this->tree = new nestedTree( $this->okt, $this->t_galleries, 'id', 'parent_id', 'ord', array( 'active', 'name', 'slug', 'ord', 'image', 'description', 'password' ) );*/ # galleries items $this->items = new galleriesItems($this->okt, $this->t_items, $this->t_items_locales, $this->t_galleries, $this->t_galleries_locales); }
public function setFrom() { if (!empty($this->okt->config->email['name'])) { $this->message->setFrom(array($this->okt->config->email['from'] => html::escapeHTML($this->okt->config->email['name']))); } else { $this->message->setFrom($this->okt->config->email['from']); } }
public static function text(&$w) { global $core; if ($w->homeonly && $core->url->type != 'default') { return; } $res = '<div class="wikitext ' . $w->class . '">' . ($w->title ? '<h1>' . html::escapeHTML($w->title) . '</h1>' : '') . $core->wikiTransform($w->content) . '</div>'; return $res; }
/** * Construit le HTML à partir de la pile d'éléments. * * @return string */ public function getHTML() { if (!$this->hasItem()) { return null; } if (count($this->stack) > 1) { return '<ul><li>' . implode('</li><li>', array_map(array('html', 'escapeHTML'), $this->stack)) . '</li></ul>'; } return '<p>' . html::escapeHTML($this->stack[0]) . '</p>'; }
function listImportExportModules($core, $modules) { $res = ''; foreach ($modules as $id) { $o = new $id($core); $res .= '<dt><a href="' . $o->getURL(true) . '">' . html::escapeHTML($o->name) . '</a></dt>' . '<dd>' . html::escapeHTML($o->description) . '</dd>'; unset($o); } return '<dl class="modules">' . $res . '</dl>'; }
function settingLine($id, $s, $ns, $field_name, $strong_label) { if ($s['type'] == 'boolean') { $field = form::combo(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $id), array(__('yes') => 1, __('no') => 0), $s['value']); } else { $field = form::field(array($field_name . '[' . $ns . '][' . $id . ']', $field_name . '_' . $id), 40, null, html::escapeHTML($s['value'])); } $slabel = $strong_label ? '<strong>%s</strong>' : '%s'; return '<tr>' . '<td><label for="s_' . $id . '">' . sprintf($slabel, html::escapeHTML($id)) . '</label></td>' . '<td>' . $field . '</td>' . '<td>' . $s['type'] . '</td>' . '<td>' . html::escapeHTML($s['label']) . '</td>' . '</tr>'; }
/** Returns an hierarchical categories combo from a category record @param categories <b>record</b> the category record @return <b>array</b> the combo box (form::combo -compatible format) */ public static function getCategoriesCombo($categories, $include_empty = true, $use_url = false) { $categories_combo = array(); if ($include_empty) { $categories_combo = array(new formSelectOption(__('(No cat)'), '')); } while ($categories->fetch()) { $categories_combo[] = new formSelectOption(html::escapeHTML($categories->cat_title) . ' (' . $categories->nb_post . ')', $use_url ? $categories->cat_url : $categories->cat_id, $categories->level - 1 ? 'sub-option' . ($categories->level - 1) : ''); } return $categories_combo; }
public static function getContent(&$rs, $absolute_urls = false) { # Not very nice hack but it does the job :) if (isset($GLOBALS['_ctx']) && $GLOBALS['_ctx']->short_feed_items === true) { $_ctx =& $GLOBALS['_ctx']; $c = parent::getContent($rs, $absolute_urls); $c = context::remove_html($c); $c = context::cut_string($c, 350); $c = '<p>' . $c . '... ' . '<em><a href="' . $rs->getURL() . '">' . __('Read') . '</em> ' . html::escapeHTML($rs->post_title) . '</a></p>'; return $c; } if ($rs->core->blog->settings->use_smilies) { return self::smilies(parent::getContent($rs, $absolute_urls), $rs->core->blog); } return parent::getContent($rs, $absolute_urls); }
/** * Retourne le HTML additionnel d'un jour dans le calendrier. * * @return string */ protected function getDayContent() { # si on as pas d'évènement pour cette date, on passe à la suivante if (!isset($this->aDatesEvents[$this->iDate])) { return null; } # si on est pas sur un vrai jour on passe à la suivante if (!$this->bRealDay) { return null; } $aEvents = array(); foreach ($this->aDatesEvents[$this->iDate] as $aEvent) { $aEvents[] = sprintf($this->aConfig['htmlEventItem'], html::escapeHTML($aEvent['title']), $aEvent['url'], 'disponibility_' . $aEvent['disponibility'], !empty($aEvent['color']) ? ' style="background-color: #' . $aEvent['color'] . ' "' : ''); } return sprintf($this->aConfig['htmlEventsList'], implode('', $aEvents)); }
protected function setFilterGroup() { $this->setIntFilter('group_id'); if ($this->params->group_id != -1) { $this->get_users_params['group_id'] = $this->params->group_id; } $rs = $this->users->getGroups(); $groups_array = array(__('c_c_All') => -1, __('m_users_wait_of_validation') => oktAuth::unverified_group_id); while ($rs->fetch()) { if ($rs->group_id == oktAuth::guest_group_id || $rs->group_id == oktAuth::superadmin_group_id && !$GLOBALS['okt']->user->is_superadmin) { continue; } $groups_array[html::escapeHTML($rs->title)] = $rs->group_id; } unset($rs); $this->fields['group_id'] = array($this->form_id . '_group_id', __('c_c_Group'), form::select(array('group_id', $this->form_id . '_group_id'), $groups_array, $this->params->group_id)); }
protected function setFilterCategory() { if (!$this->config->categories_enable) { return null; } $this->order_by_array['catégorie'] = 'category'; if (!isset($this->get_catalog_params['category_id'])) { $this->setIntFilter('category_id'); $this->get_catalog_params['category_id'] = $this->params->category_id; } $categories_list = $this->catalog->getCategories(array('active' => 2)); $sField = '<select id="' . $this->form_id . '_category_id" name="category_id">' . '<option value="0">toutes</option>'; while ($categories_list->fetch()) { $sField .= '<option value="' . $categories_list->id . '"' . ($categories_list->id == $this->params->category_id ? ' selected="selected"' : '') . '>' . str_repeat(' ', $categories_list->level) . '• ' . html::escapeHTML($categories_list->name) . '</option>'; } $sField .= '</select>'; $this->fields['category_id'] = array($this->form_id . '_category_id', 'Catégorie', $sField); }
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; }
private static function genFeed($type, $args) { global $core; $user_id = dcAntispam::checkUserCode($core, $args); if ($user_id === false) { self::p404(); return; } $core->auth->checkUser($user_id, null, null); header('Content-Type: application/xml; charset=UTF-8'); $title = $core->blog->name . ' - ' . __('Spam moderation') . ' - '; $params = array(); $end_url = ''; if ($type == 'spam') { $title .= __('Spam'); $params['comment_status'] = -2; $end_url = '?status=-2'; } else { $title .= __('Ham'); $params['sql'] = ' AND comment_status IN (1,-1) '; } echo '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<rss version="2.0"' . "\n" . 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n" . 'xmlns:content="http://purl.org/rss/1.0/modules/content/">' . "\n" . '<channel>' . "\n" . '<title>' . html::escapeHTML($title) . '</title>' . "\n" . '<link>' . (DC_ADMIN_URL ? DC_ADMIN_URL . 'comments.php' . $end_url : 'about:blank') . '</link>' . "\n" . '<description></description>' . "\n"; $rs = $core->blog->getComments($params); $maxitems = 20; $nbitems = 0; while ($rs->fetch() && $nbitems < $maxitems) { $nbitems++; $uri = DC_ADMIN_URL ? DC_ADMIN_URL . 'comment.php?id=' . $rs->comment_id : 'about:blank'; $author = $rs->comment_author; $title = $rs->post_title . ' - ' . $author; if ($type == 'spam') { $title .= '(' . $rs->comment_spam_filter . ')'; } $id = $rs->getFeedID(); $content = '<p>IP: ' . $rs->comment_ip; if (trim($rs->comment_site)) { $content .= '<br />URL: <a href="' . $rs->comment_site . '">' . $rs->comment_site . '</a>'; } $content .= "</p><hr />\n"; $content .= $rs->comment_content; echo '<item>' . "\n" . ' <title>' . html::escapeHTML($title) . '</title>' . "\n" . ' <link>' . $uri . '</link>' . "\n" . ' <guid>' . $id . '</guid>' . "\n" . ' <pubDate>' . $rs->getRFC822Date() . '</pubDate>' . "\n" . ' <dc:creator>' . html::escapeHTML($author) . '</dc:creator>' . "\n" . ' <description>' . html::escapeHTML($content) . '</description>' . "\n" . '</item>'; } echo "</channel>\n</rss>"; }
private function postLine($count, $checked) { $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; $sts_class = ''; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img, __('Published'), 'check-on.png'); $sts_class = 'sts-online'; break; case 0: $img_status = sprintf($img, __('Unpublished'), 'check-off.png'); $sts_class = 'sts-offline'; break; case -1: $img_status = sprintf($img, __('Scheduled'), 'scheduled.png'); $sts_class = 'sts-scheduled'; break; case -2: $img_status = sprintf($img, __('Pending'), 'check-wrn.png'); $sts_class = 'sts-pending'; break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img, __('Protected'), 'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img, __('Hidden'), 'hidden.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png'); } $res = '<tr class="line ' . ($this->rs->post_status != 1 ? 'offline ' : '') . $sts_class . '"' . ' id="p' . $this->rs->post_id . '">'; $cols = array('position' => '<td class="nowrap handle minimal">' . form::field(array('order[' . $this->rs->post_id . ']'), 2, 3, $count + 1, 'position', '', false, 'title="' . sprintf(__('position of %s'), html::escapeHTML($this->rs->post_title)) . '"') . '</td>', 'check' => '<td class="nowrap">' . form::checkbox(array('entries[]'), $this->rs->post_id, $checked, '', '', !$this->rs->isEditable(), 'title="' . __('Select this page') . '"') . '</td>', 'title' => '<td class="maximal" scope="row"><a href="' . $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>', 'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>', 'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>', 'comments' => '<td class="nowrap count">' . $this->rs->nb_comment . '</td>', 'trackbacks' => '<td class="nowrap count">' . $this->rs->nb_trackback . '</td>', 'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>'); $cols = new ArrayObject($cols); $this->core->callBehavior('adminPagesListValue', $this->core, $this->rs, $cols); $res .= implode(iterator_to_array($cols)); $res .= '</tr>'; 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 filesList($type, $item = '%1$s') { $files = $this->getFilesFromType($type); if (empty($files)) { return '<p>' . __('No file') . '</p>'; } $list = ''; foreach ($files as $k => $v) { if (strpos($v, $this->user_theme) === 0) { $li = sprintf('<li class="default-file">%s</li>', $item); } elseif ($this->parent_theme && strpos($v, $this->parent_theme) === 0) { $li = sprintf('<li class="parent-file">%s</li>', $item); } else { $li = sprintf('<li>%s</li>', $item); } $list .= sprintf($li, $k, html::escapeHTML($k)); } return sprintf('<ul>%s</ul>', $list); }
public function getHtmlField($aPostedData) { $return = ''; switch ($this->type) { # Champ texte default: case 1: $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::text($this->html_id, 60, 255, $aPostedData[$this->id]) . '</p>'; break; # Zone de texte # Zone de texte case 2: $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::textarea($this->html_id, 58, 10, $aPostedData[$this->id]) . '</p>'; break; # Menu déroulant # Menu déroulant case 3: $values = array_filter((array) unserialize($this->value)); $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::select($this->html_id, array_flip($values), $aPostedData[$this->id]) . '</p>'; break; # Boutons radio # Boutons radio case 4: $values = array_filter((array) unserialize($this->value)); $str = ''; foreach ($values as $k => $v) { $str .= '<li><label>' . form::radio(array($this->html_id, $this->html_id . '_' . $k), $k, $k == $aPostedData[$this->id]) . html::escapeHTML($v) . '</label></li>'; } $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>'; break; # Cases à cocher # Cases à cocher case 5: $values = array_filter((array) unserialize($this->value)); $str = ''; foreach ($values as $k => $v) { $str .= '<li><label>' . form::checkbox(array($this->html_id . '[' . $k . ']', $this->html_id . '_' . $k), $k, in_array($k, $aPostedData[$this->id])) . html::escapeHTML($v) . '</label></li>'; } $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>'; break; } return $return; }
public static function pingsForm(&$post) { $core =& $GLOBALS['core']; if (!$core->blog->settings->pings_active) { return; } $pings_uris = @unserialize($core->blog->settings->pings_uris); if (empty($pings_uris) || !is_array($pings_uris)) { return; } if (!empty($_POST['pings_do']) && is_array($_POST['pings_do'])) { $pings_do = $_POST['pings_do']; } else { $pings_do = array(); } echo '<h3 class="ping-services">' . __('Pings:') . '</h3>'; foreach ($pings_uris as $k => $v) { echo '<p class="ping-services"><label class="classic">' . form::checkbox(array('pings_do[]'), html::escapeHTML($v), in_array($v, $pings_do)) . ' ' . html::escapeHTML($k) . '</label></p>'; } }
protected function prepend() { global $oktAutoloadPaths; # chargement des principales locales l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main'); # autoload $oktAutoloadPaths['guestbookController'] = __DIR__ . '/inc/class.guestbook.controller.php'; # permissions $this->okt->addPermGroup('guestbook', __('m_guestbook_perm_group')); $this->okt->addPerm('guestbook', __('m_guestbook_perm_global'), 'guestbook'); $this->okt->addPerm('guestbook_display', __('m_guestbook_perm_display'), 'guestbook'); $this->okt->addPerm('guestbook_config', __('m_guestbook_perm_config'), 'guestbook'); # config $this->config = $this->okt->newConfig('conf_guestbook'); $this->config->url = $this->okt->page->getBaseUrl() . $this->config->public_url[$this->okt->user->language]; # définition des routes $this->okt->router->addRoute('guestbookPage', new oktRoute('^(' . html::escapeHTML(implode('|', $this->config->public_url)) . ')$', 'guestbookController', 'guestbookPage')); # table $this->t_guestbook = $this->db->prefix . 'mod_guestbook'; }
/** * Serve method to do step by step task for maintenance. * * @param core <b>dcCore</b> dcCore instance * @param get <b>array</b> cleaned $_GET * @param post <b>array</b> cleaned $_POST * * @return <b>xmlTag</b> XML representation of response */ public static function step($core, $get, $post) { if (!isset($post['task'])) { throw new Exception('No task ID'); } if (!isset($post['code'])) { throw new Exception('No code ID'); } $maintenance = new dcMaintenance($core); if (($task = $maintenance->getTask($post['task'])) === null) { throw new Exception('Unknow task ID'); } $task->code((int) $post['code']); if (($code = $task->execute()) === true) { $maintenance->setLog($task->id()); $code = 0; } $rsp = new xmlTag('step'); $rsp->code = $code; $rsp->title = html::escapeHTML($task->success()); return $rsp; }