function ftp_zip($conn_id, $directory, $list, $zipactions, $zipdir, $divelevel)
{
    // --------------
    // This function allows to download/save/email a zipfile which contains the selected directories and files
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result, $net2ftp_output;
    // -------------------------------------------------------------------------
    // Initialization
    // -------------------------------------------------------------------------
    if ($divelevel == 0) {
        // Create the zipfile
        $net2ftp_globals["zipfile"] = new zipfile();
        $timenow = time();
        $zipdir = "";
        // Open the connection
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // For all directories...
    // -------------------------------------------------------------------------
    for ($i = 1; $i <= $list["stats"]["directories"]["total_number"]; $i = $i + 1) {
        $newdir = glueDirectories($directory, $list["directories"][$i]["dirfilename"]);
        $newzipdir = glueDirectories($zipdir, $list["directories"][$i]["dirfilename"]);
        $newdivelevel = $divelevel + 1;
        // Check if the directory contains a banned keyword
        if ($list["directories"][$i]["selectable"] == "banned_keyword") {
            continue;
        }
        // Get a new list
        $newlist = ftp_getlist($conn_id, $newdir);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        ftp_zip($conn_id, $newdir, $newlist, $zipactions, $newzipdir, $newdivelevel);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
            continue;
        }
        if ($divelevel == 0 && ($zipactions["save"] == "yes" || $zipactions["email"] == "yes")) {
            $total = $list["stats"]["directories"]["total_number"] + $list["stats"]["files"]["total_number"];
            setStatus($i, $total, __("Processing the entries"));
        }
    }
    // end for directories
    // -------------------------------------------------------------------------
    // For all files...
    // -------------------------------------------------------------------------
    for ($i = 1; $i <= $list["stats"]["files"]["total_number"]; $i = $i + 1) {
        if ($list["files"][$i]["selectable"] != "ok") {
            continue;
        }
        $text = ftp_readfile($conn_id, $directory, $list["files"][$i]["dirfilename"]);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
            continue;
        }
        $filename = stripDirectory(glueDirectories($zipdir, $list["files"][$i]["dirfilename"]));
        $net2ftp_globals["zipfile"]->addFile($text, $filename);
        if ($divelevel == 0 && ($zipactions["save"] == "yes" || $zipactions["email"] == "yes")) {
            $total = $list["stats"]["directories"]["total_number"] + $list["stats"]["files"]["total_number"];
            setStatus($list["stats"]["directories"]["total_number"] + $i - 1, $total, __("Processing the entries"));
        }
    }
    // end for files
    // -------------------------------------------------------------------------
    // End
    // -------------------------------------------------------------------------
    if ($divelevel == 0) {
        // ------------------------
        // Send the zipfile to the browser
        // ------------------------
        if ($zipactions["download"] == "yes") {
            $timenow = time();
            $filenameToSend = "net2ftp-" . $timenow . ".zip";
            $filesizeToSend = strlen($net2ftp_globals["zipfile"]->file());
            sendDownloadHeaders($filenameToSend, $filesizeToSend);
            echo $net2ftp_globals["zipfile"]->file();
            flush();
        }
        // ------------------------
        // Save the zipfile string to a file
        // ------------------------
        if ($zipactions["save"] == "yes" || $zipactions["email"] == "yes") {
            $string = $net2ftp_globals["zipfile"]->file();
            $tempfilename = tempnam($net2ftp_globals["application_tempdir"], "zip__");
            if ($tempfilename == false) {
                @unlink($tempfilename);
                $errormessage = __("Unable to create the temporary file. Check the permissions of the %1\$s directory.", $net2ftp_globals["application_tempdir"]);
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            registerTempfile("register", $tempfilename);
            local_writefile($tempfilename, $string);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
        // ------------------------
        // Save the zip file to the FTP server
        // ------------------------
        if ($zipactions["save"] == "yes") {
            ftp_putfile($conn_id, "", $tempfilename, $directory, $zipactions["save_filename"], FTP_BINARY, "copy");
            if ($net2ftp_result["success"] == false) {
                @unlink($tempfilename);
                //				$errormessage = __("Unable to put the file <b>%1\$s</b> on the FTP server.<br />You may not have write permissions on the directory.", $zipactions["save_filename"]);
                //				setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            } else {
                $net2ftp_output["ftp_zip"][] = __("The zip file has been saved on the FTP server as <b>%1\$s</b>", $zipactions["save_filename"]) . "<br /><br />\n";
            }
        }
        // ------------------------
        // Close the connection
        // ------------------------
        ftp_closeconnection($conn_id);
        // ------------------------
        // Email
        // ------------------------
        if ($zipactions["email"] == "yes") {
            $FromName = "net2ftp";
            $From = $net2ftp_settings["email_feedback"];
            $ToName = "";
            $To = $zipactions["email_to"];
            $Subject = __("Requested files");
            // Email message
            $Text = __("Dear,") . "\n\n";
            $Text .= __("Someone has requested the files in attachment to be sent to this email account (%1\$s).", $To) . "\n";
            $Text .= __("If you know nothing about this or if you don't trust that person, please delete this email without opening the Zip file in attachment.") . "\n";
            $Text .= __("Note that if you don't open the Zip file, the files inside cannot harm your computer.") . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("Information about the sender: ") . "\n";
            $Text .= __("IP address: ") . $REMOTE_ADDR . "\n";
            $Text .= __("Time of sending: ") . mytime() . "\n";
            $Text .= __("Sent via the net2ftp application installed on this website: ") . $HTTP_REFERER . "\n";
            $Text .= __("Webmaster's email: ") . $From . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("Message of the sender: ") . "\n";
            $Text .= $zipactions["message"] . "\n";
            $Text .= "\n\n---------------------------------------\n";
            $Text .= __("net2ftp is free software, released under the GNU/GPL license. For more information, go to http://www.net2ftp.com.") . "\n\n\n";
            $AttmFiles = array($tempfilename);
            SendMail($From, $FromName, $To, $ToName, $Subject, $Text, $Html, $AttmFiles);
            if ($net2ftp_result["success"] == false) {
                @unlink($tempfilename);
                return false;
            }
            $net2ftp_output["ftp_zip"][] = __("The zip file has been sent to <b>%1\$s</b>.", $To) . "<br /><br />";
        }
        // ------------------------
        // Delete the temporary zipfile
        // ------------------------
        if ($zipactions["save"] == "yes" || $zipactions["email"] == "yes") {
            $success4 = @unlink($tempfilename);
            if ($success4 == false) {
                $errormessage = __("Unable to delete the temporary file");
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            registerTempfile("unregister", $tempfilename);
        }
        // Set the variable to NULL to save memory
        $net2ftp_globals["zipfile"] = NULL;
    }
    // end if $divelevel == 0
}
    $q->where("data_id % {$modmod} = {$modnum}");
}
var_dump(mytime());
if (!is_null($modnum) && $modnum != 0) {
    do {
        echo "[[ " . mytime() . " ]] [[ TYPE_GEM_TO_GOLD ]] \n";
        $ds = $dm->getGemDataset(GemExchangeDataset::TYPE_GEM_TO_GOLD);
    } while (!$ds->uptodate);
    do {
        echo "[[ " . mytime() . " ]] [[ TYPE_GOLD_TO_GEM ]] \n";
        $ds = $dm->getGemDataset(GemExchangeDataset::TYPE_GOLD_TO_GEM);
    } while (!$ds->uptodate);
}
foreach ($q->find() as $item) {
    do {
        echo "[[ " . mytime() . " ]] [[ {$item->getDataId()} ]] [[ TYPE_SELL_LISTING ]] \n";
        $ds = $dm->getItemDataset($item, ItemDataset::TYPE_SELL_LISTING);
    } while (!$ds->uptodate);
    do {
        echo "[[ " . mytime() . " ]] [[ {$item->getDataId()} ]] [[ TYPE_BUY_LISTING ]] \n";
        $ds = $dm->getItemDataset($item, ItemDataset::TYPE_BUY_LISTING);
    } while (!$ds->uptodate);
    do {
        echo "[[ " . mytime() . " ]] [[ {$item->getDataId()} ]] [[ VOLUME ]] [[ TYPE_SELL_LISTING ]] \n";
        $ds = $dm->getItemVolumeDataset($item, ItemVolumeDataset::TYPE_SELL_LISTING);
    } while (!$ds->uptodate);
    do {
        echo "[[ " . mytime() . " ]] [[ {$item->getDataId()} ]] [[ VOLUME ]] [[ TYPE_BUY_LISTING ]] \n";
        $ds = $dm->getItemVolumeDataset($item, ItemVolumeDataset::TYPE_BUY_LISTING);
    } while (!$ds->uptodate);
}
Exemple #3
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the edit screen
    // For screen == 1, the file is read from the FTP server
    // For screen == 2, the textarea is changed, the file is not read from the FTP server but comes from the HTML form
    // For screen == 3, the file is saved to the FTP server
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
    if (isset($_POST["textareaType"]) == true) {
        $textareaType = validateTextareaType($_POST["textareaType"]);
    } else {
        $textareaType = "";
    }
    if (isset($_POST["text"]) == true) {
        $text = $_POST["text"];
    } else {
        $text = "";
    }
    if (isset($_POST["text_splitted"]) == true) {
        $text_splitted = $_POST["text_splitted"];
    } else {
        $text_splitted = "";
    }
    if (isset($_POST["encodingSelect"]) == true) {
        $encodingSelect = $_POST["encodingSelect"];
    } else {
        $encodingSelect = "";
    }
    if (isset($_POST["breakSelect"]) == true) {
        $breakSelect = $_POST["breakSelect"];
    } else {
        $breakSelect = "";
    }
    $text_encoding_selected = "";
    $line_break_selected = "";
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Form name, back and forward buttons
    $formname = "EditForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // Directory + file name
    $dirfilename = htmlEncode2(glueDirectories($net2ftp_globals["directory"], $net2ftp_globals["entry"]));
    // TextareaSelect onchange
    $onchange = "document.forms['EditForm'].screen.value=2;document.forms['EditForm'].textareaType.value=document.forms['EditForm'].textareaSelect.options[document.forms['EditForm'].textareaSelect.selectedIndex].value;document.forms['EditForm'].submit();";
    // Character encoding (requires multibyte string module to be installed)
    // With this, you can save a text with specified encoding and line break sequence
    // http://www.net2ftp.org/forums/viewtopic.php?id=2449
    if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
        // $textarea_encodings is an array which contains the possible character encodings
        $textarea_encodings = getTextareaEncodingsArray();
        // $textarea_breaks is an array which contains the possible line breaks
        $textarea_breaks[] = "CRLF";
        $textarea_breaks[] = "CR";
        $textarea_breaks[] = "LF";
        // $text_encoding_old is the original encoding which is detected when the file is first read
        // $text_encoding_new is the requested encoding from the drop-down box
        // Default = encoding used for the page, which is defined by the language file in /languages/xx.inc.php
        // HTML uses BIG5, PHP uses BIG-5 (Traditional Chinese)
        // If the HTML encoding is not foreseen in the PHP function, set it to the default ISO-8859-1
        // $text_encoding is changed further on too
        if ($encodingSelect != "" && in_array($encodingSelect, $textarea_encodings)) {
            $text_encoding_new = $encodingSelect;
        } else {
            $text_encoding_new = "";
        }
        // $line_break_old is the original line break which is detected when the file is first read
        // $line_break is the requested line break from the drop-down box
        if ($breakSelect != "" && in_array($breakSelect, $textarea_breaks) == true) {
            $line_break_new = $breakSelect;
        } else {
            $line_break_new = "LF";
        }
    }
    // Programming language (for CodePress syntax highlighting)
    if ($textareaType == "codepress") {
        $filename_extension = get_filename_extension($net2ftp_globals["entry"]);
        if ($filename_extension == "asp") {
            $codepress_programming_language = "asp";
        } elseif ($filename_extension == "css") {
            $codepress_programming_language = "css";
        } elseif ($filename_extension == "cgi") {
            $codepress_programming_language = "perl";
        } elseif ($filename_extension == "htm") {
            $codepress_programming_language = "html";
        } elseif ($filename_extension == "html") {
            $codepress_programming_language = "html";
        } elseif ($filename_extension == "java") {
            $codepress_programming_language = "java";
        } elseif ($filename_extension == "js") {
            $codepress_programming_language = "javascript";
        } elseif ($filename_extension == "javascript") {
            $codepress_programming_language = "javascript";
        } elseif ($filename_extension == "pl") {
            $codepress_programming_language = "perl";
        } elseif ($filename_extension == "perl") {
            $codepress_programming_language = "perl";
        } elseif ($filename_extension == "php") {
            $codepress_programming_language = "php";
        } elseif ($filename_extension == "phps") {
            $codepress_programming_language = "php";
        } elseif ($filename_extension == "phtml") {
            $codepress_programming_language = "php";
        } elseif ($filename_extension == "ruby") {
            $codepress_programming_language = "ruby";
        } elseif ($filename_extension == "sql") {
            $codepress_programming_language = "sql";
        } elseif ($filename_extension == "txt") {
            $codepress_programming_language = "text";
        } else {
            $codepress_programming_language = "generic";
        }
        $codepress_onclick = "text.toggleEditor();";
    } else {
        $codepress_programming_language = "";
        $codepress_onclick = "";
    }
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // Read the remote file (edit), or read the local template (new file)
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Template file
        $templatefile = $net2ftp_globals["application_rootdir"] . "/modules/edit/template.txt";
        // Edit: read the file from the FTP server
        if ($net2ftp_globals["state2"] == "") {
            $text = ftp_readfile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"]);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
            // Character encoding (requires multibyte string module to be installed)
            // Detect the original encoding of the text, and change the encoding of the text to the encoding of the page
            if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
                // Detect original encoding
                $text_encoding_old = mb_detect_encoding($text, $textarea_encodings);
                $text_encoding_selected = $text_encoding_old;
                // If original encoding is detected and different from the page encoding, convert the text to the page encoding
                if ($text_encoding_old != "" && strcasecmp($text_encoding_old, $net2ftp_messages["iso-8859-1"]) != 0) {
                    $text = mb_convert_encoding($text, $net2ftp_messages["iso-8859-1"], $text_encoding_old);
                }
                // Detect original line break
                if (strpos($text, "\r\n") !== false) {
                    $line_break_old = "CRLF";
                } elseif (strpos($text, "\n") !== false) {
                    $line_break_old = "LF";
                } elseif (strpos($text, "\r") !== false) {
                    $line_break_old = "CR";
                } else {
                    $line_break_old = "LF";
                }
                $line_break_selected = $line_break_old;
            }
        } elseif ($net2ftp_globals["state2"] == "newfile") {
            $handle = fopen($templatefile, "r");
            // Open the local template file for reading only
            if ($handle == false) {
                $errormessage = __("Unable to open the template file");
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            clearstatcache();
            // for filesize
            $text = trim(fread($handle, filesize($templatefile)));
            if ($text == false) {
                $errormessage = __("Unable to read the template file");
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            }
            @fclose($handle);
        }
        // Save status
        $savestatus = __("Status: This file has not yet been saved");
        $savestatus_short = __("Not yet saved");
    } elseif ($net2ftp_globals["screen"] == 2) {
        // For HTML WYSIWYG editors, split the HTML
        if (($textareaType == "tinymce" || $textareaType == "ckeditor") && $text_splitted == "") {
            $text_splitted = splitHtml($text, $textareaType);
        } elseif (($textareaType == "plain" || $textareaType == "codepress") && $text == "" && isset($text_splitted["top"]) == true) {
            $text = $text_splitted["top"];
            $text .= $text_splitted["middle"];
            $text .= $text_splitted["bottom"];
        }
        // Save status
        $savestatus = __("Status: This file has not yet been saved");
        $savestatus_short = __("Not yet saved");
    } elseif ($net2ftp_globals["screen"] == 3) {
        // Check if a filename is specified
        if (strlen($net2ftp_globals["entry"]) < 1) {
            $errormessage = __("Please specify a filename");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // For HTML WYSIWYG editors, join the HTML
        if ($textareaType == "tinymce" || $textareaType == "ckeditor") {
            $text = $text_splitted["top"];
            $text .= $text_splitted["middle"];
            $text .= $text_splitted["bottom"];
        }
        // $text_file contains the text which is written to the FTP server
        // It is equal to the text shown on screen, except if a different character encoding is chosen
        $text_file = $text;
        // Character encoding (requires multibyte string module to be installed)
        // Change the encoding of the text from the original or page encoding to the selected encoding
        if (($net2ftp_globals["language"] == "ja" || $net2ftp_globals["language"] == "tc" || $net2ftp_messages["iso-8859-1"] == "UTF-8") && function_exists("mb_detect_encoding") == true) {
            $break_map = array("CRLF" => "\r\n", "CR" => "\r", "LF" => "\n");
            if (isset($break_map[$line_break_new]) == true) {
                $text_file = preg_replace('/(\\r\\n)|\\r|\\n/', $break_map[$line_break_new], $text_file);
            }
            if ($text_encoding_new != "" && strcasecmp($text_encoding_new, $net2ftp_messages["iso-8859-1"]) != 0) {
                $text_file = mb_convert_encoding($text_file, $text_encoding_new, $net2ftp_messages["iso-8859-1"]);
            }
            $text_encoding_selected = $text_encoding_new;
            $line_break_selected = $line_break_new;
        }
        // Write the string to the FTP server
        // Note: this function also replaces CarriageReturn+LineFeed by LineFeed
        ftp_writefile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"], $text_file);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
            // Continue anyway and print warning message
            $savestatus = __("Status: <b>This file could not be saved</b>");
            $savestatus_short = __("Could not be saved");
        } else {
            $mytime = mytime();
            $mytime_short = mytime_short();
            $ftpmode = ftpAsciiBinary($net2ftp_globals["entry"]);
            if ($ftpmode == FTP_ASCII) {
                $printftpmode = "FTP_ASCII";
            } elseif ($ftpmode == FTP_BINARY) {
                $printftpmode = "FTP_BINARY";
            }
            $savestatus = __("Status: Saved on <b>%1\$s</b> using mode %2\$s", $mytime, $printftpmode);
            $savestatus_short = __("Saved at %1\$s", $mytime_short);
        }
    }
    // -------------------------------------------------------------------------
    // Convert special characters to HTML entities
    // -------------------------------------------------------------------------
    // Plain textarea
    if ($textareaType == "" || $textareaType == "plain") {
        $text = htmlspecialchars($text, ENT_QUOTES);
    } elseif ($textareaType == "ckeditor") {
        $text_splitted["top"] = htmlspecialchars($text_splitted["top"], ENT_QUOTES);
        $text_splitted["bottom"] = htmlspecialchars($text_splitted["bottom"], ENT_QUOTES);
        // Do not encode the middle part, this is done by CKEditor itself
        //		$text_splitted["middle"] = htmlspecialchars($text_splitted["middle"], ENT_QUOTES);
    } elseif ($textareaType == "tinymce") {
        $text_splitted["top"] = htmlspecialchars($text_splitted["top"], ENT_QUOTES);
        $text_splitted["middle"] = htmlspecialchars($text_splitted["middle"], ENT_QUOTES);
        $text_splitted["bottom"] = htmlspecialchars($text_splitted["bottom"], ENT_QUOTES);
    } elseif ($textareaType == "codepress") {
        $text = htmlspecialchars($text, ENT_QUOTES);
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/edit.template.php";
}
Exemple #4
0
</td></tr><tr><td align="right" class="footer"><hr color="#000000" noshade><strong>5186-F Longs Peak Road Berthoud, Colorado 80513</strong><br>&copy 2006<?php 
if (date('Y', mytime()) > 2006) {
    echo "-" . date('Y', mytime());
}
?>
 Colorado WaterJet Company.  All rights Reserved.<br>Web site crafted by <a href='http://www.claypotconsulting.com' target='_blank'>Clay Pot Consulting, LLC</a>.<br><img src="/images/clear.gif" height="10" border="0"><br>&nbsp;</td></tr></table>
</td></tr>
</table>
</body>
</html>



function putLogStatus($logStatus)
{
    // --------------
    // This function writes the log rotation status to the database.
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Initial checks
    // -------------------------------------------------------------------------
    // Verify if a database is used. If not: don't continue.
    if ($net2ftp_settings["use_database"] != "yes") {
        return true;
    }
    // -------------------------------------------------------------------------
    // Determine current month and last month
    // -------------------------------------------------------------------------
    $currentmonth = date("Ym");
    // e.g. 201207
    $lastmonth = date("Ym", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
    $datetime = mytime();
    // -------------------------------------------------------------------------
    // Connect to the database
    // -------------------------------------------------------------------------
    $mydb = connect2db();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // -------------------------------------------------------------------------
    // Put log rotation status
    // -------------------------------------------------------------------------
    $sqlquery1 = "SELECT status, changelog FROM net2ftp_log_status WHERE month = '{$currentmonth}';";
    $result1 = mysql_query("{$sqlquery1}");
    $nrofrows1 = mysql_num_rows($result1);
    if ($nrofrows1 == 1) {
        $resultRow1 = mysql_fetch_row($result1);
        $logStatus_old = $resultRow1[0];
        $changelog_old = $resultRow1[1];
        $changelog_new = $changelog_old . "From {$logStatus_old} to {$logStatus} on {$datetime}. ";
        $sqlquery2 = "UPDATE net2ftp_log_status SET status = '" . $logStatus . "', changelog = '" . $changelog_new . "' WHERE month = '{$currentmonth}';";
        $result2 = mysql_query("{$sqlquery2}");
        $nrofrows2 = mysql_affected_rows($mydb);
    } elseif ($nrofrows1 == 0) {
        $changelog_new = "Set to {$logStatus} on {$datetime}. ";
        $sqlquery3 = "INSERT INTO net2ftp_log_status VALUES('{$currentmonth}', '" . $logStatus . "', '" . $changelog_new . "');";
        $result3 = mysql_query("{$sqlquery3}");
        $nrofrows3 = mysql_affected_rows($mydb);
        if ($nrofrows3 != 1) {
            setErrorVars(false, __("Table net2ftp_log_status could not be updated."), debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
    } else {
        setErrorVars(false, __("Table net2ftp_log_status contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    // -------------------------------------------------------------------------
    // Return true
    // -------------------------------------------------------------------------
    return true;
}
Exemple #6
0
<?php 
if ($action == 'contact') {
    $msg = "Name: " . trim(stripslashes($name)) . "\n";
    if ($accountrow["accountid"]) {
        $msg .= "Account ID: " . $accountrow["accountid"] . "\n";
    }
    $msg .= "Email: " . trim($email) . "\n";
    $msg .= "Phone: " . trim($phone) . "\n";
    $msg .= "Company: " . trim($company) . "\n\n";
    $msg .= trim(stripslashes($comments));
    if (strlike($msg, "cc:")) {
        $error = "Your message could not be sent.  The string \"cc:\" is not allowed.  Please try again.";
        echo $error;
    } else {
        @mysql_query("INSERT INTO contacts (accountid,timestamp,name,email,phone,company,comments) VALUES (\"" . $accountrow["accountid"] . "\",\"" . mytime() . "\",\"{$name}\",\"{$email}\",\"{$phone}\",\"{$company}\",\"{$comments}\")");
        mail("*****@*****.**", "coloradowaterjet.com contact", $msg);
        echo "Thank you for submitting the contact form.  We will get in touch with you as soon as possible.";
        include 'footer.php';
        exit;
    }
}
?>


<p>Send us an email by using the form below or use our <a href='/quote/index.php'>Request A Quote Form</a>.</p>


<script language="javascript">
function verify(f){
	var msg='The form could not be submitted due to the following error(s):\n';
Exemple #7
0
function overview()
{
    global $evalset;
    global $experiment, $comment;
    global $task, $user, $setup;
    global $dir;
    global $has_analysis;
    $has_analysis = array();
    head("Task: {$task} ({$user})");
    print "<a href=\"http://www.statmt.org/wiki/?n=Experiment.{$setup}\">Wiki Notes</a>";
    print " &nbsp; &nbsp; | &nbsp; &nbsp; <a href=\"?\">Overview of experiments</a> &nbsp; &nbsp; | &nbsp; &nbsp; <code>{$dir}</code><p>";
    reset($experiment);
    print "<form action=\"\" method=get>\n";
    output_state_for_form();
    // count how many analyses there are for each test set
    while (list($id, $info) = each($experiment)) {
        reset($evalset);
        while (list($set, $dummy) = each($evalset)) {
            $analysis = "{$dir}/evaluation/{$set}.analysis.{$id}";
            $report_info = "{$dir}/steps/{$id}/REPORTING_report.{$id}.INFO";
            // does the analysis file exist?
            if (file_exists($analysis)) {
                if (!array_key_exists($set, $has_analysis)) {
                    $has_analysis[$set] = 0;
                }
                $has_analysis[$set]++;
            }
        }
    }
    reset($experiment);
    print "<table border=1 cellpadding=1 cellspacing=0>\n<tr><td><input type=submit name=diff value=\"compare\"></td>\n    <td align=center>ID</td>\n    <td align=center>start</td>\n    <td align=center>end</td>\n";
    reset($evalset);
    while (list($set, $dummy) = each($evalset)) {
        if (array_key_exists($set, $has_analysis)) {
            print "<td align=center colspan=2>";
            if ($has_analysis[$set] >= 2) {
                print " <input type=submit name=\"analysis_diff_home\" value=\"{$set}\">";
            } else {
                print $set;
            }
            print "</td>";
        } else {
            print "<td align=center>{$set}</td>";
        }
    }
    print "</tr>\n";
    while (list($id, $info) = each($experiment)) {
        $state = return_state_for_link();
        print "<tr id=\"row-{$id}\" onMouseOver=\"highlightLine({$id});\" onMouseOut=\"highlightBest();\"><td><input type=checkbox name=run[] value={$id}><a href=\"?{$state}&show=config.{$id}\">cfg</a>|<a href=\"?{$state}&show=parameter.{$id}\">par</a>|<a href=\"?{$state}&show=graph.{$id}.png\">img</a></td><td><span id=run-{$setup}-{$id}><a href='javascript:createCommentBox(\"{$setup}-{$id}\");'>[{$setup}-{$id}]</a>";
        if (array_key_exists("{$setup}-{$id}", $comment)) {
            print " " . $comment["{$setup}-{$id}"]->name;
        }
        print "</span></td><td align=center>" . mytime($info->start, 0) . "</td><td align=center>";
        if (mytime($info->end, 1) == "running") {
            print "<font size=-2>" . $info->last_step;
            if ($info->last_step == "TUNING<BR>tune") {
                print "<BR>" . tune_status($id);
            } else {
                if ($info->last_step == "TRAINING<BR>run-giza" || $info->last_step == "TRAINING<BR>run-giza-inverse" || preg_match('/EVALUATION.+decode/', $info->last_step, $dummy) || $info->last_step == "TRAINING<BR>extract-phrases") {
                    $module_step = explode("<BR>", $info->last_step);
                    $step_file = "{$dir}/steps/{$id}/{$module_step['0']}_{$module_step['1']}.{$id}";
                    print "<BR><span id='{$module_step['0']}-{$module_step['1']}-{$id}'><img src=\"spinner.gif\" width=12 height=12></span>";
                    ?>
<script language="javascript" type="text/javascript">
new Ajax.Updater("<?php 
                    print "{$module_step['0']}-{$module_step['1']}-{$id}";
                    ?>
", '?setStepStatus=' + encodeURIComponent("<?php 
                    print $step_file;
                    ?>
"), { method: 'get', evalScripts: true });</script>
<?php 
                }
            }
        } else {
            if (property_exists($info, "result")) {
                print mytime($info->end, 1);
                print "<br><font size=-2>";
                print dev_score("{$dir}/tuning/moses.ini.{$id}");
            } else {
                print "<font color=red>crashed";
            }
        }
        print "</td>";
        output_score($id, $info);
        print "</tr>\n";
    }
    print "</table>";
    print "<script language=\"javascript\" type=\"text/javascript\">\n";
    print "var currentComment = new Array();\n";
    reset($experiment);
    while (list($id, $info) = each($experiment)) {
        if (array_key_exists("{$setup}-{$id}", $comment)) {
            print "currentComment[\"{$setup}-{$id}\"] = \"" . $comment["{$setup}-{$id}"]->name . "\";\n";
        }
    }
    reset($experiment);
    $best = array();
    print "var score = [];\n";
    while (list($id, $info) = each($experiment)) {
        reset($evalset);
        print "score[{$id}] = [];\n";
        while (list($set, $dummy) = each($evalset)) {
            if (property_exists($info, "result") && array_key_exists($set, $info->result)) {
                list($score) = sscanf($info->result[$set], "%f%s");
                if ($score > 0) {
                    print "score[{$id}][\"{$set}\"] = {$score};\n";
                    if (!array_key_exists($set, $best) || $score > $best[$set]) {
                        $best[$set] = $score;
                    }
                }
            } else {
                $score = "";
            }
        }
    }
    print "var best_score = [];\n";
    reset($evalset);
    while (list($set, $dummy) = each($evalset)) {
        if ($best[$set] != "" && $best[$set] > 0) {
            print "best_score[\"{$set}\"] = " . $best[$set] . ";\n";
        }
    }
    ?>

// Get the HTTP Object
function getHTTPObject(){
  if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
  else if (window.XMLHttpRequest) return new XMLHttpRequest();
  else {
    alert("Your browser does not support AJAX.");
    return null;
  }
}
function createCommentBox( runID ) {
  document.getElementById("run-" + runID).innerHTML = "<form onsubmit=\"return false;\"><input id=\"comment-" + runID + "\" name=\"comment-" + runID + "\" size=30><br><input type=submit onClick=\"addComment('" + runID + "');\" value=\"Add Comment\"></form>";
  if (currentComment[runID]) {
    document.getElementById("comment-" + runID).value = currentComment[runID];
  }
  document.getElementById("comment-" + runID).focus();
}

var httpObject = null;

function addComment( runID ) {
  httpObject = null;
  httpObject = getHTTPObject();
  if (httpObject != null) {
    httpObject.onreadystatechange = setComment;
    httpObject.open("GET", "comment.php?run="+encodeURIComponent(runID)+"&text="
                    +encodeURIComponent(document.getElementById('comment-'+runID).value), true);
    httpObject.send(null);
    currentComment[runID] = document.getElementById('comment-'+runID).value;
    document.getElementById("run-" + runID).innerHTML = "<a href='javascript:createCommentBox(\"" + runID + "\");'>[" + runID + "]</a> " + document.getElementById('comment-'+runID).value;
  }
  return true;
}

function setComment() {
  if(httpObject.readyState == 4){
    //alert("c:" +httpObject + httpObject.status + " " + httpObject.responseText);
    httpObject = null;
  }
}

function highlightBest() {
    lowlightAll();
    for (set in best_score) {
	for (run in score) {
	    var column = "score-"+run+"-"+set;
	    if ($(column)) {
	        if (score[run][set] == best_score[set]) {
		   $(column).setStyle({ backgroundColor: '#a0ffa0'});
		}
	        else if (score[run][set]+1 >= best_score[set]) {
		   $(column).setStyle({ backgroundColor: '#e0ffe0'});
		}
	    }
	}
    }
}

function highlightLine( id ) {
  lowlightAll();
  var row = "row-"+id;
  $(row).setStyle({ backgroundColor: '#f0f0f0'});
  for (set in score[id]) {
    for (run in score) {
      var column = "score-"+run+"-"+set;
      if ($(column)) {
        if (run == id) {
          $(column).setStyle({ backgroundColor: '#ffffff'});
        }
        else {
	  if (score[run][set] < score[id][set]-1) {
	    $(column).setStyle({ backgroundColor: '#ffa0a0'});
	  }
	  else if (score[run][set] < score[id][set]) {
	    $(column).setStyle({ backgroundColor: '#ffe0e0'});
	  }
          else if (score[run][set] > score[id][set]+1) {
	    $(column).setStyle({ backgroundColor: '#a0ffa0'});
	  }
          else if (score[run][set] > score[id][set]) {
	    $(column).setStyle({ backgroundColor: '#e0ffe0'});
	  }
	}
      }
    }
  }
}
function lowlightAll() {
  for (run in score) {
    var row = "row-"+run
    if ($(row)) {
      $(row).setStyle({ backgroundColor: 'transparent' });
    }
    for (set in best_score) {
      var column = "score-"+run+"-"+set;
      if ($(column)) {
	$(column).setStyle({ backgroundColor: 'transparent' });
      }
    }
  }
}

highlightBest();
//-->
</script>
<?php 
}
if (isset($argv[1])) {
    $q->filterByDataId($argv[1]);
}
$items = $q->find();
var_dump(mytime());
$cleaner = new GemDatasetCleaner(GemDatasetCleaner::TYPE_GEM_TO_GOLD);
$countM = $cleaner->clean(ItemDatasetCleaner::CLEANUP_MONTH);
$countW = $cleaner->clean(ItemDatasetCleaner::CLEANUP_WEEK);
unset($cleaner);
echo "[GEMS][GEM_TO_GOLD] cleaned [{$countM}] > month old and [{$countW}] > week old hours in " . mytime() . ", mem @ [" . memory_get_usage(true) . "] \n";
@ob_flush();
$cleaner = new GemDatasetCleaner(GemDatasetCleaner::TYPE_GOLD_TO_GEM);
$countM = $cleaner->clean(ItemDatasetCleaner::CLEANUP_MONTH);
$countW = $cleaner->clean(ItemDatasetCleaner::CLEANUP_WEEK);
unset($cleaner);
echo "[GEMS][GOLD_TO_GEM] cleaned [{$countM}] > month old and [{$countW}] > week old hours in " . mytime() . ", mem @ [" . memory_get_usage(true) . "] \n";
@ob_flush();
foreach ($items as $dataId) {
    $cleaner = new ItemDatasetCleaner($dataId, ItemDatasetCleaner::TYPE_SELL_LISTING);
    $countM = $cleaner->clean(ItemDatasetCleaner::CLEANUP_MONTH);
    $countW = $cleaner->clean(ItemDatasetCleaner::CLEANUP_WEEK);
    unset($cleaner);
    echo "[{$dataId}][sell] cleaned [{$countM}] > month old and [{$countW}] > week old hours in " . mytime() . ", mem @ [" . memory_get_usage(true) . "] \n";
    @ob_flush();
    $cleaner = new ItemDatasetCleaner($dataId, ItemDatasetCleaner::TYPE_BUY_LISTING);
    $countM = $cleaner->clean(ItemDatasetCleaner::CLEANUP_MONTH);
    $countW = $cleaner->clean(ItemDatasetCleaner::CLEANUP_WEEK);
    unset($cleaner);
    echo "[{$dataId}][buy] cleaned [{$countM}] > month old and [{$countW}] > week old hours in " . mytime() . ", mem @ [" . memory_get_usage(true) . "] \n";
    @ob_flush();
}
Exemple #9
0
}
///////////////////////////////////////////////////////////////
// UPDATE QUOTE FORM
// FIRST FIGURE OUT DESIGN FILE
if (!is_uploaded_file($_FILES['design_file']['tmp_name'])) {
    $design_file = "";
} else {
    // FIGURE OUT FILE EXTENTION
    $design_file_name = "designfile_{$quoteid}" . substr($_FILES['design_file']['name'], strrpos($_FILES['design_file']['name'], "."));
    @move_uploaded_file($_FILES['design_file']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/admin/designfiles/{$design_file_name}");
    $design_file = $design_file_name;
}
// CREATE UPDATE QUERY
$sql = "UPDATE quotes SET ";
$junk = mysql_fetch_assoc(mysql_unbuffered_query("SELECT * FROM quotes WHERE visitorid='{$visitorid}'"));
$fieldnames = array_keys($junk);
for ($i = 0; $i < count($fieldnames); $i++) {
    if ($i > 0) {
        $sql .= ", ";
    }
    eval("\$sql.=" . $fieldnames[$i] . ".\"=\\\"\$" . $fieldnames[$i] . "\\\"\";");
}
$sql .= " WHERE quoteid=\"{$quoteid}\"";
@mysql_query($sql);
@mysql_query("UPDATE quotes SET timestamp=\"" . mytime() . "\", status=\"new\", visitorid=\"0\" WHERE quoteid=\"{$quoteid}\"");
//mail("*****@*****.**","coloradowaterjet.com quote","A quote requerst has been submitted from coloradowaterjet.com","From: quotes@coloradowaterjet.com");
mail("*****@*****.**", "coloradowaterjet.com quote", "A quote requerst has been submitted from coloradowaterjet.com", "From: quotes@coloradowaterjet.com");
include '../header.php';
// OUTPUT RECIEPT
echo receipt($quoteid);
include '../footer.php';
Exemple #10
0
    @mysql_query("UPDATE quotes SET timestamp=\"" . mytime() . "\", accountid=\"" . $accountrow["accountid"] . "\", status=\"incomplete\" WHERE visitorid='{$visitorid}'");
} else {
    @mysql_query("INSERT INTO quotes (visitorid,accountid,timestamp,status) VALUES ('{$visitorid}','" . $accountrow["accountid"] . "','" . mytime() . "','incomplete')");
}
$quote = mysql_fetch_assoc(mysql_unbuffered_query("SELECT * FROM quotes WHERE visitorid='{$visitorid}'"));
echo "Please complete the quote request form in as much detail as possible and click the \"Request Quote\" button to submit your request.  We strive to turn quotes around in two business days.";
echo "<form name=\"quote1\" method=\"post\" action=\"/quote/quote2.php\" onsubmit=\"return verify(this);\" enctype=\"multipart/form-data\">";
echo "<table>";
$account = mysql_fetch_assoc(mysql_unbuffered_query("SELECT * FROM accounts WHERE accountid='" . $accountrow["accountid"] . "'"));
$fieldnames = array_keys($quote);
for ($i = 0; $i < count($fieldnames); $i++) {
    // FIRST PICK OUT HIDDEN FIELDS
    if ($fieldnames[$i] == "visitorid" || $fieldnames[$i] == "accountid" || $fieldnames[$i] == "status") {
        echo "<input type=\"hidden\" name=\"" . $fieldnames[$i] . "\" value=\"" . formvalue($account[$fieldnames[$i]]) . "\"/>";
    } elseif ($fieldnames[$i] == "timestamp") {
        echo "<input type='hidden' name=\"" . $fieldnames[$i] . "\" value='" . mytime() . "'/>";
    } elseif ($fieldnames[$i] == "quoteid") {
        echo "<input type='hidden' name=\"" . $fieldnames[$i] . "\" value='" . $quote["quoteid"] . "'/>";
    } elseif ($fieldnames[$i] == "materials_supplied_by_customer" || $fieldnames[$i] == "materials_supplied_by_colorado_waterjet") {
        echo "<tr><td colspan=\"2\">" . str_replace(" ", "&nbsp;", ucwords(str_replace("_", " ", $fieldnames[$i]))) . "&nbsp;<input type='checkbox' name='" . $fieldnames[$i] . "' value='1'/></td></tr>";
    } else {
        echo "<tr valign=\"top\">";
        echo "<td>" . str_replace(" ", "&nbsp;", ucwords(str_replace("_", " ", $fieldnames[$i]))) . ":";
        // CHECK REQUIRED FIELD
        if ($fieldnames[$i] == "email" || $fieldnames[$i] == "phone_number" || $fieldnames[$i] == "name" || $fieldnames[$i] == "project_name" || $fieldnames[$i] == "quantity") {
            echo "<font color=\"#B80009\"><sup>*</sup></font>";
        }
        echo "&nbsp;</td>";
        echo "<td>";
        if ($fieldnames[$i] == "design_file") {
            echo "<input type=\"file\" name=\"" . $fieldnames[$i] . "\"/><br><i>Please review our drawing <a href=\"#\" onclick=\"window.open('/filespecs.php','filespecs','status=0,toolbar=0,location=0,resizeable=1,scrollbars=1,menubar=0,directories=0,height=500,width=600');\">file requirements</a>.</i>";
function SaveUploadInfo($title,$filename,$medaitype=1,$addinfos='')
{
		global $dsql,$cfg_ml;
		if($filename=="") return "";
		if(!is_object($dsql)){ $dsql = new DedeSql(false); }
		if(!is_array($addinfos)){
			$addinfos[0] = 0; $addinfos[1] = 0; $addinfos[2] = 0;
		}
		$row = $dsql->GetOne("Select title,url From #@__uploads where url='$filename'; ");
		if(is_array($row) && count($row)>0){ return '';}
		$inquery = "
       INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
       VALUES ('$title','$filename','1','".$addinfos[0]."','".$addinfos[1]."','0','".$addinfos[2]."','".mytime()."','0','".$cfg_ml->M_ID."');
    ";
    $dsql->SetQuery($inquery);
    $dsql->ExecuteNoneQuery();
}
Exemple #12
0
function visitorid_set()
{
    $duration = 60 * 60 * 24 * 30;
    global $visitorid;
    $timestamp = mytime();
    // IF NO VISITOR ID THEN CREATE ONE AND FILL VISITORS TABLE
    if (!$visitorid) {
        $visitorid = $_COOKIE["coloradowaterjet_id"];
    }
    if (!$visitorid) {
        @mysql_query("insert into visitors (timestamp) VALUES ('{$timestamp}')");
        $visitorid = mysql_insert_id();
    }
    // CHECK TO MAKE SURE THAT ROW EXISTS IN VISITORS TABLE
    $row = mysql_fetch_array(mysql_unbuffered_query("SELECT visitorid FROM visitors WHERE visitorid='{$visitorid}'"));
    if ($visitorid && !$row["visitorid"]) {
        @mysql_query("INSERT INTO visitors (visitorid,timestamp) VALUES ('{$visitorid}','{$timestamp}')");
    }
    // UPDATE EVERYTHING
    @mysql_query("UPDATE visitors SET timestamp='{$timestamp}' WHERE visitorid='{$visitorid}'");
    if (!headers_sent()) {
        setcookie("coloradowaterjet_id", $visitorid, $timestamp + $duration, "/", "", 0);
    }
    // REMOVE OLD CRAP
    $result = mysql_unbuffered_query("SELECT visitorid FROM visitors WHERE timestamp<'" . ($timestamp - $duration) . "'");
    $oldvisitors = "";
    while ($row = mysql_fetch_array($result)) {
        if ($oldvisitors) {
            $oldvisitors .= ",";
        }
        $oldvisitors .= "'" . $row["visitorid"] . "'";
    }
    @mysql_unbuffered_query("DELETE FROM visitors_accounts WHERE visitorid IN ({$oldvisitors})");
    @mysql_unbuffered_query("DELETE FROM visitors WHERE visitorid IN ({$oldvisitors})");
    return $visitorid;
}