/** * Format Alert * @param string $tpl Template * @param array $obj Alert-Array * @return string */ function FormatAlertTpl($tpl, $obj) { $msg = '$ret .= "' . str_replace(array('{else}', '{/if}', '{/foreach}'), array('"; } else { $ret .= "', '"; } $ret .= "', '"; } $ret .= "'), addslashes($tpl)) . '";'; $parsed = $msg; $s = strlen($msg); $x = $pos = -1; $buff = ''; $if = $for = false; while (++$x < $s) { if ($msg[$x] == '{' && $buff == '') { $buff .= $msg[$x]; } else { if ($buff == '{ ') { $buff = ''; } else { if ($buff != '') { $buff .= $msg[$x]; } } } if ($buff == '{if') { $pos = $x; $if = true; } else { if ($buff == '{foreach') { $pos = $x; $for = true; } } if ($pos != -1 && $msg[$x] == '}') { $orig = $buff; $buff = ''; $pos = -1; if ($if) { $if = false; $o = 3; $native = array('"; if( ', ' ) { $ret .= "'); } else { if ($for) { $for = false; $o = 8; $native = array('"; foreach( ', ' as $key=>$value) { $ret .= "'); } else { continue; } } $cond = trim(populate(substr($orig, $o, -1), false)); $native = $native[0] . $cond . $native[1]; $parsed = str_replace($orig, $native, $parsed); unset($cond, $o, $orig, $native); } //end if } //end while $parsed = populate($parsed); return RunJail($parsed, $obj); }
function renderPage($template, $page, $rw, $basepath = "/") { // TODO: refactor this so we don't overrite it $pagename = $page; // Get Simple Website Schema $xml = new DOMDocument(); $xml->load($template); $xml_xpath = new DOMXPath($xml); // Get the template $template = $xml->documentElement->getAttribute("template"); // Load the template $html = new DOMDocument(); $html->load($template); $html_xpath = new DOMXPath($html); // Load the default page (the first one) $requested_page_name = str_replace(" ", "_", preg_replace("/[^_.\\/a-zA-Z0-9 ']/", "", strtolower(rtrim($page, "/")))); if ($requested_page_name[0] == '/') { $requested_page_name = substr($requested_page_name, 1); } $requested_page = $xml_xpath->query("/site/page")->item(0); // Query for the actual page $sections = explode("/", $requested_page_name); // This is largely to make the search case insensitive $query = "/site/page[translate(@link,'ABCDEFGHIJKLMNOPQRSTUVWXYZ ','abcdefghijklmnopqrstuvwxyz_') =\"" . implode("\"]/subpages/page[translate(@link, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ', 'abcdefghijklmnopqrstuvwxyz_') =\"", $sections) . "\"]"; $query = $xml_xpath->query($query); if ($query->item(0)) { $requested_page = $query->item(0); } // Start scoping variables $variables = array(); $links = array(); // Add breadcrumb variables $path_elements = array(); $count = count($sections) - 1; $ptr = $requested_page; while ($ptr->nodeName != "site") { if ($ptr->getAttribute("link")) { $path = $ptr->getAttribute("link"); $path_elements[] = $path; $node = $xml->createElement(str_repeat("sub", $count) . "path"); $node->appendChild($xml->createTextNode($path)); $variables[str_repeat("sub", $count) . "path"] = $node; $count--; } $ptr = $ptr->parentNode; } // Add variables from page foreach ($requested_page->childNodes as $element) { if ($element->nodeName != "#text") { $variables[$element->nodeName] = $element; } } // If the page has subpages, set the scope to be of the subpages, otherwise, the current page $scope; $offset = 0; if ($xml_xpath->query("subpages", $requested_page)->item(0)) { $scope = $xml_xpath->query("subpages", $requested_page)->item(0); $offset += 1; } else { $scope = $requested_page; } // How deep we're tracing up/how, ie. many "../"'s we need to add $depth = 2 * count($sections) + $offset; for ($i = 0; $i < 2 * count($sections) + $offset; $i++) { // Add variables from owner (if not already defined) foreach ($scope->childNodes as $element) { if (!in_array((string) $element->nodeName, array("#text", "variables", "page", "subpages"))) { if (!$variables[$element->nodeName]) { $variables[$element->nodeName] = $element; } } } // Pages must be in a subpages node, thus we should bail here if ($scope->nodeName == "page") { $scope = $scope->parentNode; continue; } // Trace current path $path = ""; $ptr = $scope; $subdepth = 0; while ($ptr->nodeName != "site") { if ($ptr->getAttribute("link")) { $path = (string) $ptr->getAttribute("link") . "/" . $path; } $ptr = $ptr->parentNode; } $path = $basepath . $path; //str_repeat("../",($depth-1)/2).$path; // Calculated how many "sub"s to add to this set of links (TODO: fix up this grossness) $prefix = str_repeat("sub", (2 * count($sections) - 1 - $i) / 2 + $offset); // Add all pages to sublinks $menu_links = $xml->createElement($prefix . "links"); // Extract the links $query = $xml_xpath->query("page", $scope); foreach ($query as $page) { $link = (string) $page->getAttribute("link"); $name = (string) $page->getAttribute("name"); $links[] = $path . $link; // If they're not hidden, link them if ($page->getAttribute("hidden") != "true") { $ref = $page->getAttribute("ref"); $link_node = $xml->createElement("a"); $link_href = $xml->createAttribute("href"); $link_href->appendChild($xml->createTextNode($ref ? $ref : $path . $link)); $link_node->appendChild($link_href); $link_node->appendChild($xml->createTextNode($name ? $name : $link)); if (in_array($link, $path_elements)) { $link_style = $xml->createAttribute("class"); $link_style->appendChild($xml->createTextNode("selected")); $link_node->appendChild($link_style); } $menu_links->appendChild($link_node); $menu_links->appendChild($xml->createTextNode(" ")); } } $variables[$prefix . "links"] = $menu_links; // Pop to parent $scope = $scope->parentNode; } // Build the all encompassing breadcrum $path = "path"; $breadcrumb = $xml->createElement("breadcrumb"); while ($variables[$path]) { $container = $xml->createElement("div"); $source = $variables[$path]; foreach ($source->childNodes as $child) { $container->appendChild($child->cloneNode(TRUE)); } $breadcrumb->appendChild($container); $path = "sub" . $path; } $variables["breadcrumb"] = $breadcrumb; // Build the all encompassing links_list $path = "links"; $alllinks = $xml->createElement("alllinks"); while ($variables[$path]) { $container = $xml->createElement("div"); $source = $variables[$path]; foreach ($source->childNodes as $child) { $container->appendChild($child->cloneNode(TRUE)); } $alllinks->appendChild($container); $path = "sub" . $path; } $variables["alllinks"] = $alllinks; // Set the title $site_title = $xml->documentElement->getAttribute('title'); $page_title = $requested_page->getAttribute('title'); $html_xpath->query("/html/head/title")->item(0)->nodeValue = $site_title . ' ' . $page_title; // Set the css $css = $html->createElement("link"); $css_href = $html->createAttribute("href"); $subpath = $xml->documentElement->getAttribute('css'); $css_href->appendChild($html->createTextNode(($subpath[0] == '/' ? "" : $basepath) . $subpath)); $css_rel = $html->createAttribute("rel"); $css_rel->appendChild($html->createTextNode("stylesheet")); $css_type = $html->createAttribute("type"); $css_type->appendChild($html->createTextNode("text/css")); $css->appendChild($css_href); $css->appendChild($css_rel); $css->appendChild($css_type); $html_xpath->query("/html/head")->item(0)->appendChild($css); //print_r($variables); //print_r($links); // Substitute all the IDs in the html with the corresponding page elements $path = rtrim($pagename, "/") . "/"; populate($html, $variables, $links, $path, $basepath, !$rw); return $html->saveHTML(); }
} $re = mysql_query("SELECT id_category, lang_code, text_name, text_desc\r\n\t\t\tFROM learning_competence_category_text\r\n\t\t\tWHERE 1"); while (list($id_cat, $lang_code, $name, $description) = mysql_fetch_row($re)) { mysql_query("INSERT INTO learning_competence_category_lang\r\n\t\t\t\tVALUES (" . $id_category . ", '" . $lang_code . "', '" . $name . "', '" . $description . "')"); } $re = mysql_query("SELECT id_category, lang_code, text_name, text_desc\r\n\t\t\tFROM learning_competence_text\r\n\t\t\tWHERE 1"); while (list($id_cat, $lang_code, $name, $description) = mysql_fetch_row($re)) { mysql_query("INSERT INTO learning_competence_lang\r\n\t\t\t\tVALUES (" . $id_category . ", '" . $lang_code . "', '" . $name . "', '" . $description . "')"); } break; case "4": // --- Upgrade trees (ileft / iright) ---------------------------- $GLOBALS['tree_st'] = ''; $tables = array('core_org_chart_tree' => 'idOrg', 'learning_category' => 'idCategory'); foreach ($tables as $tab => $p_key) { populate($tab, $p_key); } break; case "5": // --- Upgrade settings table ------------------------------------ updateSettings(); break; case "6": // --- Adding god admins and all users roles --------------------- addUpgraderRoles(); break; case "7": // --- Remove old photo ------------------------------------------ $db = mysql_connect($_SESSION['db_info']['db_host'], $_SESSION['db_info']['db_user'], $_SESSION['db_info']['db_pass']); mysql_select_db($_SESSION['db_info']['db_name']); $query = "SELECT photo" . " FROM core_user" . " WHERE avatar <> ''" . " AND photo <> ''";
function main() { global $debug; global $DEFAULT_DEPTHS; if ($debug) { printf("Garbage Collector Test\n"); printf("Stretching memory with a binary tree of depth %d\n", kStretchTreeDepth); } $t_start = microtime(true); $temp_tree = make_tree(kStretchTreeDepth); if ($debug) { printf(" Creating a long-lived binary tree of depth %d\n", kLongLivedTreeDepth); } $long_lived_tree = new Node(); populate(kLongLivedTreeDepth, $long_lived_tree); if ($debug) { printf(" Creating a long-lived array of %d doubles\n", kArraySize); } $long_lived_array = array(0.0); for ($i = 1; $i < kArraySize; $i++) { $long_lived_array[] = 1 / $i; } time_constructions($DEFAULT_DEPTHS, $debug); $t_finish = microtime(true); return $t_finish - $t_start; }
if(isset($_GET["dar-list"])){dar_list();exit;} if(isset($_GET["dar-list-index"])){dar_list_type();exit;} if(isset($_GET["dar-list-query"])){dar_list_query();exit;} if(isset($_GET["dar-browse"])){dar_browse();exit;} if(isset($_GET["schedule"])){schedule();exit;} if(isset($_GET["RefreshCache"])){RefreshCache();exit;} if(isset($_GET["perform-backup"])){run_backup_js();exit;} if(isset($_GET["restore-full"])){retore_full_mode();exit;} if(isset($_GET["restore-single-file"])){restore_single_file();exit;} if(isset($_GET["original_path"])){restore_full_mode_exec();exit;} if(isset($_GET["original_file_path"])){restore_single_mode_exec();exit;} if(isset($_GET["populate"])){populate();exit;} function dar_mount_1(){ $html="<div id='mounted_logs_1'></div>"; echo $html; } function run_backup_js(){ $tpl=new templates(); $page=CurrentPageName(); $confirm=$tpl->_ENGINE_parse_body('{error_want_operation}'); $html="
<tr> <th>First Name</th><th>Last Name</th><th>Class</th><th>IQ</th> </tr> </thead> <tbody> <?php while ($row = mysqli_fetch_assoc($result)) { echo "<tr><td>" . $row['firstName'] . "</td><td>" . $row['lastName'] . "</td><td>" . $row['Class'] . "</td><td>" . $row['IQ'] . "</td></tr>"; } ?> </table> <hr><?php $query = "SELECT * FROM QuizQuestion"; $result = mysqli_query($connection, $query); if (mysqli_num_rows($result) == 0) { populate($connection); } else { echo "Database already populated"; } ?> <hr> <h2>Number of Participating Schools</h2> <?php $query = "SELECT * FROM SchoolCount ;"; $result = mysqli_query($connection, $query); $quer = "SELECT Count(*) AS 'Cnt' FROM SchoolCount ;"; $rest = mysqli_query($connection, $quer); ?> <table cellpadding='5px' > <thead>
$result = mysql_query($query, $session->fDbInfo); if (!$result) { echo "<p>+++ DB {$db_name} nicht erzeugt: " . htmlentities(mysql_error()) . "</p>\n"; } else { echo "<p>DB {$db_name} wurde erzeugt</p>\n"; $db_status = checkDB($session); } } if ($table_status = checkTableStatus($db_status, $tables_exist)) { echo "<p>{$table_status}</p>\n"; } if (isset($db_overwrite)) { echo "db_overwrite: {$db_overwrite}<br/>\n"; } if (isset($db_populate) && (!isset($db_overwrite) || $db_overwrite == "J")) { populate($session, $file); } else { echo "<form name=\"form\" action=\"install.php\" method=\"post\">\n"; echo '<table><tr><td>MySQL-Server</td><td>'; guiTextField('db_server', $db_server, 16, 0); echo "</td></tr>\n<tr><td>Datenbank</td><td>"; guiTextField('db_name', $db_name, 16, 0); echo "</td></tr>\n<tr><td>Benutzer</td><td>"; guiTextField('db_user', $db_user, 16, 0); echo "</td></tr>\n<tr><td>Passwort</td><td>"; guiTextField('db_passw', $db_passw, 16, 0); echo "</td></tr>\n<tr><td>Tabellenvorspann</td><td>"; guiTextField('db_prefix', $db_prefix, 16, 0); echo "</td></tr>\n<tr><td>"; if ($sql_exists) { if ($tables_exist) {
/** * Describe Alert * @param array $alert Alert-Result from DB * @return array */ function DescribeAlert($alert) { $obj = array(); $i = 0; $device = dbFetchRow('SELECT hostname FROM devices WHERE device_id = ?', array($alert['device_id'])); $tpl = dbFetchRow('SELECT `template`,`title`,`title_rec` FROM `alert_templates` JOIN `alert_template_map` ON `alert_template_map`.`alert_templates_id`=`alert_templates`.`id` WHERE `alert_template_map`.`alert_rule_id`=?', array($alert['rule_id'])); $default_tpl = "%title\r\nSeverity: %severity\r\n{if %state == 0}Time elapsed: %elapsed\r\n{/if}Timestamp: %timestamp\r\nUnique-ID: %uid\r\nRule: {if %name}%name{else}%rule{/if}\r\n{if %faults}Faults:\r\n{foreach %faults} #%key: %value.string\r\n{/foreach}{/if}Alert sent to: {foreach %contacts}%value <%key> {/foreach}"; $obj['hostname'] = $device['hostname']; $obj['device_id'] = $alert['device_id']; $extra = $alert['details']; if (!isset($tpl['template'])) { $obj['template'] = $default_tpl; } else { $obj['template'] = $tpl['template']; } if ($alert['state'] >= 1) { if (!empty($tpl['title'])) { $obj['title'] = $tpl['title']; } else { $obj['title'] = 'Alert for device ' . $device['hostname'] . ' - ' . ($alert['name'] ? $alert['name'] : $alert['rule']); } if ($alert['state'] == 2) { $obj['title'] .= ' got acknowledged'; } elseif ($alert['state'] == 3) { $obj['title'] .= ' got worse'; } elseif ($alert['state'] == 4) { $obj['title'] .= ' got better'; } foreach ($extra['rule'] as $incident) { $i++; $obj['faults'][$i] = $incident; foreach ($incident as $k => $v) { if (!empty($v) && $k != 'device_id' && (stristr($k, 'id') || stristr($k, 'desc') || stristr($k, 'msg')) && substr_count($k, '_') <= 1) { $obj['faults'][$i]['string'] .= $k . ' => ' . $v . '; '; } } } $obj['elapsed'] = TimeFormat(time() - strtotime($alert['time_logged'])); if (!empty($extra['diff'])) { $obj['diff'] = $extra['diff']; } } elseif ($alert['state'] == 0) { $id = dbFetchRow('SELECT alert_log.id,alert_log.time_logged,alert_log.details FROM alert_log WHERE alert_log.state != 2 && alert_log.state != 0 && alert_log.rule_id = ? && alert_log.device_id = ? && alert_log.id < ? ORDER BY id DESC LIMIT 1', array($alert['rule_id'], $alert['device_id'], $alert['id'])); if (empty($id['id'])) { return false; } $extra = json_decode(gzuncompress($id['details']), true); if (!empty($tpl['title_rec'])) { $obj['title'] = $tpl['title_rec']; } else { $obj['title'] = 'Device ' . $device['hostname'] . ' recovered from ' . ($alert['name'] ? $alert['name'] : $alert['rule']); } $obj['elapsed'] = TimeFormat(strtotime($alert['time_logged']) - strtotime($id['time_logged'])); $obj['id'] = $id['id']; $obj['faults'] = false; } else { return 'Unknown State'; } //end if $obj['uid'] = $alert['id']; $obj['severity'] = $alert['severity']; $obj['rule'] = $alert['rule']; $obj['name'] = $alert['name']; $obj['timestamp'] = $alert['time_logged']; $obj['contacts'] = $extra['contacts']; $obj['state'] = $alert['state']; if (strstr($obj['title'], '%')) { $obj['title'] = RunJail('$ret = "' . populate(addslashes($obj['title'])) . '";', $obj); } return $obj; }
// var_dump($rolesPermissions); // Right now if we get two different answers from different chains, then the result is not gaurenteed. // Aka: Dont have ambiguous ACL trees foreach ($permissions as $name => $values) { if (!isset($rolesPermissions[$name])) { $rolesPermissions[$name] = array(); } foreach ($values as $key => $value) { $rolesPermissions[$name][$key] = $value; } } return $rolesPermissions; //echo "\n"; // var_dump($rolesPermissions); // echo "\n\n\n"; //return $permissions; } function can($permissions, $name, $value) { if (isset($permissions[$name][$value])) { return $permissions[$name][$value]; } else { return false; } } $permissions = populate(4); var_dump($permissions); $value = can($permissions, "Article1", "Edit"); var_dump($value); ?> </pre>
function instDBAnswer(&$session) { global $inst_populate; $session->trace(TC_Init, 'instDBAnswer'); $message = ''; if (isset($inst_populate)) { $message = populate($session, instGetSqlFile($session)); } instDB($session, $message); }
<strong><?php echo form_error('section[]'); ?> </strong> </p> </td> <td> <p><strong>Тип тура:</strong></p><br> <?php foreach ($type_tours_list as $item) { ?> <input type = "checkbox" name = "section[]" value = <?php echo $item['section_id']; ?> <?php echo populate($material_id, $names, $item['section_id']); echo set_checkbox('section[]', $item['section_id']); ?> ><?php echo $item['title']; ?> (<?php echo $item['section_id']; ?> )<br> <?php } ?> </td> </tr> </table>
} $query = "select * from stats where s_id={$s_id}"; $result = $conn->query($query); if ($result->num_rows == 0) { $json = file_get_contents("https://na.api.pvp.net/api/lol/na/v2.2/matchlist/by-summoner/{$s_id}?seasons=PRESEASON2016&api_key=9073dedb-d0e0-43db-8557-9ae31bf7967e"); $obj = json_decode($json, TRUE); if ($obj["totalGames"] == 0) { header("Location: stats.php"); $conn->close(); die; } for ($i = 0; $i < 10; $i++) { $matchid = $obj["matches"][$i]["matchId"]; $championid = $obj["matches"][$i]["champion"]; $timestamp = $obj["matches"][$i]["timestamp"]; populate($matchid, $timestamp, $championid, $s_id); // 1 API request per a call. sleep(1.5); } $query = "select * from wins\n where wins.s_id = {$s_id}\n union\n select * from losses\n where losses.s_id = {$s_id}\n order by timestamp desc"; $results = $conn->query($query); $numrows = $results->num_rows; $latest_timestamp = 0; $kills = 0; $deaths = 0; $assists = 0; $gold = 0; $cs = 0; $resultrow = $results->fetch_assoc(); $latest_timestamp = $resultrow["timestamp"]; $kills = $resultrow["kills"];
$jsonMeanings = util_getRequestParameter('jsonMeanings'); // LexemModel parameters (arrays) $modelType = util_getRequestParameter('modelType'); $modelNumber = util_getRequestParameter('modelNumber'); $restriction = util_getRequestParameter('restriction'); $sourceIds = util_getRequestParameter('lexemSourceIds'); $lmTags = util_getRequestParameter('lmTags'); $isLoc = util_getRequestParameter('isLoc'); // Button parameters $refreshLexem = util_getRequestParameter('refreshLexem'); $saveLexem = util_getRequestParameter('saveLexem'); $lexem = Lexem::get_by_id($lexemId); $original = Lexem::get_by_id($lexemId); // Keep a copy so we can test whether certain fields have changed if ($refreshLexem || $saveLexem) { populate($lexem, $original, $lexemForm, $lexemNumber, $lexemDescription, $lexemComment, $needsAccent, $hyphenations, $pronunciations, $variantOfId, $structStatus, $modelType, $modelNumber, $restriction, $lmTags, $isLoc, $sourceIds); $meanings = json_decode($jsonMeanings); if (validate($lexem, $original, $variantIds, $meanings)) { // Case 1: Validation passed if ($saveLexem) { if ($original->hasModelType('VT') && !$lexem->hasModelType('VT')) { $original->deleteParticiple(); } if (($original->hasModelType('VT') || $original->hasModelType('V')) && (!$lexem->hasModelType('VT') && !$lexem->hasModelType('V'))) { $original->deleteLongInfinitive(); } foreach ($original->getLexemModels() as $lm) { $lm->delete(); // This will also delete LexemSources and InflectedForms } $lexem->deepSave();
function verify($s_name, $s_id2) { // Start session session_start(); // For MySQL $servername = 'localhost'; $username = '******'; $password = '******'; $dbname = 'leaguestats'; // Establish connection $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { $conn->close(); die("Connection failed: " . $conn->connect_error); } $s_id = 0; $url = 'https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/' . rawurlencode($s_name) . '?api_key=9073dedb-d0e0-43db-8557-9ae31bf7967e'; $json = file_get_contents($url); $obj = json_decode($json, true); if (empty($obj)) { $s_id = -1; } else { $temp = preg_replace('/\\s/', '', $s_name); $temp = strtolower($temp); $s_id = $obj[$temp]['id']; if ($s_id == $s_id2) { return -1; } $query = "select latest_timestamp from stats where s_id = {$s_id}"; $result = $conn->query($query); $resultrow = $result->fetch_assoc(); $json = file_get_contents("https://na.api.pvp.net/api/lol/na/v2.2/matchlist/by-summoner/{$s_id}?seasons=PRESEASON2016&api_key=9073dedb-d0e0-43db-8557-9ae31bf7967e"); $obj = json_decode($json, TRUE); $timestamp = $obj["matches"][0]["timestamp"]; if ($obj["totalGames"] == 0) { return 1; } if ($result->num_rows > 0 && $timestamp > $resultrow["latest_timestamp"] && !empty($obj)) { repopulate($obj, $s_id); } else { if ($result->num_rows == 0) { for ($i = 0; $i < 10; $i++) { $matchid = $obj["matches"][$i]["matchId"]; $championid = $obj["matches"][$i]["champion"]; $timestamp = $obj["matches"][$i]["timestamp"]; populate($matchid, $timestamp, $championid, $s_id); // 1 API request per a call. sleep(1.5); } $query = "select * from wins\n where wins.s_id = {$s_id}\n union\n select * from losses\n where losses.s_id = {$s_id}\n order by timestamp desc"; $results = $conn->query($query); $numrows = $results->num_rows; $latest_timestamp = 0; $kills = 0; $deaths = 0; $assists = 0; $gold = 0; $cs = 0; $resultrow = $results->fetch_assoc(); $latest_timestamp = $resultrow["timestamp"]; $kills = $resultrow["kills"]; $deaths = $resultrow["deaths"]; $assists = $resultrow["assists"]; $gold = $resultrow["gold"]; $cs = $resultrow["cs"]; while ($resultrow = $results->fetch_assoc()) { $kills += $resultrow["kills"]; $deaths += $resultrow["deaths"]; $assists += $resultrow["assists"]; $gold += $resultrow["gold"]; $cs += $resultrow["cs"]; } $kills /= $numrows; $deaths /= $numrows; $assists /= $numrows; $gold /= $numrows; $cs /= $numrows; // Average stats $query = "insert into stats(s_id, latest_timestamp, kills, deaths, assists, gold, cs) \n values({$s_id}, {$latest_timestamp}, {$kills}, {$deaths}, {$assists}, {$gold}, {$cs})"; $result = $conn->query($query); $conn->close(); } } } return $s_id; }
{ foreach ($listacibi as $cibo => $ingredienti) { if (strpos($ingredienti, $key) !== false) { echo "'" . $key . "' presente in: '" . htmlentities($cibo) . "' ({$ingredienti})"; echo "<br />"; } } } //////VIEW///// ?> <html> <form method="POST"> <select name="cibo"> Inserisci la chiave da cercare: <?php populate($cibieingredienti); ?> </select> <input type="submit" value="Cerca" /> </form> <br /> <br /> <?php if (isset($_POST["cibo"])) { search($cibieingredienti, $_POST["cibo"]); } ?> </html>
$items = $wpdb->get_results("SELECT * FROM wp_pro_CraftyPanel"); foreach ($items as $item) { item($item->id, $item->name, $item->publisher, $item->permission, $item->content); } } function item($id, $name, $publisher, $role, $content) { echo ' <tbody id="the-list"> <tr> <td><input type="radio" name="radio"/></td> <td>' . $id . '</td> <td>' . $name . '</td> <td>' . $publisher . '</td> <td>' . $role . '</td> <td>' . 'add later' . '</td> <td>' . $content . '</td> </tr> </tbody> '; } populate(); echo '<div id="buttons" style="float:left;">'; echo '<input id="submit" class="button button-primary" type="submit" value="New" name="submit" />'; echo '<input id="submit" class="button button-primary" type="submit" value="Edit" name="submit" />'; echo '<input id="submit" class="button button-primary" type="submit" value="Delete" name="submit" />'; echo '</div>'; //Edit add Form ?>
$com_id = $line['mincomid']; // Libère le résultat pg_free_result($result); return $com_id; } function populate_modify_quantity_in_ligne_commande($dbconn, $com_id) { // Exécute la requête préparée. Notez qu'il n'est pas nécessaire d'échapper $result = pg_execute($dbconn, "update_lignes_commande_quantite", array(rand(1, 10), $com_id)); // Libère le résultat pg_free_result($result); } function detect_incoherence($dbconn, $com_id) { // get the minimum command id $query = 'SELECT co.com_id,co.com_total_ht as tot1,sum(lc.lic_total) as tot2' . ' FROM app.commandes co ' . ' INNER JOIN app.lignes_commande lc ON lc.com_id=co.com_id ' . ' WHERE co.com_id = ' . (int) $com_id . ' GROUP BY co.com_id,co.com_total_ht;'; $result = pg_query($query) or die('Échec de la requête : ' . pg_last_error()); $line = pg_fetch_array($result, null, PGSQL_ASSOC); $tot1 = $line['tot1']; $tot2 = $line['tot2']; if ($tot1 != $tot2) { echo "\n ETAT INCOHERENT DETECTE!! {$tot1} :: {$tot2} \n"; } // Libère le résultat pg_free_result($result); return $com_id; } // MAIN PROGRAM ********** $dbconn = connect(); populate($dbconn); endprogram($dbconn);
} return $rarr; } else { $carr = schoolQuery("all", $sid); $r1 = 227; $r2 = 82; $g1 = 85; $g2 = 4; $b1 = 66; $b2 = 53; $grad = 1 / sizeof($carr); $i = 0; foreach ($carr as $key => &$elem) { $elem["color"] = sprintf("%02s", dechex($r1 + $i * $grad * ($r2 - $r1))) . sprintf("%02s", dechex($g1 + $i * $grad * ($g2 - $g1))) . sprintf("%02s", dechex($b1 + $i * $grad * ($b2 - $b1))); $i++; } return array("All clubs" => $carr); } } // MAIN $master_arr = []; if (isset($_GET["int"]) && isset($_GET["sid"])) { $int = $_GET["int"]; $sid = $_GET["sid"]; $arr_clubs = populate($int, $sid, $conn); if (isset($arr_clubs) && $arr_clubs != -1) { $arr_interests = flipsort($arr_clubs, $conn); $master_arr = generate($arr_interests, $sid, $conn); } } echo json_encode($master_arr, JSON_UNESCAPED_UNICODE);
// clean_param , email username text $user->auth = 'nologin'; $user->username = $username; $user->password = md5(uniqid(rand(), 1)); populate($user, $context, $tool); $user->id = $DB->insert_record('user', $user); // Reload full user $user = $DB->get_record('user', array('id' => $user->id)); } else { $user = new stdClass(); populate($user, $context, $tool); if (user_match($user, $dbuser)) { $user = $dbuser; } else { $user = $dbuser; populate($user, $context, $tool); $DB->update_record('user', $user); } } // Enrol user in course and activity if needed if (!$context = $DB->get_record('context', array('id' => $tool->contextid))) { print_error("invalidcontext"); } if ($context->contextlevel == CONTEXT_COURSE) { $courseid = $context->instanceid; $urltogo = $CFG->wwwroot . '/course/view.php?id=' . $courseid; } else if ($context->contextlevel == CONTEXT_MODULE) { $cmid = $context->instanceid; $cm = get_coursemodule_from_id(false, $context->instanceid, 0, false, MUST_EXIST);
$dn = dirname("{$ebsprefix}{$i}/{$f}"); } if (!array_key_exists($dn, $paths_map)) { $paths_map[$dn] = $realkey_cnt++; } } } $mymap = array_flip($paths_map); // output map and data $myc = $realkey_cnt . "\n"; $myc_arr .= $myc; for ($i = 0; $i < $realkey_cnt; $i++) { $myc = $mymap[$i] . "\n"; $myc_arr .= $myc; } for ($i = 0; $i < $k; $i++) { foreach (array_filter(explode("\n", $awsinfo[$i]["files"])) as $f) { if (preg_match('/^\\//', $f)) { $tmpstr = "{$ebsprefix}{$i}{$f}"; } else { $tmpstr = "{$ebsprefix}{$i}/{$f}"; } $dn = dirname($tmpstr); $bn = basename($tmpstr); $realkey = $paths_map[$dn]; $myc = $realkey . "\t" . $bn . "\n"; $myc_arr .= $myc; } } populate($myc_arr); }
<?php // -------------------------------------- // @name GenomeVIP Loader for Amazon's 1000 Genomes Project file trees // @version // @author R. Jay Mashl <*****@*****.**> // -------------------------------------- ini_set('display_errors', 1); error_reporting(E_ALL); include realpath(dirname(__FILE__) . "/" . "populate.php"); if ($_SERVER['REQUEST_METHOD'] == "POST") { $mymap = array(1 => "1000G.pilot_phase.lst.processed", 2 => "1000G.phase1.low_cov.lst.processed", 3 => "1000G.phase1.exome.lst.processed", 4 => "1000G.phase3.low_cov.lst.processed", 5 => "1000G.phase3.exome.lst.processed", 6 => "1000G.phase3.high_cov.lst.processed"); populate(file_get_contents("configsys/1000G_tree/" . $mymap[$_POST['n']])); }