How to use closeFile method of file class

Best Atoum code snippet using file.closeFile

index.php

Source:index.php Github

copy

Full Screen

...213 continue;214 }215 $r_arr[]=$line;216 }217 closeFile ($rp);218 list($r_no,$oyasub,$n_,$v_,$c_,$u_,$img_,$_,$_,$thumb_,$pt_,$md5_,$to_,$pch_,$postedtime,$fp_time_,$h_,$uid_,$h_,$r_oya)=explode("\t",trim($r_arr[0]));219 //レスファイルの1行目のチェック。経過日数、ログの1行目が'oya'かどうか確認。220 $check_elapsed_days = check_elapsed_days($postedtime);221 $count_r_arr=count($r_arr);222 if($pictmp2){//お絵かきの時は新規投稿にする223 //お絵かきの時に日数を経過していたら新規投稿。224 //お絵かきの時に最大レス数を超過していたら新規投稿。225 if($resto && (!$check_elapsed_days || $count_r_arr>$max_res || $r_no!==$resto || $r_oya!=='oya')){226 $resto='';227 }228 }229 if($resto && ($r_no!==$resto || $r_oya!=='oya')){230 return error($en? 'The article does not exist.':'記事がありません。');231 }232 //お絵かき以外。233 if($resto && !$check_elapsed_days){//指定した日数より古いスレッドには投稿できない。234 return error($en? 'This thread is too old to post.':'このスレッドには投稿できません。');235 }236 if($resto && $count_r_arr>$max_res){//最大レス数超過。237 return error($en?'The maximum number of replies has been exceeded.':'最大レス数を超過しています。');238 }239 $sub='Re: '.$oyasub;240 }241 //ファイルアップロード242 $up_tempfile = isset($_FILES['imgfile']['tmp_name']) ? $_FILES['imgfile']['tmp_name'] : ''; // 一時ファイル名243 if(isset($_FILES['imgfile']['error']) && in_array($_FILES['imgfile']['error'],[1,2])){//容量オーバー244 return error($en? "Upload failed.The file size is too big.":"アップロードに失敗しました。ファイルサイズが大きすぎます。");245 } 246 if ($up_tempfile && $_FILES['imgfile']['error'] === UPLOAD_ERR_OK && ($use_upload || $adminpost)){247 if($resto && $up_tempfile && !$use_res_upload && !$adminpost){248 safe_unlink($up_tempfile);249 return error($en? 'You are not logged in in diary mode.':'日記にログインしていません。');250 }251 $img_type = isset($_FILES['imgfile']['type']) ? $_FILES['imgfile']['type'] : '';252 if (!in_array($img_type, ['image/gif', 'image/jpeg', 'image/png','image/webp'])) {253 safe_unlink($up_tempfile);254 return error($en? 'This file is an unsupported format.':'対応していないフォーマットです。');255 }256 $upfile=TEMP_DIR.$time.'.tmp';257 move_uploaded_file($up_tempfile,$upfile);258 $tool = 'upload'; 259 260 }261 //お絵かきアップロード262 if($pictmp2 && is_file($tempfile)){263 $upfile=TEMP_DIR.$time.'.tmp';264 copy($tempfile, $upfile);265 chmod($upfile,0606);266 }267 //POSTされた値をログファイルに格納する書式にフォーマット268 $formatted_post=create_formatted_text_from_post($name,$sub,$url,$com);269 $name = $formatted_post['name'];270 $sub = $formatted_post['sub'];271 $url = $formatted_post['url'];272 $com = $formatted_post['com'];273 if(!$name){274 if($name_input_required){275 safe_unlink($upfile);276 return error($en?'Please enter your name.':'名前がありません。');277 }else{278 $name='anonymous';279 }280 }281 if(!$upfile&&!$com){282 return error($en?'Please write something.':'何か書いて下さい。');283 }284 if(!$resto && !$allow_coments_only && !$upfile && !$adminpost){285 return error($en?'Please attach an image.':'画像を添付してください。');286 }287 $hash = $pwd ? password_hash($pwd,PASSWORD_BCRYPT,['cost' => 5]) : '';288 setcookie("namec",$name,time()+(60*60*24*30),"","",false,true);289 setcookie("urlc",$url,time()+(60*60*24*30),"","",false,true);290 setcookie("pwdc",$pwd,time()+(60*60*24*30),"","",false,true);291 //ユーザーid292 $userid = t(getId($userip));293 $verified = ($adminpost||($admin_pass && $pwd===$admin_pass)) ? 'adminpost' : ''; 294 //全体ログを開く295 $fp=fopen(LOG_DIR."alllog.log","r+");296 if(!$fp){297 safe_unlink($upfile);298 return error($en?'The operation failed.':'失敗しました。');299 }300 flock($fp, LOCK_EX);301 $alllog_arr=[];302 while ($_line = fgets($fp)) {303 if(!trim($_line)){304 continue;305 }306 $alllog_arr[]=$_line;307 }308 $img_md5='';309 //チェックするスレッド数。画像ありなら15、コメントのみなら5 310 $n= $upfile ? 15 : 5;311 $chk_log_arr=array_slice($alllog_arr,0,$n,false);312 $chk_com=[];313 $chk_images=[];314 $chk_resnos=[];315 foreach($chk_log_arr as $chk_log){316 list($chk_resno)=explode("\t",$chk_log);317 $chk_resnos[]=$chk_resno;318 }319 if($resto){//レスの時はレスファイルをチェックに追加320 $chk_resnos=array_merge($chk_resnos,[$resto]);321 } 322 foreach($chk_resnos as $chk_resno){323 if(is_file(LOG_DIR."{$chk_resno}.log")){324 $cp=fopen(LOG_DIR."{$chk_resno}.log","r");325 while($line=fgets($cp)){326 if(!trim($line)){327 continue;328 }329 $chk_ex_line=explode("\t",trim($line));330 list($no_,$sub_,$name_,$verified_,$com_,$url_,$imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5_,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_)=$chk_ex_line;331 $chk_time=(strlen($time_)>15) ? substr($time_,0,-6) : substr($time_,0,-3);332 if((int)time()-(int)$chk_time<1){//投稿時刻の重複回避が主目的333 safe_unlink($upfile);334 closeFile($fp);335 safe_unlink($upfile);336 return error($en? 'Please wait a little.':'少し待ってください。');337 }338 if($host === $host_){339 $chk_com[$time_]=$chk_ex_line;//コメント340 }341 if($upfile && $imgfile_){342 $chk_images[$time_]=$chk_ex_line;//画像343 }344 }345 fclose($cp);346 }347 }348 krsort($chk_com);349 $chk_com=array_slice($chk_com,0,20,false);350 foreach($chk_com as $line){351 list($_no_,$_sub_,$_name_,$_verified_,$_com_,$_url_,$_imgfile_,$_w_,$_h_,$_thumbnail_,$_painttime_,$_log_md5_,$_tool_,$_pchext_,$_time_,$_first_posted_time_,$_host_,$_userid_,$_hash_,$_oya_)=$line;352 if($com && ($com === $_com_)){353 closeFile($fp);354 safe_unlink($upfile);355 return error($en?'Post once by this comment.':'同じコメントがありました。');356 }357 // 画像アップロードと画像なしそれぞれの待機時間358 $_chk_time_=(strlen($_time_)>15) ? substr($_time_,0,-6) : substr($_time_,0,-3);359 if($upfile && ((int)time()-(int)$_chk_time_<30)||(!$upfile && ((int)time()-(int)$_chk_time_)<15)){360 closeFile($fp);361 safe_unlink($upfile);362 return error($en? 'Please wait a little.':'少し待ってください。');363 }364 }365 if($upfile && is_file($upfile)){366 if(!$pictmp2){//実体データの縮小367 $max_px=isset($max_px) ? $max_px : 1024;368 thumb(TEMP_DIR,$time.'.tmp',$time,$max_px,$max_px,['toolarge'=>1]);369 } 370 clearstatcache();371 $filesize=filesize($upfile);372 if($filesize > 800 * 1024){//指定サイズを超えていたら373 if ($im_jpg = png2jpg($upfile)) {//PNG→JPEG自動変換374 if(filesize($im_jpg)<$filesize){//JPEGのほうが小さい時だけ375 rename($im_jpg,$upfile);//JPEGで保存376 chmod($upfile,0606);377 } else{//PNGよりファイルサイズが大きくなる時は378 unlink($im_jpg);//作成したJPEG画像を削除379 }380 }381 }382 if(!$pictmp2){383 clearstatcache();384 if(filesize($upfile) > $max_kb*1024){385 closeFile($fp);386 safe_unlink($upfile);387 return error($en? "Upload failed. File size exceeds {$max_kb}kb.":"アップロードに失敗しました。ファイル容量が{$max_kb}kbを超えています。");388 }389 }390 list($w,$h)=getimagesize($upfile);391 $_img_type=mime_content_type($upfile);392 $ext=getImgType ($_img_type);393 if (!$ext) {394 closeFile($fp);395 safe_unlink($upfile);396 return error($en? 'This file is an unsupported format.':'対応していないフォーマットです。');397 }398 //同じ画像チェック アップロード画像のみチェックしてお絵かきはチェックしない399 if(!$pictmp2){400 401 $img_md5=md5_file($upfile);402 foreach($chk_images as $line){403 list($no_,$sub_,$name_,$verified_,$com_,$url_,$imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_)=$line;404 if($log_md5 && ($log_md5 === $img_md5)){405 closeFile($fp);406 safe_unlink($upfile);407 return error($en?'Image already exists.':'同じ画像がありました。');408 }409 }410 }411 $imgfile=$time.$ext; 412 rename($upfile,IMG_DIR.$imgfile);413 }414 $src='';415 $pchext = '';416 if($pictmp2 && $imgfile){417 //PCHファイルアップロード418 // .pch, .spch,.chi,.psd ブランク どれかが返ってくる419 if ($pchext = check_pch_ext(TEMP_DIR.$picfile,['upload'=>true])) {420 $src = TEMP_DIR.$picfile.$pchext;421 $dst = IMG_DIR.$time.$pchext;422 if(copy($src, $dst)){423 chmod($dst,0606);424 }425 }426 }427 $thumbnail='';428 if($imgfile && is_file(IMG_DIR.$imgfile)){429 430 $max_w = $resto ? $res_max_w : $max_w; 431 $max_h = $resto ? $res_max_h : $max_h; 432 //縮小表示433 list($w,$h)=image_reduction_display($w,$h,$max_w,$max_h);434 //サムネイル435 if($use_thumb){436 if(thumb(IMG_DIR,$imgfile,$time,$max_w,$max_h)){437 $thumbnail='thumbnail';438 }439 }440 }441 //ログの番号の最大値442 $no_arr = [];443 foreach($alllog_arr as $i => $_alllog){444 list($log_no,)=explode("\t",$_alllog);445 $no_arr[]=$log_no;446 }447 $max_no=0;448 if(!empty($no_arr)){449 $max_no=max($no_arr);450 }451 //書き込むログの書式452 $line='';453 $newline='';454 if($resto){//レスの時はスレッド別ログに追記455 //ファイルロックした状態で再度開く456 $rp=fopen(LOG_DIR."{$resto}.log","r+");457 if(!$rp){458 closeFile($fp);459 safe_unlink(IMG_DIR.$imgfile);460 return error($en?'The operation failed.':'失敗しました。');461 }462 flock($rp, LOCK_EX);463 $r_arr=[];464 $r_oya='';465 $r_no='';466 while ($line = fgets($rp)) {467 if(!trim($line)){468 continue;469 }470 $r_arr[]=$line;471 }472 if(empty($r_arr)){473 closeFile($rp);474 closeFile($fp);475 safe_unlink(IMG_DIR.$imgfile);476 return error($en?'The operation failed.':'失敗しました。');477 }478 //ファイルロックがかかった状態で再確認。479 //レス先はoya?480 list($r_no,,,,,,,,,,,,,,,,,,,$r_oya)=explode("\t",trim($r_arr[0]));481 if($r_no!==$resto||$r_oya!=='oya'){482 closeFile($rp);483 closeFile($fp);484 safe_unlink(IMG_DIR.$imgfile);485 return error($en? 'The article does not exist.':'記事がありません。');486 }487 $r_line = "$resto\t$sub\t$name\t$verified\t$com\t$url\t$imgfile\t$w\t$h\t$thumbnail\t$painttime\t$img_md5\t$tool\t$pchext\t$time\t$time\t$host\t$userid\t$hash\tres\n";488 $new_rline= implode("",$r_arr).$r_line;489 writeFile($rp,$new_rline);490 closeFile($rp);491 chmod(LOG_DIR.$resto.'.log',0600);492 if(!$sage){493 foreach($alllog_arr as $i =>$val){494 list($_no)=explode("\t",$val);495 if($resto==$_no){496 $newline = $val;//レスが付いたスレッドを$newlineに保存。あとから全体ログの先頭に追加して上げる497 unset($alllog_arr[$i]);//レスが付いたスレッドを全体ログからいったん削除498 break;499 }500 }501 }502 }else{503 //最後の記事ナンバーに+1504 $no=$max_no+1;505 $newline = "$no\t$sub\t$name\t$verified\t$com\t$url\t$imgfile\t$w\t$h\t$thumbnail\t$painttime\t$img_md5\t$tool\t$pchext\t$time\t$time\t$host\t$userid\t$hash\toya\n";506 file_put_contents(LOG_DIR.$no.'.log',$newline,LOCK_EX);//新規投稿の時は、記事ナンバーのファイルを作成して書き込む507 chmod(LOG_DIR.$no.'.log',0600);508 }509 //保存件数超過処理510 $countlog=count($alllog_arr);511 if($max_log && $countlog && ($max_log<=$countlog)){512 for($i=$max_log-1; $i<$countlog;++$i){513 if(!isset($alllog_arr[$i]) || !trim($alllog_arr[$i])){514 continue;515 }516 list($d_no,)=explode("\t",$alllog_arr[$i]);517 if(is_file(LOG_DIR."{$d_no}.log")){518 $dp = fopen(LOG_DIR."{$d_no}.log", "r");//個別スレッドのログを開く519 flock($dp, LOCK_EX);520 while ($line = fgets($dp)) {521 if(!trim($line)){522 continue;523 }524 list($d_no,$_sub,$_name,$_verified,$_com,$_url,$d_imgfile,$_w,$_h,$_thumbnail,$_painttime,$_log_md5,$_tool,$_pchext,$d_time,$_first_posted_time,$_host,$_userid,$_hash,$_oya)=explode("\t",trim($line));525 delete_files ($d_imgfile, $d_time);//一連のファイルを削除526 }527 safe_unlink(LOG_DIR.$d_no.'.log');//スレッド個別ログファイル削除528 closeFile($dp);529 } 530 unset($alllog_arr[$i]);//全体ログ記事削除531 }532 }533 $newline.=implode("",$alllog_arr);534 writeFile ($fp, $newline);535 closeFile($fp);536 chmod(LOG_DIR.'alllog.log',0600);537 //ワークファイル削除538 safe_unlink($src);539 safe_unlink($tempfile);540 safe_unlink($up_tempfile);541 safe_unlink($upfile);542 safe_unlink(TEMP_DIR.$picfile.".dat");543 global $send_email,$to_mail,$root_url,$boardname;544 if($send_email){545 //template_ini.phpで未定義の時の初期値546 //このままでよければ定義不要547 defined('NOTICE_MAIL_TITLE') or define('NOTICE_MAIL_TITLE', '記事題名');548 defined('NOTICE_MAIL_IMG') or define('NOTICE_MAIL_IMG', '投稿画像');549 defined('NOTICE_MAIL_THUMBNAIL') or define('NOTICE_MAIL_THUMBNAIL', 'サムネイル画像');550 defined('NOTICE_MAIL_ANIME') or define('NOTICE_MAIL_ANIME', 'アニメファイル');551 defined('NOTICE_MAIL_URL') or define('NOTICE_MAIL_URL', '記事URL');552 defined('NOTICE_MAIL_REPLY') or define('NOTICE_MAIL_REPLY', 'へのレスがありました');553 defined('NOTICE_MAIL_NEWPOST') or define('NOTICE_MAIL_NEWPOST', '新規投稿がありました');554 $data['to'] = $to_mail;555 $data['name'] = $name;556 $data['option'][] = 'URL,'.$url;557 $data['option'][] = NOTICE_MAIL_TITLE.','.$sub;558 if($imgfile) $data['option'][] = NOTICE_MAIL_IMG.','.$root_url.IMG_DIR.$imgfile;//拡張子があったら559 if(is_file(THUMB_DIR.$time.'s.jpg')) $data['option'][] = NOTICE_MAIL_THUMBNAIL.','.$root_url.THUMB_DIR.$time.'s.jpg';560 if($resto){561 $data['subject'] = '['.$boardname.'] No.'.$resto.NOTICE_MAIL_REPLY;562 $data['option'][] = "\n".NOTICE_MAIL_URL.','.$root_url.'?res='.$resto;563 }else{564 $data['subject'] = '['.$boardname.'] '.NOTICE_MAIL_NEWPOST;565 $data['option'][] = "\n".NOTICE_MAIL_URL.','.$root_url.'?res='.$no;566 }567 $data['comment'] = str_replace('"\n"',"\n",$com);568 noticemail::send($data);569 }570 //多重送信防止571 if($resto){572 return header('Location: ./?resno='.$resto.'#'.$time);573 }574 575return header('Location: ./');576}577//お絵かき画面578function paint(){579 global $boardname,$skindir,$pmax_w,$pmax_h,$en;580 $app = (string)filter_input(INPUT_POST,'app');581 $picw = filter_input(INPUT_POST,'picw',FILTER_VALIDATE_INT);582 $pich = filter_input(INPUT_POST,'pich',FILTER_VALIDATE_INT);583 $usercode = t((string)filter_input(INPUT_COOKIE, 'usercode'));584 $resto = t((string)filter_input(INPUT_POST, 'resto',FILTER_VALIDATE_INT));585 if(strlen($resto)>1000){586 return error($en?'Unknown error':'問題が発生しました。');587 }588 if($picw < 300) $picw = 300;589 if($pich < 300) $pich = 300;590 if($picw > $pmax_w) $picw = $pmax_w;591 if($pich > $pmax_h) $pich = $pmax_h;592 setcookie("appc", $app , time()+(60*60*24*30),"","",false,true);//アプレット選択593 setcookie("picwc", $picw , time()+(60*60*24*30),"","",false,true);//幅594 setcookie("pichc", $pich , time()+(60*60*24*30),"","",false,true);//高さ595 $mode = filter_input(INPUT_POST, 'mode');596 $imgfile='';597 $pchfile='';598 $img_chi='';599 $img_klecks='';600 $anime=true;601 $rep=false;602 $paintmode='paintcom';603 session_sta();604 $adminpost=adminpost_valid();605 //pchファイルアップロードペイント606 if($adminpost){607 $pchfilename = isset($_FILES['pchup']['name']) ? basename($_FILES['pchup']['name']) : '';608 609 $pchtmp=isset($_FILES['pchup']['tmp_name']) ? $_FILES['pchup']['tmp_name'] : '';610 if(isset($_FILES['pchup']['error']) && in_array($_FILES['pchup']['error'],[1,2])){//容量オーバー611 return error($en? 'The file size is too big.':'ファイルサイズが大きすぎます。');612 } 613 if ($pchtmp && $_FILES['pchup']['error'] === UPLOAD_ERR_OK){614 615 $time = (string)(time().substr(microtime(),2,6));616 $pchext=pathinfo($pchfilename, PATHINFO_EXTENSION);617 $pchext=strtolower($pchext);//すべて小文字に618 //拡張子チェック619 if (!in_array($pchext, ['pch','chi','psd'])) {620 return error($en?'This file does not supported by the ability to load uploaded files onto the canvas.Supported formats are pch and chi.':'アップロードペイントで使用できるファイルはpch、chi、psdです。');621 }622 $pchup = TEMP_DIR.'pchup-'.$time.'-tmp.'.$pchext;//アップロードされるファイル名623 if(move_uploaded_file($pchtmp, $pchup)){//アップロード成功なら続行624 $pchup=TEMP_DIR.basename($pchup);//ファイルを開くディレクトリを固定625 if(!in_array(mime_content_type($pchup),["application/octet-stream","application/gzip","image/vnd.adobe.photoshop"])){626 safe_unlink($pchup);627 return error($en?'This file does not supported':'ファイル形式が一致しません。');628 }629 if($pchext==="pch"){630 $app='neo';631 $pchfile = $pchup;632 } elseif($pchext==="chi"){633 $app='chi';634 $img_chi = $pchup;635 } elseif($pchext==="psd"){636 $app='klecks';637 $img_klecks = $pchup;638 }639 }640 }641 }642 $repcode='';643 if($mode==="contpaint"){644 $imgfile = (string)filter_input(INPUT_POST,'imgfile');645 $ctype = (string)filter_input(INPUT_POST, 'ctype');646 $type = (string)filter_input(INPUT_POST, 'type');647 $no = filter_input(INPUT_POST, 'no',FILTER_VALIDATE_INT);648 $time = (string)filter_input(INPUT_POST, 'time');649 if(($type!=='rep') && is_file(LOG_DIR."{$no}.log")){650 651 $rp=fopen(LOG_DIR."{$no}.log","r");652 while ($line = fgets($rp)) {653 if(!trim($line)){654 continue;655 }656 list($no_,$sub_,$name_,$verified_,$com_,$url_,$imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5_,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_)=explode("\t",trim($line));657 if($time===$time_ && (int)$no==$no_){658 $resto=(trim($oya_)==='res') ? $no_ : '';659 break;660 }661 }662 closeFile ($rp);663 }664 list($picw,$pich)=getimagesize(IMG_DIR.$imgfile);//キャンバスサイズ665 $_pch_ext = check_pch_ext(IMG_DIR.$time,['upload'=>true]);666 if($ctype=='pch'&& $_pch_ext){//動画から続き667 $pchfile = IMG_DIR.$time.$_pch_ext;668 }669 if($ctype=='img' && is_file(IMG_DIR.$imgfile)){//画像から続き670 $anime=false;671 $animeform = false;672 $anime= false;673 $imgfile = IMG_DIR.$imgfile;674 if($_pch_ext==='.chi'){675 $img_chi =IMG_DIR.$time.'.chi';676 }677 if($_pch_ext==='.psd'){678 $img_klecks =IMG_DIR.$time.'.psd';679 }680 }681 if($type==='rep'){//画像差し換え682 $rep=true;683 $pwd = t((string)filter_input(INPUT_POST, 'pwd'));684 $pwd=$pwd ? $pwd : t((string)filter_input(INPUT_COOKIE,'pwdc'));//未入力ならCookieのパスワード685 if(strlen($pwd) > 100) return error($en? 'Password is too long.':'パスワードが長すぎます。');686 if($pwd){687 $pwd=openssl_encrypt ($pwd,CRYPT_METHOD, CRYPT_PASS, true, CRYPT_IV);//暗号化688 $pwd=bin2hex($pwd);//16進数に689 }690 $userip = get_uip();691 $paintmode='picrep';692 $id=$time; //テンプレートでも使用。693 $repcode = substr(crypt(md5($no.$id.$userip.$pwd.date("Ymd", time())),time()),-8);694 //念の為にエスケープ文字があればアルファベットに変換695 $repcode = strtr($repcode,"!\"#$%&'()+,/:;<=>?@[\\]^`/{|}~","ABCDEFGHIJKLMNOabcdefghijklmn");696 }697 }698 $parameter_day = date("Ymd");//JavaScriptのキャッシュ制御699 switch($app){700 case 'chi'://ChickenPaint701 702 $tool='chi';703 // HTML出力704 $templete='paint_chi.html';705 return include __DIR__.'/'.$skindir.$templete;706 case 'klecks':707 $tool ='klecks';708 $templete='paint_klecks.html';709 return include __DIR__.'/'.$skindir.$templete;710 case 'neo'://PaintBBS NEO711 $tool='neo';712 $appw = $picw + 150;//NEOの幅713 $apph = $pich + 172;//NEOの高さ714 if($apph < 560){$apph = 560;}//最低高715 //動的パレット716 $palettetxt = $en? (is_file('palette_en.txt') ? 'palette_en.txt':'palette.txt') : 'palette.txt'; 717 $lines =file($palettetxt);718 $initial_palette = 'Palettes[0] = "#000000\n#FFFFFF\n#B47575\n#888888\n#FA9696\n#C096C0\n#FFB6FF\n#8080FF\n#25C7C9\n#E7E58D\n#E7962D\n#99CB7B\n#FCECE2\n#F9DDCF";';719 $pal=[];720 $DynP=[];721 foreach ( $lines as $i => $line ) {722 $line=str_replace(["\r","\n","\t"],"",$line);723 $line=h($line);724 list($pid,$pname,$pal[0],$pal[2],$pal[4],$pal[6],$pal[8],$pal[10],$pal[1],$pal[3],$pal[5],$pal[7],$pal[9],$pal[11],$pal[12],$pal[13]) = explode(",", $line);725 $DynP[]=$pname;726 $p_cnt=$i+1;727 $palettes = 'Palettes['.$p_cnt.'] = "#';728 ksort($pal);729 $palettes.=implode('\n#',$pal);730 $palettes.='";';731 $arr_pal[$i] = $palettes;732 }733 $palettes=$initial_palette.implode('',$arr_pal);734 $palsize = count($DynP) + 1;735 foreach ($DynP as $p){736 $arr_dynp[] = $p;737 }738 // HTML出力739 $templete='paint_neo.html';740 return include __DIR__.'/'.$skindir.$templete;741 default:742 return error($en?'The operation failed.':'失敗しました。');743 }744}745// お絵かきコメント 746function paintcom(){747 global $use_aikotoba,$boardname,$home,$skindir,$sage_all,$en;748 $token=get_csrf_token();749 $userip = get_uip();750 $usercode = filter_input(INPUT_COOKIE,'usercode');751 //テンポラリ画像リスト作成752 $uresto = '';753 $handle = opendir(TEMP_DIR);754 $tmps = [];755 while ($file = readdir($handle)) {756 if(!is_dir($file) && pathinfo($file, PATHINFO_EXTENSION)==='dat') {757 $fp = fopen(TEMP_DIR.$file, "r");758 $userdata = fread($fp, 1024);759 fclose($fp);760 list($uip,$uhost,$uagent,$imgext,$ucode,,$starttime,$postedtime,$uresto,$tool) = explode("\t", rtrim($userdata));761 $file_name = pathinfo($file, PATHINFO_FILENAME);762 $uresto = $uresto ? 'res' :''; 763 if(is_file(TEMP_DIR.$file_name.$imgext)){ //画像があればリストに追加764 if($ucode === $usercode||$uip === $userip){765 $tmps[] = [$file_name.$imgext,$uresto];766 }767 }768 }769 }770 closedir($handle);771 if(!empty($tmps)){772 $pictmp = 2;773 sort($tmps);774 reset($tmps);775 foreach($tmps as $tmp){776 list($tmpfile,$resto)=$tmp;777 $tmp_img['src'] = TEMP_DIR.$tmpfile;778 $tmp_img['srcname'] = $tmpfile;779 $tmp_img['slect_src_val'] = $tmpfile.','.$resto;780 $tmp_img['date'] = date("Y/m/d H:i", filemtime($tmp_img['src']));781 $out['tmp'][] = $tmp_img;782 }783 }784 $aikotoba=aikotoba_valid();785 if(!$use_aikotoba){786 $aikotoba=true;787 }788 $namec = filter_input(INPUT_COOKIE,'namec');789 $pwdc=filter_input(INPUT_COOKIE,'pwdc');790 $urlc=(string)filter_input(INPUT_COOKIE,'urlc');791 // HTML出力792 $templete='paint_com.html';793 return include __DIR__.'/'.$skindir.$templete;794}795//コンティニュー前画面796function to_continue(){797 global $boardname,$use_diary,$use_aikotoba,$set_nsfw,$skindir,$en;798 $appc=(string)filter_input(INPUT_COOKIE,'appc');799 $pwdc=filter_input(INPUT_COOKIE,'pwdc');800 $no = (string)filter_input(INPUT_GET, 'no',FILTER_VALIDATE_INT);801 $id = (string)filter_input(INPUT_GET, 'id');//intの範囲外802 $flag = false;803 if(is_file(LOG_DIR."{$no}.log")){804 805 $rp=fopen(LOG_DIR."{$no}.log","r");806 while ($line = fgets($rp)) {807 if(!trim($line)){808 continue;809 }810 list($_no,$sub,$name,$verified,$com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=explode("\t",trim($line));811 if($id===$time && $no===$_no){812 $flag=true;813 break;814 }815 }816 closeFile ($rp);817 }818 if(!$flag || !$imgfile || !is_file(IMG_DIR.$imgfile)){//画像が無い時は処理しない819 return error($en? 'The article does not exist.':'記事がありません。');820 }821 $picfile = IMG_DIR.$imgfile;822 list($picw, $pich) = getimagesize($picfile);823 $select_app = false;824 $app_to_use = false;825 $ctype_pch = false;826 $download_app_dat=true;827 if(($pchext==='.pch')&&is_file(IMG_DIR.$time.'.pch')){828 $ctype_pch = true;829 $app_to_use = "neo";830 831 }elseif(($pchext==='.chi')&&is_file(IMG_DIR.$time.'.chi')){832 $app_to_use = 'chi';833 }elseif(($pchext==='.psd')&&is_file(IMG_DIR.$time.'.psd')){834 $app_to_use = 'klecks';835 }else{836 $select_app = true;837 $download_app_dat=false;838 }839 //日記判定処理840 session_sta();841 $adminpost=adminpost_valid();842 $adminmode = ($adminpost||admindel_valid());843 $aikotoba=aikotoba_valid();844 if(!$use_aikotoba){845 $aikotoba=true;846 }847 // nsfw848 $nsfwc=filter_input(INPUT_COOKIE,'nsfwc',FILTER_VALIDATE_BOOLEAN);849 // HTML出力850 $templete='continue.html';851 return include __DIR__.'/'.$skindir.$templete;852 853}854//アプリ固有ファイルのダウンロード855function download_app_dat(){856 global $en;857 $pwd=filter_input(INPUT_POST,'pwd');858 $no = (string)filter_input(INPUT_POST, 'no',FILTER_VALIDATE_INT);859 $id = (string)filter_input(INPUT_POST, 'id');//intの範囲外860 if(!is_file(LOG_DIR."{$no}.log")){861 return error($en? 'The article does not exist.':'記事がありません。');862 }863 $rp=fopen(LOG_DIR."{$no}.log","r");864 $flag=false;865 while ($line = fgets($rp)) {866 if(!trim($line)){867 continue;868 }869 list($_no,$sub,$name,$verified,$com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=explode("\t",trim($line));870 if($id==$time && $no===$_no){871 if(!adminpost_valid()&&!admindel_valid()&&(!$pwd || !password_verify($pwd,$hash))){872 return error($en?'Password is incorrect.':'パスワードが違います。');873 }874 $flag=true;875 break;876 } 877 }878 closeFile ($rp);879 $filepath= ($flag && is_file(IMG_DIR.$time.$pchext)) ? IMG_DIR.$time.$pchext : '';880 if(!$filepath){881 return error($en?'The operation failed.':'失敗しました。');882 }883 $mime_type = mime_content_type($filepath);884 header('Content-Type: '.$mime_type);885 header('Content-Length: '.filesize($filepath));886 header('Content-Disposition: attachment; filename="'.h(basename($filepath)).'"');887 readfile($filepath);888}889// 画像差し換え890function img_replace(){891 global $use_thumb,$max_w,$max_h,$res_max_w,$res_max_h,$max_px,$en,$use_upload;892 $no = t((string)filter_input(INPUT_POST, 'no',FILTER_VALIDATE_INT));893 $no = $no ? $no :t((string)filter_input(INPUT_GET, 'no',FILTER_VALIDATE_INT));894 $id = t((string)filter_input(INPUT_POST, 'id'));//intの範囲外895 $id = $id ? $id :t((string)filter_input(INPUT_GET, 'id'));896 $getpwd = t((string)filter_input(INPUT_GET, 'pwd'));897 $postpwd = t((string)filter_input(INPUT_POST, 'pwd'));898 $repcode = t((string)filter_input(INPUT_GET, 'repcode'));899 $userip = t(get_uip());900 //ホスト取得901 $host = t(gethostbyaddr($userip));902 //ユーザーid903 $userid = t(getId($userip));904 $getpwd = $getpwd ? hex2bin($getpwd): '';//バイナリに905 $pwd = $getpwd ? 906 openssl_decrypt($getpwd,CRYPT_METHOD, CRYPT_PASS, true, CRYPT_IV):$postpwd;//復号化907 if(strlen($pwd) > 100) return error($en? 'Password is too long.':'パスワードが長すぎます。');908 $adminpost=adminpost_valid();909 $admindel=admindel_valid();910 //アップロード画像の差し換え911 $up_tempfile = isset($_FILES['imgfile']['tmp_name']) ? $_FILES['imgfile']['tmp_name'] : ''; // 一時ファイル名912 if (isset($_FILES['imgfile']['error']) && $_FILES['imgfile']['error'] === UPLOAD_ERR_NO_FILE){913 return error($en?'Please attach an image.':'画像を添付してください。');914 } 915 if(isset($_FILES['imgfile']['error']) && in_array($_FILES['imgfile']['error'],[1,2])){//容量オーバー916 return error($en? "Upload failed.The file size is too big.":"アップロードに失敗しました。ファイルサイズが大きすぎます。");917 } 918 $is_upload=false;919 $tool = '';920 if ($up_tempfile && $_FILES['imgfile']['error'] === UPLOAD_ERR_OK && ($use_upload || $admindel)){921 $img_type = isset($_FILES['imgfile']['type']) ? $_FILES['imgfile']['type'] : '';922 if (!in_array($img_type, ['image/gif', 'image/jpeg', 'image/png','image/webp'])) {923 safe_unlink($up_tempfile);924 return error($en? 'This file is an unsupported format.':'対応していないフォーマットです。');925 }926 check_csrf_token();927 $is_upload = true;928 $tool = 'upload';929 }930 $tempfile='';931 $file_name='';932 $starttime='';933 $postedtime='';934 $repfind=false;935 if(!$is_upload){936 /*--- テンポラリ捜査 ---*/937 $handle = opendir(TEMP_DIR);938 while ($file = readdir($handle)) {939 if(!is_dir($file) && pathinfo($file, PATHINFO_EXTENSION)==='dat') {940 $fp = fopen(TEMP_DIR.$file, "r");941 $userdata = fread($fp, 1024);942 fclose($fp);943 list($uip,$uhost,$uagent,$imgext,$ucode,$urepcode,$starttime,$postedtime,$uresto,$tool) = explode("\t", rtrim($userdata)."\t");//区切りの"\t"を行末に944 $file_name = pathinfo($file, PATHINFO_FILENAME );//拡張子除去945 //画像があり、認識コードがhitすれば抜ける946 947 if($file_name && is_file(TEMP_DIR.$file_name.$imgext) && $urepcode === $repcode){948 $repfind=true;949 break;950 }951 }952 }953 closedir($handle);954 if(!$repfind){955 return error($en?'The operation failed.':'失敗しました。');956 }957 $tempfile=TEMP_DIR.$file_name.$imgext;958 }959 if($up_tempfile && $is_upload && !is_file($up_tempfile)){960 return error($en?'Please attach an image.':'画像を添付してください。');961 }962 //ログ読み込み963 if(!is_file(LOG_DIR."{$no}.log")){964 if($is_upload){//該当記事が無い時はエラー965 return error($en? 'The article does not exist.':'記事がありません。');966 } 967 return paintcom();//該当記事が無い時は新規投稿。968 }969 $fp=fopen(LOG_DIR."alllog.log","r+");970 flock($fp, LOCK_EX);971 $alllog_arr=[];972 while ($_line = fgets($fp)) {973 if(!trim($_line)){974 continue;975 }976 $alllog_arr[]=$_line; 977 }978 if(empty($alllog_arr)){979 closeFile($fp);980 return error($en?'The operation failed.':'失敗しました。');981 }982 $rp=fopen(LOG_DIR."{$no}.log","r+");983 flock($rp, LOCK_EX);984 $r_arr=[];985 while ($line = fgets($rp)) {986 if(!trim($line)){987 continue;988 }989 $r_arr[]=$line;990 }991 if(empty($r_arr)){992 closeFile($rp);993 closeFile($fp);994 return error($en?'The operation failed.':'失敗しました。');995 }996 $flag=false;997 foreach($r_arr as $i => $line){998 list($_no,$_sub,$_name,$_verified,$_com,$_url,$_imgfile,$_w,$_h,$_thumbnail,$_painttime,$_log_md5,$_tool,$_pchext,$_time,$_first_posted_time,$_host,$_userid,$_hash,$_oya)=explode("\t",trim($line));999 if($id===$_time && $no===$_no){1000 if(($is_upload) && ($_tool!=='upload')) {1001 closeFile($rp);1002 closeFile($fp);1003 return error($en?'The operation failed.':'失敗しました。');1004 }1005 if(($is_upload && $admindel) || ($pwd && password_verify($pwd,$_hash))){1006 $flag=true;1007 break;1008 }1009 }1010 }1011 if(!check_elapsed_days($_time)&&(!$adminpost && !$admindel)){//指定日数より古い画像差し換えは新規投稿にする1012 closeFile($rp);1013 closeFile($fp);1014 if($is_upload){1015 return error($en?'The operation failed.':'失敗しました。');1016 } 1017 return paintcom();1018 }1019 if(!$flag){1020 closeFile($rp);1021 closeFile($fp);1022 return error($en?'The operation failed.':'失敗しました。');1023 }1024 $time = (string)(time().substr(microtime(),2,6));1025 $testexts=['.gif','.jpg','.png','.webp'];1026 foreach($testexts as $testext){1027 if(is_file(IMG_DIR.$time.$testext)){1028 $time=(string)((int)time()+1).substr(microtime(),2,6);1029 break; 1030 }1031 }1032 1033 $upfile=TEMP_DIR.$time.'.tmp';1034 if($is_upload&&($_tool==='upload')){1035 if(is_file($up_tempfile)){1036 move_uploaded_file($up_tempfile,$upfile);1037 }1038 }else{1039 if(is_file($tempfile)){1040 copy($tempfile, $upfile);1041 }1042 }1043 if(!is_file($upfile)){1044 closeFile($rp);1045 closeFile($fp);1046 return error($en?'The operation failed.':'失敗しました。');1047 } 1048 chmod($upfile,0606);1049 if($is_upload&&($_tool==='upload')){//実体データの縮小1050 $max_px=isset($max_px) ? $max_px : 1024;1051 thumb(TEMP_DIR,$time.'.tmp',$time,$max_px,$max_px,['toolarge'=>1]);1052 } 1053 $filesize=filesize($upfile);1054 if($filesize > 800 * 1024){//指定サイズを超えていたら1055 if ($im_jpg = png2jpg($upfile)) {//PNG→JPEG自動変換1056 if(filesize($im_jpg)<$filesize){//JPEGのほうが小さい時だけ1057 rename($im_jpg,$upfile);//JPEGで保存1058 chmod($upfile,0606);1059 } else{//PNGよりファイルサイズが大きくなる時は1060 unlink($im_jpg);//作成したJPEG画像を削除1061 }1062 }1063 }1064 1065 $img_type=mime_content_type($upfile);1066 $imgext = getImgType($img_type);1067 if (!$imgext) {1068 closeFile($fp);1069 closeFile($rp);1070 safe_unlink($upfile);1071 return error($en? 'This file is an unsupported format.':'対応していないフォーマットです。');1072 }1073 list($w, $h) = getimagesize($upfile);1074 $img_md5=md5_file($upfile);1075 1076 //チェックするスレッド数。 1077 $n= 15;1078 $chk_log_arr=array_slice($alllog_arr,0,$n,false);1079 $chk_resnos=[];1080 foreach($chk_log_arr as $chk_log){1081 list($chk_resno)=explode("\t",$chk_log);1082 $chk_resnos[]=$chk_resno;1083 }1084 $chk_lines=[];1085 foreach($chk_resnos as $chk_resno){1086 if(($chk_resno!==$no)&&is_file(LOG_DIR."{$chk_resno}.log")){1087 $cp=fopen(LOG_DIR."{$chk_resno}.log","r");1088 while($line=fgets($cp)){1089 if(!trim($line)){1090 continue;1091 }1092 $chk_lines[]=$line;//画像1093 }1094 fclose($cp);1095 }1096 }1097 $chk_images=array_merge($chk_lines,$r_arr);1098 foreach($chk_images as $chk_line){1099 list($chk_no,$chk_sub,$chk_name,$chk_verified,$chk_com,$chk_url,$chk_imgfile,$chk_w,$chk_h,$chk_thumbnail,$chk_painttime,$chk_log_md5,$chk_tool,$chk_pchext,$chk_time,$chk_first_posted_time,$chk_host,$chk_userid,$chk_hash,$chk_oya_)=explode("\t",trim($chk_line));1100 $_chk_time=(strlen($chk_time)>15) ? substr($chk_time,0,-6) : substr($chk_time,0,-3);//秒単位に戻す1101 if($is_upload && (int)substr($time,0,-6)-(int)$_chk_time<1){//投稿時刻の重複回避1102 safe_unlink($upfile);1103 closeFile($fp);1104 closeFile($rp);1105 return error($en? 'Please wait a little.':'少し待ってください。');1106 }1107 if(!$is_upload && (string)$time===(string)$chk_time){1108 $time=((int)substr($time,0,-6)+1).substr($time,-6);1109 }1110 if($is_upload && $chk_log_md5 && ($chk_log_md5 === $img_md5)){1111 safe_unlink($upfile);1112 closeFile($fp);1113 closeFile($rp);1114 return error($en?'Image already exists.':'同じ画像がありました。');1115 }1116 }1117 $imgfile = $time.$imgext;1118 rename($upfile,IMG_DIR.$imgfile);1119 chmod(IMG_DIR.$imgfile,0606);1120 $src='';1121 //PCHファイルアップロード1122 // .pch, .spch,.chi,.psd ブランク どれかが返ってくる1123 if ($pchext = check_pch_ext(TEMP_DIR . $file_name,['upload'=>true])) {1124 $src = TEMP_DIR . $file_name . $pchext;1125 $dst = IMG_DIR . $time . $pchext;1126 if(copy($src, $dst)){1127 chmod($dst, 0606);1128 }1129 }1130 list($w,$h)=getimagesize(IMG_DIR.$imgfile);1131 //縮小表示 1132 $max_w = ($_oya==='res') ? $res_max_w : $max_w; 1133 $max_h = ($_oya==='res') ? $res_max_h : $max_h; 1134 list($w,$h)=image_reduction_display($w,$h,$max_w,$max_h);1135 1136 //サムネイル1137 $thumbnail='';1138 if($use_thumb){1139 if(thumb(IMG_DIR,$imgfile,$time,$max_w,$max_h)){1140 $thumbnail='thumbnail';1141 }1142 }1143 //描画時間追加1144 $painttime = '';1145 if($starttime && is_numeric($starttime) && $postedtime && is_numeric($postedtime)){1146 $psec=(int)$postedtime-(int)$starttime;1147 $painttime=(int)$_painttime+(int)$psec;1148 }1149 1150 $new_line= "$_no\t$_sub\t$_name\t$_verified\t$_com\t$_url\t$imgfile\t$w\t$h\t$thumbnail\t$painttime\t$img_md5\t$tool\t$pchext\t$time\t$_first_posted_time\t$host\t$userid\t$_hash\t$_oya\n";1151 $r_arr[$i] = $new_line;1152 if($_oya ==='oya'){1153 $flag=false;1154 foreach($alllog_arr as $i => $val){1155 list($no_,$sub_,$name_,$verified_,$com_,$url_,$imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5_,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_) = explode("\t",trim($val));1156 1157 if(($id===$time_ && $no===$no_) &&1158 (($admindel && $is_upload ||1159 ($pwd && password_verify($pwd,$hash_))))){1160 $alllog_arr[$i] = $new_line;1161 $flag=true;1162 break;1163 }1164 }1165 if(!$flag){1166 closeFile($rp);1167 closeFile($fp);1168 safe_unlink(IMG_DIR.$imgfile);1169 return error($en?'The operation failed.':'失敗しました。');1170 }1171 writeFile($fp,implode("",$alllog_arr));1172 }1173 writeFile($rp, implode("", $r_arr));1174 closeFile($rp);1175 closeFile($fp);1176 1177 //旧ファイル削除1178 delete_files($_imgfile, $_time);1179 //ワークファイル削除1180 safe_unlink($src);1181 safe_unlink($tempfile);1182 safe_unlink($up_tempfile);1183 safe_unlink($upfile);1184 safe_unlink(TEMP_DIR.$file_name.".dat");1185 if($is_upload){1186 return edit_form($time,$no);//編集画面にもどる1187 }1188 return header('Location: ./?resno='.$no.'#'.$time);1189}1190// 動画表示1191function pchview(){1192 global $boardname,$skindir,$en;1193 $imagefile = filter_input(INPUT_GET, 'imagefile');1194 $no = (string)filter_input(INPUT_GET, 'no',FILTER_VALIDATE_INT);1195 $pch = pathinfo($imagefile, PATHINFO_FILENAME);1196 $pchext = check_pch_ext(IMG_DIR . $pch);1197 if(!$pchext){1198 return error('ファイルがありません。');1199 }1200 $pchfile = IMG_DIR.$pch.$pchext;1201 list($picw, $pich) = getimagesize(IMG_DIR.$imagefile);1202 $appw = $picw < 200 ? 200 : $picw;1203 $apph = $pich < 200 ? 200 : $pich + 26;1204 // HTML出力1205 $templete='pch_view.html';1206 return include __DIR__.'/'.$skindir.$templete;1207}1208//削除前の確認画面1209function confirmation_before_deletion ($edit_mode=''){1210 global $boardname,$home,$petit_ver,$petit_lot,$skindir,$use_aikotoba,$set_nsfw,$en;1211 //管理者判定処理1212 session_sta();1213 $admindel=admindel_valid();1214 $aikotoba=aikotoba_valid();1215 $userdel=isset($_SESSION['userdel'])&&($_SESSION['userdel']==='userdel_mode');1216 $resmode = filter_input(INPUT_POST,'resmode',FILTER_VALIDATE_BOOLEAN);1217 $resmode = $resmode ? 'true' : 'false';1218 $postpage = filter_input(INPUT_POST,'postpage',FILTER_VALIDATE_INT);1219 $postresno = filter_input(INPUT_POST,'postresno',FILTER_VALIDATE_INT);1220 $postpage = ($postpage || $postpage===0) ? $postpage : 0; 1221 $postresno = ($postresno) ? $postresno : false; 1222 $pwdc=filter_input(INPUT_COOKIE,'pwdc');1223 $edit_mode = filter_input(INPUT_POST,'edit_mode');1224 if(!($admindel||$userdel)){1225 return error($en?'The operation failed.':'失敗しました。');1226 }1227 if($edit_mode!=='delmode' && $edit_mode!=='editmode'){1228 return error($en?'The operation failed.':'失敗しました。');1229 }1230 $id = t((string)filter_input(INPUT_POST,'id'));//intの範囲外1231 $no = t((string)filter_input(INPUT_POST,'no',FILTER_VALIDATE_INT));1232 if(!is_file(LOG_DIR."{$no}.log")){1233 return error($en? 'The article does not exist.':'記事がありません。');1234 }1235 $rp=fopen(LOG_DIR."{$no}.log","r");1236 flock($rp, LOCK_EX);1237 $r_arr=[];1238 while ($r_line = fgets($rp)) {1239 if(!trim($r_line)){1240 continue;1241 }1242 $r_arr[]=$r_line;1243 }1244 if(empty($r_arr)){1245 closeFile($rp);1246 return error($en?'The operation failed.':'失敗しました。');1247 }1248 $find=false;1249 foreach($r_arr as $i =>$val){1250 $_line=explode("\t",trim($val));1251 list($_no,$sub,$name,$verified,$com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=$_line;1252 if($id===$time && $no===$_no){1253 $out[0][]=create_res($_line);1254 $find=true;1255 break;1256 1257 }1258 }1259 if(!$find){1260 closeFile ($rp);1261 return error($en?'The article was not found.':'記事が見つかりません。');1262 }1263 closeFile ($rp);1264 $token=get_csrf_token();1265 if(!$use_aikotoba){1266 $aikotoba=true;1267 }1268 // nsfw1269 $nsfwc=filter_input(INPUT_COOKIE,'nsfwc',FILTER_VALIDATE_BOOLEAN);1270 if($edit_mode==='delmode'){1271 $templete='before_del.html';1272 return include __DIR__.'/'.$skindir.$templete;1273 }1274 if($edit_mode==='editmode'){1275 $templete='before_edit.html';1276 return include __DIR__.'/'.$skindir.$templete;1277 }1278 return error($en?'The operation failed.':'失敗しました。');1279}1280//編集画面1281function edit_form($id='',$no=''){1282 global $petit_ver,$petit_lot,$home,$boardname,$skindir,$set_nsfw,$en,$max_kb;1283 $max_byte = $max_kb * 1024*2;1284 $token=get_csrf_token();1285 $admindel=admindel_valid();1286 $userdel=isset($_SESSION['userdel'])&&($_SESSION['userdel']==='userdel_mode');1287 $pwd=(string)filter_input(INPUT_POST,'pwd');1288 $pwdc=(string)filter_input(INPUT_COOKIE,'pwdc');1289 $pwd = $pwd ? $pwd : $pwdc;1290 1291 if(!($admindel||($userdel&&$pwd))){1292 return error($en?'The operation failed.':'失敗しました。');1293 }1294 $id_and_no=(string)filter_input(INPUT_POST,'id_and_no');1295 if($id_and_no){1296 list($id,$no)=explode(",",trim($id_and_no));1297 }1298 if(!is_file(LOG_DIR."{$no}.log")){1299 return error($en? 'The article does not exist.':'記事がありません。');1300 }1301 1302 $rp=fopen(LOG_DIR."{$no}.log","r");1303 flock($rp, LOCK_EX);1304 $r_arr=[];1305 while ($r_line = fgets($rp)) {1306 if(!trim($r_line)){1307 continue;1308 }1309 $r_arr[]=$r_line;1310 }1311 if(empty($r_arr)){1312 closeFile($rp);1313 return error($en?'The operation failed.':'失敗しました。');1314 }1315 $flag=false;1316 foreach($r_arr as $val){1317 $line=explode("\t",trim($val));1318 list($_no,$sub,$name,$verified,$com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=$line;1319 if($id===$time && $no===$_no){1320 1321 if($admindel||(check_elapsed_days($time)&&$pwd&&password_verify($pwd,$hash))){1322 $flag=true;1323 break;1324 }1325 }1326 }1327 if(!$flag){1328 closeFile($rp);1329 return error($en?'The operation failed.':'失敗しました。');1330 }1331 closeFile($rp);1332 $out[0][]=create_res($line);//$lineから、情報を取り出す;1333 $resno=filter_input(INPUT_POST,'postresno',FILTER_VALIDATE_INT);1334 $page=filter_input(INPUT_POST,'postpage',FILTER_VALIDATE_INT);1335 foreach($line as $i => $val){1336 $line[$i]=h($val);1337 }1338 list($_no,$sub,$name,$verified,$_com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=$line;1339 $com=h(str_replace('"\n"',"\n",$com));1340 $page = ($page||$page===0) ? $page : false; 1341 $resno = $resno ? $resno : false;1342 $nsfwc=filter_input(INPUT_COOKIE,'nsfwc',FILTER_VALIDATE_BOOLEAN);1343 // HTML出力1344 $templete='edit_form.html';1345 return include __DIR__.'/'.$skindir.$templete;1346}1347//編集1348function edit(){1349 global $name_input_required,$max_com,$en;1350 check_csrf_token();1351 //POSTされた内容を取得1352 $userip =t(get_uip());1353 //ホスト取得1354 $host = t(gethostbyaddr($userip));1355 $userid = t(getId($userip));1356 $sub = t((string)filter_input(INPUT_POST,'sub'));1357 $name = t((string)filter_input(INPUT_POST,'name'));1358 $com = t((string)filter_input(INPUT_POST,'com'));1359 $url = t((string)filter_input(INPUT_POST,'url',FILTER_VALIDATE_URL));1360 $id = t((string)filter_input(INPUT_POST,'id'));//intの範囲外1361 $no = t((string)filter_input(INPUT_POST,'no',FILTER_VALIDATE_INT));1362 1363 $pwd=(string)filter_input(INPUT_POST,'pwd');1364 $pwdc=(string)filter_input(INPUT_COOKIE,'pwdc');1365 $pwd = $pwd ? $pwd : $pwdc;1366 session_sta();1367 $admindel=admindel_valid();1368 $userdel=isset($_SESSION['userdel'])&&($_SESSION['userdel']==='userdel_mode');1369 if(!($admindel||($userdel&&$pwd))){1370 return error($en?'The operation failed.':'失敗しました。');1371 }1372 //NGワードがあれば拒絶1373 Reject_if_NGword_exists_in_the_post();1374 //POSTされた値をログファイルに格納する書式にフォーマット1375 $formatted_post=create_formatted_text_from_post($name,$sub,$url,$com);1376 $name = $formatted_post['name'];1377 $sub = $formatted_post['sub'];1378 $url = $formatted_post['url'];1379 $com = $formatted_post['com'];1380 if(!$name){1381 if($name_input_required){1382 return error($en?'Please enter your name.':'名前がありません。');1383 }else{1384 $name='anonymous';1385 }1386 }1387 //ログ読み込み1388 if(!is_file(LOG_DIR."{$no}.log")){1389 return error($en? 'The article does not exist.':'記事がありません。');1390 }1391 $fp=fopen(LOG_DIR."alllog.log","r+");1392 flock($fp, LOCK_EX);1393 $r_arr=[];1394 $rp=fopen(LOG_DIR."{$no}.log","r+");1395 flock($rp, LOCK_EX);1396 while ($line = fgets($rp)) {1397 if(!trim($line)){1398 continue;1399 }1400 $r_arr[]=$line;1401 }1402 if(empty($r_arr)){1403 closeFile($rp);1404 closeFile($fp);1405 return error($en?'The operation failed.':'失敗しました。');1406 }1407 $flag=false;1408 foreach($r_arr as $i => $line){1409 list($_no,$_sub,$_name,$_verified,$_com,$_url,$_imgfile,$_w,$_h,$_thumbnail,$_painttime,$_log_md5,$_tool,$_pchext,$_time,$_first_posted_time,$_host,$_userid,$_hash,$_oya)=explode("\t",trim($line));1410 if($id===$_time && $no===$_no){1411 if($admindel||(check_elapsed_days($_time)&&$pwd&&password_verify($pwd,$_hash))){1412 $flag=true;1413 break;1414 }1415 }1416 }1417 if(!$flag){1418 closeFile($rp);1419 closeFile($fp);1420 return error($en?'The operation failed.':'失敗しました。');1421 }1422 if(!$_imgfile && !$com){1423 closeFile($rp);1424 closeFile($fp);1425 return error($en?'Please write something.':'何か書いて下さい。');1426 }1427 $sub=($_oya==='res') ? $_sub : $sub; 1428 $sub=(!$sub) ? ($en? 'No subject':'無題') : $sub;1429 $new_line= "$_no\t$sub\t$name\t$_verified\t$com\t$url\t$_imgfile\t$_w\t$_h\t$_thumbnail\t$_painttime\t$_log_md5\t$_tool\t$_pchext\t$_time\t$_first_posted_time\t$host\t$userid\t$_hash\t$_oya\n";1430 $r_arr[$i] = $new_line;1431 if($_oya==='oya'){1432 $alllog_arr=[];1433 while ($_line = fgets($fp)) {1434 if(!trim($_line)){1435 continue;1436 }1437 $alllog_arr[]=$_line; 1438 }1439 if(empty($alllog_arr)){1440 closeFile($rp);1441 closeFile($fp);1442 return error($en?'The operation failed.':'失敗しました。');1443 }1444 $flag=false;1445 foreach($alllog_arr as $i => $val){1446 list($no_,$sub_,$name_,$verified_,$com_,$url_,$imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5_,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_) = explode("\t",trim($val));1447 if(($id===$time_ && $no===$no_) &&1448 ($admindel || ($pwd && password_verify($pwd,$hash_)))){1449 $alllog_arr[$i] = $new_line;1450 $flag=true;1451 break;1452 }1453 }1454 if(!$flag){1455 closeFile($rp);1456 closeFile($fp);1457 return error($en?'The operation failed.':'失敗しました。');1458 }1459 writeFile($fp,implode("",$alllog_arr));1460 }1461 writeFile($rp, implode("", $r_arr));1462 closeFile($rp);1463 closeFile($fp);1464 unset($_SESSION['userdel']);1465 return header('Location: ./?resno='.$no.'#'.$_time);1466}1467//記事削除1468function del(){1469 global $en;1470 $pwd=(string)filter_input(INPUT_POST,'pwd');1471 $pwdc=(string)filter_input(INPUT_COOKIE,'pwdc');1472 $pwd = $pwd ? $pwd : $pwdc;1473 check_csrf_token();1474 session_sta();1475 $admindel=admindel_valid();1476 $userdel_mode=isset($_SESSION['userdel'])&&($_SESSION['userdel']==='userdel_mode');1477 if(!($admindel||($userdel_mode&&$pwd))){1478 return error($en?'The operation failed.':'失敗しました。');1479 }1480 $id_and_no=(string)filter_input(INPUT_POST,'id_and_no');1481 if(!$id_and_no){1482 return error($en?'Please select an article.':'記事が選択されていません。');1483 }1484 $id=$no='';1485 if($id_and_no){1486 list($id,$no)=explode(",",trim($id_and_no));1487 }1488 $fp=fopen(LOG_DIR."alllog.log","r+");1489 flock($fp, LOCK_EX);1490 if(!is_file(LOG_DIR."{$no}.log")){1491 return error($en? 'The article does not exist.':'記事がありません。');1492 }1493 $rp=fopen(LOG_DIR."{$no}.log","r+");1494 flock($rp, LOCK_EX);1495 $r_arr=[];1496 while ($r_line = fgets($rp)) {1497 if(!trim($r_line)){1498 continue;1499 }1500 $r_arr[]=$r_line;1501 }1502 if(empty($r_arr)){1503 closeFile ($rp);1504 closeFile($fp);1505 return error($en?'The operation failed.':'失敗しました。');1506 }1507 $find=false;1508 foreach($r_arr as $i =>$val){1509 list($_no,$sub,$name,$verified,$com,$url,$imgfile,$w,$h,$thumbnail,$painttime,$log_md5,$tool,$pchext,$time,$first_posted_time,$host,$userid,$hash,$oya)=explode("\t",trim($val));1510 if($id===$time && $no===$_no){1511 1512 if(!$admindel){1513 if(!$pwd||!password_verify($pwd,$hash)){1514 closeFile ($rp);1515 closeFile($fp);1516 return error($en?'The operation failed.':'失敗しました。');1517 }1518 }1519 if($oya==='oya'){//スレッド削除1520 $alllog_arr=[];1521 while ($_line = fgets($fp)) {1522 if(!trim($_line)){1523 continue;1524 }1525 $alllog_arr[]=$_line; 1526 }1527 if(empty($alllog_arr)){1528 closeFile ($rp);1529 closeFile($fp);1530 return error($en?'The operation failed.':'失敗しました。');1531 }1532 $flag=false;1533 foreach($alllog_arr as $i =>$_val){//全体ログ1534 list($no_,$sub_,$name_,$verified_,$com_,$url_,$_imgfile_,$w_,$h_,$thumbnail_,$painttime_,$log_md5_,$tool_,$pchext_,$time_,$first_posted_time_,$host_,$userid_,$hash_,$oya_)=explode("\t",trim($_val));1535 if(($id===$time_ && $no===$no_) &&1536 ($admindel || ($pwd && password_verify($pwd,$hash_)))){1537 unset($alllog_arr[$i]);1538 $flag=true;1539 break;1540 }1541 }1542 if(!$flag){1543 closeFile ($rp);1544 closeFile($fp);1545 return error($en?'The operation failed.':'失敗しました。');1546 }1547 foreach($r_arr as $r_line) {//レスファイル1548 list($_no,$_sub,$_name,$_verified,$_com,$_url,$_imgfile,$_w,$_h,$_thumbnail,$_painttime,$_log_md5,$_tool,$_pchext,$_time,$_first_posted_time,$_host,$_userid,$_hash,$_oya)=explode("\t",trim($r_line));1549 1550 delete_files ($_imgfile, $_time);//一連のファイルを削除1551 1552 }1553 writeFile($fp,implode("",$alllog_arr));1554 safe_unlink(LOG_DIR.$no.'.log');1555 1556 }else{1557 unset($r_arr[$i]);1558 delete_files ($imgfile, $time);//一連のファイルを削除1559 writeFile ($rp,implode("",$r_arr));1560 }1561 $find=true;1562 break;1563 }1564 }1565 closeFile ($rp);1566 closeFile($fp);1567 if(!$find){1568 return error($en?'The article was not found.':'記事が見つかりません。');1569 }1570 unset($_SESSION['userdel']);1571 $resno=(string)filter_input(INPUT_POST,'postresno');1572 //多重送信防止1573 if(filter_input(INPUT_POST,'resmode')==='true'){1574 if(!is_file(LOG_DIR.$resno.'.log')){1575 return header('Location: ./');1576 }1577 return header('Location: ./?resno='.$resno);1578 }1579 return header('Location: ./?page='.filter_input(INPUT_POST,'postpage'));1580}...

Full Screen

Full Screen

EditFile.php

Source:EditFile.php Github

copy

Full Screen

1<?php2require_once 'Zend/Controller/Plugin/Abstract.php';3class Common_Plugin_EditFile extends Zend_Controller_Plugin_Abstract4{5 var $fPoint; //文件指针 6 var $fName; //文件名称 7 var $Count; //文件行数8 9 //按指定条件打开文件并锁定 |LOCK_SH:读|LOCK_EX:写|LOCK_UN:释放|LOCK_NB| 10 function OpenFile($Method="r",$Lock=LOCK_SH) 11 { 12 if(($Method == 'r' or $Method == 'r+') && !file_exists($this->fName)) 13 { 14 return false; 15 } 16 else 17 { 18 $this->fPoint = fopen($this->fName,$Method); 19 flock($this->fPoint,$Lock); 20 return true; 21 } 22 } 23 24 //关闭文件 25 function CloseFile() 26 { 27 if(isset($this->fPoint)) 28 { 29 flock($this->fPoint,LOCK_UN); 30 fclose($this->fPoint); 31 return true; 32 } 33 else 34 { 35 return false; 36 } 37 } 38 39 //读文件到<数组>,文件每行作数组的值,返回一维数组 40 function FileToArr() 41 { 42 if(file_exists($this->fName)) 43 { 44 $rArr = file($this->fName); 45 return $rArr; 46 } 47 else 48 { 49 return array(); 50 } 51 } 52 53 //读指定长度的文件到<字符串>,没有指定返回全部 54 function FileToStr($Size=0) 55 { 56 if($this->OpenFile()) 57 { 58 if ($Size < 1) 59 { 60 $Size = filesize($this->fName); 61 } 62 $rStr = fread($this->fPoint,$Size); 63 rewind($this->fPoint); 64 $this->CloseFile(); 65 return $rStr; 66 } 67 else 68 { 69 return ""; 70 } 71 } 72 //更改指定行的字符 73 function ModifyStr($id,$Data) 74 { 75 if($this->OpenFile('r+',LOCK_EX)) 76 { 77 $Next = 0; //初始行计数 78 while(!feof($this->fPoint)) 79 { 80 $Tell = ftell($this->fPoint); //保存开始读取的位置 81 $Temp = fgets($this->fPoint,filesize($this->fName)*1024); //逐行读取 82 $Next++; 83 if($Next == $id) 84 { 85 $Str = fread($this->fPoint,filesize($this->fName)*1024); 86 $Len = strlen($Temp); 87 fseek($this->fPoint,$Tell); //回绕当行开始处 88 $Write = str_pad($Data,$Len,"\x0E",STR_PAD_LEFT).$Str; 89 fputs($this->fPoint,$Write); //把新串写入文件 90 break; 91 } 92 } 93 $this->CloseFile(); 94 return true; 95 } 96 else 97 { 98 return false; 99 } 100 } 101 102 //删除指定行的字符 103 function DeleteStr($id,$Data) 104 { 105 if($this->OpenFile('r+',LOCK_EX)) 106 { 107 $Next = 0; //初始行计数 108 while(!feof($this->fPoint)) 109 { 110 $Tell = ftell($this->fPoint); //保存开始读取的位置 111 $Temp = fgets($this->fPoint,filesize($this->fName)*1024); //逐行读取 112 $Next++; 113 if($Next == $id) 114 { 115 $Len = strlen($Data); 116 fseek($this->fPoint,$Tell); //回绕当行开始处 117 $Write = str_pad("\x0E",$Len,"\x0E",STR_PAD_LEFT); 118 fputs($this->fPoint,$Write); //把新串写入文件 119 break; 120 } 121 } 122 $this->CloseFile(); 123 return true; 124 } 125 else 126 { 127 return false; 128 } 129 } 130 //获取总行数131 function GetCount() 132 { 133 return count($this->FileToArr()); 134 } 135 136 //写入字符串到文件尾,如果文件不存在则新建 137 function WriteToEnd($String) 138 { 139 if($this->OpenFile("a",LOCK_EX)) 140 { 141 fputs($this->fPoint,$String); 142 $this->CloseFile(); 143 return true; 144 } 145 else 146 { 147 return false; 148 } 149 } 150 151 //覆盖写入字符串,如果文件不存在则新建 152 function WriteToNull($String) 153 { 154 if($this->OpenFile("w",LOCK_EX)) 155 { 156 fputs($this->fPoint,$String); 157 $this->CloseFile(); 158 return true; 159 } 160 else 161 { 162 return false; 163 } 164 } 165}166?>...

Full Screen

Full Screen

CityRepositoryTest.php

Source:CityRepositoryTest.php Github

copy

Full Screen

...7{8 /**9 * Factors:10 * - loadFile true/false11 * - closeFile true/false12 * - file Lines 0/or have it13 * Equivalence Classes:14 * - file has 0 line - loadFile true - closeFile true15 * - file has 0 line - loadFile true - closeFile false16 * - file has 0 line - loadFile false - closeFile true17 * - file has 0 line - loadFile false - closeFile false18 *19 * - file has lines - loadFile true - closeFile false20 * - file has lines - loadFile true - closeFile false21 * - file has lines - loadFile false - closeFile false22 * - file has lines - loadFile false - closeFile false23 * Limit values24 * - file has 1 line or have N don't change result limit are in 1 line25 */26 public function testGetCitiesOnEmptyFileCanLoadFileCanCloseFileReturnNull()27 {28 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();29 $cityRepository->shouldReceive('getLine')->andReturn(false);30 $cityRepository->shouldReceive('loadFile')->andReturn(true);31 $cityRepository->shouldReceive('closeFile')->andReturn(true);32 /** @var CityRepository $cityRepository */33 $this->assertNull($cityRepository->getCities());34 }35 public function testGetCitiesOnEmptyFileCanLoadFileCantCloseFileReturnNull()36 {37 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();38 $cityRepository->shouldReceive('getLine')->andReturn(false);39 $cityRepository->shouldReceive('loadFile')->andReturn(true);40 $cityRepository->shouldReceive('closeFile')->andReturn(false);41 /** @var CityRepository $cityRepository */42 $this->assertNull($cityRepository->getCities());43 }44 public function testGetCitiesOnEmptyFileCantLoadFileCanCloseFileReturnNull()45 {46 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();47 $cityRepository->shouldReceive('getLine')->andReturn(false);48 $cityRepository->shouldReceive('loadFile')->andReturn(false);49 $cityRepository->shouldReceive('closeFile')->andReturn(true);50 /** @var CityRepository $cityRepository */51 $this->assertNull($cityRepository->getCities());52 }53 public function testGetCitiesOnEmptyFileCantLoadFileCantCloseFileReturnNull()54 {55 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();56 $cityRepository->shouldReceive('getLine')->andReturn(false);57 $cityRepository->shouldReceive('loadFile')->andReturn(false);58 $cityRepository->shouldReceive('closeFile')->andReturn(false);59 /** @var CityRepository $cityRepository */60 $this->assertNull($cityRepository->getCities());61 }62 public function testGetCitiesOnNotEmptyFileCanLoadFileCanCloseFileReturnArray()63 {64 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();65 $cityRepository->shouldReceive('getLine')->andReturn(CityRepositoryBuilder::VALID_MULTI_WORD_NAME_CITY_STRING, false);66 $cityRepository->shouldReceive('loadFile')->andReturn(true);67 $cityRepository->shouldReceive('closeFile')->andReturn(true);68 /** @var CityRepository $cityRepository */69 $this->assertIsArray($cityRepository->getCities());70 }71 public function testGetCitiesOnNotEmptyFileCanLoadFileCantCloseFileReturnNull()72 {73 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();74 $cityRepository->shouldReceive('getLine')->andReturn(CityRepositoryBuilder::VALID_MULTI_WORD_NAME_CITY_STRING, false);75 $cityRepository->shouldReceive('loadFile')->andReturn(true);76 $cityRepository->shouldReceive('closeFile')->andReturn(false);77 /** @var CityRepository $cityRepository */78 $this->assertNull($cityRepository->getCities());79 }80 public function testGetCitiesOnNotEmptyFileCantLoadFileCanCloseFileReturnNull()81 {82 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();83 $cityRepository->shouldReceive('getLine')->andReturn(CityRepositoryBuilder::VALID_MULTI_WORD_NAME_CITY_STRING, false);84 $cityRepository->shouldReceive('loadFile')->andReturn(false);85 $cityRepository->shouldReceive('closeFile')->andReturn(true);86 /** @var CityRepository $cityRepository */87 $this->assertNull($cityRepository->getCities());88 }89 public function testGetCitiesOnNotEmptyFileCantLoadFileCantCloseFileReturnNull()90 {91 $cityRepository = Mockery::mock(CityRepository::class)->makePartial();92 $cityRepository->shouldReceive('getLine')->andReturn(CityRepositoryBuilder::VALID_MULTI_WORD_NAME_CITY_STRING, false);93 $cityRepository->shouldReceive('loadFile')->andReturn(false);94 $cityRepository->shouldReceive('closeFile')->andReturn(false);95 /** @var CityRepository $cityRepository */96 $this->assertNull($cityRepository->getCities());97 }98}...

Full Screen

Full Screen

closeFile

Using AI Code Generation

copy

Full Screen

1$file->closeFile();2$file->closeFile();3$file->closeFile();4$file->closeFile();5$file->closeFile();6$file->closeFile();7$file->closeFile();8$file->closeFile();9$file->closeFile();10$file->closeFile();11Use of fclose() function in PHP:12fclose(file_pointer);13Example: Use of fclose() function in PHP14$file_pointer = fopen("file.txt", "r");15fclose($file_pointer);

Full Screen

Full Screen

closeFile

Using AI Code Generation

copy

Full Screen

1$file->closeFile();2$file->openFile();3$file->closeFile();4class file {5 public static function openFile() {6";7 }8 public static function closeFile() {9";10 }11}12file::closeFile();13file::openFile();14file::closeFile();

Full Screen

Full Screen

closeFile

Using AI Code Generation

copy

Full Screen

1require_once('file.php');2$file = new file();3$file->closeFile();4require_once('file.php');5$file = new file();6$file->closeFile();

Full Screen

Full Screen

closeFile

Using AI Code Generation

copy

Full Screen

1$fileobj = new File();2$fileobj->closeFile();3$fileobj = new File();4$fileobj->openFile();5include_once 'file name';6require_once 'file name';7$fileobj = new File();8$fileobj->closeFile();9$fileobj = new File();10$fileobj->openFile();11{12 function openFile()13 {14 echo "File Opened";15 }16 function closeFile()17 {18 echo "File Closed";19 }20}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful