/** * Оплата из буфера * @param type $type * @param array $data (prof_id) * @return type */ function quickPaymentTservicebindupBuffer($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $kind = (int) @$data['kind']; $tservice_id = (int) @$data['tservice_text_db_id']; $prof_id = (int) @$data['prof_id']; $is_spec = $kind == tservices_binds::KIND_SPEC; $tservices_binds = new tservices_binds($kind); $bind = $tservices_binds->getItem($uid, $tservice_id, $prof_id); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/buffer.php"; $buffer = new buffer(); $buffer_sum = $buffer->getSum(); $price = $tservices_binds->getPrice(true, $uid, $prof_id); if ($bind && $buffer_sum >= $price) { $bill = new billing($uid); $ok = $bill->addServiceAndPayFromAccount(tservices_binds::OP_CODE_UP_BUFFER, array('bind_id' => $bind['id'])); if ($ok) { $is_error = false; $buffer->setUsedSum($price); $objResponse->script("window.location.reload();"); } } // Показываем предупреждение в случае ошибки if ($is_error) { $idx = quickPaymentPopupTservicebindup::getPopupId($tservice_id); $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPaymentById('tservicebindup', '" . $idx . "');\n if(qp) qp.show_error('Возникла ошибка при поднятии закрепления услуги!');\n "); } return $objResponse; }
/** * Оплата из буфера. * * @param type $type * @param array $data (prof_id) * * @return type */ function quickPaymentFrlbindupBuffer($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $prof_id = (int) @$data['prof_id']; $is_spec = (bool) @$data['is_spec']; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/buffer.php'; $buffer = new buffer(); $buffer_sum = $buffer->getSum(); $freelancer_binds = new freelancer_binds(); $is_binded = $freelancer_binds->isUserBinded($uid, $prof_id, $is_spec); $price = $freelancer_binds->getPriceUp($prof_id, $is_spec, $uid); if ($is_binded && $buffer_sum >= $price) { $bill = new billing($uid); $option = array('prof_id' => $prof_id); //Покупаем услугу смоимостью 0 рублей при любом заначении ЛС $ok = $bill->addServiceAndPayZero(freelancer_binds::OP_CODE_UP_BUFFER, $option); if ($ok) { $is_error = false; $buffer->setUsedSum($price); $objResponse->script('window.location.reload();'); } } // Показываем предупреждение в случае ошибки if ($is_error) { $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPayment('frlbindup');\n if(qp) qp.show_error('Возникла ошибка при поднятии закрепления в каталоге!');\n "); } return $objResponse; }
public function init($options) { parent::init($options); $this->setBuyPopupTemplate('buy_popup_frlbindup.tpl.php'); $promoCodes = new PromoCodes(); $buffer = new buffer(); $options = array('popup_title_class_bg' => 'b-fon_bg_po', 'popup_title_class_icon' => 'b-icon__po', 'popup_title' => 'Поднятие закрепления на 1 место', 'popup_id' => $this->ID, 'unic_name' => $this->UNIC_NAME, 'payments_title' => 'Сумма и способ оплаты', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'ac_sum' => round($_SESSION['ac_sum'], 2), 'payment_account' => self::PAYMENT_TYPE_ACCOUNT, 'is_show' => $options['autoshow'], 'buffer' => $buffer->getSum(), 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_FRLBIND)); //Обязательно передаем родителю parent::init($options); //Добавляем свойство к одному способу оплаты $this->options['payments'][self::PAYMENT_TYPE_CARD]['wait'] = 'Ждите ....'; $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'закрепление'); }
function siteMap() { db::table('pages'); db::where('site_id', ADMIN_SITE_ID); db::where('page_map', '1'); db::where('page_dynamic', '0'); $res = db::select(); $content = ''; while ($row = mysql_fetch_assoc($res)) { $content .= ' <url> <loc>http://' . ADMIN_SITE . $row['page_folder'] . '</loc> <lastmod>' . substr($row['page_date'], 0, 10) . '</lastmod> </url>'; } $xml = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">' . $content . ' </urlset>'; if (files::write(ROOT . '/sitemap.xml', $xml)) { buffer::set('sitemap.xml успешно создан.'); } else { buffer::set('Не удалось записать sitemap.xml.'); } }
public function init($params) { $kind = $params['kind'] ?: tservices_binds::KIND_LANDING; //По умолчанию ставим лендинг $prof_id = (int) $params['prof_id']; $this->setBuyPopupTemplate('buy_popup_tservicebindup.tpl.php'); $tservices_binds = new tservices_binds($kind); $promoCodes = new PromoCodes(); $buffer = new buffer(); $options = array('popup_title_class_bg' => 'b-fon_bg_po', 'popup_title_class_icon' => 'b-icon__po', 'popup_title' => 'Поднятие закрепления на 1 место', 'popup_id' => $this->getPopupId(0), 'unic_name' => $this->UNIC_NAME, 'payments_title' => 'Сумма и способ оплаты', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'ac_sum' => round($_SESSION['ac_sum'], 2), 'payment_account' => self::PAYMENT_TYPE_ACCOUNT, 'kind' => $kind, 'profession' => $tservices_binds->getProfessionText(false, $prof_id), 'buffer' => $buffer->getSum(), 'ammount' => round($tservices_binds->getPrice(true, @$params['uid'], $prof_id), 2), 'disable_tservices' => false, 'prof_id' => $prof_id, 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_TSERVICEBIND)); //Обязательно передаем родителю parent::init($options); //Добавляем свойство к одному способу оплаты $this->options['payments'][self::PAYMENT_TYPE_CARD]['wait'] = 'Ждите ....'; $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'закрепление'); $this->inited = true; }
function checkDuplicate() { db::table('mails'); if (params::get('mail_id')) { db::where('mail_id', params::get('mail_id'), '!='); } db::where('mail_name', params::get('value')); db::select('mail_id'); if (db::rows() != 0) { buffer::set('error'); } }
function show() { $dir = IMAGES_PATH . 'index/'; db::table('images'); db::where('img_set', '1'); db::orderByRand(); $img = db::assoc(); if (db::rows() != 0) { $file = $dir . $img['img_id'] . '.jpg'; buffer::set('<img src="' . $file . '" width="700" height="360" alt="" />'); } }
function checkDuplicate() { db::table('admin_users'); if (params::get('user_id') !== false) { db::where('user_id', params::get('user_id'), '!='); } db::where('user_login', params::get('user_login')); db::select(); if (db::rows() != 0) { buffer::set('error'); } }
function restore() { db::table('admin_log_trash'); db::where('log_id', params::get('log_id')); $date = date('Y-m-d H:i:s'); db::update('log_restored', $date); db::table('admin_log_trash'); db::where('log_id', params::get('log_id')); $row = db::assoc(); if ($row['log_tmpl'] == '1') { trash::restore(params::get('log_id'), SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/'); } else { trash::restore(params::get('log_id')); } buffer::set(dt::date2print('%H:%i:%s<br />%d %F %y', $date)); }
function upload() { $dir = FILES_ROOT . 'all/'; if (!empty($_FILES['file']['name'])) { $file_name = urldecode($_GET['file_name']); $file_type = files::info($_FILES['file']['name'], 'type'); $file_size = files::info($_FILES['file']['tmp_name'], 'size'); db::table('files'); db::insert('', 'NOW()', $file_name, $file_type, $file_size); $file_id = mysql_insert_id(); $file = $dir . $file_id . '.' . $file_type; copy($_FILES['file']['tmp_name'], $file); $file_icon = files::getFileIco($file_type); buffer::set('<p class="load"><img src="/i/fileicons/' . $file_icon . '.png" width="18" height="18" alt="" /> <a href="/download/files/download/?file=' . $file_id . '">' . $file_name . '</a> <span>(' . $file_type . ', ' . round($file_size / 1000) . ' Кб)</span></p>'); } }
function login() { $err = true; $pass = md5(params::get('user_password')); if (adminUser::auth(params::get('user_login'), $pass)) { $err = false; if (params::get('user_login') != adminUser::get('user_login') && $pass != adminUser::get('user_password')) { $err = true; } else { $word = 'legenda'; $mem = md5(adminUser::get('user_login') . $word); setcookie('legenda', adminUser::get('user_login') . ',' . adminUser::get('user_id') . ',' . $mem, time() + 86400 * 14, "/"); $_SESSION['ADMIN_AUTH'] = 1; $_SESSION['ADMIN_USER_ID'] = adminUser::get('user_id'); } } if ($err) { buffer::add('Неверный логин или пароль'); } }
if (!empty($_POST['p_theme'])) { $fname = 'theme-' . $_POST['p_theme']; if (!empty($themes_list[$_POST['p_theme']]['version'])) { $fname .= '-' . $themes_list[$_POST['p_theme']]['version']; } $fname .= '.pkg.gz'; dcPackager::packIt($_POST['p_theme'], $themes_root, $fname, !empty($_POST['p_save']) && is_writable(DC_SHARE_DIR), $tool_url . '&t_ok=1', __('An error occured while creating the theme.'), $err); } /* Affichage -------------------------------------------------------- */ buffer::str('<h2>' . __('Themes and plugins packing') . '</h2>'); if ($err != '') { buffer::str('<div class="erreur"><p><strong>' . __('Error(s)') . ' :</strong></p>' . $err . '</div>'); } if (!empty($_GET['p_ok'])) { buffer::str('<p class="message">' . __('Plugin saved.') . '</p>'); } if (!empty($_GET['t_ok'])) { buffer::str('<p class="message">' . __('Theme saved.') . '</p>'); } buffer::str('<form action="' . $tool_url . '" method="post">' . '<fieldset class="clear"><legend>' . __('Pack a plugin') . '</legend>' . '<p class="field"><label class="float" for="p_plugin">' . __('Plugin name') . ' :</label>' . form::combo('p_plugin', $p_list) . '</p>' . '<p><input class="submit" type="submit" name="p_dl" value="' . __('Download this plugin') . '" />'); if (is_writable(DC_SHARE_DIR)) { buffer::str(' <input class="submit" type="submit" name="p_save" value="' . __('Save this plugin in share folder') . '" /></p>'); } buffer::str('</p>' . '</fieldset></form>'); buffer::str('<form action="' . $tool_url . '" method="post">' . '<fieldset class="clear"><legend>' . __('Pack a theme') . '</legend>' . '<p class="field"><label class="float" for="p_theme">' . __('Theme name') . ' :</label>' . form::combo('p_theme', $t_list) . '</p>' . '<p><input class="submit" type="submit" name="p_dl" value="' . __('Download this theme') . '" />'); if (is_writable(DC_SHARE_DIR)) { buffer::str(' <input class="submit" type="submit" name="p_save" value="' . __('Save this theme in share folder') . '" /></p>'); } buffer::str('</p>' . '</fieldset></form>');
function showMethods($tmpl_id = false) { if (!$tmpl_id) { $tmpl_id = params::get('tmpl_id'); } conf::parse('tmpls', $tmpl_id); $array = conf::get('tmpls', 'methods'); if (!$array) { buffer::setTmpl(); } foreach ($array as $v) { $arr = explode('::', $v); if (!isset($arr[1])) { buffer::setTmpl(); return false; } s::roll('methods', array('app' => $arr[0], 'module' => $arr[1], 'action' => $arr[2])); } }
function showEvents($menu_id = false) { if (!$menu_id) { $menu_id = params::get('menu_id'); } conf::parse('menus', $menu_id); $array = conf::get('menus', 'events'); if (!$array) { buffer::setTmpl(); } foreach ($array as $v) { $arr = explode('::', $v); if (!isset($arr[1])) { buffer::setTmpl(); return false; } switch ($arr[3]) { case 'hide': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2])); break; case 'replace': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2], 'action' => appMenus::getMenuName($arr[4]))); break; } } }
buffer::str('<p>' . sprintf(__('The folder %s is not writable, please check its permissions.'), DC_ECRIRE . '/tools/') . '</p>'); } else { buffer::str('<form action="tools.php" method="get">' . '<p><label for="tool_url">' . __('Please give the URL (http or ftp) of the plugin\'s file') . ' :</label>' . form::field('tool_url', 50, '', $tool_url) . '</p>' . '<p><input type="submit" class="submit" value="' . __('install') . '" />' . '<input type="hidden" name="p" value="toolsmng" /></p>' . '</form>'); } buffer::str('<p><a href="http://www.wikini.net">' . __('Install new plugins') . '</a></p>'); # Traduction des plugins foreach ($plugins_list as $k => $v) { $plugins->loadl10n($k); $plugins_list[$k]['label'] = __($v['label']); $plugins_list[$k]['desc'] = __($v['desc']); } # Tri des plugins par leur nom uasort($plugins_list, create_function('$a,$b', 'return strcmp($a["label"],$b["label"]);')); buffer::str('<h3>' . __('List of installed plugins') . '</h3>' . '<dl>'); foreach ($plugins_list as $k => $v) { buffer::str('<dt>' . __($v['label']) . ' - ' . $k . '</dt>' . '<dd>' . __($v['desc']) . ' <br />' . 'par ' . $v['author'] . ' - ' . __('version') . ' ' . $v['version'] . ' <br />'); if ($k != 'toolsmng') { if (is_writable($plugins_root . $k . '/desc.xml')) { $action = $v['active'] ? 'disable' : 'enable'; buffer::str('<a href="tools.php?p=toolsmng&switch=' . $k . '">' . __($action) . '</a>'); } else { buffer::str('<em>' . sprintf(__('cannot enable/disable'), 'desc.xml') . '</em>'); } if ($is_writable) { buffer::str(' - <a href="tools.php?p=toolsmng&delete=' . $k . '" ' . 'onclick="return window.confirm(\'' . __('Are you sure you want to delete this plugin ?') . '\')">' . __('delete') . '</a>'); } } buffer::str('</dd>'); } buffer::str('</dl>');
function upload() { $dir = IMAGES_ROOT . 'all/'; @mkdir(IMAGES_ROOT); @mkdir($dir); if (!empty($_FILES['file']['name'])) { $img_id = md5(date('YmdHis')); $file = $dir . $img_id . '.jpg'; copy($_FILES['file']['tmp_name'], $file); if ($_GET['image_align'] == '0') { buffer::set('<img src="' . IMAGES_DIR . 'all/' . $img_id . '.jpg" />'); } else { if ($_GET['image_align'] == 'left') { buffer::set('<img style="margin-bottom: 10px; margin-right: 10px; float: left;" src="' . IMAGES_DIR . 'all/' . $img_id . '.jpg" />'); } else { if ($_GET['image_align'] == 'right') { buffer::set('<img style="margin-bottom: 10px; margin-left: 10px; float: right;" src="' . IMAGES_DIR . 'all/' . $img_id . '.jpg" />'); } } } } }
function showSection() { $section_id = web::getThis(); $item_id = web::getEvent(); if ($item_id !== false) { buffer::setTmpl('card.html'); self::showCard($item_id, $section_id); return false; } $dir = IMAGES_ROOT . 'sections/'; $dir_path = IMAGES_PATH . 'sections/'; db::table('catalog_sections'); db::where('section_id', $section_id); $section = db::assoc(); if (db::rows() == 0) { web::error404(); } s::set($section); s::set('page_title', $section['section_name']); s::set('page_header', $section['section_name']); $file = $dir . $section['section_id'] . '.jpg'; if (file_exists($file)) { s::set('section_img', '<img src="' . $dir_path . $section['section_id'] . '.jpg' . '" />'); } db::table('catalog_items'); db::where('section_id', $section_id); $r = db::select('item_name', 'item_id', 'item_desc'); $i = 0; while ($a = mysql_fetch_assoc($r)) { $i++; if ($i % 2) { s::roll('items1', $a); } else { s::roll('items2', $a); } } }
function showEvents($block_id = false) { if (!$block_id) { $block_id = params::get('block_id'); } conf::parse('blocks', $block_id); $array = conf::get('blocks', 'events'); if (!$array) { buffer::setTmpl(); } foreach ($array as $v) { $arr = explode('::', $v); if (!isset($arr[1])) { buffer::setTmpl(); return false; } switch ($arr[3]) { case 'hide': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2])); break; case 'show': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2])); break; case 'replace': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2], 'action' => '{!' . appBlocks::getBlockName($arr[4]) . '}')); break; case 'handler': s::roll('events', array('event_t' => $v, 'type' => $arr[3], 'mode' => $arr[0], 'name' => $arr[1], 'value' => $arr[2], 'action' => implode('::', array($arr[4], $arr[5], $arr[6])))); break; } } }
function setHandlersRepeat() { if (!self::$buffer) { self::$buffer = buffer::gets(); } if (self::$buffer) { foreach (self::$buffer as $k => $v) { $data = buffer::get($v['app'], $v['tmpl'], $v['data'], false); // replace {load ...} on data self::$code = str_replace($v['replace'], $data, self::$code); } } }
} if ($dcchat_installed) { buffer::str('<li>'.sprintf($img_check,'on').' '. __('dcChat is installed.'). '</li>' ); } else { buffer::str('<li>'.sprintf($img_check,'off').' '. __('dcChat is not installed.').($can_install?' (<a href="'.$url.'&install">install it</a>)':''). '</li>' ); } */ /* if (is_writable($dir)) { buffer::str('<li>'.sprintf($img_check,'on').' '. sprintf(__('Directory %s is writable.'),'<strong><code>'.$dir.'</code></strong>'). '</li>' ); } else { buffer::str('<li>'.sprintf($img_check,'off').' '. sprintf(__('Directory %s is not writable.'),'<strong><code>'.$dir.'</code></strong>'). '</li>' ); } */ buffer::str("</ul>");
function start() { db::connect(); if (!router::get(1)) { return true; } self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2)); if (router::get(3)) { self::set('module', router::get(2)); self::set('action', router::get(3)); } s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR); define('APP', APPS . self::get('app') . '/'); s::set('APP', APP); define('MODULE', APP . self::get('module') . '/'); s::set('MODULE', MODULE); /* Lang items */ if (self::get('mode') == 'webAjax') { web::getSite(); $lang = lang::gets(LANG_INDEX, SITE_ID); /* Authentification webUser */ web::observer(); } else { define('LANG_INDEX', SYS_INDEX); $lang = lang::gets(LANG_INDEX); admin::observer(); if (defined('ADMIN_USER_SITE_ID')) { define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID); s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID); $group_rules = ini::parse(SYS_ROOT . 'conf/admin/groups.ini', ADMIN_USER_GROUP_ID); define('RULE', $group_rules['rule']); db::table('admin_sites'); db::where('site_id', ADMIN_USER_SITE_ID); db::limit(1); define('ADMIN_SITE', db::get('site_domain')); s::set('ADMIN_SITE', ADMIN_SITE); } } /* Set params */ params::send(); $tmpl = params::get('tmpl'); $sys = false; if (self::get('mode') == 'adminAjax') { $sys = true; } buffer::init(0, self::get('app'), false, $tmpl); if (self::get('mode') == 'webAjax') { load::handler(self::get('app'), self::get('module'), self::get('action')); } else { load::module(self::get('app'), self::get('module'), self::get('action')); } /* Get plugin action */ ob_start(); /* запуск обработчика с возвратом данных тут два варианта либо данные просто выводим если нет шаблона, а если есть то сначала обрабатываем шаблон если буффер полный выводим информацию из него */ $buffer = buffer::gets(); if ($buffer[0]) { if ($sys) { buffer::$module = self::get('module'); } $section = params::get('section'); echo buffer::get($buffer[0]['app'], $buffer[0]['tmpl'], $buffer[0]['data'], $section, $sys); } $code = ob_get_contents(); ob_clean(); s::$mode = 'code'; s::setTmpl($code, $lang); s::display(); }
if ($a->checkAuth()) { } else { exit; } $plugins_root = 'tools/'; $plugins = new plugins($plugins_root); $plugins->getPlugins(true); $plugins_list = $plugins->getPluginsList(); $PLUGIN_HEAD = ''; $PLUGIN_BODY = ''; if (!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']]) && $plugins_list[$_REQUEST['p']]['active']) { $p = $_REQUEST['p']; buffer::init(); include $plugins_root . $p . '/index.php'; $PLUGIN_BODY = buffer::getContent(); buffer::clean(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> <head> <title>Configuration extension(s) de WikiNi</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> </head> <body> <?php
<?php // Administration // Vérification de sécurité if (!defined("TOOLS_MANAGER")) { die("accès direct interdit"); } buffer::str(' Ajouter les lignes suivantes dans le fichier wakka.css pour personnaliser votre menu de navigation : <br> <code> .page_table {margin: 0px; padding: 0px ; border: none; height: 100%;width: 100%;} <br> .menu_column {background-color: #FFFFCC; vertical-align: top; width: 150px; border: 1px solid #000000;padding:5px;} <br> .body_column {vertical-align: top; border: none;padding:5px;} <br> </code> ');
<header> <!-- <?php buffer::flushBuffer('template/header'); ?> --> <nav> <?php buffer::flushBuffer('template/nav'); ?> </nav> </header> <section> <?php echo $A_buffer['section']; ?> </section> <footer> <?php buffer::flushBuffer('template/footer'); ?> </footer> </div> <!-- javasript files should be linked at the bottom of the page --> <script src="/public/js/jquery.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="/public/js/bootstrap.min.js"></script> <!-- My JavaScript files script.js --> <script src="/public/js/script.js"></script> </body> </html>
<?php // index.php // Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes // opérations réservées à l'administrateur technique de Wikini. // Vérification de sécurité if (!defined("TOOLS_MANAGER")) { die("accès direct interdit"); } // Affichage au moyen de la méthode statique buffer::str : buffer::str('Parametrage de l\'extension akismet ...' . '<br />'); # Liste des thèmes $plugins_root = dirname(__FILE__) . '/../'; $plugins = new plugins($plugins_root); $plugins->getPlugins(false); $plugins_list = $plugins->getPluginsList(); $is_writable = is_writable($plugins_root); if (!$is_writable) { buffer::str('<p>' . sprintf(__('The folder %s is not writable, please check its permissions.'), DC_ECRIRE . '/tools/') . '</p>'); } else { buffer::str('<form action="tools.php" method="post">' . '<p><label for="tool_url">' . __('Entrez votre clef Akismet') . ' :</label>' . form::field('akismet_key', 50, '', $akismet_key) . '</p>' . '<p><input type="submit" class="submit" value="' . __('Install') . '" />' . '<input type="hidden" name="p" value="akismet" /></p>' . '</form>'); } if (isset($_POST['akismet_key'])) { $key_path = $plugins->location . $p . '/akismet.key.php'; $content = "<?php\n" . "\$akismet_key='" . $_POST['akismet_key'] . "';\n" . "?>"; if (!files::putContent($key_path, $content)) { buffer::str('Problème installation de la clef' . '<br />'); } else { buffer::str('Clef installée !' . '<br />'); } }
function uploadFiles() { $dir = FILES_ROOT . 'items/'; if (!empty($_FILES['item_files']['name'])) { $file_size = $_FILES['item_files']['size']; $file_type = files::info($_FILES['item_files']['name'], 'type'); $file_id = md5(date('YmdHis')); $file_name = str_replace('.' . $file_type, '', $_FILES['item_files']['name']); $file = $dir . $file_id . '.' . $file_type; $array = array('file_id' => $file_id, 'file_date' => 'NOW()', 'file_type' => $file_type, 'file_name' => $file_name, 'file_size' => $file_size, 'item_id' => 0); db::table('catalog_items_files'); db::smartInsert($array); copy($_FILES['item_files']['tmp_name'], $file); buffer::set(' <li id="files_id' . $file_id . '"> <input type="hidden" name="files_id[' . $file_id . ']" value="' . $file_id . '"> <img class="vamiddle" src="/i/fileicons/' . files::getFileIco($file_type) . '.png" /> ' . $file_name . '.' . $file_type . ' <a href="javascript:void(null);" onclick="deleteFilesFile(\'' . $file_id . '\');" title="Удалить файл" class="ico ico16 ico_delete"> </a> </li>'); } }
<?php // index.php // Administration de l'extension : initialisations (tables, fichier de configuration) , information etc. : toutes // opérations réservées à l'administrateur technique de Wikini. // Vérification de sécurité if (!defined("TOOLS_MANAGER")) { die("accès direct interdit"); } // Affichage au moyen de la méthode statique buffer::str : buffer::str('Parametrage de l\'extension Hello ...' . '<br />'); // Utilisation d'un objet Wiki pour acces à la base de donnée $wiki = new Wiki($wakkaConfig); buffer::str('Utilisateurs enregistrés : ' . '<br />'); $last_users = $wiki->LoadAll("select name, signuptime from " . $wiki->config["table_prefix"] . "users order by signuptime desc limit 10"); foreach ($last_users as $user) { buffer::str($user["name"] . " . . . " . $user["signuptime"] . "<br />\n"); }
function view() { if (!self::$menu) { self::loadSiteMenu(); } $menu_name = params::get('menu'); if (!isset(self::$menu[$menu_name])) { return false; } $menu_id = self::$menu_id[$menu_name]; /* Menu conf */ if (!self::$menu_conf) { self::$menu_conf = conf::parse('menus'); } $menu = self::$menu[$menu_name][0]; if (self::$menu_conf) { /* Menu pages */ $menu_conf_pages_in = conf::get('menus', 'in', $menu_id); $menu_conf_pages_out = conf::get('menus', 'out', $menu_id); if (!conf::testPages($menu_conf_pages_out)) { if (in_array(PAGE_ID, $menu_conf_pages_out)) { return true; } } else { if (!conf::testPages($menu_conf_pages_in)) { if (!in_array(PAGE_ID, $menu_conf_pages_in)) { return true; } } } /* Menu events */ if (conf::get('menus', 'events', $menu_id)) { foreach (conf::get('menus', 'events', $menu_id) as $v) { $arr = explode('::', trim($v)); if (events::targetDetect($arr[0], $arr[1], $arr[2])) { /* :TODO: добавить передачу в params события, его названия и его значения */ if ($arr[3] == 'replace') { $menu_id = $arr[4]; $menu_name = self::$menu_by_id[$menu_id]; $menu = self::$menu[$menu_name][0]; } else { if ($arr[3] == 'hide') { return true; } } } } } } // $points_conf = conf::parse('points'); $points = ''; $i = 0; foreach ($menu as $k => $v) { $i++; /* Points conf $conf_index = $menu_id.'.'.$v['point_id']; if ($points_conf) { $points_conf_pages = conf::get('points', 'pages', $conf_index); if ($points_conf_pages && $points_conf_pages[0] != 0) { if (!in_array(PAGE_ID, $points_conf_pages)) continue; } } */ $v = self::getPointLink($v, $menu_name); $v['index'] = $i; /* Check parents */ if (strstr($v['menu_tmpl_link'], '{POINTS}')) { if (isset(self::$menu[$menu_name][$v['point_id']])) { $parent_points = ''; foreach (self::$menu[$menu_name][$v['point_id']] as $d => $f) { $f = self::getPointLink($f, $menu_name); $parent_points .= s::parseVars($f['menu_tmpl_link'], $f); } $v['menu_tmpl_link'] = str_replace('{POINTS}', $parent_points, $v['menu_tmpl_link']); } } $points .= s::parseVars($v['menu_tmpl_link'], $v); $menu_tmpl = $v['menu_tmpl']; } buffer::set(str_replace('{POINTS}', $points, $menu_tmpl)); }
function testerConfig(&$sortie, $texte, $test, $texte_erreur = '', $stop_erreur = 1, $erreur) { if ($erreur == 2) { return 2; } buffer::str($texte . ' '); if ($test) { buffer::str('<span class="ok"> OK </span><br />' . "\n"); return 0; } else { buffer::str('<span class="failed"> ECHEC </span>'); if ($texte_erreur) { buffer::str(' <span class="erreur">' . $texte_erreur . '</span>'); } buffer::str('<br />' . "\n"); if ($stop_erreur == 1) { return 2; } else { return 1; } } }
$a->start(); exit; } if ($a->checkAuth()) { } else { exit; } $plugins_root = 'tools/'; $plugins = new plugins($plugins_root); $plugins->getPlugins(true); $plugins_list = $plugins->getPluginsList(); $PLUGIN_HEAD = ''; $PLUGIN_BODY = ''; if (!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']]) && $plugins_list[$_REQUEST['p']]['active']) { $p = $_REQUEST['p']; $buffer = new buffer(); $buffer->init(); include $plugins_root . $p . '/index.php'; $PLUGIN_BODY = $buffer->getContent(); $buffer->clean(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> <head> <title><?php echo _t('YESWIKI_TOOLS_CONFIG'); ?> </title>