当前位置: 首页>>代码示例>>PHP>>正文


PHP setErrorVars函数代码示例

本文整理汇总了PHP中setErrorVars函数的典型用法代码示例。如果您正苦于以下问题:PHP setErrorVars函数的具体用法?PHP setErrorVars怎么用?PHP setErrorVars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setErrorVars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: net2ftp_module_sendHttpHeaders

function net2ftp_module_sendHttpHeaders()
{
    // --------------
    // This function sends HTTP headers
    // --------------
    global $net2ftp_globals, $net2ftp_settings;
    if ($net2ftp_settings["functionuse_downloadfile"] == "yes") {
        ftp_downloadfile($net2ftp_globals["directory"], $net2ftp_globals["entry"]);
    } else {
        $errormessage = __("This function has been disabled by the Administrator of this website.");
        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
}
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:14,代码来源:downloadfile.inc.php

示例2: connect2db

function connect2db()
{
    // --------------
    // This function logs user accesses to the site
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings;
    $mydb = mysql_connect($net2ftp_settings["dbserver"], $net2ftp_settings["dbusername"], $net2ftp_settings["dbpassword"]);
    if ($mydb == false) {
        setErrorVars(false, __("Unable to connect to the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    $result2 = mysql_select_db($net2ftp_settings["dbname"]);
    if ($result2 == false) {
        setErrorVars(false, __("Unable to select the MySQL database. Please check your MySQL database settings in net2ftp's configuration file settings.inc.php."), debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    return $mydb;
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:21,代码来源:database.inc.php

示例3: net2ftp_module_sendHttpHeaders

function net2ftp_module_sendHttpHeaders()
{
    // --------------
    // This function sends HTTP headers
    // --------------
    global $net2ftp_globals, $net2ftp_settings;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } elseif (isset($_GET["list"]) == true) {
        $list = getSelectedEntries($_GET["list"]);
    } else {
        $list = "";
    }
    if ($net2ftp_settings["functionuse_downloadzip"] == "yes") {
        $zipactions["download"] = "yes";
        $zipactions["email"] = "no";
        $zipactions["save"] = "no";
        ftp_zip("", $net2ftp_globals["directory"], $list, $zipactions, "", 0);
    } else {
        $errormessage = __("This function has been disabled by the Administrator of this website.");
        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
}
开发者ID:jprice,项目名称:EHCP,代码行数:24,代码来源:downloadzip.inc.php

示例4: putConsumption

function putConsumption()
{
    // --------------
    // This function writes the consumption to the database.
    // It is run at the end of the script.
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Initial checks
    // -------------------------------------------------------------------------
    // Verify if a database is used, and if consumption checking is turned on. If not: don't continue.
    if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_consumption"] != "yes") {
        return true;
    }
    // When user is not logged in, the FTP server is not set
    if ($net2ftp_globals["ftpserver"] == "") {
        return true;
    }
    // If the REMOTE_ADDR is not filled in, then there is a problem (IP spoofing), so return an error
    if ($net2ftp_globals["REMOTE_ADDR"] == "") {
        setErrorVars(false, __("Unable to determine your IP address."), debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    // If the database has already been updated, don't do it a second time.
    // This is to avoid updating the database twice. The putConsumption() function
    // is called from index.php and from shutdown() in filesystem.inc.php. On Windows
    // the shutdown() function is called after *every* script execution.
    if ($net2ftp_globals["consumption_database_updated"] == 1) {
        return true;
    }
    // Add slashes to variables which are used in a SQL query, and which are
    // potentially unsafe (supplied by the user).
    // $date is calculated in this function
    // $time is calculated in this function
    $REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
    $net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
    // -------------------------------------------------------------------------
    // Check the input
    // -------------------------------------------------------------------------
    //	if (preg_match("/^[0-9]+$/", $net2ftp_globals["consumption_ipaddress_datatransfer) == FALSE) {
    //			setErrorVars(false, __("The variable <b>consumption_ipaddress_datatransfer</b> is not numeric."), debug_backtrace(), __FILE__, __LINE__);
    //			return false;
    //	}
    // -------------------------------------------------------------------------
    // Connect
    // -------------------------------------------------------------------------
    $mydb = connect2db();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // -------------------------------------------------------------------------
    // Get date
    // -------------------------------------------------------------------------
    $date = date("Y-m-d");
    // -------------------------------------------------------------------------
    // Put consumed data volume and execution time by the current IP address
    // -------------------------------------------------------------------------
    $sqlquery1 = "SELECT * FROM net2ftp_log_consumption_ipaddress WHERE date = '{$date}' AND ipaddress = '{$REMOTE_ADDR_safe}';";
    $result1 = mysql_query("{$sqlquery1}");
    $nrofrows1 = mysql_num_rows($result1);
    if ($nrofrows1 == 1) {
        $sqlquery2 = "UPDATE net2ftp_log_consumption_ipaddress SET datatransfer = '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "' WHERE date = '{$date}' AND ipaddress = '{$REMOTE_ADDR_safe}';";
        $result2 = mysql_query("{$sqlquery2}");
        $nrofrows2 = mysql_affected_rows($mydb);
        // Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
        // the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
        // and the executiontime is the same as in the table.)
        //		if ($nrofrows2 != 1) {
        //			setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress could not be updated."), debug_backtrace(), __FILE__, __LINE__);
        //			return false;
        //		}
    } elseif ($nrofrows1 == 0) {
        $sqlquery3 = "INSERT INTO net2ftp_log_consumption_ipaddress VALUES('{$date}', '{$REMOTE_ADDR_safe}', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "');";
        $result3 = mysql_query("{$sqlquery3}");
        $nrofrows3 = mysql_affected_rows($mydb);
        if ($nrofrows3 != 1) {
            setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress could not be updated."), debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
    } else {
        setErrorVars(false, __("Table net2ftp_log_consumption_ipaddress contains duplicate entries."), debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    // MySQL > 4.1.0
    //	$sqlquery1 = "INSERT INTO net2ftp_log_consumption_ipaddress VALUES('$date', '$REMOTE_ADDR_safe', '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', '" . round($net2ftp_globals["consumption_ipaddress_executiontime"])  . "') ON DUPLICATE KEY UPDATE datatransfer = '" . $net2ftp_globals["consumption_ipaddress_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ipaddress_executiontime"]) . "';";
    // -------------------------------------------------------------------------
    // Put consumed data volume and execution time to the current FTP server
    // -------------------------------------------------------------------------
    $sqlquery4 = "SELECT * FROM net2ftp_log_consumption_ftpserver WHERE date = '{$date}' AND ftpserver = '{$net2ftp_ftpserver_safe}';";
    $result4 = mysql_query("{$sqlquery4}");
    $nrofrows4 = mysql_num_rows($result4);
    if ($nrofrows4 == 1) {
        $sqlquery5 = "UPDATE net2ftp_log_consumption_ftpserver SET datatransfer = '" . $net2ftp_globals["consumption_ftpserver_datatransfer"] . "', executiontime = '" . round($net2ftp_globals["consumption_ftpserver_executiontime"]) . "' WHERE date = '{$date}' AND ftpserver = '{$net2ftp_ftpserver_safe}';";
        $result5 = mysql_query("{$sqlquery5}");
        $nrofrows5 = mysql_affected_rows($mydb);
        // Don't check on the UPDATE nr of rows, because when the values in the variables and in the table are the same,
        // the $nrofrows2 is set to 0. (This happens on the Browse screen, when the loading is fast: the datatransfer is 0
//.........这里部分代码省略.........
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:consumption.inc.php

示例5: net2ftp


//.........这里部分代码省略.........
        if ($net2ftp_result["success"] == false) {
            logError();
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // Check authorizations
    // --> Do this only once, when $action == "sendHttpHeaders"
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders" && $net2ftp_settings["check_authorization"] == "yes" && $net2ftp_globals["ftpserver"] != "") {
        checkAuthorization($net2ftp_globals["ftpserver"], $net2ftp_globals["ftpserverport"], $net2ftp_globals["directory"], $net2ftp_globals["username"]);
        if ($net2ftp_result["success"] == false) {
            logError();
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // Get the consumption counter values from the database
    // This retrieves the consumption of network and server resources for the
    // current IP address and FTP server from the database, and stores these
    // values in global variables. See /includes/consumption.inc.php for the details.
    // --> Do this only once, when $action == "sendHttpHeaders"
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        getConsumption();
        if ($net2ftp_result["success"] == false) {
            logError();
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // Execute the action!
    // -------------------------------------------------------------------------
    // ------------------------------------
    // For most modules, everything must be done: send headers, print body, etc
    // ------------------------------------
    if ($net2ftp_globals["state"] == "admin" || $net2ftp_globals["state"] == "admin_createtables" || $net2ftp_globals["state"] == "admin_emptylogs" || $net2ftp_globals["state"] == "admin_viewlogs" || $net2ftp_globals["state"] == "advanced" || $net2ftp_globals["state"] == "advanced_ftpserver" || $net2ftp_globals["state"] == "advanced_parsing" || $net2ftp_globals["state"] == "advanced_webserver" || $net2ftp_globals["state"] == "bookmark" || $net2ftp_globals["state"] == "browse" || $net2ftp_globals["state"] == "calculatesize" || $net2ftp_globals["state"] == "chmod" || $net2ftp_globals["state"] == "copymovedelete" || $net2ftp_globals["state"] == "edit" || $net2ftp_globals["state"] == "findstring" || $net2ftp_globals["state"] == "install" || $net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 1 || $net2ftp_globals["state"] == "login" || $net2ftp_globals["state"] == "login_small" || $net2ftp_globals["state"] == "logout" || $net2ftp_globals["state"] == "newdir" || $net2ftp_globals["state"] == "raw" || $net2ftp_globals["state"] == "rename" || $net2ftp_globals["state"] == "unzip" || $net2ftp_globals["state"] == "upload" || $net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] == "" || $net2ftp_globals["state"] == "zip") {
        require_once $net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php";
        if ($action == "sendHttpHeaders") {
            net2ftp_module_sendHttpHeaders();
            // If needed, exit to avoid sending non-header output (by net2ftp or other application)
            // Example: if a module sends a HTTP redirect header (See /includes/authorizations.inc.php function checkAdminUsernamePassword()!)
            if ($net2ftp_result["exit"] == true) {
                exit;
            }
        } elseif ($action == "printJavascript") {
            net2ftp_module_printJavascript();
            net2ftp_plugin_printJavascript();
        } elseif ($action == "printCss") {
            net2ftp_module_printCss();
            net2ftp_plugin_printCss();
        } elseif ($action == "printBodyOnload") {
            net2ftp_module_printBodyOnload();
            net2ftp_plugin_printBodyOnload();
        } elseif ($action == "printBody") {
            // Print the status bar to be able to show the progress
            if (isStatusbarActive() == true) {
                require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/statusbar.template.php";
            }
            require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/status/status.inc.php";
            // Do the work and meanwhile update the progress bar
            net2ftp_module_printBody();
            // Update the consumption statistics
            $net2ftp_globals["endtime"] = microtime();
            $net2ftp_globals["time_taken"] = timer();
            addConsumption(0, $net2ftp_globals["time_taken"]);
            putConsumption();
            // Set the progress bar to "finished"
            if (isStatusbarActive() == true) {
                $statusmessage = __("Script finished in %1\$s seconds", $net2ftp_globals["time_taken"]);
                setStatus(1, 1, $statusmessage);
            }
        }
    } elseif ($net2ftp_globals["state"] == "clearcookies" || $net2ftp_globals["state"] == "downloadfile" || $net2ftp_globals["state"] == "downloadzip" || $net2ftp_globals["state"] == "followsymlink" || $net2ftp_globals["state"] == "jupload" && $net2ftp_globals["screen"] == 2 || $net2ftp_globals["state"] == "view" && $net2ftp_globals["state2"] != "") {
        require_once $net2ftp_globals["application_modulesdir"] . "/" . $net2ftp_globals["state"] . "/" . $net2ftp_globals["state"] . ".inc.php";
        if ($action == "sendHttpHeaders") {
            // Do the work - do not update the progress bar
            net2ftp_module_sendHttpHeaders();
            // Update the consumption statistics
            $net2ftp_globals["endtime"] = microtime();
            $net2ftp_globals["time_taken"] = timer();
            addConsumption(0, $net2ftp_globals["time_taken"]);
            putConsumption();
            // Exit to avoid sending non-header output (by net2ftp or other application)
            exit;
        } elseif ($action == "printJavascript") {
        } elseif ($action == "printCss") {
        } elseif ($action == "printBodyOnload") {
        } elseif ($action == "printBody") {
        }
    } elseif ($net2ftp_globals["state"] == "error") {
        logError();
        return false;
    } else {
        $errormessage = __("Unexpected state string: %1\$s. Exiting.", $net2ftp_globals["state"]);
        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
        logError();
        return false;
    }
}
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:main.inc.php

示例6: net2ftp_module_printBody


//.........这里部分代码省略.........
        // 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__);
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:67,代码来源:edit.inc.php

示例7: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the rename screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    if (isset($_POST["newNames"]) == true) {
        $newNames = validateEntry($_POST["newNames"]);
    } else {
        $newNames = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Rename directories and files");
    // Form name, back and forward buttons
    $formname = "RenameForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Rename files
        setStatus(4, 10, __("Processing the entries"));
        for ($i = 1; $i <= sizeof($list["all"]); $i++) {
            if (strstr($list["all"][$i]["dirfilename"], "..") != false) {
                $net2ftp_output["rename"][] = __("The new name may not contain any dots. This entry was not renamed to <b>%1\$s</b>", htmlEncode2($newNames[$i])) . "<br />";
                continue;
            }
            if (checkAuthorizedName($newNames[$i]) == false) {
                $net2ftp_output["rename"][] = __("The new name may not contain any banned keywords. This entry was not renamed to <b>%1\$s</b>", htmlEncode2($newNames[$i])) . "<br />";
                continue;
            }
            ftp_rename2($conn_id, $net2ftp_globals["directory"], $list["all"][$i]["dirfilename"], $newNames[$i]);
            if ($net2ftp_result["success"] == false) {
                setErrorVars(true, "", "", "", "");
                $net2ftp_output["rename"][] = __("<b>%1\$s</b> could not be renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i]));
                continue;
            } else {
                $net2ftp_output["rename"][] = __("<b>%1\$s</b> was successfully renamed to <b>%2\$s</b>", htmlEncode2($list["all"][$i]["dirfilename"]), htmlEncode2($newNames[$i]));
            }
        }
        // End for
        // Close connection
        ftp_closeconnection($conn_id);
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:71,代码来源:rename.inc.php

示例8: getRootdirectory

function getRootdirectory()
{
    // --------------
    // This function gets the user's root directory from the database and
    // stores it in $net2ftp_globals["homedirectory"].
    //
    // If $net2ftp_globals["homedirectory"] is already filled in (cache), no connection
    // is made to the DB and this value is returned.
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Initial checks
    // -------------------------------------------------------------------------
    if ($net2ftp_settings["use_database"] != "yes" || $net2ftp_settings["check_homedirectory"] != "yes") {
        $net2ftp_globals["homedirectory"] = "/";
    }
    // -------------------------------------------------------------------------
    // Get the homedirectory from the database, then store it in a global
    // variable, and from then on, don't access the database any more
    // -------------------------------------------------------------------------
    if (isset($net2ftp_globals["homedirectory"]) == false) {
        // -------------------------------------------------------------------------
        // Add slashes to variables which are used in a SQL query, and which are
        // potentially unsafe (supplied by the user)
        // -------------------------------------------------------------------------
        $net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
        $net2ftp_username_safe = addslashes($net2ftp_globals["username"]);
        // -------------------------------------------------------------------------
        // Connect
        // -------------------------------------------------------------------------
        $mydb = connect2db();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // -------------------------------------------------------------------------
        // Get user's home directory
        // -------------------------------------------------------------------------
        $sqlquery1 = "SELECT homedirectory FROM net2ftp_users WHERE ftpserver = '{$net2ftp_ftpserver_safe}' AND username = '{$net2ftp_username_safe}';";
        $result1 = mysql_query("{$sqlquery1}") or die("Unable to execute SQL SELECT query (isAuthorizedDirectory > sqlquery1) <br /> {$sqlquery1}");
        $nrofrows1 = mysql_num_rows($result1);
        if ($nrofrows1 == 0) {
            $net2ftp_globals["homedirectory"] = "/";
        } elseif ($nrofrows1 == 1) {
            $resultRow1 = mysql_fetch_row($result1);
            $net2ftp_globals["homedirectory"] = $resultRow1[0];
        } else {
            setErrorVars(false, __("Table net2ftp_users contains duplicate rows."), debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
    }
    return $net2ftp_globals["homedirectory"];
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:55,代码来源:authorizations.inc.php

示例9: putLogStatus

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;
}
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:62,代码来源:logging.inc.php

示例10: net2ftp_module_sendHttpHeaders


//.........这里部分代码省略.........
                    // Copy all parameters for this file from the $uploadedFilesArray to the $acceptedFilesArray
                    $acceptedFilesArray["{$moved_counter}"]["tmp_name"] = $tempfilename;
                    // Overwrite the old temporary name by the new one
                }
            }
            // end for j
            flush();
        }
        // end if elseif
        // ------------------------------------
        // 3. Move the files from net2ftp's temporary directory to the FTP server.
        // ------------------------------------
        if (sizeof($acceptedFilesArray) == 0 && sizeof($uploadedFilesArray) != 0) {
            echo "WARNING: No files were accepted (see messages above), so nothing will be transferred to the FTP server.<br />\n";
        } elseif (sizeof($acceptedFilesArray) > 0) {
            // ------------------------------
            // 3.1 Open connection
            // ------------------------------
            // Open connection
            echo __("Connecting to the FTP server") . "<br />\n";
            $conn_id = ftp_openconnection();
            if ($net2ftp_result["success"] == false) {
                echo "ERROR: " . $net2ftp_result["errormessage"] . "<br />\n";
                return false;
            }
            // ------------------------------
            // For loop (loop over all the files)
            // ------------------------------
            for ($k = 1; $k <= sizeof($acceptedFilesArray); $k++) {
                $file_name = $acceptedFilesArray["{$k}"]["name"];
                $file_tmp_name = $acceptedFilesArray["{$k}"]["tmp_name"];
                $file_size = $acceptedFilesArray["{$k}"]["size"];
                $file_error = $acceptedFilesArray["{$k}"]["error"];
                $file_relative_directory = $acceptedFilesArray["{$k}"]["relative_directory"];
                $ftpmode = ftpAsciiBinary($file_name);
                if ($ftpmode == FTP_ASCII) {
                    $printftpmode = "FTP_ASCII";
                } elseif ($ftpmode == FTP_BINARY) {
                    $printftpmode = "FTP_BINARY";
                }
                // ------------------------------
                // 3.2 Within the for loop: create the subdirectory if needed
                // ------------------------------
                // Replace Windows-style backslashes \ by Unix-style slashes /
                $file_relative_directory = str_replace("\\", "/", trim($file_relative_directory));
                // Get the names of the subdirectories by splitting the string using slashes /
                $file_subdirectories = explode("/", $file_relative_directory);
                // $targetdirectory contains the successive directories to be created
                $targetdirectory = $net2ftp_globals["directory"];
                // Loop over sizeof()-1 because the last part is the filename itself:
                for ($m = 0; $m < sizeof($file_subdirectories) - 1; $m++) {
                    // Create the targetdirectory string
                    $targetdirectory = glueDirectories($targetdirectory, $file_subdirectories[$m]);
                    // Check if the subdirectories exist
                    if ($targetdirectory != "") {
                        $result = @ftp_chdir($conn_id, $targetdirectory);
                        if ($result == false) {
                            $ftp_mkdir_result = ftp_mkdir($conn_id, $targetdirectory);
                            if ($ftp_mkdir_result == false) {
                                echo "WARNING: Unable to create the directory <b>{$targetdirectory}</b>. The script will try to continue...<br />\n";
                                continue;
                            }
                            echo "Directory {$targetdirectory} created.<br />\n";
                        }
                        // end if
                        flush();
                    }
                    // end if
                }
                // end for m
                // Store the $targetdirectory in the $acceptedFilesArray
                if ($targetdirectory != "" && $targetdirectory != "/") {
                    $acceptedFilesArray["{$k}"]["targetdirectory"] = $targetdirectory;
                }
                // ------------------------------
                // 3.3 Within the for loop: put local file to remote file
                // ------------------------------
                ftp_putfile($conn_id, "", $acceptedFilesArray["{$k}"]["tmp_name"], $acceptedFilesArray["{$k}"]["targetdirectory"], $acceptedFilesArray["{$k}"]["name"], $ftpmode, "move");
                if ($net2ftp_result["success"] == false) {
                    echo "ERROR: File <b>{$file_name}</b> skipped. Message: " . $net2ftp_result["errormessage"] . "<br />\n";
                    setErrorVars(true, "", "", "", "");
                    continue;
                } else {
                    echo "The file <b>{$file_name}</b> was transferred to the FTP server successfully. <br />\n";
                }
                flush();
            }
            // End for k
            // Note: the java applet is looking for the word "SUCCESS" to determine if the upload result is OK or not (see applet parameter stringUploadSuccess)
            // The applet doesn't seem to recognize the words "SUCCESS", "WARNING" or "ERROR" when they are issued by the code above
            echo "SUCCESS";
            // ------------------------------
            // 3.4 Close connection
            // ------------------------------
            ftp_quit($conn_id);
        }
        // end if
    }
    // end if $screen == 2
}
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:101,代码来源:jupload.inc.php

示例11: logError

function logError()
{
    // --------------
    // This function logs user accesses to the site
    //
    // IMPORTANT: this function uses, but does not change the global $net2ftp_result[""] variables.
    // It returns true on success, false on failure.
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
    if ($net2ftp_settings["log_error"] == "yes") {
        // -------------------------------------------------------------------------
        // Take a copy of the $net2ftp_result
        // If an error occurs within logError, logError will return false and reset the
        // $net2ftp_result variable to it's original value
        // Also if no error occurs logError will return the variable to it's original value
        // -------------------------------------------------------------------------
        $net2ftp_result_original = $net2ftp_result;
        setErrorVars(true, "", "", "", "");
        // -------------------------------------------------------------------------
        // Errormessage and debug backtrace
        // -------------------------------------------------------------------------
        $errormessage = addslashes($net2ftp_result_original["errormessage"]);
        $debug_backtrace = "";
        $i = sizeof($net2ftp_result_original["debug_backtrace"]) - 1;
        if ($i > 0) {
            $debug_backtrace .= addslashes("function " . $net2ftp_result_original["debug_backtrace"][$i]["function"] . " (" . $net2ftp_result_original["debug_backtrace"][$i]["file"] . " on line " . $net2ftp_result_original["debug_backtrace"][$i]["line"] . ")\n");
            for ($j = 0; $j < sizeof($net2ftp_result_original["debug_backtrace"][$i]["args"]); $j++) {
                $debug_backtrace .= addslashes("argument {$j}: " . $net2ftp_result_original["debug_backtrace"][$i]["args"][$j] . "\n");
            }
        }
        // -------------------------------------------------------------------------
        // Date and time
        // -------------------------------------------------------------------------
        $date = date("Y-m-d");
        $time = date("H:i:s");
        // -------------------------------------------------------------------------
        // Logging to the database
        // -------------------------------------------------------------------------
        if ($net2ftp_settings["use_database"] == "yes") {
            // ----------------------------------------------
            // Input checks
            // ----------------------------------------------
            // Add slashes to variables which are used in a SQL query, and which are
            // potentially unsafe (supplied by the user).
            // $date is calculated in this function
            // $time is calculated in this function
            $net2ftp_ftpserver_safe = addslashes($net2ftp_globals["ftpserver"]);
            $net2ftp_username_safe = addslashes($net2ftp_globals["username"]);
            $state_safe = addslashes($net2ftp_globals["state"]);
            $state2_safe = addslashes($net2ftp_globals["state2"]);
            $directory_safe = addslashes($net2ftp_globals["directory"]);
            $REMOTE_ADDR_safe = addslashes($net2ftp_globals["REMOTE_ADDR"]);
            $REMOTE_PORT_safe = addslashes($net2ftp_globals["REMOTE_PORT"]);
            $HTTP_USER_AGENT_safe = addslashes($net2ftp_globals["HTTP_USER_AGENT"]);
            // ----------------------------------------------
            // Connect to the DB
            // ----------------------------------------------
            $mydb = connect2db();
            if ($net2ftp_result["success"] == false) {
                setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
                return false;
            }
            // ----------------------------------------------
            // Add record to the database table
            // ----------------------------------------------
            $sqlquerystring = "INSERT INTO net2ftp_log_error VALUES('{$date}', '{$time}', '{$net2ftp_ftpserver_safe}', '{$net2ftp_username_safe}', '{$errormessage}', '{$debug_backtrace}', '{$state_safe}', '{$state2_safe}', '{$directory_safe}', '{$REMOTE_ADDR_safe}', '{$REMOTE_PORT_safe}', '{$HTTP_USER_AGENT_safe}')";
            $result_mysql_query = @mysql_query($sqlquerystring);
            if ($result_mysql_query == false) {
                setErrorVars($net2ftp_result_original["success"], $net2ftp_result_original["errormessage"], $net2ftp_result_original["debug_backtrace"], $net2ftp_result_original["file"], $net2ftp_result_original["line"]);
                return false;
            }
        }
        // end if use_database
        // -------------------------------------------------------------------------
        // Logging to the system log
        // -------------------------------------------------------------------------
        if ($net2ftp_settings["use_syslog"] == "yes") {
            // ----------------------------------------------
            // Get consumption values
            // ----------------------------------------------
            if (isset($net2ftp_globals["consumption_datatransfer"]) == true) {
                $consumption_datatransfer = $net2ftp_globals["consumption_datatransfer"];
            } else {
                $consumption_datatransfer = "0";
            }
            if (isset($net2ftp_globals["consumption_executiontime"]) == true) {
                $consumption_executiontime = $net2ftp_globals["consumption_executiontime"];
            } else {
                $consumption_executiontime = "0";
            }
            // ----------------------------------------------
            // Create message
            // ----------------------------------------------
            $message2log = "{$date} {$time} " . $net2ftp_globals["ftpserver"] . " " . $net2ftp_globals["username"] . " " . $net2ftp_result["errormessage"] . " {$debug_backtrace} " . $net2ftp_globals["state"] . " " . $net2ftp_globals["state2"] . " " . $net2ftp_globals["directory"] . " " . $net2ftp_globals["REMOTE_ADDR"] . " " . $net2ftp_globals["HTTP_USER_AGENT"];
            $result2 = openlog($net2ftp_settings["syslog_ident"], 0, $net2ftp_settings["syslog_facility"]);
            if ($result2 == false) {
                $errormessage = __("Unable to open the system log.");
//.........这里部分代码省略.........
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:101,代码来源:authorizations.inc.php

示例12: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the new directory screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["newNames"]) == true) {
        $newNames = validateEntry($_POST["newNames"]);
    } else {
        $newNames = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Create new directories");
    // Form name, back and forward buttons
    $formname = "NewDirForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Create new directories
        setStatus(4, 10, __("Processing the entries"));
        for ($k = 1; $k <= sizeof($newNames); $k++) {
            if (strlen($newNames[$k]) > 0) {
                $newsubdir = glueDirectories($net2ftp_globals["directory"], $newNames[$k]);
                ftp_newdirectory($conn_id, $newsubdir);
                if ($net2ftp_result["success"] == false) {
                    setErrorVars(true, "", "", "", "");
                    // Continue anyway
                    $net2ftp_output["newdir"][] = __("Directory <b>%1\$s</b> could not be created.", htmlEncode2($newNames[$k]));
                } else {
                    $net2ftp_output["newdir"][] = __("Directory <b>%1\$s</b> was successfully created.", htmlEncode2($newNames[$k]));
                }
            }
            // End if
        }
        // End for
        // Close connection
        ftp_closeconnection($conn_id);
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:62,代码来源:newdir.inc.php

示例13: net2ftp_module_printBody


//.........这里部分代码省略.........
            } else {
                $list["all"][$i]["other_write"] = "";
            }
            if (substr($list["all"][$i]["permissions"], 8, 1) == "x") {
                $other_chmod += 1;
                $list["all"][$i]["other_execute"] = "checked=\"checked\"";
            } else {
                $list["all"][$i]["other_execute"] = "";
            }
            $list["all"][$i]["chmodvalue"] = $owner_chmod . $group_chmod . $other_chmod;
            if ($list["all"][$i]["dirorfile"] == "d") {
                $list["directories"][$directory_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"];
                $directory_index++;
            } elseif ($list["all"][$i]["dirorfile"] == "-") {
                $list["files"][$file_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"];
                $file_index++;
            } elseif ($list["all"][$i]["dirorfile"] == "l") {
                $list["symlinks"][$symlink_index]["chmodvalue"] = $list["all"][$i]["chmodvalue"];
                $symlink_index++;
            }
        }
        // end for
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Initialize variables
        $directory_index = 1;
        $file_index = 1;
        $symlink_index = 1;
        // Calculate the chmod octal
        for ($i = 1; $i <= count($list["all"]); $i++) {
            if (isset($list["all"][$i]["owner_read"]) == false) {
                $list["all"][$i]["owner_read"] = 0;
            }
            if (isset($list["all"][$i]["owner_write"]) == false) {
                $list["all"][$i]["owner_write"] = 0;
            }
            if (isset($list["all"][$i]["owner_execute"]) == false) {
                $list["all"][$i]["owner_execute"] = 0;
            }
            if (isset($list["all"][$i]["group_read"]) == false) {
                $list["all"][$i]["group_read"] = 0;
            }
            if (isset($list["all"][$i]["group_write"]) == false) {
                $list["all"][$i]["group_write"] = 0;
            }
            if (isset($list["all"][$i]["group_execute"]) == false) {
                $list["all"][$i]["group_execute"] = 0;
            }
            if (isset($list["all"][$i]["other_read"]) == false) {
                $list["all"][$i]["other_read"] = 0;
            }
            if (isset($list["all"][$i]["other_write"]) == false) {
                $list["all"][$i]["other_write"] = 0;
            }
            if (isset($list["all"][$i]["other_execute"]) == false) {
                $list["all"][$i]["other_execute"] = 0;
            }
            $ownerOctal = $list["all"][$i]["owner_read"] + $list["all"][$i]["owner_write"] + $list["all"][$i]["owner_execute"];
            $groupOctal = $list["all"][$i]["group_read"] + $list["all"][$i]["group_write"] + $list["all"][$i]["group_execute"];
            $otherOctal = $list["all"][$i]["other_read"] + $list["all"][$i]["other_write"] + $list["all"][$i]["other_execute"];
            $chmodOctal = $ownerOctal . $groupOctal . $otherOctal;
            if ($chmodOctal > 777 || $chmodOctal < 0) {
                $errormessage = __("The chmod nr <b>%1\$s</b> is out of the range 000-777. Please try again.", $chmodOctal);
                setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
                return false;
            } else {
                $list["all"][$i]["chmodoctal"] = $chmodOctal;
                if ($list["all"][$i]["dirorfile"] == "d") {
                    $list["directories"][$directory_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"];
                    $directory_index++;
                } elseif ($list["all"][$i]["dirorfile"] == "-") {
                    $list["files"][$file_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"];
                    $file_index++;
                } elseif ($list["all"][$i]["dirorfile"] == "l") {
                    $list["symlinks"][$symlink_index]["chmodoctal"] = $list["all"][$i]["chmodoctal"];
                    $symlink_index++;
                }
            }
        }
        // End for
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($conn_id == false) {
            return false;
        }
        // Chmod the entries
        setStatus(4, 10, __("Processing the entries"));
        ftp_chmod2($conn_id, $net2ftp_globals["directory"], $list, 0);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Close connection
        ftp_closeconnection($conn_id);
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:Gemorroj,项目名称:net2ftp,代码行数:101,代码来源:chmod.inc.php

示例14: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the login screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    // ------------------------------------
    // Title
    // ------------------------------------
    $login_title = __("Login!");
    // ------------------------------------
    // FTP server
    //	    $ftpserver["inputType"] can be "text", "select" or "hidden"
    //	    $ftpserver"][$i]["text"] is "ftp.server.com"
    //	    $ftpserver"][$i]["selected"] is "selected" or ""
    // ------------------------------------
    // All FTP servers are allowed
    // Prefill the textbox with the value that was filled in (when changing the language the page refreshes)
    // or else with the value from the cookie
    if ($net2ftp_settings["allowed_ftpservers"][1] == "ALL") {
        // Input type is textbox
        $ftpserver["inputType"] = "text";
        // Prefill with the previous input value
        if ($net2ftp_globals["ftpserver"] != "") {
            $ftpserver["list"][1] = htmlEncode2($net2ftp_globals["ftpserver"]);
        } else {
            $ftpserver["list"][1] = htmlEncode2($net2ftp_globals["cookie_ftpserver"]);
        }
    } elseif (sizeof($net2ftp_settings["allowed_ftpservers"]) > 1) {
        // Input type is drop-down box
        $ftpserver["inputType"] = "select";
        // List of allowed FTP servers
        $ftpserver["list"] = $net2ftp_settings["allowed_ftpservers"];
        // Preselect the right FTP server
        // ... using the previous input value
        $array_search_result1 = array_search($net2ftp_globals["ftpserver"], $ftpserver);
        if (is_numeric($array_search_result1) == true) {
            $ftpserver["list"][$array_search_result1]["selected"] = "selected=\"selected\"";
        } else {
            $array_search_result2 = array_search($net2ftp_globals["cookie_ftpserver"], $ftpserver);
            if (is_numeric($array_search_result2) == true) {
                $ftpserver["list"][$array_search_result2]["selected"] = "selected=\"selected\"";
            }
        }
    } elseif (sizeof($net2ftp_settings["allowed_ftpservers"]) == 1) {
        $ftpserver["inputType"] = "hidden";
        $ftpserver["list"][1] = $net2ftp_settings["allowed_ftpservers"][1];
    } else {
        $errormessage = "There is an error in the net2ftp configuration file <b>settings_authorizations.inc.php</b>: variable <b>\$net2ftp_allowed_ftpservers</b> does not follow the expected format.";
        setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
        return false;
    }
    // ------------------------------------
    // FTP server port
    //	    $ftpserverport["inputType"] can be "text" or "hidden"
    //	    $ftpserverport is "21"
    // ------------------------------------
    if ($net2ftp_settings["allowed_ftpserverport"] == "ALL") {
        // Input type is textbox
        $ftpserverport["inputType"] = "text";
        // Prefill with the previous input value
        if ($net2ftp_globals["ftpserverport"] != "") {
            $ftpserverport["value"] = htmlEncode2($net2ftp_globals["ftpserverport"]);
        } elseif ($net2ftp_globals["cookie_ftpserverport"] != "") {
            $ftpserverport["value"] = htmlEncode2($net2ftp_globals["cookie_ftpserverport"]);
        } else {
            $ftpserverport["value"] = 21;
        }
    } else {
        $ftpserverport["inputType"] = "hidden";
        $ftpserverport["value"] = $net2ftp_settings["allowed_ftpserverport"];
    }
    // ------------------------------------
    // Username
    // ------------------------------------
    // Prefill with the previous input value
    if ($net2ftp_globals["username"] != "") {
        $username = htmlEncode2($net2ftp_globals["username"]);
    } else {
        $username = htmlEncode2($net2ftp_globals["cookie_username"]);
    }
    // ------------------------------------
    // Password
    // ------------------------------------
    // Do not prefill this field
    $password = "";
    // ------------------------------------
    // Passive mode
    // ------------------------------------
    if ($net2ftp_globals["passivemode"] == "yes") {
        $passivemode["checked"] = "checked=\"checked\"";
    } elseif ($net2ftp_globals["cookie_passivemode"] == "yes") {
        $passivemode["checked"] = "checked=\"checked\"";
    } else {
//.........这里部分代码省略.........
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:101,代码来源:login.inc.php

示例15: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the search screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    if (isset($_POST["searchoptions"]) == true) {
        $searchoptions = $_POST["searchoptions"];
    }
    if (isset($searchoptions["string"]) == false) {
        $searchoptions["string"] = "";
    }
    if (isset($searchoptions["case_sensitive"]) == false) {
        $searchoptions["case_sensitive"] = "";
    }
    if (isset($searchoptions["filename"]) == false) {
        $searchoptions["filename"] = "";
    }
    if (isset($searchoptions["size_from"]) == false) {
        $searchoptions["size_from"] = "";
    }
    if (isset($searchoptions["size_to"]) == false) {
        $searchoptions["size_to"] = "";
    }
    if (isset($searchoptions["modified_from"]) == false) {
        $searchoptions["modified_from"] = "";
    }
    if (isset($searchoptions["modified_to"]) == false) {
        $searchoptions["modified_to"] = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    // See below
    // Form name, back and forward buttons
    $formname = "FindstringForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Next screen
    $nextscreen = 2;
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Title
        $title = __("Search directories and files");
        // From and to dates
        $tomorrow = date("Y-m-d", time() + 3600 * 24);
        $oneweekago = date("Y-m-d", time() - 3600 * 24 * 7);
        $modified_from = $oneweekago;
        $modified_to = $tomorrow;
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Title
        $title = __("Search results");
        // Check if $searchoptions["string"] is a valid string
        if (is_string($searchoptions["string"]) == false) {
            $errormessage = __("Please enter a valid search word or phrase.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["filename"] is a valid filename with a possible wildcard character *
        if ($searchoptions["filename"] != "" && preg_match("/^[a-zA-Z0-9_ *\\.-]*\$/", $searchoptions["filename"]) == 0) {
            $errormessage = __("Please enter a valid filename.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["size_from"] and $searchoptions["size_to"] are valid numbers
        if ($searchoptions["size_from"] != "" && is_numeric($searchoptions["size_from"]) == false) {
            $errormessage = __("Please enter a valid file size in the \"from\" textbox, for example 0.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        if ($searchoptions["size_to"] != "" && is_numeric($searchoptions["size_to"]) == false) {
            $errormessage = __("Please enter a valid file size in the \"to\" textbox, for example 500000.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // Check if $searchoptions["modified_from"] and $searchoptions["modified_to"] are valid dates
        if ($searchoptions["modified_from"] != "" && preg_match("/^[0-9-]*\$/", $searchoptions["modified_from"]) == 0) {
            $errormessage = __("Please enter a valid date in Y-m-d format in the \"from\" textbox.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        if ($searchoptions["modified_to"] != "" && preg_match("/^[0-9-]*\$/", $searchoptions["modified_to"]) == 0) {
            $errormessage = __("Please enter a valid date in Y-m-d format in the \"to\" textbox.");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // ------------
        // CONVERSIONS
        // ------------
//.........这里部分代码省略.........
开发者ID:klr2003,项目名称:sourceread,代码行数:101,代码来源:findstring.inc.php


注:本文中的setErrorVars函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。