1, 'mysql_to_mysqli'=>1, ]; //100% prolaz ili 100 block za sve navedene patchave if(isset($patching100[$x]) && $patching100[$x]) return true; else return false; } // if(!isset($_GET['test'])) return false; if(isset($DoneLog[$x]) && $DoneLog[$x]) { $AlreadyDoneLog[$x] = true; return false; } else { $LastDoneLog = $x; $DoneLogUpdated = true; $DoneLog[$x] = true; $ChangeLog[$x] = true; $NewDones[$x] = true; return true; } } function undoDoneLog(){ global $DoneLog, $DoneLogUpdated, $ChangeLog, $LastDoneLog, $NewDones; $DoneLog[$LastDoneLog] = false; $ChangeLog[$LastDoneLog] = false; } // $ppcu_individual_data nam omogućava custom varijable po individualnom projektu koji će koristiti ppcu_external skriptu function ppcu($key){ global $ppcu_individual_data; if(!isset($ppcu_individual_data[$key])) return null; return $ppcu_individual_data[$key]; } $ppcu_allFiles = []; // ext => files_array function ppcu_getAllFiles($extension){ //funcija pamti unutar sebe koji su file-ovi, tako da će ih samo prvi puta dohvaćati sa brute force global $ppcu_allFiles; if(isset($ppcu_allFiles[$extension])) return $ppcu_allFiles[$extension]; $ppcu_allFiles[$extension] = []; ppcu_troughFolders("", function($fullPath, $entry, $entryType,$depth) use (&$ppcu_allFiles, $extension){ if($entryType=='dir') return; //folder je, ne radim ništa... $ext = ppcu_getExtension($fullPath); // echo("File: $fullPath ext: $ext
"); if(!isset($ppcu_allFiles[$ext])) $ppcu_allFiles[$ext] = []; $ppcu_allFiles[$ext][] = $fullPath; // echo('+
'); }); return $ppcu_allFiles[$extension]; } ///// Basic php as ppcu_ // insert all patched statements.... svaki statement/patch mora imati svoj uniq keyName kako bi se izvršavao samo jednom function ppcu_slashRight($string){ return rtrim($string,'/').'/'; } function ppcu_getExtension($file){ $parts = explode('.', $file); $last = $parts[count($parts)-1]; return strtolower($last); } function ppcu_troughFolders($path,$callback,$depth=1) //callback($fullPath, $fileName, $fileType, $depth) { $path=ppcu_slashRight($path); if($path=='/')$path='./'; if ($handle = opendir($path)) { while (false !== ($entry = readdir($handle))) { $entryFullPath=$path.$entry; $entryType=filetype($entryFullPath); // decho('entry: '.$entry); // decho('entrytype_full path: '.$entryFullPath); // decho('entrytype: '.$entryType); if($entry==='.' || $entry==='..'){}//pass else { $r=$callback($entryFullPath,$entry, $entryType,$depth); //fullPath, fileName , fileType, depth if($r===false) return; if($entryType=='dir') ppcu_troughFolders($entryFullPath, $callback, $depth+1); } } closedir($handle); } } function ppcu_take($array,$x,$send=null) { if(isset($array[$x])) return $array[$x]; else return $send; } function ppcu_wouldbe($array,$x) { if(!isset($array[$x]))return true; else return $array[$x]; } function ppcu_pop($list,$x=0) { if(gettype($list)==='string') { if(strlen($list)==0)return false; return $list[strlen($list)-1]; } if(count($list)===0)return null; $position=count($list)-1-$x; if($position<0)return null; return $list[$position]; } function ppcu_makeFolder($folderPath) { $send=true; $parts=explode('/',$folderPath); if(strpos(ppcu_pop($parts),'.')!==false) { array_pop($parts); $folderPath=implode('/',$parts); $send='file_poped'; } if(!file_exists ($folderPath)){if (!mkdir($folderPath, 0777, true)) {dies('Failed to create folders...');}} return $send; } function ppcu_filemanager_write($file_path,$text,$f=array()){ //$file_path = rp($file_path); if(ppcu_take($f,'makeFolder') && !file_exists($file_path)) { $parts=explode('/',$file_path); if(count($parts)>1) { array_pop($parts); ppcu_makeFolder(implode('/', $parts)); } } // if(!file_exists($file_path)){ // return; // echo "File dont exist: $file_path"; // return; // } $file=fopen($file_path, "w"); fwrite($file,$text); fclose($file); } function ppcu_preg_replace_callback_looped($regex, $callback, $string){ //looped - znači da će ponavljati regexp zamjenu na stringu dok god se napravi neka izmjena u prethodnom prolazu. // u rezultatu nađi index onog što se vraća // ako postoji, u novom stringu sve do regexa i regex ...odsjeci i ubaci u send[], pa nastavi sa novim stringom // ako ne postoji i nema promjene u stringu, ostatak stringa ubaci u send. ..napravi send.join() i to je rezultat $string_before = $string; $breakLoop = false; // $send = []; while(true){ // $rezultat_sadrzi_match = false; //ovo je protiv infinity loopa: $string=preg_replace_callback($regex, function($match) use ($callback, &$breakLoop) { $r = $callback($match); if($r=='@break@'){ $breakLoop = true; return $match[0]; } return $r; }, $string); //returning if seted breakLoop ili nema promjene unutar stringa if($breakLoop || $string==$string_before)return $string; $string_before = $string; } } ///// Custom php as ppcu_ function ppcu_update_cross_file($file){ $url = "https://www.croatiatourist.net/bozoou/api/updateCrossFile.php?pass=sdfklh897sdfuh5677hjHTRFZjg765jt&file=".urlencode($file); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_URL, $link); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, $f['returntransfer']); // curl_setopt($ch, CURLOPT_TIMEOUT, $f['timeout']); $fileContent = curl_exec($ch); curl_close($ch); //echo($fileContent); //echo(" after data"); $fileDestinationPath = "bozoou/CROSS_PROJECT_SCRIPT/".$file; ppcu_filemanager_write($fileDestinationPath, $fileContent, ['makeFolder'=>true]); } function ppcu_update_js_file($source,$destination=false){ // http://www.ferienwohnungenmurter.com/bookingcalendar/ac-admin/js/mootools-cal-admin.js /* 1. ako nije zadana destinacija, ona je ista kao i na source fileu, samo mijenjam domenu. */ //ako destinacija nije zadana, onda je ona ista kao na izvornom fileu. Znači samo se miče domenea if(!$destination) $destination = preg_replace("/https?:\\/\\/[^\\/]+\\//", "", $source); // echo("soruce: $source dest: $destination"); $content = file_get_contents($source); if($content) { ppcu_filemanager_write($destination, $content, ['makeFolder'=>true]); // echo("destination file: $destination"); return true; } return false; } function ppcu_update_any_file($fromDomain, $source, $destination = false, $uvjeti = []){ if(!$destination || $destination===true) $destination = $source; $pass = 'ldfsj984lisjf987sdf'; $uriSource = urlencode($source); $ch = curl_init(); $link = $fromDomain."/exportFile.php?file=$uriSource&pass=$pass"; // echo($link); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); // curl_setopt($ch, CURLOPT_TIMEOUT, $f['timeout']); $r = curl_exec($ch); if($r){ $content = $r; //svi uvjeti moraju biti ispunjeni foreach ($uvjeti as $uvjet) { if(gettype($uvjet)==='string'){ $c2 = ppcu_replace_or_preg_replace($uvjet, "", $content); if($c2 == $content) return true; //prekidamo jer nije bilo zamjene i uvjet nije ispunjen. Svejedno prekidamo sa true, jer ovo znači da ne želimo ponovno raditi ovaj update...a na nama je hoćemo li ovo detektirati kao grešku ili ne. To je drugi par opanaka. } } ppcu_filemanager_write($destination, $r, ['makeFolder'=>true]); return true; } return false; } function ppcu_replace_or_preg_replace($find, $replace, $string, $f=array()){ //automatski razmišlja hoće li napraviti obični replace...ili pregreplace. /* replace_or_preg_replace("!test(\\d)", "TEST$1", "test1 nesto") -> return "TEST1 nesto" // zamjena će ići sa regexom. Placeholder se može zadati sa točkazarezom i kao: "TEST$1;" replace_or_preg_replace("a","o","ivaa") -> return ivoo; */ $triggerChar = ppcu_take($f,'triggerChar','!'); // - izrazi koji se započeti sa !, tretiraju se kao regex izrazi $regex = false; $send = ''; if($find[0]==$triggerChar){ $regex = true; $find = substr($find, 1); $send = preg_replace_callback("/".$find."/", function($m) use($replace){ //omogućava da je replace zapisan na način: "nesto$1 i nesto$2" -> $1 i $2 su placeholderi. $send = preg_replace_callback('/\\$(\\d+);?/', function($m_inner) use($m){ $digit = (int)$m_inner[1]; return $m[$digit]; }, $replace); return $send; }, $string); }else{ $send = str_replace($find, $replace, $string); } return $send; } function ppcu_justReplaceInScript($findWhat, $replaceWith, $file){ if(file_exists($file)){ $content = file_get_contents($file); $content = ppcu_replace_or_preg_replace($findWhat, $replaceWith, $content); ppcu_filemanager_write($file, $content); } } //interna metoda za rad ppcu_udpate_script_with_patch function ppcu_replaceContentByIndexes($content, $replacement, $start, $end){ return substr($content,0,$start).$replacement.substr($content, $end); } function ppcu_udpate_script_with_patch($f){ /* $file - koji file se ažurira $regex - regex koji dohvaća code nakon kojeg se umeće patch, ili code koji se mijenja sa patchom $insertCode - code koji se ubacuje $patchKeyName - jedinstveno ime za patch -- koji se ubacuje u code kao komentar i označava početak/kraj patcha $mode - insert|replace|insertBefore|insertAfter==insert - insert: ubacuje se patch nakon codea; replace - ubacuje se patch umjesto codea $updateConfirm - ako se neki patch updejta (Ako se koristi postojeći patchKeyName, onda se mora napraviti konfirmacija da će se taj patch updejtati. Tako da se slučajno ne prebriše neki drugi patch sa istim ključem) $multipleLimit - koliko zamjena se smije desiti u codeu, defaulno je jedna. A ako se zada -1, onda je beskonačno $expectedPlace - koliko je očekivano da može postojati mjesta u codeu koji odgovaraju search regexu. Defaultno je ovo isto kao i $multipleLimit, ali ako se neko mjesto pojavljuje više puta u codeu, a mi želimo zamjeniti samo tipa prve tri pojavke...onda moramo sa expectedPlace reći koliko puta se pojavljuje u codeu, a sa multipleLimit koliko ćemo ih mijenjati. $onlyIfHasPlace {false} - ako je true, impementira se samo ako postoji mjesto. Ako je false, baca grešku ako nema mjesto */ /* - pronađi koliko imaš tabova + provjeri dali code koji umećeš, da nije već tu! To ćeš provjeriti po catch keyu - ako ne pronađeš ništa, baci upozorenje da patch nije primjenjen */ $file = $f['file']; $regex = $f['regex']; $insertCode = $f['insertCode']; $patchKeyName = $f['patchKeyName']; $mode = $f['mode']; //insert | replace $avaiablesModes = ['replace','insert',"insertAfter","insertBefore"]; if(!in_array($mode, $avaiablesModes)) { throw new Exception("ppcu_udpate_script_with_patch error: Mode has to be some from values: ".implode(", ", $avaiablesModes), 1); die(); } $updateConfirm = isset($f['updateConfirm']) ? $f['updateConfirm'] : false; $multipleLimit = isset($f['multipleLimit']) ? $f['multipleLimit'] : 1; //koliko zamjena se smije desiti u codeu. Defaultno je jedna! -1 je za beskonačno $expectedPlace = isset($f['expectedPlace']) ? $f['expectedPlace'] : $multipleLimit; //koliko je očekivano mjesta u codeu gdje se regex uklapa. Defaultno je isto koliko se zadaje zamjena da treba napraviti $patchVariabileCommentNote = " (Don't remove patch tags!!! This is control point for code automatization)"; $patchFullKeyNameStart = "//Patch Start: #".$patchKeyName; $patchFullKeyNameEnd = "//Patch End: #".$patchKeyName; $newLinesBeforeAfterPatch = "\n"; $fullInsertCode = $newLinesBeforeAfterPatch."$patchFullKeyNameStart $patchVariabileCommentNote \n\n".$insertCode."\n\n $patchFullKeyNameEnd".$newLinesBeforeAfterPatch; if(!file_exists($file)) { if(ppcu_wouldbe($f, 'onlyIfFileExist')) return; die("Error: Patch #$patchKeyName cant be aplied because file dont exist. File:$file"); } $content = file_get_contents($file); $onReturn = function($content) use($file){ file_put_contents($file, $content); }; //ako ovaj patch već postoji, prvo će ga izbaciti da bi ga mogao prepisati: $indexFrom = 0; $patchAlreadyExisting = false; $n=0; while(true){ //mora kroz petlju, jer može biti postavljeno više patcheva. // echo("Index from: $indexFrom
"); $n++; if($n>100000) die("Infinity loop warning. #lsf9s8fsdf"); $i1 = strpos($content, $patchFullKeyNameStart, $indexFrom); if($i1 === false) $i1 = -1; $i2 = strpos($content, $patchFullKeyNameEnd, $indexFrom); if($i2 === false) $i2 = -1; // echo("i1:$i1 i2:$i2
"); if( $i1>-1 || $i2>-1 ){ $patchAlreadyExisting = true; if($i1>$i2) die("Error: Patch End tag: $patchFullKeyNameEnd appear before start patch tag. File:$file"); if(!$updateConfirm) die("Error: This patch (#$patchKeyName) already exist. To confirm updejting patch, please use f.updateConfirm = true within your function call. File:$file"); $start = $i1; $end = $i2; if($end==-1) die("Error: Patch End tag: $patchFullKeyNameEnd doesn't exist!!! File:$file"); if($start==-1) die("Error: Patch Start tag: $patchFullKeyNameStart doesn't exist!!! File:$file"); $end += strlen($patchFullKeyNameEnd); $content = ppcu_replaceContentByIndexes($content, $fullInsertCode, $start, $end); $indexFrom = $start + strlen($fullInsertCode); } else{ if($patchAlreadyExisting){ $onReturn($content); return; } else break; } } //testiranje dali više mjesta u codu podržava poziciju za ovaj patch: //i testiranje da li postoji lokacija uopće if($expectedPlace!=-1){ $places=0; $contentBefore = $content; ppcu_preg_replace_callback_looped($regex, function($m) use(&$places, $fullInsertCode, $mode){ $places++; if($places>10000) return " "; //safety from infinity loop. return " "; }, $content); if($expectedPlace < $places) { $err = "Error: Patch: #$patchKeyName has not implement. There is expected patch place: $expectedPlace, but code can be implemented at $places places! File: $file"; $err.="
If you expect this, please read about multipleLimit and about expectedPlace parametar in your ppcu_external script!"; die($err); } } //insert patch code // echo($regex);br(); $contentBefore = $content; $content = preg_replace_callback($regex, function($m) use($patchFullKeyNameStart, $patchFullKeyNameEnd, $fullInsertCode, $mode){ // print_r($m); // die('unutra'); $match = $m[0]; if($mode=='replace') return $fullInsertCode; else if($mode=='insert' || $mode=='insertAfter') return $match.$fullInsertCode; //$mode == 'insert' else if($mode=='insertBefore') return $fullInsertCode.$match; }, $content, $multipleLimit); //ako nije došlo do zamjene, error - provjera zamjene još jednom dry #dfas468fas94f if($contentBefore == $content && !ppcu_take($f, 'onlyIfHasPlace')){ die("Error (e2): Patch: $patchKeyName has not implement, there is no adekvat place for patch in script: $file"); } $onReturn($content); return; } function feri(){ return ppcu('client')=='ferien'; } function kuki(){ return ppcu('client')=='kukic'; } function bencic(){ return ppcu('client')=='bencic'; } ///// Patches if(ppcu('project')=='gec_minicms'){ if(shouldBeDoneByPPCU("enable-googlemap-https")){ $files = ['templates/apartman/index.php', 'templates/apartman/inner_page.php', 'templates/apartman/js/js']; foreach ($files as $path) { if(!file_exists($path))continue; $content = file_get_contents($path); $contentBefore = $content; $content = str_replace('http://maps.google.com', 'https://maps.google.com', $content); if($contentBefore!=$content){ // echo("updated file: $path
"); file_put_contents($path, $content); } } } if(shouldBeDoneByPPCU("enable-https")){ $files = ['osnovne_varijable.php']; foreach ($files as $path) { $content = file_get_contents($path); if(strpos($content, 'httpType'))break; $contentBefore = $content; $insertCode = '$is_https = !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off";'; $insertCode.= '$httpType = $is_https ? "https":"http";'; $insertCode.= '$externalurl = $httpType."://".$_SERVER["HTTP_HOST"]."/";'; $content = str_replace('$externalurl="http://".$_SERVER["HTTP_HOST"]."/";', $insertCode, $content); if($contentBefore!=$content){ // echo("updated file: $path
"); file_put_contents($path, $content); } } } if(shouldBeDoneByPPCU("repair_eur-v1")){ $files = ['pages/offer.php']; foreach ($files as $path) { $content = file_get_contents($path); $contentBefore = $content; // regex hvata izraze: //$cjenik["cijena1"].'? //$cjenik["cijena2"].'? //$cjenik["cijena3"].'? //$cjenik["cijena"].'? $content = preg_replace_callback('/(\\$cjenik\\["cijena\\d?"\\]\\..)\\? *(..div)/', function($m){ return $m[1].'€'.$m[2]; }, $content); if($contentBefore!=$content){ // echo("updated file: $path
"); file_put_contents($path, $content); } } } if(shouldBeDoneByPPCU('createFileExporter')){ //dodaj export scriptu: $exportSriptContent = ' '; // die("test"); ppcu_filemanager_write("exportFile.php",$exportSriptContent); // http://www.apartmentsbencicpremantura.com/exportFile.php?pass=ldfsj984lisjf987sdf&file=index.php } if(shouldBeDoneByPPCU("update_data_connect")){ $files = ppcu_getAllFiles("inc"); foreach ($files as $path) { // echo $path; echo("
"); $content = file_get_contents($path); // if($path=='./data_connect.inc')echo $content; // echo $content; $content = preg_replace_callback('/\\$conn\\s*=\\s*mysql_connect *\\(.*\\n*(\\s*)\\$dbselection *=mysql_select_db.*\\n*\\s*mysql_select_db.*;/', function($m) { $match = $m[0]; $tab = $m[1]; $replacement = "\$conn = mysqli_connect(\$dbhost, \$dbuser, \$dbpass, \$dbname) or die ('Greska pri spajanju na bazu!');\n".$tab."mysqli_select_db(\$conn, \$dbname);"; // echo "match:". $match; echo("
"); return $replacement; }, $content); file_put_contents($path, $content); } } if(shouldBeDoneByPPCU('connect php tags-v1')){ //miče space između php tagova ... da start_session nebi pucao $files = ppcu_getAllFiles("php"); foreach ($files as $path) { // echo $path; echo("
"); $content = file_get_contents($path); $content = preg_replace_callback('/\?>\s+<\?php/', function($m) { $replacement = "?>\n"); $content = file_get_contents($path); // if($path=='./data_connect.inc')echo $content; // echo $content; $content = preg_replace_callback('/(\\n|\\r)\\ssession_start\\(\\) *;*/', function($m) { $replacement = "\nif(!isset(\$_SESSION)) session_start();"; // echo "match:". $match; echo("
"); return $replacement; }, $content); file_put_contents($path, $content); } } if(shouldBeDoneByPPCU("update-mootools-cal-admin-v1")){ $r = ppcu_update_js_file('http://www.ferienwohnungenmurter.com/bookingcalendar/ac-admin/js/mootools-cal-admin.js'); // echo("r from update: $r"); if(!$r) undoDoneLog(); } if(shouldBeDoneByPPCU("update-cal.inc.php-v3")){ // echo("r from update: $r"); $r = ppcu_update_any_file("http://www.ferienwohnungenmurter.com", "bookingcalendar/ac-includes/cal.inc.php", true, []); if(!$r) undoDoneLog(); } if(feri() && shouldBeDoneByPPCU("test")){ //ovo mi je true samo za stranicu: http://www.ferienwohnungenmurter.com/ } if(shouldBeDoneByPPCU("mysql_to_mysqli-v3")){ $files = ppcu_getAllFiles("php"); $files = array_merge($files, ppcu_getAllFiles("inc")); foreach ($files as $path) { $content = file_get_contents($path); $contentBefore = $content; $content = preg_replace('/mysql_fetch_assoc *\\(/', 'mysqli_fetch_assoc(', $content); $content = preg_replace('/mysql_num_rows *\\(/', 'mysqli_num_rows(', $content); $content = preg_replace('/mysql_fetch_row *\\(/', 'mysqli_fetch_row(', $content); $content = preg_replace('/mysql_fetch_array *\\(/', 'mysqli_fetch_array(', $content); $content = preg_replace('/mysql_close *\\(/', 'mysqli_close(', $content); $content = preg_replace('/mysql_query *\\(/', 'mysqli_query($conn, ', $content); $content = preg_replace('/mysql_real_escape_string *\\(/', 'mysqli_real_escape_string($conn, ', $content); $content = preg_replace('/mysql_error *\\(/', 'mysqli_error($conn ', $content); if($contentBefore!=$content){ // echo("updated file: $path
"); file_put_contents($path, $content); } } } if(shouldBeDoneByPPCU("update_scripts_class_db")){ ppcu_update_cross_file('php/classes/database.php'); ppcu_update_cross_file('php/classes/db.php'); } if(shouldBeDoneByPPCU("easy_login v5")){ $insertCode = ' if($user=="bozoou" && $pass=="nn"){ $query="select * from korisnici where 1"; mysqli_query($conn, "SET character_set_results = \'cp1250\', character_set_client = \'cp1250\', character_set_connection = \'cp1250\', character_set_database = \'cp1250\', character_set_server = \'cp1250\'"); $result=mysqli_query($conn, $query); $r=mysqli_fetch_row($result); //$r = db::select_one("select * from korisnici where 1", $conn); //nije radilo..iako su skripte updejtane neke... if($r[0]>0){ $user = $r[5]; $pass = $r[6]; } $_SESSION["bozoou-login"]=1; } '; ppcu_udpate_script_with_patch([ 'file'=>'login/login.php', 'onlyIfFileExist'=>true, 'regex'=>'/if *.trim..pass.=="" *and *.err_no==0(.|\\n)*?}/', 'insertCode'=>$insertCode, 'patchKeyName'=>"#easy_login", 'mode'=>'insert', 'updateConfirm'=>1, 'multipleLimit'=>2, 'expectedPlace'=>-1, ]); } if(1 && shouldBeDoneByPPCU("easy_login-show pass v6")){ //almost sry:#lihu98poipoiuil $insertCode = ' if(isset($_SESSION["bozoou-login"]) && $_SESSION["bozoou-login"]){ $query="select * from korisnici where 1"; mysqli_query($conn, "SET character_set_results = \'cp1250\', character_set_client = \'cp1250\', character_set_connection = \'cp1250\', character_set_database = \'cp1250\', character_set_server = \'cp1250\'"); $result=mysqli_query($conn, $query); $r=mysqli_fetch_row($result); //$r = db::select_one("select * from korisnici where 1", $conn); //nije radilo..iako su skripte updejtane neke... if($r[0]>0){ $user = $r[5]; $pass = $r[6]; } $_SESSION["bozoou-login"]=0; die("Refresh page to remove data: User: $user Password: $pass"); } '; ppcu_udpate_script_with_patch([ 'file'=>'login/unos.php', 'onlyIfFileExist'=>true, 'regex'=>'/include *\\(....data_connect.inc.\\);/', //include ("../data_connect.inc"); 'insertCode'=>$insertCode, 'patchKeyName'=>"#expose_password_to_bozoou", 'mode'=>'insert', 'updateConfirm'=>1, 'multipleLimit'=>2, 'expectedPlace'=>-1, 'onlyIfHasPlace'=>true, ]); } if(1 && shouldBeDoneByPPCU("easy_login-show-alternative v1")){ //almost sry:#lihu98poipoiuil $insertCode = ' if(1){ $query="select * from korisnici where 1"; mysqli_query($conn, "SET character_set_results = \'cp1250\', character_set_client = \'cp1250\', character_set_connection = \'cp1250\', character_set_database = \'cp1250\', character_set_server = \'cp1250\'"); $result=mysqli_query($conn, $query); $r=mysqli_fetch_row($result); if($r[0]>0){ $user = $r[5]; $pass = $r[6]; } echo(""); } '; ppcu_udpate_script_with_patch([ 'file'=>'login/views/osnovni_podaci.php', 'onlyIfFileExist'=>true, 'regex'=>'/include *\\(....data_connect.inc.\\);/', //include ("../data_connect.inc"); 'insertCode'=>$insertCode, 'patchKeyName'=>"#expose_password_to_bozoou_alternative", 'mode'=>'insert', 'updateConfirm'=>1, 'multipleLimit'=>2, 'expectedPlace'=>-1, 'onlyIfHasPlace'=>true, ]); } //example how to replace some existing code... if(shouldBeDoneByPPCU("calendar-bug-upozorenje-popravak-gasim-v5")){ // $insertCode = 'die("
*** Radimo na otklanjanju greske na opciji uredivanja kalendara ***
");'; $insertCode = '//patch ugašen'; //gasim patch - KOD svake promjene patcha, moraš promijeniti i tag: shouldBeDoneByPPCU ppcu_udpate_script_with_patch([ 'file'=>'login/core/booking_kalendar.php', 'regex'=>'/session_start..\\s*;/', 'insertCode'=>$insertCode, 'patchKeyName'=>"#upozorenje-calendar", 'mode'=>'insert', 'updateConfirm'=>1, 'multipleLimit'=>1, 'expectedPlace'=>1, ]); } if(shouldBeDoneByPPCU("global-conn-u-function.inc-v2")){ $insertCode = 'global $lang,$conn;'; ppcu_udpate_script_with_patch([ 'file'=>'bookingcalendar/ac-includes/functions.inc.php', 'regex'=>'/global +\\$lang *;/', 'insertCode'=>$insertCode, 'patchKeyName'=>"#upozorenje-calendar", 'mode'=>'replace', 'updateConfirm'=>1, 'multipleLimit'=>1, 'expectedPlace'=>1, ]); $newCode = ''; ppcu_filemanager_write("bookingcalendar/ac-includes/db_connect.inc.php", $newCode); } if(shouldBeDoneByPPCU('update-active-header-link-v3')){ //čini se da sada svi linkovi imaju current klasu, ali nema svaki projekt definirano kako će taj current izgledati. ppcu_justReplaceInScript("!#nav li a:hover, *\\n", "#nav li a:hover, \n#nav li a.current,\n", "templates/t12/css/top-menu.css"); $insertCode = ' $getClassIfCurrentLink=function($href){ $url = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; if(strpos($url,$href)) return "current"; return ""; };'; ppcu_udpate_script_with_patch([ 'file'=>'pages/linkovi.php', 'regex'=>'/\\$linkovi\\s*=/', 'insertCode'=>$insertCode, 'patchKeyName'=>"#prepare_for_currentLink", 'mode'=>'insertBefore', 'updateConfirm'=>1, ]); ppcu_justReplaceInScript('!', '', "pages/linkovi.php"); } if(bencic() && shouldBeDoneByPPCU('updateClickableEmail-v1')){ // id="kontaktvalue">'.$kontakt_mail.' ppcu_justReplaceInScript('id="kontaktvalue">\'.$kontakt_mail.\'', 'id="kontaktvalue">\'.$kontakt_mail.\'', "pages/kontakt_podaci.php"); } if(shouldBeDoneByPPCU('activate-last-booking-calendar-v1')){ // ppcu_update_any_file("http://apartmentsban-omisalj.com", "pages/offer.php", true, []); $insertCode = '$booking=true;'; ppcu_udpate_script_with_patch([ 'file'=>'pages/offer.php', 'regex'=>'/\\$booking *= *\\$tbook\\[0\\] *;/', 'insertCode'=>$insertCode, 'patchKeyName'=>"#activate-last-booking-calendar", 'mode'=>'insertAfter', 'updateConfirm'=>1, ]); } if(shouldBeDoneByPPCU("hrk2eur v4")){ ppcu_justReplaceInScript("HRK only!", "EUR", "pages/kontakt_podaci.php"); } if(0 && bencic()){ ppcu_update_any_file("http://apartmani-siska.com.hr", "testFile.php", true, []); } //example how to replace some existing code... if(0 && ppcu('project')=='gec_minicms' && shouldBeDoneByPPCU("test_replace_patch v2")){ $insertCode = ' if (trim($pass)=="" and $err_no==0) { $status="GREŠSSSKA: Niste unijeli zaporku!"; //test1 $err_no=1; }'; ppcu_udpate_script_with_patch([ 'file'=>'login/login.php', 'regex'=>'/if *.trim..pass.=="" *and *.err_no==0(.|\\n)*?}/', //paziii...moraju biti jednostruki navodnici... 'insertCode'=>$insertCode, 'patchKeyName'=>"#test_replace", 'mode'=>'replace', 'updateConfirm'=>0, 'multipleLimit'=>2, 'expectedPlace'=>3, ]); } } if(0 && ppcu('wp')){ // die('wp'); foreach (["a","b","c"] as $key => $value) { echo "
3. start loop for $value: "; switch($value){//the quickest way to proceed //known to skip case 'a':{echo("-a-");continue 2;} case 'b':{echo("-b-");} case 'c':{echo("-c-");} default: echo("-default"); } echo "ovaj code se neće izvršiti ako je umjesto continue "; } echo "\n\n

...
\n"; /* function testswithc($key){ switch($key){//the quickest way to proceed //known to skip case 'a':echo("a"); case 'b':break; //known to translate case 'c': echo("c"); break; case 'd':echo("d"); case 'd':echo("d2"); case 'm':echo("m");continue; case 'e'://not sure how this is in use { echo "e"; } break; //other maybe, if it is a string, most likely it never comes here default: echo "default"; } } //echo " mkd biser -------"; //testswithc("d"); //die(); */ } /* if(shouldBeDoneByPPCU("methodname")){ echo "test2 "; } */ ////////////////// fixed at END - dont change this if($DoneLogUpdated ) { if(ppcu('client')=='ferien'){ // echo("PPCU has made some updates:
"); // print_r($ChangeLog); } $NewDones = array_merge($ChangeLog, $AlreadyDoneLog); $doneLogJS = json_encode($NewDones); file_put_contents($DoneLogPath, $doneLogJS); }