function transcribe($aList, $aIsTopLevel = true) { $gpcList = array(); $isMagic = get_magic_quotes_gpc(); foreach ($aList as $key => $value) { if (is_array($value)) { $decodedKey = $isMagic && !$aIsTopLevel ? stripslashes($key) : $key; $decodedValue = transcribe($value, false); } else { $decodedKey = stripslashes($key); $decodedValue = $isMagic ? stripslashes($value) : $value; } $gpcList[$decodedKey] = $decodedValue; } return $gpcList; }
function get($str) { $_GET = transcribe($_GET); return isset($_GET[$str]) ? $_GET[$str] : false; }
$y = $Px_echelle_Y2['32T'] - $yp * $p['32T']; } else { // Fuseau 30 T : une rotation + translation est appliquée if ($utm['sector'] == '30T') { $cosa = cos(deg2rad($angle3031)); $sina = sin(deg2rad($angle3031)); $xp = ($utm['x_utm'] - $M_UTM_X1['30T']) * $cosa + ($utm['y_utm'] - $M_UTM_Y1['30T']) * $sina; $yp = -($utm['x_utm'] - $M_UTM_X1['30T']) * $sina + ($utm['y_utm'] - $M_UTM_Y1['30T']) * $cosa; $x = $xp * $p['30T'] + $Px_echelle_X1['30T']; $y = $Px_echelle_Y2['30T'] - $yp * $p['30T']; } } } $x = round($x); $y = round($y); $name = strtoupper(transcribe($utm['maj_name'])); if (isset($name) && $name != '') { $comment = ' : ' . $comment; } // Le commentaire commence par un lien forcé : On lit la premiere image de la page wiki $imagewiki = ''; $url = ''; if (preg_match("/.*\\[\\[(\\S*)(\\s+(.+))?\\]\\].*/U", $comment, $matches)) { list(, $url, $texte_url) = $matches; if ($url) { $html = file_get_contents($this->href("", $url)); preg_match('/<img src="(.*)"/U', $html, $matches); $imagewiki = $matches[1]; } // nettoyage $comment = preg_replace('/\\[\\[(.*)\\]\\]/', $texte_url, $comment);
/** * create or edit a page * * @return array status of the edit */ function Core_adminPageEdit() { /** * function for recursively updating a page (and its children) template * * @param int $id the page id * @param string $template the template name * * @return null */ function recursivelyUpdatePageTemplates($id, $template) { $pages = Pages::getInstancesByParent($id, false); $ids = array(); foreach ($pages->pages as $page) { $ids[] = $page->id; recursivelyUpdatePageTemplates($page->id, $template); } if (!count($ids)) { return; } dbQuery('update pages set template="' . addslashes($template) . '" where id in (' . join(',', $ids) . ')'); } $id = (int) @$_REQUEST['id']; $pid = $id ? dbOne('select parent from pages where id=' . $id, 'parent') : (int) $_REQUEST['parent']; $special = 0; if (isset($_REQUEST['special'])) { $specials = $_REQUEST['special']; if (is_array($specials)) { foreach ($specials as $a => $b) { $special += pow(2, $a); } } $homes = dbOne("select count(id) as ids from pages where (special&1)" . ($id ? " AND id!={$id}" : ""), 'ids'); if ($special & 1) { // there can be only one homepage if ($homes != 0) { dbQuery("update pages set special=special-1 where special&1"); } } else { if ($homes == 0) { $special += 1; } } } $keywords = @$_REQUEST['keywords']; $title = @$_REQUEST['title']; $description = @$_REQUEST['description']; $date_publish = isset($_REQUEST['date_publish']) ? $_REQUEST['date_publish'] : '0000-00-00 00:00:00'; $date_unpublish = isset($_REQUEST['date_unpublish']) ? $_REQUEST['date_unpublish'] : '0000-00-00 00:00:00'; $importance = (double) @$_REQUEST['importance']; if (!isset($_REQUEST['body'])) { $_REQUEST['body'] = ''; } if ($importance < 0.1) { $importance = 0.5; } if ($importance > 1) { $importance = 1; } // { name, alias $name = trim($_REQUEST['name']); if (!$name) { $name = __('No page name provided'); } else { // check to see if name is already in use $sql = 'select id from pages where name="' . addslashes($name) . '" and parent=' . $pid . ' and id!=' . $id; if (dbOne($sql, 'id')) { $i = 2; while (dbOne('select id from pages where name="' . addslashes($name . $i) . '" and parent=' . $pid . ' and id!="' . $id . '"', 'id')) { $i++; } $msgs .= '<em>' . __('A page named "%1" already exists. Page name amended to "%2"', $name, $name . $i) . '</em>'; $name .= $i; } } $alias = transcribe(__FromJson($name, true)); // } // { body if (@$_REQUEST['page_vars']['_body']) { $_REQUEST['body'] = $_REQUEST['page_vars']['_body']; unset($_REQUEST['page_vars']['_body']); } if (!$id) { $original_body = '<h1>' . htmlspecialchars($name) . '</h1><p> </p>'; } else { $lim = (int) @$GLOBALS['DBVARS']['site_page_length_limit']; if (is_array($_REQUEST['body'])) { if ($lim) { foreach ($_REQUEST['body'] as $k => $v) { if (strlen($v) > $lim) { $_REQUEST['body'][$k] = preg_replace('/<[^>]*$/', '', substr($v, 0, $lim)); } } } $original_body = json_encode($_REQUEST['body']); } else { $original_body = $_REQUEST['body']; if ($lim && strlen($original_body) > $lim) { $original_body = preg_replace('/<[^>]*$/', '', substr($original_body, 0, $lim)); } } } foreach ($GLOBALS['PLUGINS'] as $plugin) { if (isset($plugin['admin']['body_override'])) { $original_body = $plugin['admin']['body_override'](false); } } $body = $original_body; $body = Core_sanitiseHtml($body); // } // { template $template = @$_REQUEST['template']; if ($template == '' && $pid) { $template = dbOne('select template from pages where id=' . $pid, 'template'); } if (isset($_REQUEST['recursively_update_page_templates'])) { recursivelyUpdatePageTemplates($id, $template); } // } if ($id != 0) { //if we don't create a page //i.e. we edit it $page = Page::getInstance($id); $page->initValues(); if (isset($page->plugin)) { //if this page it's a plugin $type = $page->plugin; //we find the plugin's name(plugin type) } if (@$GLOBALS['PLUGINS'][$type]['do-not-delete']) { // don't modify type $type = dbOne('select type from pages where id=' . $id, 'type'); if ($type != $_REQUEST['type']) { echo '<script>alert("' . addslashes(__("The type of the page couldn't be changed")) . '")</script>'; } } else { //We can change the type $type = $_REQUEST['type']; } } else { //if we create the page $type = $_REQUEST['type']; } $destType = preg_replace('/\\|.*/', '', $_REQUEST['type']); if (@$GLOBALS['PLUGINS'][$destType]['only-one-page-instance'] == true) { //we count how many pages of this type //we have $howMany = dbOne('select COUNT(type) FROM pages WHERE type="' . $_REQUEST['type'] . '"' . ' and id!=' . $id, 'COUNT(type)'); if ($howMany >= 1) { //If we already have a page echo "<script>alert('" . addslashes(__('You already have one page of that type')) . "');</script>"; return array('error' => __('You can have only one page of this type')); } } $associated_date = isset($_REQUEST['associated_date']) ? $_REQUEST['associated_date'] : date('Y-m-d H:i:s'); $q = 'pages set importance=' . $importance . ',template="' . addslashes($template) . '",edate=now()' . ',type="' . addslashes($type) . '"' . ',date_unpublish="' . addslashes($date_unpublish) . '"' . ',date_publish="' . addslashes($date_publish) . '"' . ',associated_date="' . addslashes($associated_date) . '"' . ',keywords="' . addslashes($keywords) . '"' . ',description="' . addslashes($description) . '"' . ',name="' . addslashes($name) . '"' . ',title="' . addslashes($title) . '"' . ',original_body="' . addslashes(Core_sanitiseHtmlEssential($original_body)) . '"' . ',link="' . addslashes(__FromJson($name, true)) . '"' . ',body="' . addslashes($body) . '"' . ',alias="' . $alias . '",parent=' . $pid . ',special=' . $special; if (!$id) { // ord $ord = dbOne('select ord from pages where parent=' . $pid . ' order by ord desc limit 1', 'ord') + 1; $q .= ',ord=' . $ord . ',cdate=now()'; } // { insert the page if ($id) { $q = 'update ' . $q . ' where id=' . $id; } else { $onlyOnePageInstance = false; $pluginType = preg_replace('/\\|.*/', '', $_REQUEST['type']); if (isset($GLOBALS['PLUGINS'][$pluginType]['only-one-page-instance'])) { $onlyOnePageInstance = $GLOBALS['PLUGINS'][$pluginType]['only-one-page-instance']; } $alreadyAtInstancesLimit = $onlyOnePageInstance ? dbOne('select COUNT(type) FROM pages WHERE type="' . $_REQUEST['type'] . '"', 'COUNT(type)') : 0; $q = 'INSERT into ' . $q . ',category=""'; if ($onlyOnePageInstance == true) { if ($howMany >= 1) { return array('error' => __('You can have only one page of this type')); } } } dbQuery($q); if (!$id) { $id = dbOne('select last_insert_id() as id', 'id'); } // } // { page_vars dbQuery('delete from page_vars where page_id="' . $id . '"'); $pagevars = isset($_REQUEST['page_vars']) ? $_REQUEST['page_vars'] : array(); if (@$_REQUEST['short_url']) { dbQuery('insert into short_urls set cdate=now(),page_id=' . $id . ',short_url="' . addslashes($_REQUEST['short_url']) . '"'); $pagevars['_short_url'] = 1; } else { dbQuery('delete from short_urls where page_id=' . $id); unset($pagevars['_short_url']); } if (is_array($pagevars)) { if (isset($pagevars['google-site-verification'])) { $pagevars['google-site-verification'] = preg_replace('#.*content="([^"]*)".*#', '\\1', $pagevars['google-site-verification']); } foreach ($pagevars as $k => $v) { if (is_array($v)) { $v = json_encode($v); } dbQuery('insert into page_vars (name,value,page_id) values("' . addslashes($k) . '","' . addslashes($v) . '",' . $id . ')'); } } // } if ($_POST['type'] == 4) { $page_summary_parent = isset($_POST['page_summary_parent']) ? $_POST['page_summary_parent'] : $id; $r2 = dbRow('select * from page_summaries where page_id="' . $id . '"'); $do = 1; if ($r2) { if (isset($_POST['page_summary_parent']) && $r2['parent_id'] != $page_summary_parent) { dbQuery('delete from page_summaries where page_id="' . $id . '"'); } else { $do = 0; } } if ($do) { dbQuery('insert into page_summaries set page_id="' . $id . '",parent_id="' . $page_summary_parent . '",rss=""'); } require_once SCRIPTBASE . '/ww.incs/page.summaries.php'; PageSummaries_getHtml($id); } // { clean up and return dbQuery('update page_summaries set rss=""'); if (@$GLOBALS['DBVARS']['cron-next']) { unset($GLOBALS['DBVARS']['cron-next']); } Core_cacheClear(); Core_configRewrite(); return array('id' => $id, 'pid' => $pid, 'alias' => $alias, 'sql' => $q); // } }
return; } $c .= '<div id="blog-featured-excerpts"><div class="main">'; $shown = 0; foreach ($rs as $r) { $c .= '<div class="featured-excerpt"'; if ($shown++) { $c .= ' style="display:none"'; } $c .= '>'; // { image if (!$r['excerpt_image']) { $img = preg_replace('/.*<img.*?src="([^"]*)".*/m', '\\1', str_replace(array("\n", "\r"), ' ', $r['body'])); if (strpos($img, '/f') === 0) { $r['excerpt_image'] = preg_replace('#^/f/#', '', $img); } } $img = ''; if ($r['excerpt_image']) { $img = '<img class="blog-excerpt-image" src="/a/f=getImg/w=320/h=200/' . $r['excerpt_image'] . '"/>'; } // } $c .= $img; $excerpt = preg_replace('/<[^>]*>/', ' ', $r['body']); $date = preg_replace('/ .*/', '', $r['cdate']); $c .= '<div class="text"><div class="overlay"></div>' . '<h2 class="blog-header">' . htmlspecialchars($r['title']) . '</h2>' . '<div class="blog-excerpt">' . $excerpt . '</div>' . '<a class="blog-link-to-article" href="' . $links_prefix . '/' . $r['user_id'] . '/' . $date . '/' . preg_replace('/[^a-zA-Z0-9]/', '-', transcribe($r['title'])) . '">' . __('Read more', 'core') . '</a>' . '</div>'; $c .= '</div>'; } $c .= '</div>' . '<div class="carousel"></div>' . '</div>'; WW_addScript('blog/j/featured.js'); WW_addCSS('/ww.plugins/blog/c/featured.css');
require APP . 'conf' . DS . 'config.php'; $GLOBALS['system'] = isset($_CONFIGS['system']) ? $_CONFIGS['system'] : array(); $GLOBALS['app'] = isset($_CONFIGS['app']) ? $_CONFIGS['app'] : array(); $GLOBALS['db'] = isset($_CONFIGS['db']) ? $_CONFIGS['db'] : array(); // array_merge($_CONFIGS, $GLOBALS); define('ENV', $GLOBALS['app']['environment']); // 载入日志类 require BOMB . 'core' . DS . 'Logger.lib.php'; // 载入框架核心函数库 require BOMB . 'core' . DS . 'core.fn.php'; // 载入框架数据库操作函数 require BOMB . 'core' . DS . 'db.fn.php'; // 载入程序全局函数(程序公用函数库) require APP . 'funcs' . DS . 'app.fn.php'; // 取消自动转义 transcribe(); // 如果用户没有设置site_domain,则自动配置生成site_domain if (!($site_domain = conf('app', 'site_domain'))) { $GLOBALS['app']['site_domain'] = gen_site_domain(); } // 获取当前请求URL $GLOBALS['request']['url'] = get_current_url(); // 获取请求URI $GLOBALS['request']['uri'] = get_current_uri(); // 解析URI,如果不存在则响应404 if (!parse_uri($GLOBALS['request']['uri'])) { show_404(); } // 挂载钩子 mount_hooks($GLOBALS['request']['uri']); /**
$r['excerpt_image'] = preg_replace('#^/f/#', '', $img); } } $img = ''; if ($r['excerpt_image']) { if (!isset($excerptImageSizeX)) { $excerptImageSizeX = 100; } if (!isset($excerptImageSizeY)) { $excerptImageSizeY = 100; } $img = '<img class="blog-excerpt-image" src="/a/f=getImg/w=' . $excerptImageSizeX . '/h=' . $excerptImageSizeY . '/' . $r['excerpt_image'] . '"/>'; } // } $date = preg_replace('/ .*/', '', $r['cdate']); $c .= '<div class="blog-excerpt">' . $img . $excerpt . ' <a class="blog-link-to-article" href="' . preg_replace('#/tags/[^/]*#', '', $links_prefix) . '/' . $r['user_id'] . '/' . $date . '/' . preg_replace('/[^a-zA-Z0-9]/', '-', transcribe($r['title'])) . '">more</a>' . '</div>'; $c .= '</div>'; } $this_page = (int) ($excerpts_offset / $excerpts_per_page); $bottom_links = array(); if ($num_of_entries > $excerpts_offset + $excerpts_per_page) { $bottom_links[] = '<a class="blog-link-to-older-entries" href="' . $links_prefix . '/page' . ($this_page + 1) . '">' . 'older entries</a>'; } if ($this_page) { $bottom_links[] = '<a class="blog-link-to-newers-entries" href="' . $links_prefix . '/page' . ($this_page - 1) . '">' . 'newer entries</a>'; } if (!isset($nobottomlinks)) { $bottom_links[] = '<a style="display:none" class="blog-link-to-all-authors" href="' . $links_prefix . '/authors">' . 'list of authors</a>'; $c .= '<div class="blog-bottom-links">' . join(' | ', $bottom_links) . '</div>'; } $c .= '</div>';
* * @category None * @package None * @subpackage None * @author Kae Verens <*****@*****.**> * @license GPL Version 2 * @link www.kvweb.me */ $bits = explode('/', $unused_uri); $user_id = (int) $bits[0]; $date = $bits[1]; $titlelike = str_replace('-', '_', $bits[2]); $sql = 'select * from blog_entry where user_id=' . $user_id . ' and cast(cdate as date)' . '="' . addslashes($date) . '" and title like "' . addslashes($titlelike) . '"'; $r = dbRow($sql, 'blog_entry'); if (!$r) { $c = '<div class="blog-article-error">Error: article not found.</div>'; return; } $c = '<div class="blog-article-wrapper" id="blog-entry-' . $r['id'] . '">'; $c .= '<h1 class="blog-header">' . htmlspecialchars($r['title']) . '</h1>'; $user = User::getInstance($r['user_id']); $name = $user ? $user->name : 'unknown'; $c .= '<div class="blog-meta">' . '<span class="blog-author" data-uid="' . $r['user_id'] . '">' . $name . '</span>' . '<span class="blog-spacing"> ~ </span>' . '<span class="blog-date-published">' . Core_dateM2H($r['cdate']) . '</span>' . '</div>'; $c .= '<div class="blog-body">' . $r['body'] . '</div>'; $date = preg_replace('/ .*/', '', $r['cdate']); $c .= '</div>'; WW_addScript('blog'); WW_addInlineScript('window.blog_comments=0;'); if ($r['allow_comments']) { $c .= Core_commentsShow($PAGEDATA->getAbsoluteUrl() . '/' . $r['user_id'] . '/' . $date . '/' . preg_replace('/[^a-zA-Z0-9]/', '-', transcribe($r['title']))); }
function transcribe($string) { $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ ßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuy bsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; $string = utf8_decode($string); $string = strtr($string, utf8_decode($a), $b); $string = strtolower($string); return utf8_encode($string); } } dbQuery('alter table products_categories add link text'); $rs = dbAll('select id,name from products_categories'); foreach ($rs as $r) { dbQuery('update products_categories set' . ' link="' . addslashes(transcribe($r['name'])) . '"' . 'where id=' . $r['id']); } $version = 35; } if ($version == 35) { // fix a bug that has popped up again dbQuery('alter table products_types change stock_management stock_control ' . 'smallint default 0'); $version = 36; } if ($version == 36) { // change default image to text dbQuery('alter table products change image_default image_default text'); $rs = dbAll('select id from products'); foreach ($rs as $r) { $product = Product::getInstance($r['id']); $url = $product->getDefaultImage();
<?php $url_request = $_SERVER['REQUEST_URI']; if (APP_PATH == '/') { $url_path = $url_request; } else { $url_path = str_ireplace(APP_PATH, '', $url_request); } if ($url_path[0] == '/') { $url_path = substr($url_path, 1); } $url_param = explode('/', $url_path); //print_r($url_param); $c = $url_param[0] ? $url_param[0] : 'index'; $a = $url_param[1] ? $url_param[1] : 'index'; if ($url_param[2]) { for ($i = 2; $i < sizeof($url_param); $i = $i + 2) { $params[$url_param[$i]] = isset($url_param[$i + 1]) ? $url_param[$i + 1] : ''; } $_GET = transcribe($params); }
$pos = strrpos($_REQUEST['images_directory'], '/'); if ($pos === false) { $dname .= $_REQUEST['images_directory']; } else { $dname = substr($_REQUEST['images_directory'], $pos + 1); } if (strlen($dname) == 0) { $dname = rand() . microtime(); } $parent_id = kfm_api_getDirectoryId('products/product-images'); $parent = kfmDirectory::getInstance($parent_id); $parent->createSubdir($dname); } // } // { save main data and data fields $sql = 'set name="' . addslashes($_REQUEST['name']) . '"' . ',link="' . addslashes(transcribe(__FromJson($_REQUEST['name'], true))) . '"' . ',ean="' . addslashes(@$_REQUEST['ean']) . '"' . ',user_id=' . (int) @$_REQUEST['user_id'] . ',stock_number="' . addslashes($_REQUEST['stock_number']) . '"' . ',activates_on="' . addslashes($_REQUEST['activates_on']) . '"' . ',expires_on="' . addslashes($_REQUEST['expires_on']) . '"' . ',product_type_id=' . (int) $_REQUEST['product_type_id'] . ',default_category=' . (int) $_REQUEST['products_default_category'] . ',enabled=' . (int) $_REQUEST['enabled'] . ',date_edited=now()' . ', num_of_categories=' . count($_REQUEST['product_categories']) . ',location=' . (int) $_REQUEST['location'] . ',images_directory="' . addslashes($_REQUEST['images_directory']) . '"'; foreach ($_REQUEST['productsExtra'] as $k => $v) { $sql .= ', `' . addslashes($k) . '`="' . addslashes($v) . '"'; } // { add data fields to SQL $datafields = array(); if (!isset($_REQUEST['data_fields'])) { $_REQUEST['data_fields'] = array(); } foreach ($_REQUEST['data_fields'] as $n => $v) { $datafields[] = array('n' => $n, 'v' => is_array($v) ? json_encode($v) : $v); } $sql .= ',data_fields="' . addslashes(json_encode($datafields)) . '"'; // } // { online store stuff // { stock control