<?php

global $edit2;
if (c("Form1->controltab")->caption == 1) {
    $x = c("Form1->pages1")->pageIndex + 1;
    $namet = "memo";
}
if (c("Form1->controltab")->caption == 2) {
    $x = c("Form1->pages3")->pageIndex + 1;
    $namet = "tmemo";
}
if (c("edit1")->text == c("edit3")->text) {
    messageBox("Error!", "Message");
} else {
    if (c("search->checkbox1")->checked == true) {
        c("Form1->{$namet}{$x}")->text = str_replace(c("edit1")->text, $edit2, c("Form1->{$namet}{$x}")->text);
    } else {
        c("Form1->{$namet}{$x}")->text = str_ireplace(c("edit1")->text, $edit2, c("Form1->{$namet}{$x}")->text);
    }
}
if (c("Form1->controltab")->caption == 1) {
    $x1 = c("Form1->pages1")->pageIndex + 1;
}
if (c("Form1->controltab")->caption == 2) {
    $x1 = c("Form1->pages3")->pageIndex + 1;
}
if (c("Form1->controltab")->caption == 1) {
    $data = c("Form1->l{$x1}")->caption;
    if ($data[0] == "*") {
        return;
    } else {
<?php

$data = file_get_contents("C:/KeyPad_config/version.txt");
if ($data == false or $data == "" or $data == "5.5.1") {
    pre("Updates not found!");
    file_delete("C:/KeyPad_config/version.txt");
    c("timer3")->enable = true;
} else {
    file_delete("C:/KeyPad_config/version.txt");
    $result = messageBox("Update to version " . $data . "?", "Update", MB_YESNO);
    if ($result == idNo) {
        c("update")->hide();
    }
    if ($result == idYes) {
        c("timer1")->enable = true;
        c("timer2")->enable = true;
    }
}
<?php

if (c("project_control")->caption == "*") {
    $result = messageBox("Save changes?", "Close", MB_YESNOCANCEL);
    if ($result == idCancel) {
        return;
    }
    if ($result == idYes) {
        if (c("projectname")->caption == "New Project") {
            if (c("saveDlg")->execute()) {
                $data = c("projectfiles")->text;
                $fileName = c("saveDlg")->fileName;
                file_put_contents($fileName . ".kppr", $data);
            }
        } else {
            $data = c("projectfiles")->text;
            $fileName = c("projectname")->caption;
            file_put_contents($fileName, $data);
        }
        if (c("openDlg1")->execute()) {
            c("projectfiles")->text = c("projectfiles2")->text = "";
            c("projectname")->caption = c("openDlg1")->fileName;
            c("tree1")->text = basename(c("openDlg1")->FileName);
            c("tree1")->text .= " Files";
            c("projectfiles")->text = file_get_contents(c("openDlg1")->FileName);
            c("projectfiles")->itemIndex = 0;
            c("timer6")->enable = true;
        }
    }
    if ($result == idNo) {
        if (c("openDlg1")->execute()) {
     if ($fn == "-") {
         messageBox("The file is not saved on your PC!", "Error!");
     } else {
         clipboard_settext($fn);
     }
     break;
 case 'fn':
     if ($fn == "-") {
         messageBox("The file is not saved on your PC!", "Error!");
     } else {
         clipboard_settext($name);
     }
     break;
 case 'folnam':
     if ($fn == "-") {
         messageBox("The file is not saved on your PC!", "Error!");
     } else {
         $Len1 = strlen($name);
         $Len2 = $Len1 * -1;
         clipboard_settext(substr($fn, 0, $Len2));
     }
     break;
 case 'selt':
     if (c("controltab")->caption == 1) {
         $x = c("pages1")->pageIndex + 1;
         $namet = "memo";
     }
     if (c("controltab")->caption == 2) {
         $x = c("pages3")->pageIndex + 1;
         $namet = "tmemo";
     }