About 2 results: "php preg_match_all repo:Edke/Nette-addDynamic"
Page 1 of 1
Filter Results
Sources
Languages
Filter Results
Try Search On
index.php in Nette-addDynamic https://github.com/Edke/Nette-addDynamic.git | 1436 lines | PHP
  1. column_foreign_keys($h){global$o;$c=array();foreach($o->foreignKeys($h)as$A){foreach($A["source"]as$b){$c[$b][]=$A;}}return$c;}function
  2. enum_input($z,$Ra,$e,$q,$hc=null){global$o;preg_match_all("~'((?:[^']|'')*)'~",$e["length"],$oa);$c=(isset($hc)?"<label><input type='$z'$Ra value='$hc'".((is_array($q)?in_array($hc,$q):$q===0)?" checked":"")."><i>".lang(4)."</i></label>":"");foreach($oa[1]as$l=>$b){$b=stripcslashes(str_replace("''","'",$b));$ab=(is_int($q)?$q==$l+1:(is_array($q)?in_array($l+1,$q):$q===$b));$c.=" <label><input type='$z'$Ra value='".($l+1)."'".($ab?' checked':'').'>'.h($o->editVal($b,$e)).'</label>';}return$c;}function
  3. nbsp($da[""])."<td>".$o->editInput($_GET["edit"],$e,$Ra,$q);}else{$Ba=0;foreach($da
  4. as$d=>$b){if($d===""||!$b){break;}$Ba++;}$Qb=($Ba?" onchange=\"var f = this.form['function[".js_escape($f)."]']; if ($Ba > f.selectedIndex) f.selectedIndex = $Ba;\"":"");$Ra.=$Qb;echo(count($da)>1?html_select("function[$f]",$da,!isset($K)||in_array($K,$da)||isset($da[$K])?$K:"","functionChange(this);"):nbsp(reset($da))).'<td>';$Ae=$o->editInput($_GET["edit"],$e,$Ra,$q);if($Ae!=""){echo$Ae;}elseif($e["type"]=="set"){preg_match_all("~'((?:[^']|'')*)'~",$e["length"],$oa);foreach($oa[1]as$l=>$b){$b=stripcslashes(str_replace("''","'",$b));$ab=(is_int($q)?($q>>$l)&1:in_array($b,explode(",",$q),true));echo" <label><input type='checkbox' name='fields[$f][$l]' value='".(1<<$l)."'".($ab?' checked':'')."$Qb>".h($o->editVal($b,$e)).'</label>';}}elseif(ereg('blob|bytea|raw|file',$e["type"])&&ini_bool("file_uploads")){echo"<input type='file' name='fields-$f'$Qb>";}elseif(ereg('text|lob',$e["type"])){echo"<textarea ".($v!="sqlite"||ereg("\n",$q)?"cols='50' rows='12'":"cols='30' rows='1' style='height: 1.2em;'")."$Ra>".h($q).'</textarea>';}else{$nd=(!ereg('int',$e["type"])&&preg_match('~^(\\d+)(,(\\d+))?$~',$e["length"],$k)?((ereg("binary",$e["type"])?2:1)*$k[1]+($k[3]?1:0)+($k[2]&&!$e["unsigned"]?1:0)):($R[$e["type"]]?$R[$e["type"]]+($e["unsigned"]?0:1):0));echo"<input value='".h($q)."'".($nd?" maxlength='$nd'":"").(ereg('char|binary',$e["type"])&&$nd>20?" size='40'":"")."$Ra>";}}}function
  5. switch_lang(){global$ua,$Lb;echo"<form action=''>\n<div id='lang'>";hidden_fields($_GET,array('lang'));echo
  6. lang(7).": ".html_select("lang",$Lb,$ua,"var loc = location.search.replace(/[?&]lang=[^&]*/, ''); location.search = loc + (loc ? '&' : '') + 'lang=' + this.value;")," <input type='submit' value='".lang(8)."' class='hidden'>\n","</div>\n</form>\n";}if(isset($_GET["lang"])){$_COOKIE["adminer_lang"]=$_GET["lang"];$_SESSION["lang"]=$_GET["lang"];}$ua="en";if(isset($Lb[$_COOKIE["adminer_lang"]])){cookie("adminer_lang",$_COOKIE["adminer_lang"]);$ua=$_COOKIE["adminer_lang"];}elseif(isset($Lb[$_SESSION["lang"]])){$ua=$_SESSION["lang"];}else{$cd=array();preg_match_all('~([-a-z]+)(;q=([0-9.]+))?~',str_replace("_","-",strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"])),$oa,PREG_SET_ORDER);foreach($oa
  7. array("Timing"=>array("BEFORE","AFTER"),"Type"=>array("FOR EACH ROW"),);}function
  8. routine($f,$z){global$g,$Gb,$jc,$R;$kf=array("bool","boolean","integer","double precision","real","dec","numeric","fixed","national char","national varchar");$Ce="((".implode("|",array_merge(array_keys($R),$kf)).")(?:\\s*\\(((?:[^'\")]*|$Gb)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";$ba="\\s*(".($z=="FUNCTION"?"":implode("|",$jc)).")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$Ce";$la=$g->result("SHOW CREATE $z ".idf_escape($f),2);preg_match("~\\(((?:$ba\\s*,?)*)\\)".($z=="FUNCTION"?"\\s*RETURNS\\s+$Ce":"")."\\s*(.*)~is",$la,$k);$p=array();preg_match_all("~$ba\\s*,?~is",$k[1],$oa,PREG_SET_ORDER);foreach($oa
  9. <td><input name="',$d,'[length]" value="',h($e["length"]),'" size="3" onfocus="editingLengthFocus(this);"><td class="options">',"<select name='$d"."[collation]'".(ereg('(char|text|enum|set)$',$e["type"])?"":" class='hidden'").'><option value="">('.lang(85).')'.optionlist($Z,$e["collation"]).'</select>',($ob?"<select name='$d"."[unsigned]'".(!$e["type"]||ereg('(int|float|double|decimal)$',$e["type"])?"":" class='hidden'").'><option>'.optionlist($ob,$e["unsigned"]).'</select>':''),($ha?"<select name='$d"."[on_delete]'".(ereg("`",$e["type"])?"":" class='hidden'")."><option value=''>(".lang(86).")".optionlist($fb,$e["on_delete"])."</select> ":" ");}function
  10. process_length($W){global$Gb;return(preg_match("~^\\s*(?:$Gb)(?:\\s*,\\s*(?:$Gb))*\\s*\$~",$W)&&preg_match_all("~$Gb~",$W,$oa)?implode(",",$oa[0]):preg_replace('~[^0-9,+-]~','',$W));}function
  11. as$f=>$A){$w=($A["db"]!=""?"<b>".h($A["db"])."</b>.":"").h($A["table"]);echo"<tr>","<th><i>".implode("</i>, <i>",array_map('h',$A["source"]))."</i>","<td><a href='".h($A["db"]!=""?preg_replace('~db=[^&]*~',"db=".urlencode($A["db"]),ME):ME)."table=".urlencode($A["table"])."'>$w</a>","(<i>".implode("</i>, <i>",array_map('h',$A["target"]))."</i>)","<td>$A[on_delete]\n","<td>$A[on_update]\n";if($v!="sqlite"){echo'<td><a href="'.h(ME.'foreign='.urlencode($m).'&name='.urlencode($f)).'">'.lang(107).'</a>';}}echo"</table>\n";}if($v!="sqlite"){echo'<p><a href="'.h(ME).'foreign='.urlencode($m).'">'.lang(108)."</a>\n";}}if(support("trigger")){echo"<h3>".lang(109)."</h3>\n";$Mc=triggers($m);if($Mc){echo"<table cellspacing='0'>\n";foreach($Mc
  12. as$d=>$b){echo"<tr valign='top'><td>$b[0]<td>$b[1]<th>".h($d)."<td><a href='".h(ME.'trigger='.urlencode($m).'&name='.urlencode($d))."'>".lang(107)."</a>\n";}echo"</table>\n";}echo'<p><a href="'.h(ME).'trigger='.urlencode($m).'">'.lang(110)."</a>\n";}}}}elseif(isset($_GET["schema"])){page_header(lang(111),"",array(),DB);$sb=array();$ve=array();$f="adminer_schema";$hf=($_GET["schema"]?$_GET["schema"]:$_COOKIE[($_COOKIE["$f-".DB]?"$f-".DB:$f)]);preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$hf,$oa,PREG_SET_ORDER);foreach($oa
  13. </form>
  14. ';}elseif(isset($_GET["user"])){$Fd=$_GET["user"];$sa=array(""=>array("All privileges"=>""));foreach(get_rows("SHOW PRIVILEGES")as$a){foreach(explode(",",($a["Privilege"]=="Grant option"?"":$a["Context"]))as$Gc){$sa[$Gc][$a["Privilege"]]=$a["Comment"];}}$sa["Server Admin"]+=$sa["File access on server"];$sa["Databases"]["Create routine"]=$sa["Procedures"]["Create routine"];unset($sa["Procedures"]["Create routine"]);$sa["Columns"]=array();foreach(array("Select","Insert","Update","References")as$b){$sa["Columns"][$b]=$sa["Tables"][$b];}unset($sa["Server Admin"]["Usage"]);foreach($sa["Tables"]as$d=>$b){unset($sa["Databases"][$d]);}$nc=array();if($_POST){foreach($_POST["objects"]as$d=>$b){$nc[$b]=(array)$nc[$b]+(array)$_POST["grants"][$d];}}$nb=array();$Xc="";if(isset($_GET["host"])&&($i=$g->query("SHOW GRANTS FOR ".q($Fd)."@".q($_GET["host"])))){while($a=$i->fetch_row()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$a[0],$k)&&preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$k[1],$oa,PREG_SET_ORDER)){foreach($oa
  15. as$f=>$b){$b=process_input($p[$f]);if($b!==null){if($_POST["clone"]){$r[idf_escape($f)]=($b!==false?$b:idf_escape($f));}elseif($b!==false){$r[]=idf_escape($f)." = $b";}}}$j.=($_POST["clone"]?" (".implode(", ",array_keys($r)).")\nSELECT ".implode(", ",$r)."\nFROM ".table($m):" SET\n".implode(",\n",$r));}if($_POST["delete"]||$r){$id="UPDATE";if($_POST["delete"]){$id="DELETE";$j="FROM $j";}if($_POST["clone"]){$id="INSERT";$j="INTO $j";}if($_POST["all"]||($ad===array()&&$_POST["check"])||count($pa)<count($Q)){$i=queries($id." $j".($_POST["all"]?($s?"\nWHERE ".implode(" AND ",$s):""):"\nWHERE $ne"));$wb=$g->affected_rows;}else{foreach((array)$_POST["check"]as$b){$i=queries($id.limit1($j,"\nWHERE ".where_check($b)));if(!$i){break;}$wb+=$g->affected_rows;}}}queries_redirect(remove_from_uri("page"),lang(225,$wb),$i);}elseif(!$_POST["import"]){if(!$_POST["val"]){$n=lang(226);}else{$i=true;$wb=0;foreach($_POST["val"]as$gb=>$a){$r=array();foreach($a
  16. as$d=>$b){$d=bracket_escape($d,1);$r[]=idf_escape($d)." = ".(ereg('char|text',$p[$d]["type"])||$b!=""?$o->processInput($p[$d],$b):"NULL");}$j=table($m)." SET ".implode(", ",$r);$bc=" WHERE ".where_check($gb).($s?" AND ".implode(" AND ",$s):"");$i=queries("UPDATE".(count($pa)<count($Q)?" $j$bc":limit1($j,$bc)));if(!$i){break;}$wb+=$g->affected_rows;}queries_redirect(remove_from_uri(),lang(225,$wb),$i);}}elseif(is_string($Ia=get_file("csv_file",true))){$i=true;$mb=array_keys($p);preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~',$Ia,$oa);$wb=count($oa[0]);begin();$Wa=($_POST["separator"]=="csv"?",":($_POST["separator"]=="tsv"?"\t":";"));foreach($oa[0]as$d=>$b){preg_match_all("~((\"[^\"]*\")+|[^$Wa]*)$Wa~",$b.$Wa,$Gd);if(!$d&&!array_diff($Gd[1],$mb)){$mb=$Gd[1];$wb--;}else{$r=array();foreach($Gd[1]as$l=>$Pc){$r[idf_escape($mb[$l])]=($Pc==""&&$p[$mb[$l]]["null"]?"NULL":q(str_replace('""','"',preg_replace('~^"|"$~','',$Pc))));}$i=insert_update($m,$r,$Qa);if(!$i){break;}}}if($i){queries("COMMIT");}queries_redirect(remove_from_uri("page"),lang(227,$wb),$i);queries("ROLLBACK");}else{$n=upload_error($Ia);}}}$Ea=$o->tableName($D);page_header(lang(33).": $Ea",$n);session_write_close();$r=null;if(isset($Td["insert"])){$r="";foreach((array)$_GET["where"]as$b){if(count($ha[$b["col"]])==1&&($b["op"]=="="||(!$b["op"]&&!ereg('[_%]',$b["val"])))){$r.="&set".urlencode("[".bracket_escape($b["col"])."]")."=".urlencode($b["val"]);}}}$o->selectLinks($D,$r);if(!$B){echo"<p class='error'>".lang(228).($p?".":": ".error())."\n";}else{echo"<form action='' id='form'>\n","<div style='display: none;'>";hidden_fields_get();echo(DB!=""?'<input type="hidden" name="db" value="'.h(DB).'">'.(isset($_GET["ns"])?'<input type="hidden" name="ns" value="'.h($_GET["ns"]).'">':""):"");echo'<input type="hidden" name="select" value="'.h($m).'">',"</div>\n";$o->selectColumnsPrint($Q,$B);$o->selectSearchPrint($s,$B,$J);$o->selectOrderPrint($Xa,$B,$J);$o->selectLimitPrint($O);$o->selectLengthPrint($Db);$o->selectActionPrint($Db);echo"</form>\n";$ca=$_GET["page"];if($ca=="last"){$Ya=$g->result("SELECT COUNT(*) FROM ".table($m).($s?" WHERE ".implode(" AND ",$s):""));$ca=floor(max(0,$Ya-1)/$O);}$j="SELECT".limit((+$O&&$pa&&count($pa)<count($Q)&&$v=="sql"?"SQL_CALC_FOUND_ROWS ":"").$Yb,($s?"\nWHERE ".implode(" AND ",$s):"").$Ld,($O!=""?+$O:null),($ca?$O*$ca:0),"\n");echo$o->selectQuery($j);$i=$g->query($j);if(!$i){echo"<p class='error'>".error()."\n";}else{if($v=="mssql"){$i->seek($O*$ca);}$Hc=array();echo"<form action='' method='post' enctype='multipart/form-data'>\n";$H=array();while($a=$i->fetch_assoc()){$H[]=$a;}if($_GET["page"]!="last"){$Ya=(+$O&&$pa&&count($pa)<count($Q)?($v=="sql"?$g->result(" SELECT FOUND_ROWS()"):$g->result("SELECT COUNT(*) FROM ($j) x")):count($H));}if(!$H){echo"<p class='message'>".lang(82)."\n";}else{$Bd=$o->backwardKeys($m,$Ea);echo"<table cellspacing='0' class='nowrap' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n","<thead><tr>".(!$pa&&$Q?"":"<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='".h($_GET["modify"]?remove_from_uri("modify"):$_SERVER["REQUEST_URI"]."&modify=1")."'>".lang(119)."</a>");$Cd=array();$da=array();reset($Q);$ke=1;foreach($H[0]as$d=>$b){if($D["Oid"]!="t"||$d!="oid"){$b=$_GET["columns"][key($Q)];$e=$p[$Q?$b["col"]:$d];$f=($e?$o->fieldName($e,$ke):"*");if($f!=""){$ke++;$Cd[$d]=$f;$C=idf_escape($d);echo'<th><a href="'.h(remove_from_uri('(order|desc)[^=]*|page').'&order%5B0%5D='.urlencode($d).($Xa[0]==$C||$Xa[0]==$d||(!$Xa&&$pa[0]==$C)?'&desc%5B0%5D=1':'')).'">'.apply_sql_function($b["fun"],$f)."</a>";}$da[$d]=$b["fun"];next($Q);}}$ec=array();if($_GET["modify"]){foreach($H


Back to Top