function fill($prefix, $listid) { global $server_name, $tables, $table_prefix; # check for not too many $domain = getConfig("domain"); $res = Sql_query("select count(*) from {$tables['user']}"); $row = Sql_fetch_row($res); if ($row[0] > 50000) { error("Hmm, I think 50 thousand users is quite enough for a test<br/>This machine does need to do other things you know."); print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Done. Now there are ' . $row[0] . ' users in the database";</script>' . "\n"; return 0; } # fill the database with "users" who have any combination of attribute values $attributes = array(); $res = Sql_query("select * from {$tables['attribute']} where type = \"select\" or type = \"checkbox\" or type=\"radio\""); $num_attributes = Sql_Affected_rows(); $total_attr = 0; $total_val = 0; while ($row = Sql_fetch_array($res)) { array_push($attributes, $row["id"]); $total_attr++; $values[$row["id"]] = array(); $res2 = Sql_query("select * from {$table_prefix}" . "listattr_" . $row["tablename"]); while ($row2 = Sql_fetch_array($res2)) { array_push($values[$row["id"]], $row2["id"]); $total_val++; } } $total = $total_attr * $total_val; if (!$total) { Fatal_Error("Can only do stress test when some attributes exist"); return 0; } for ($i = 0; $i < $total; $i++) { $data = array(); reset($attributes); while (list($key, $val) = each($attributes)) { $data[$val] = pos($values[$val]); if (!$data[$val]) { reset($values[$val]); $data[$val] = pos($values[$val]); } next($values[$val]); } $query = sprintf('insert into %s (email,entered,confirmed) values("testuser%s",now(),1)', $tables["user"], $prefix . '-' . $i . '@' . $domain); $result = Sql_query($query, 0); $userid = Sql_insert_id(); if ($userid) { $result = Sql_query("replace into {$tables['listuser']} (userid,listid,entered) values({$userid},{$listid},now())"); reset($data); while (list($key, $val) = each($data)) { if ($key && $val) { Sql_query("replace into {$tables['user_attribute']} (attributeid,userid,value) values(" . $key . ",{$userid}," . $val . ")"); } } } } return 1; }
function get_systable($s_systable) { global $dbhandle; // get the field names and types $sql = 'SELECT RDB$RELATION_FIELDS.RDB$FIELD_NAME AS FNAME,' . ' RDB$RELATION_FIELDS.RDB$FIELD_POSITION,' . ' RDB$FIELD_TYPE AS FTYPE,' . ' RDB$FIELD_SUB_TYPE AS STYPE' . ' FROM RDB$RELATION_FIELDS, RDB$FIELDS' . ' WHERE RDB$RELATION_NAME=\'' . $s_systable['table'] . '\'' . ' AND RDB$FIELD_SOURCE=RDB$FIELDS.RDB$FIELD_NAME' . ' ORDER BY RDB$FIELD_POSITION'; $res = fbird_query($dbhandle, $sql) or ib_error(__FILE__, __LINE__, $sql); $table = array(); while ($row = fbird_fetch_object($res)) { $type = isset($row->FTYPE) ? $row->FTYPE : NULL; $stype = isset($row->STYPE) ? $row->STYPE : NULL; $table[trim($row->FNAME)]['type'] = get_datatype($type, $stype); } fbird_free_result($res); // get the table content $sql = 'SELECT *' . ' FROM ' . $s_systable['table']; if ($s_systable['sysdata'] == FALSE) { $fields = array_keys($table); $sql .= ' WHERE ' . pos($fields) . " NOT LIKE 'RDB\$%'" . ' AND ' . pos($fields) . " NOT LIKE 'TMP\$%'"; } // handle the filter if (!empty($s_systable['ffield']) && in_array($s_systable['ffield'], array_keys($table))) { $sql .= $s_systable['sysdata'] == TRUE ? ' WHERE ' : ' AND '; switch ($s_systable['fvalue']) { case '': $sql .= $s_systable['ffield'] . ' IS NULL'; break; case 'BLOB': if ($table[$s_systable['ffield']]['type'] == 'BLOB') { $sql .= $s_systable['ffield'] . " IS NOT NULL"; break; } default: $sql .= $s_systable['ffield'] . "='" . $s_systable['fvalue'] . "'"; } } if (!empty($s_systable['order'])) { $sql .= ' ORDER BY ' . $s_systable['order'] . ' ' . $s_systable['dir']; } $res = fbird_query($dbhandle, $sql) or ib_error(__FILE__, __LINE__, $sql); while ($row = fbird_fetch_object($res)) { foreach (array_keys($table) as $fname) { if ($row->{$fname} === 0) { $table[$fname]['col'][] = '0'; } elseif (!isset($row->{$fname}) || empty($row->{$fname})) { $table[$fname]['col'][] = ' '; } elseif ($table[$fname]['type'] == 'BLOB') { $table[$fname]['col'][] = '<i>BLOB</i>'; } else { $table[$fname]['col'][] = trim($row->{$fname}); } } } fbird_free_result($res); return $table; }
public function startClass($class, $definition) { $string = "<?php\nclass {$class}"; if ($definition['extend']) { $string .= ' extends ' . pos($definition['extend']); } if ($definition['implement']) { $string .= ' implements ' . implode(',', $definition['implement']); } return $string . "{\n"; }
protected function _oneQuery($id) { $primary = $this->info(self::PRIMARY); $select = $this->select(); if (is_scalar($id)) { $id = array(pos($primary) => $id); } foreach ($primary as $p) { $select->where("`{$this->_name}`.`{$p}` = ?", $id); } return $select; }
function show_array($array) { $output = ""; for (reset($array); $key = key($array), $pos = pos($array); next($array)) { if (is_array($pos)) { $output .= "{$key} : <ul>"; $output .= show_array($pos); $output .= "</ul>"; } else { $output .= "{$key} = {$pos} <br/>"; } } return $output; }
protected function tagVariableVar(&$token) { if (('}' === $this->prevType || T_VARIABLE === $this->prevType) && !in_array($this->penuType, array(T_NEW, T_OBJECT_OPERATOR, T_DOUBLE_COLON))) { $t =& $this->types; end($t); $i = key($t); if (T_VARIABLE === $this->prevType && '$' !== $this->penuType) { if ('$this' !== ($a = $this->texts[$i])) { $this->texts[$i] = $this->varVarLead . $a . $this->varVarTail; } } else { if ('}' === $this->prevType) { $a = 1; $b = array($i, 0); prev($t); while ($a > 0 && null !== ($i = key($t))) { if ('{' === $t[$i]) { --$a; } else { if ('}' === $t[$i]) { ++$a; } } prev($t); } $b[1] = $i; if ('$' !== prev($t)) { return; } } else { $a = $b = 0; } do { } while ('$' === prev($t)); if (in_array(pos($t), array(T_NEW, T_OBJECT_OPERATOR, T_DOUBLE_COLON))) { return; } $a =& $this->texts; $b && ($a[$b[0]] = $a[$b[1]] = ''); next($t); $a[key($t)] = $this->varVarLead; end($t); $a[key($t)] .= $this->varVarTail; } } }
/** * UTF-8 aware alternative to strpos. * * Find position of first occurrence of a string. * This will get alot slower if offset is used. * * @see http://www.php.net/strpos * @see utf8_strlen * @see utf8_substr * * @param string $str haystack * @param string $needle needle (you should validate this with utf8_is_valid) * @param integer|false $offset offset in characters (from left) * * @return mixed integer position or false on failure */ function pos($str, $needle, $offset = false) { if ($offset === false) { $ar = explode($needle, $str, 2); //if (count($ar) > 1) if (isset($ar[1])) { return len($ar[0]); } return false; } if (!is_int($offset)) { trigger_error('utf8_strpos: Offset must be an integer', E_USER_ERROR); return false; } $str = sub($str, $offset); if (($pos = pos($str, $needle)) !== false) { return $pos + $offset; } return false; }
} else { if ($upload) { if (!is_writable($dirPath)) { write_error("Error: cannot write to the specified directory."); } else { //if mulltipart mode and there is no file form field in request , then write error if ($isMultiPart && count($_FILES) <= 0) { write_error("No chunk for save."); } //if can't open file for append , then write error if (!($file = fopen($filePath, "a"))) { write_error("Can't open file for write."); } //logic to read and save chunk posted with multipart if ($isMultiPart) { $filearr = pos($_FILES); if (!($input = file_get_contents($filearr['tmp_name']))) { write_error("Can't read from file."); } else { if (!fwrite($file, $input)) { write_error("Can't write to file."); } } } else { $input = file_get_contents("php://input"); if (!fwrite($file, $input)) { write_error("Can't write to file."); } } fclose($file); //Upload complete if size of saved temp file >= size of source file.
function replaceMacroVars($branch, $vars) { $newBranch = array(); foreach ($branch as $leaf) { if (is_array($leaf)) { if (pos($leaf) == 'unquote') { $newBranch[] = $vars[$leaf[1]]; } else { if (pos($leaf) == 'unquotesplice') { foreach ($vars[$leaf[1]] as $part) { $newBranch[] = $part; } } else { $newBranch[] = $this->replaceMacroVars($leaf, $vars); } } } else { $newBranch[] = $leaf; } } return $newBranch; }
public static function replace_symbol($symbol) { $symbol = pos($symbol); return self::$symbols_hash[$symbol][array_rand(self::$symbols_hash[$symbol])]; }
function getAccessList($name, $selected = "private") { $arr = array("private" => "Private", "public" => "Global public", "group" => "Group public"); if (ereg(",", $selected)) { $selected = "group"; } $out = "<select name=\"{$name}\">\n"; for (reset($arr); current($arr); next($arr)) { $out .= '<option value="' . key($arr) . '"'; if ($selected == key($arr)) { $out .= " SELECTED"; } $out .= ">" . pos($arr) . "</option>\n"; } $out .= "</select>\n"; return $out; }
function marc_select($type, $name = 'mySelector', $selected = '', $onchange = '') { $source = new marc_list($type); if ($onchange) { $onchange = " onchange=\"{$onchange}\" "; } $this->display = "<select id='{$name}' name='{$name}' {$onchange} >"; if ($selected) { foreach ($source->table as $value => $libelle) { if (!($value == $selected)) { $tag = "<option value='{$value}'>"; } else { $tag = "<option value='{$value}' selected='selected' >"; } $this->display .= "{$tag}{$libelle}</option>"; } } else { // cirque à cause d'un bug d'IE reset($source->table); $this->display .= "<option value='" . key($source->table) . "' selected='selected' >"; $this->display .= pos($source->table) . '</option>'; while (next($source->table)) { $this->display .= "<option value='" . key($source->table) . "'>"; $this->display .= pos($source->table) . '</option>'; } } $this->display .= "</select>"; }
/** * dbFormHandler::_saveData() * * Save the data into the database * * @param array $data: associative array with the fields => values which should be saved * @return int: the id which was used to save the record * @access private * @author Teye Heimans */ function _saveDbData($data) { // get the not-null fields from the table $notNullFields = $this->_db->getNotNullFields($this->_table); // get the data which should be saved foreach ($data as $field => $value) { if (is_array($value)) { $value = implode(', ', $value); } // remove unneeded spaces $value = trim($value); // do we have to save the field ? if (!in_array($field, $this->_dontSave) && (!isset($this->_fields[$field]) || !method_exists($this->_fields[$field][1], 'getViewMode') || !$this->_fields[$field][1]->getViewMode())) { // is the value empty and it can contain NULL, then save NULL if ($value == '' && !in_array($field, $notNullFields)) { $value = 'NULL'; $this->_sql[] = $field; // overwrite the old value with the new one $data[$field] = $value; } } else { unset($data[$field]); } } // get the column types of the fields $fields = $this->_db->getFieldTypes($this->_table); // walk all datefields foreach ($this->_date as $field) { // do we still have to convert the value ? if (isset($data[$field]) && $data[$field] != 'NULL') { // does the field exists in the table? if (isset($fields[$field])) { // get the fields type $type = strtolower($fields[$field][0]); // is the field's type a date field ? if (strpos(strtolower($type), 'date') !== false) { // get the value from the field list($y, $m, $d) = $this->_fields[$field][1]->getAsArray(); // are all fields empty ? if (empty($d) && empty($m) && empty($y)) { // save NULL if possible, otherwise 0000-00-00 if (in_array($field, $notNullFields)) { // this field cannot contain NULL $data[$field] = '0000-00-00'; } else { $data[$field] = 'NULL'; $this->_sql[] = $field; } } else { // make sure that there are values for each "field" if ($d == '') { $d = '00'; } if ($m == '') { $m = '00'; } if ($y == '') { $y = '0000'; } //date('Y'); // save the value as date $data[$field] = $this->_db->dbDate($y, $m, $d); $this->_sql[] = $field; } } } } } // get the query $query = $this->_getQuery($this->_table, $data, $this->_sql, $this->edit, $this->_id); // for debugging.. die when we got the query //$this->dieOnQuery = true; if (isset($this->dieOnQuery) && $this->dieOnQuery) { echo "<pre>"; echo $query; echo "</pre>"; exit; } // make sure that there is something to save... if (!$query) { return 0; } // execute the query $sql = $this->_db->query($query); // query failed? if (!$sql) { trigger_error("Error, query failed!<br />\n" . "<b>Error message:</b> " . $this->_db->getError() . "<br />\n" . "<b>Query:</b> " . $query, E_USER_WARNING); return -1; } else { // is it an edit form ? Then return the known edit id's if ($this->edit) { $return = $this->_id; } else { // get the inserted id $id = $this->_db->getInsertId($this->_table); // got an id ? if ($id) { $return = $id; } else { // fetch the keys from the table $keys = $this->_db->getPrKeys($this->_table); // walk the keys $result = array(); foreach ($keys as $key) { // check if the key exists in the "save" data if (array_key_exists($key, $data)) { // replace possible quotes arround the data $result[] = trim($data[$key], "'"); } } $size = sizeof($result); $return = $size > 1 ? $result : ($size == 1 ? $result[0] : null); } } } // execute actions on the junction table if (isset($id) || isset($return)) { $pk = isset($id) ? $id : pos($return); foreach ($this->_tableConfig as $tableName => $fields) { if (!$this->_fields[$fields[0]][1]->getViewMode()) { $this->deleteJunctionData($tableName, $fields[1], $pk); $this->insertJunctionData($tableName, $fields[0], $fields[1], $pk); } } } // unset the database object (we dont need it anymore) unset($this->_db); return $return; }
for ($j = 1; $j <= 5; $j++) { $sql .= 'shoot' . $j; if ($j < 5) { $sql .= ' + '; } } $sql .= ' AS total FROM Societe_2016 WHERE id_shooter = ' . key($tab) . ' ORDER BY total DESC LIMIT 0 , 1'; $res = mysql_query($sql) or die('requete invalide'); $n_passe = 1; //affichage des 3 passe concernée while ($data = mysql_fetch_array($res)) { echo ' <strong>Total société:</strong>'; $total_passe = 0; for ($j = 0; $j <= 5; $j++) { $sh = 'shoot' . $j; if (isset($data[$sh])) { $total_passe += $data[$sh]; } } $str = sprintf("%05s", $total_passe); echo str_replace('0', ' ', substr($str, 0, 3)); echo substr($str, 3, 2); $n_passe++; } echo ' <strong>Total :' . pos($tab) . '</strong>'; echo '</div></div><br />'; next($tab); } } echo '</page>'; mysql_close($base);
/** * Constructor. * * @param $clusterdata int/object/array The data id of a data record or data elements to load manually. * */ function cluster($clusterdata = false) { global $CURMAN; parent::datarecord(); $this->set_table(CLSTTABLE); $this->add_property('id', 'int'); $this->add_property('name', 'string'); $this->add_property('display', 'string'); $this->add_property('leader', 'int'); $this->add_property('parent', 'int'); $this->add_property('depth', 'int'); if (is_numeric($clusterdata)) { $this->data_load_record($clusterdata); } else { if (is_array($clusterdata)) { $this->data_load_array($clusterdata); } else { if (is_object($clusterdata)) { $this->data_load_array(get_object_vars($clusterdata)); } } } if (!empty($this->id)) { // custom fields $level = context_level_base::get_custom_context_level('cluster', 'block_curr_admin'); if ($level) { $fielddata = field_data::get_for_context(get_context_instance($level, $this->id)); $fielddata = $fielddata ? $fielddata : array(); foreach ($fielddata as $name => $value) { $this->{"field_{$name}"} = $value; } } } /* * profile_field1 -select box * profile_value1 -select box corresponding to profile_field1 * * profile_field2 -select box * profile_value2 -select box corresponding to profile_field2 */ $prof_fields = $CURMAN->db->get_records(CLSTPROFTABLE, 'clusterid', $this->id, '', '*', 0, 2); if (!empty($prof_fields)) { foreach (range(1, 2) as $i) { $profile = pos($prof_fields); if (!empty($profile)) { $field = 'profile_field' . $i; $value = 'profile_value' . $i; $this->{$field} = $profile->fieldid; $this->{$value} = $profile->value; } next($prof_fields); } } }
include_once 'dataQuery.php'; ini_set('auto_detect_line_endings', TRUE); //deals with differing line ending date_default_timezone_set('America/Edmonton'); // </n> in linux and </lf /cr> in windows $formatStr = "Y-m-d H:i:s"; $unixTime = time(); $date = new DateTime("@{$unixTime}"); $date = $date->format($formatStr); $db; $dir = '/opt/ZEUS/parsed_datalogs/sql_parsed/'; $files = scandir($dir, 1); $files = preg_grep("/^.*\\.csv\$/", $files); //removes all files from the array that do not end in *.csv $files = $dir . pos($files); echo $files; if (($handle = fopen($files, "r")) !== FALSE) { //file exists $db = new Db(); $sql = "INSERT INTO `DataSet`(`dataID`, `addedBy`, `raceID`, `datasetname`) VALUES ('NULL','1','3','{$date}');"; $result = $db->query($sql); // echo $result."\n"; $sql = "SELECT MAX(dataID) FROM DataSet;"; $result = $db->query($sql); $maxId = mysqli_fetch_assoc($result); $max = $maxId["MAX(dataID)"]; while (($data = fgetcsv($handle, 500, ",")) !== FALSE) { /* echo "Time is ".$data[0]."\n"; echo "Acceleration is ". $data[1] ." M/s^2 \n"; echo "Velocity is " .$data[2]." M/s \n";
function marc_select($type, $name = 'mySelector', $selected = '', $onchange = '', $option_premier_code = '', $option_premier_info = '') { global $charset; $source = new marc_list($type); $source_tab = $source->table; if ($option_premier_code !== '' && $option_premier_info !== '') { $option_premier_tab = array($option_premier_code => $option_premier_info); $source_tab = $option_premier_tab + $source_tab; } if ($onchange) { $onchange = " onchange=\"{$onchange}\" "; } $this->display = "<select id='{$name}' name='{$name}' {$onchange} >"; if ($selected) { foreach ($source_tab as $value => $libelle) { if (!($value == $selected)) { $tag = "<option value='{$value}'>"; } else { $tag = "<option value='{$value}' selected='selected'>"; $this->libelle = "{$libelle}"; } $this->display .= $tag . htmlentities($libelle, ENT_QUOTES, $charset) . "</option>"; } } else { // cirque à cause d'un bug d'IE reset($source_tab); $this->display .= "<option value='" . key($source_tab) . "' selected='selected'>"; $this->display .= htmlentities(pos($source_tab), ENT_QUOTES, $charset) . '</option>'; while (next($source_tab)) { $this->display .= "<option value='" . key($source_tab) . "'>"; $this->display .= htmlentities(pos($source_tab), ENT_QUOTES, $charset) . '</option>'; } } $this->display .= "</select>"; }
if (pos(buttontask, '.add') > 0) { JToolbarHelper::addNewX($buttons[0], $button[2]); } else { if (pos(buttontask, '.edit') > 0) { JToolbarHelper::editListX($buttons[0], $button[2]); } else { if (pos(buttontask, '.delete') > 0) { JToolbarHelper::deleteListX('', $buttons[0], $button[2]); } else { if (pos(buttontask, '.save') > 0) { JToolbarHelper::save($buttons[0], $button[2]); } else { if (pos(buttontask, '.cancel') > 0) { JToolbarHelper::cancel($buttons[0], $button[2]); } else { if (pos(buttontask, '.back') > 0) { JToolbarHelper::back($buttons[0], $button[2]); } else { JToolbarHelper::custom($buttons[0], $buttons[1], $buttons[2], false); } } } } } } } ?> <script language="javascript" type="text/javascript"> btnClixk = function(task) { document.forms.adminForm.task.value = task;
} if (in_array("55", $os, true)) { print "strict doesn't work"; } // array_values $array = array("size" => "XL", "color" => "gold"); print_r(array_values($array)); // current, pos, next, key, prev, end reset($os); print current($os); print key($os); next($os); print pos($os); print key($os); print prev($os); print pos($os); print key($os); print end($os); print current($os); print key($os); while ($val = prev($os)) { echo "prev check: {$val}\n"; } // array_reverse $input = array('your' => "php", 'my' => 4.0, array("green", "red")); $result = array_reverse($input); $result_keyed = array_reverse($input, true); var_dump($result); var_dump($result_keyed); // array_pop $stack = array("orange", "banana", "apple", "raspberry");
$paidappfee = "off"; } $data->adminEditUser($editview, $_REQUEST["editaccess"], $usrAccessid, $_REQUEST["email"], stripslashes($_REQUEST["firstname"]), stripslashes($_REQUEST["lastname"]), $_REQUEST["dob"], $_REQUEST["sex"], $_REQUEST["phone"], $_REQUEST["marital"], $_REQUEST["streetaddress"], $_REQUEST["city"], $_REQUEST["zip"], $_REQUEST["state"], $_REQUEST["country"], $_REQUEST["phone"], $_REQUEST["allergies"], $_REQUEST["medications"], $_REQUEST["notes"], $_REQUEST["insurance"], $_REQUEST["adminnotes"], $usr->groupid, $paidappfee, $_REQUEST["tshirt_size"]); if ($editview == $usr->userid) { $usr->firstname = $_REQUEST["firstname"]; $usr->lastname = $_REQUEST["lastname"]; $usr->email = $_REQUEST["email"]; $usr->streetaddress = $_REQUEST["streetaddress"]; } $smarty->assign('feedback', 'Profile information updated.'); } } // Process Image $newname = ""; if (count($_FILES) > 0) { $arrfile = pos($_FILES); $filename = basename($arrfile['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (strtolower($ext) == "jpg" || strtolower($ext) == "png" || strtolower($ext) == "bmp" || strtolower($ext) == "gif") { $newname = md5(microtime()); $newpath = SYS_TIDIR . "/" . $newname . "." . $ext; if (!file_exists($newname)) { if (move_uploaded_file($arrfile['tmp_name'], $newpath)) { list($width, $height) = getimagesize($newpath); // Create Avatar $newname_resized = SYS_IDIR . "/" . $newname . "_avatar.jpg"; $exec_command = "nice -n 19 " . SYS_CONVERT . " -size 100x100 -thumbnail 44x44^ -gravity center -extent 44x44 -quality 80 -density 88x88 +profile \"*\" {$newpath} {$newname_resized}"; exec($exec_command); // Create profile picture $newname_resized = SYS_IDIR . "/" . $newname . "_profile.jpg"; $exec_command = "nice -n 19 " . SYS_CONVERT . " -quality 75 -resize 600x600\\> -density 88x88 +profile \"*\" {$newpath} {$newname_resized}";
<?php echo "<h1>ANSWER TO THE QUESTION NO 3</h1><br>"; $color = array(4 => 'white', 6 => 'green', 11 => 'red'); echo "<h1>THE FIRST ELEMENT IN THE ARRAY IS:</h1> "; print_r(pos($color));
<!DOCTYPE html> <!-- MD.Owes Quruny Shubho http://shubho.info --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php $people = array("Shubho", "Rony", "Jony", "Anwar"); echo " End Value in Array Is: "; echo pos($people) . "<br>"; ?> </body> </html>
/** * Megvizsgálja, hogy a where tömb utolsó eleme tartalmaz-e ( karaktert * ha igen, akkor true-t ad vissza * ha a where tömb üres, vagy az utolsó eleme nem tartalamz ( jelet false-t ad vissza * * @return boolean */ private function check_bracket() { if (!empty($this->where)) { //az utolsó elemre állÃtjuk a where tömb belsÅ‘ mutatóját, hogy megkapjuk az utolsó elemét end($this->where); //itt visszadjuk az utolsó elemet egy átmeneti változóba $last = pos($this->where); //visszaállÃtjuk a tömb belsÅ‘ mutatóját az elsÅ‘ elemre reset($this->where); // visszadjuk az utolsó tömbelem utolsó karakterét $result = substr($last, -1); // megvizsgáljuk, hogy az utolsó karakter ( karakter-e ... (ha igen, akkor true-t ad vissza a metódus) if ($result == '(') { return true; } else { return false; } } else { return false; } }
public function testPosAlreadyStartsFromStrictlyPositiveValues() { $generator = pos(); $this->assertGreaterThan(0, $generator->__invoke(0)); }
function Read() { if ($this->items) { $getback = pos($this->items); next($this->items); return $getback; } }
/** * Creates the menu in the internal variables, ready for output. * Basically this will read the page records needed and fill in the internal $this->menuArr * Based on a hash of this array and some other variables the $this->result variable will be loaded either from cache OR by calling the generate() method of the class to create the menu for real. * * @return void * @todo Define visibility */ public function makeMenu() { if ($this->id) { $this->useCacheHash = FALSE; // Initializing showAccessRestrictedPages if ($this->mconf['showAccessRestrictedPages']) { // SAVING where_groupAccess $SAVED_where_groupAccess = $this->sys_page->where_groupAccess; // Temporarily removing fe_group checking! $this->sys_page->where_groupAccess = ''; } // Begin production of menu: $temp = array(); $altSortFieldValue = trim($this->mconf['alternativeSortingField']); $altSortField = $altSortFieldValue ?: 'sorting'; // ... only for the FIRST level of a HMENU if ($this->menuNumber == 1 && $this->conf['special']) { $value = isset($this->conf['special.']['value.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['value'], $this->conf['special.']['value.']) : $this->conf['special.']['value']; switch ($this->conf['special']) { case 'userfunction': $temp = $this->parent_cObj->callUserFunction($this->conf['special.']['userFunc'], array_merge($this->conf['special.'], array('_altSortField' => $altSortField)), ''); if (!is_array($temp)) { $temp = array(); } break; case 'language': $temp = array(); // Getting current page record NOT overlaid by any translation: $currentPageWithNoOverlay = $this->sys_page->getRawRecord('pages', $GLOBALS['TSFE']->page['uid']); // Traverse languages set up: $languageItems = GeneralUtility::intExplode(',', $value); foreach ($languageItems as $sUid) { // Find overlay record: if ($sUid) { $lRecs = $this->sys_page->getPageOverlay($GLOBALS['TSFE']->page['uid'], $sUid); } else { $lRecs = array(); } // Checking if the "disabled" state should be set. if (GeneralUtility::hideIfNotTranslated($GLOBALS['TSFE']->page['l18n_cfg']) && $sUid && !count($lRecs) || $GLOBALS['TSFE']->page['l18n_cfg'] & 1 && (!$sUid || !count($lRecs)) || !$this->conf['special.']['normalWhenNoLanguage'] && $sUid && !count($lRecs)) { $iState = $GLOBALS['TSFE']->sys_language_uid == $sUid ? 'USERDEF2' : 'USERDEF1'; } else { $iState = $GLOBALS['TSFE']->sys_language_uid == $sUid ? 'ACT' : 'NO'; } if ($this->conf['addQueryString']) { $getVars = $this->parent_cObj->getQueryArguments($this->conf['addQueryString.'], array('L' => $sUid), TRUE); $this->analyzeCacheHashRequirements($getVars); } else { $getVars = '&L=' . $sUid; } // Adding menu item: $temp[] = array_merge(array_merge($currentPageWithNoOverlay, $lRecs), array('ITEM_STATE' => $iState, '_ADD_GETVARS' => $getVars, '_SAFE' => TRUE)); } break; case 'directory': if ($value == '') { $value = $GLOBALS['TSFE']->page['uid']; } $items = GeneralUtility::intExplode(',', $value); foreach ($items as $id) { $MP = $this->tmpl->getFromMPmap($id); // Checking if a page is a mount page and if so, change the ID and set the MP var properly. $mount_info = $this->sys_page->getMountPointInfo($id); if (is_array($mount_info)) { if ($mount_info['overlay']) { // Overlays should already have their full MPvars calculated: $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']); $MP = $MP ? $MP : $mount_info['MPvar']; } else { $MP = ($MP ? $MP . ',' : '') . $mount_info['MPvar']; } $id = $mount_info['mount_pid']; } // Get sub-pages: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . (int) $id . $this->sys_page->where_hid_del, '', $altSortField); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $row = $this->sys_page->getPage($row['uid']); $GLOBALS['TSFE']->sys_page->versionOL('pages', $row, TRUE); if (!empty($row)) { // Keep mount point? $mount_info = $this->sys_page->getMountPointInfo($row['uid'], $row); // There is a valid mount point. if (is_array($mount_info) && $mount_info['overlay']) { // Using "getPage" is OK since we need the check for enableFields // AND for type 2 of mount pids we DO require a doktype < 200! $mp_row = $this->sys_page->getPage($mount_info['mount_pid']); if (count($mp_row)) { $row = $mp_row; $row['_MP_PARAM'] = $mount_info['MPvar']; } else { // If the mount point could not be fetched with respect // to enableFields, unset the row so it does not become a part of the menu! unset($row); } } // Add external MP params, then the row: if (!empty($row)) { if ($MP) { $row['_MP_PARAM'] = $MP . ($row['_MP_PARAM'] ? ',' . $row['_MP_PARAM'] : ''); } $temp[$row['uid']] = $row; } } } $GLOBALS['TYPO3_DB']->sql_free_result($res); } break; case 'list': if ($value == '') { $value = $this->id; } $skippedEnableFields = array(); if (!empty($this->mconf['showAccessRestrictedPages'])) { $skippedEnableFields = array('fe_group' => 1); } /** @var \TYPO3\CMS\Core\Database\RelationHandler $loadDB*/ $loadDB = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler'); $loadDB->setFetchAllFields(TRUE); $loadDB->start($value, 'pages'); $loadDB->additionalWhere['pages'] = $this->parent_cObj->enableFields('pages', FALSE, $skippedEnableFields); $loadDB->getFromDB(); foreach ($loadDB->itemArray as $val) { $MP = $this->tmpl->getFromMPmap($val['id']); // Keep mount point? $mount_info = $this->sys_page->getMountPointInfo($val['id']); // There is a valid mount point. if (is_array($mount_info) && $mount_info['overlay']) { // Using "getPage" is OK since we need the check for enableFields // AND for type 2 of mount pids we DO require a doktype < 200! $mp_row = $this->sys_page->getPage($mount_info['mount_pid']); if (count($mp_row)) { $row = $mp_row; $row['_MP_PARAM'] = $mount_info['MPvar']; // Overlays should already have their full MPvars calculated if ($mount_info['overlay']) { $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']); if ($MP) { unset($row['_MP_PARAM']); } } } else { // If the mount point could not be fetched with respect to // enableFields, unset the row so it does not become a part of the menu! unset($row); } } else { $row = $loadDB->results['pages'][$val['id']]; } //Add versioning overlay for current page (to respect workspaces) if (is_array($row)) { $this->sys_page->versionOL('pages', $row, TRUE); } // Add external MP params, then the row: if (is_array($row)) { if ($MP) { $row['_MP_PARAM'] = $MP . ($row['_MP_PARAM'] ? ',' . $row['_MP_PARAM'] : ''); } $temp[] = $this->sys_page->getPageOverlay($row); } } break; case 'updated': if ($value == '') { $value = $GLOBALS['TSFE']->page['uid']; } $items = GeneralUtility::intExplode(',', $value); if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) { $depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 1, 20); } else { $depth = 20; } // Max number of items $limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100); $maxAge = (int) $this->parent_cObj->calc($this->conf['special.']['maxAge']); if (!$limit) { $limit = 10; } // *'auto', 'manual', 'tstamp' $mode = $this->conf['special.']['mode']; // Get id's $id_list_arr = array(); foreach ($items as $id) { $bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100); $id_list_arr[] = $this->parent_cObj->getTreeList(-1 * $id, $depth - 1 + $bA, $bA - 1); } $id_list = implode(',', $id_list_arr); // Get sortField (mode) switch ($mode) { case 'starttime': $sortField = 'starttime'; break; case 'lastUpdated': case 'manual': $sortField = 'lastUpdated'; break; case 'tstamp': $sortField = 'tstamp'; break; case 'crdate': $sortField = 'crdate'; break; default: $sortField = 'SYS_LASTCHANGED'; } // Get $extraWhere = ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere(); if ($this->conf['special.']['excludeNoSearchPages']) { $extraWhere .= ' AND pages.no_search=0'; } if ($maxAge > 0) { $extraWhere .= ' AND ' . $sortField . '>' . ($GLOBALS['SIM_ACCESS_TIME'] - $maxAge); } $res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => $sortField . '>=0' . $extraWhere, 'orderBy' => $altSortFieldValue ? $altSortFieldValue : $sortField . ' desc', 'max' => $limit)); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $GLOBALS['TSFE']->sys_page->versionOL('pages', $row, TRUE); if (is_array($row)) { $temp[$row['uid']] = $this->sys_page->getPageOverlay($row); } } break; case 'keywords': list($value) = GeneralUtility::intExplode(',', $value); if (!$value) { $value = $GLOBALS['TSFE']->page['uid']; } if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) { $kw = isset($this->conf['special.']['setKeywords.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']) : $this->conf['special.']['setKeywords']; } else { // The page record of the 'value'. $value_rec = $this->sys_page->getPage($value); $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords'; // keywords. $kw = trim($this->parent_cObj->keywords($value_rec[$kfieldSrc])); } // *'auto', 'manual', 'tstamp' $mode = $this->conf['special.']['mode']; switch ($mode) { case 'starttime': $sortField = 'starttime'; break; case 'lastUpdated': case 'manual': $sortField = 'lastUpdated'; break; case 'tstamp': $sortField = 'tstamp'; break; case 'crdate': $sortField = 'crdate'; break; default: $sortField = 'SYS_LASTCHANGED'; } // Depth, limit, extra where if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) { $depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 0, 20); } else { $depth = 20; } // Max number of items $limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100); $extraWhere = ' AND pages.uid<>' . $value . ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere(); if ($this->conf['special.']['excludeNoSearchPages']) { $extraWhere .= ' AND pages.no_search=0'; } // Start point $eLevel = $this->parent_cObj->getKey(isset($this->conf['special.']['entryLevel.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['entryLevel'], $this->conf['special.']['entryLevel.']) : $this->conf['special.']['entryLevel'], $this->tmpl->rootLine); $startUid = (int) $this->tmpl->rootLine[$eLevel]['uid']; // Which field is for keywords $kfield = 'keywords'; if ($this->conf['special.']['keywordsField']) { list($kfield) = explode(' ', trim($this->conf['special.']['keywordsField'])); } // If there are keywords and the startuid is present. if ($kw && $startUid) { $bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100); $id_list = $this->parent_cObj->getTreeList(-1 * $startUid, $depth - 1 + $bA, $bA - 1); $kwArr = explode(',', $kw); foreach ($kwArr as $word) { $word = trim($word); if ($word) { $keyWordsWhereArr[] = $kfield . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($word, 'pages') . '%\''; } } $res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => '(' . implode(' OR ', $keyWordsWhereArr) . ')' . $extraWhere, 'orderBy' => $altSortFieldValue ? $altSortFieldValue : $sortField . ' desc', 'max' => $limit)); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $GLOBALS['TSFE']->sys_page->versionOL('pages', $row, TRUE); if (is_array($row)) { $temp[$row['uid']] = $this->sys_page->getPageOverlay($row); } } } break; case 'categories': /** @var \TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility $categoryMenuUtility */ $categoryMenuUtility = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\Menu\\CategoryMenuUtility'); $temp = $categoryMenuUtility->collectPages($value, $this->conf['special.'], $this); break; case 'rootline': $range = isset($this->conf['special.']['range.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['range'], $this->conf['special.']['range.']) : $this->conf['special.']['range']; $begin_end = explode('|', $range); $begin_end[0] = (int) $begin_end[0]; if (!MathUtility::canBeInterpretedAsInteger($begin_end[1])) { $begin_end[1] = -1; } $beginKey = $this->parent_cObj->getKey($begin_end[0], $this->tmpl->rootLine); $endKey = $this->parent_cObj->getKey($begin_end[1], $this->tmpl->rootLine); if ($endKey < $beginKey) { $endKey = $beginKey; } $rl_MParray = array(); foreach ($this->tmpl->rootLine as $k_rl => $v_rl) { // For overlaid mount points, set the variable right now: if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) { $rl_MParray[] = $v_rl['_MP_PARAM']; } // Traverse rootline: if ($k_rl >= $beginKey && $k_rl <= $endKey) { $temp_key = $k_rl; $temp[$temp_key] = $this->sys_page->getPage($v_rl['uid']); if (count($temp[$temp_key])) { // If there are no specific target for the page, put the level specific target on. if (!$temp[$temp_key]['target']) { $temp[$temp_key]['target'] = $this->conf['special.']['targets.'][$k_rl]; $temp[$temp_key]['_MP_PARAM'] = implode(',', $rl_MParray); } } else { unset($temp[$temp_key]); } } // For normal mount points, set the variable for next level. if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) { $rl_MParray[] = $v_rl['_MP_PARAM']; } } // Reverse order of elements (e.g. "1,2,3,4" gets "4,3,2,1"): if (isset($this->conf['special.']['reverseOrder']) && $this->conf['special.']['reverseOrder']) { $temp = array_reverse($temp); $rl_MParray = array_reverse($rl_MParray); } break; case 'browse': list($value) = GeneralUtility::intExplode(',', $value); if (!$value) { $value = $GLOBALS['TSFE']->page['uid']; } // Will not work out of rootline if ($value != $this->tmpl->rootLine[0]['uid']) { $recArr = array(); // The page record of the 'value'. $value_rec = $this->sys_page->getPage($value); // 'up' page cannot be outside rootline if ($value_rec['pid']) { // The page record of 'up'. $recArr['up'] = $this->sys_page->getPage($value_rec['pid']); } // If the 'up' item was NOT level 0 in rootline... if ($recArr['up']['pid'] && $value_rec['pid'] != $this->tmpl->rootLine[0]['uid']) { // The page record of "index". $recArr['index'] = $this->sys_page->getPage($recArr['up']['pid']); } // prev / next is found $prevnext_menu = $this->removeInaccessiblePages($this->sys_page->getMenu($value_rec['pid'], '*', $altSortField)); $lastKey = 0; $nextActive = 0; foreach ($prevnext_menu as $k_b => $v_b) { if ($nextActive) { $recArr['next'] = $v_b; $nextActive = 0; } if ($v_b['uid'] == $value) { if ($lastKey) { $recArr['prev'] = $prevnext_menu[$lastKey]; } $nextActive = 1; } $lastKey = $k_b; } reset($prevnext_menu); $recArr['first'] = pos($prevnext_menu); end($prevnext_menu); $recArr['last'] = pos($prevnext_menu); // prevsection / nextsection is found // You can only do this, if there is a valid page two levels up! if (is_array($recArr['index'])) { $prevnextsection_menu = $this->removeInaccessiblePages($this->sys_page->getMenu($recArr['index']['uid'], '*', $altSortField)); $lastKey = 0; $nextActive = 0; foreach ($prevnextsection_menu as $k_b => $v_b) { if ($nextActive) { $sectionRec_temp = $this->removeInaccessiblePages($this->sys_page->getMenu($v_b['uid'], '*', $altSortField)); if (count($sectionRec_temp)) { reset($sectionRec_temp); $recArr['nextsection'] = pos($sectionRec_temp); end($sectionRec_temp); $recArr['nextsection_last'] = pos($sectionRec_temp); $nextActive = 0; } } if ($v_b['uid'] == $value_rec['pid']) { if ($lastKey) { $sectionRec_temp = $this->removeInaccessiblePages($this->sys_page->getMenu($prevnextsection_menu[$lastKey]['uid'], '*', $altSortField)); if (count($sectionRec_temp)) { reset($sectionRec_temp); $recArr['prevsection'] = pos($sectionRec_temp); end($sectionRec_temp); $recArr['prevsection_last'] = pos($sectionRec_temp); } } $nextActive = 1; } $lastKey = $k_b; } } if ($this->conf['special.']['items.']['prevnextToSection']) { if (!is_array($recArr['prev']) && is_array($recArr['prevsection_last'])) { $recArr['prev'] = $recArr['prevsection_last']; } if (!is_array($recArr['next']) && is_array($recArr['nextsection'])) { $recArr['next'] = $recArr['nextsection']; } } $items = explode('|', $this->conf['special.']['items']); $c = 0; foreach ($items as $k_b => $v_b) { $v_b = strtolower(trim($v_b)); if ((int) $this->conf['special.'][$v_b . '.']['uid']) { $recArr[$v_b] = $this->sys_page->getPage((int) $this->conf['special.'][$v_b . '.']['uid']); } if (is_array($recArr[$v_b])) { $temp[$c] = $recArr[$v_b]; if ($this->conf['special.'][$v_b . '.']['target']) { $temp[$c]['target'] = $this->conf['special.'][$v_b . '.']['target']; } $tmpSpecialFields = $this->conf['special.'][$v_b . '.']['fields.']; if (is_array($tmpSpecialFields)) { foreach ($tmpSpecialFields as $fk => $val) { $temp[$c][$fk] = $val; } } $c++; } } } break; } if ($this->mconf['sectionIndex']) { $sectionIndexes = array(); foreach ($temp as $page) { $sectionIndexes = $sectionIndexes + $this->sectionIndex($altSortField, $page['uid']); } $temp = $sectionIndexes; } } elseif (is_array($this->alternativeMenuTempArray)) { // Setting $temp array if not level 1. $temp = $this->alternativeMenuTempArray; } elseif ($this->mconf['sectionIndex']) { $temp = $this->sectionIndex($altSortField); } else { // Default: // gets the menu $temp = $this->sys_page->getMenu($this->id, '*', $altSortField); } $c = 0; $c_b = 0; $minItems = (int) ($this->mconf['minItems'] ?: $this->conf['minItems']); $maxItems = (int) ($this->mconf['maxItems'] ?: $this->conf['maxItems']); $begin = $this->parent_cObj->calc($this->mconf['begin'] ? $this->mconf['begin'] : $this->conf['begin']); $minItemsConf = isset($this->mconf['minItems.']) ? $this->mconf['minItems.'] : (isset($this->conf['minItems.']) ? $this->conf['minItems.'] : NULL); $minItems = is_array($minItemsConf) ? $this->parent_cObj->stdWrap($minItems, $minItemsConf) : $minItems; $maxItemsConf = isset($this->mconf['maxItems.']) ? $this->mconf['maxItems.'] : (isset($this->conf['maxItems.']) ? $this->conf['maxItems.'] : NULL); $maxItems = is_array($maxItemsConf) ? $this->parent_cObj->stdWrap($maxItems, $maxItemsConf) : $maxItems; $beginConf = isset($this->mconf['begin.']) ? $this->mconf['begin.'] : (isset($this->conf['begin.']) ? $this->conf['begin.'] : NULL); $begin = is_array($beginConf) ? $this->parent_cObj->stdWrap($begin, $beginConf) : $begin; $banUidArray = $this->getBannedUids(); // Fill in the menuArr with elements that should go into the menu: $this->menuArr = array(); foreach ($temp as $data) { $spacer = GeneralUtility::inList($this->spacerIDList, $data['doktype']) || $data['ITEM_STATE'] === 'SPC' ? 1 : 0; // if item is a spacer, $spacer is set if ($this->filterMenuPages($data, $banUidArray, $spacer)) { $c_b++; // If the beginning item has been reached. if ($begin <= $c_b) { $this->menuArr[$c] = $data; $this->menuArr[$c]['isSpacer'] = $spacer; $c++; if ($maxItems && $c >= $maxItems) { break; } } } } // Fill in fake items, if min-items is set. if ($minItems) { while ($c < $minItems) { $this->menuArr[$c] = array('title' => '...', 'uid' => $GLOBALS['TSFE']->id); $c++; } } // Passing the menuArr through a user defined function: if ($this->mconf['itemArrayProcFunc']) { if (!is_array($this->parentMenuArr)) { $this->parentMenuArr = array(); } $this->menuArr = $this->userProcess('itemArrayProcFunc', $this->menuArr); } // Setting number of menu items $GLOBALS['TSFE']->register['count_menuItems'] = count($this->menuArr); $this->hash = md5(serialize($this->menuArr) . serialize($this->mconf) . serialize($this->tmpl->rootLine) . serialize($this->MP_array)); // Get the cache timeout: if ($this->conf['cache_period']) { $cacheTimeout = $this->conf['cache_period']; } else { $cacheTimeout = $GLOBALS['TSFE']->get_cache_timeout(); } $cache = $this->getCache(); $cachedData = $cache->get($this->hash); if (!is_array($cachedData)) { $this->generate(); $cache->set($this->hash, $this->result, array('ident_MENUDATA'), (int) $cacheTimeout); } else { $this->result = $cachedData; } // End showAccessRestrictedPages if ($this->mconf['showAccessRestrictedPages']) { // RESTORING where_groupAccess $this->sys_page->where_groupAccess = $SAVED_where_groupAccess; } } }
function to_code($ast, $t = '-') { if (D) { puts($t . 'AST:', $ast); } if (is_array($ast) && count($ast) == 1 && !$this->get_method(pos($ast))) { $ast = pos($ast); } //IS IT AN ATOM? if (!is_array($ast)) { //is it a float or negative number? $f = str_replace(array('__DOT', '__DSH'), array('.', '-'), $ast); if (is_numeric($f)) { return $f; } return $this->get_var($ast) && !is_numeric($ast) ? '$' . $ast : $ast; } //IS IT A SINGLE LIST? if (!is_array(pos($ast))) { $ast = array($ast); } //CREATE PARSED AST $code = array(); $special_forms = array('__quote', 'lambda', 'define', 'cond', 'if', 'and', 'or', 'not', 'iapply'); foreach ($ast as $node) { if (D) { puts(N, $t . 'CHECK:', $node, N); } $method = array_shift($node); if (in_array($method, $special_forms)) { $args = $node; $method = '__' . $method; } else { $args = array(); foreach ((array) $node as $arg) { $args[] = $this->to_code($arg); } if (D) { puts('BLIND', $args); } } $code[] = $this->{$method}(empty($args) ? NULL : $args); } return count($code) == 1 ? array_shift($code) : $code; }
protected function tagDoubleColon(&$token) { if ($this->inStatic || T_STRING !== $this->prevType || T_CLASS === $this->scope->type || T_INTERFACE === $this->scope->type || T_TRAIT === $this->scope->type) { return; } $t =& $this->types; end($t); $c = strtolower(strtr(substr($this->nsResolved, 1), '\\', '_')); if (isset($this->inlineClass[$c])) { return; } for (;;) { switch (prev($t)) { default: break 2; case '(': case ',': return; // To not break pass by ref, isset, unset and list // To not break pass by ref, isset, unset and list case T_DEC: case T_INC: case T_STRING: case T_NS_SEPARATOR: continue 2; } } $this->scope->markerState || ($this->scope->markerState = -1); $c = $this->getMarker($c); $r = '&' === pos($t); next($t); new CloseMarker($this, $this->texts[key($t)], 0, $r ? "patchwork_autoload_marker({$c}," : "(({$c})?", $r ? ')' : ':0)'); }
function get_triggertype_selectlist($name, $sel = NULL, $empty = FALSE) { $types = array('insert', 'update', 'delete'); $html = ''; if (SERVER_FAMILY == 'FB' && SERVER_VERSION >= 15) { if (!is_array($sel)) { $sel = array($sel); } $html = '<select name="' . $name . "[]\" size=\"3\" multiple>\n"; foreach ($types as $type) { $html .= '<option value="' . $type . '"'; if (in_array($type, $sel)) { $html .= ' selected'; } $html .= '>' . $type . "</option>\n"; } $html .= "</select>\n"; } else { $html = get_selectlist($name . '[]', $types, pos($sel), $empty); } return $html; }
function printQueryResult($result) { echo "<table>"; while ($row = $result->fetch_assoc()) { if (isset($_GET["produse"])) { next($row); echo "<tr><td><input type='checkbox' name=drecord[] value='" . pos($row) . "'>"; reset($row); } else { echo "<tr><td><input type='checkbox' name=drecord[] value='" . pos($row) . "'>"; } foreach ($row as $column) { echo "<td>" . $column . "</td>"; } echo "</td></tr>"; } echo "</table>"; return; }