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


PHP setStatus函数代码示例

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


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

示例1: processSettingsFile

function processSettingsFile($settingsFile, $data, $secret, &$output, \Milo\Github\Api $api, $index = 0)
{
    $buildNumber = $index + 1;
    $allowedPattern = '/[^a-z0-9\\/]+\\.yml/i';
    $settingsFile = urldecode($settingsFile);
    $settingsFile = trim($settingsFile, './\\');
    // no absolutes or dot-files, including escaped ones.
    $settingsFile = preg_match($allowedPattern, $settingsFile) ?: $settingsFile;
    // nullify if invalid
    $payload = new \NamelessCoder\Gizzle\Payload($data, $secret, $settingsFile);
    $payload->setApi($api);
    setStatus($payload, $api, 'pending', $buildNumber);
    $response = $payload->process();
    $payload->dispatchMessages();
    if (0 === $response->getCode()) {
        $output += $response->getOutput();
        setStatus($payload, $api, 'success', $buildNumber);
    } else {
        $output['messages'][] = 'The following errors were reported:';
        foreach ($response->getErrors() as $error) {
            $output['messages'][] = $error->getMessage() . ' (' . $error->getCode() . ')' . PHP_EOL;
        }
        setStatus($payload, $api, 'error', $buildNumber);
    }
    return $payload;
}
开发者ID:NamelessCoder,项目名称:gizzle,代码行数:26,代码来源:github-webhook.php

示例2: internalServerError

function internalServerError($msg)
{
    setStatus(500, "Internal Server Error");
    setContentTypeJson();
    echo '{"error":"' . $msg . '"}';
    die;
}
开发者ID:jan-berge-ommedal,项目名称:Thin-PHP-Backend,代码行数:7,代码来源:http.php

示例3: validateUser

function validateUser()
{
    if (!isValidSessionId(getCookie(COOKIE_SESSION_ID))) {
        setStatus("401", "Unauthorized");
        die;
    } else {
        debug("Validated user");
    }
}
开发者ID:jan-berge-ommedal,项目名称:Thin-PHP-Backend,代码行数:9,代码来源:auth.php

示例4: resultToJsonObject

function resultToJsonObject($result)
{
    $row = $result->fetch_assoc();
    if ($row) {
        encodeData($row);
        setContentTypeJson();
        echo json_encode($row);
    } else {
        setStatus(404, "Not Found");
    }
}
开发者ID:jan-berge-ommedal,项目名称:Thin-PHP-Backend,代码行数:11,代码来源:db.php

示例5: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the browse screen ($state2=="main") or the directory popup screen ($state2=="popup")
    // For the browse screen ($state2=="main"), 2 template files are called
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Check if the directory name contains \' and if it does, print an error message
    // Note: these directories cannot be browsed, but can be deleted
    // -------------------------------------------------------------------------
    //	if (strstr($directory, "\'") != false) {
    //		$errormessage = __("Directories with names containing \' cannot be displayed correctly. They can only be deleted. Please go back and select another subdirectory.");
    //		setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
    //		return false;
    //	}
    // -------------------------------------------------------------------------
    // Variables
    // With status update if $state2=="main"
    // -------------------------------------------------------------------------
    // ------------------------------------
    // Open connection
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        setStatus(2, 10, __("Connecting to the FTP server"));
    }
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // ------------------------------------
    // Get raw list of directories and files; parse the raw list and return a nice list
    // This function may change the current $directory; a warning message is returned in that case
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        setStatus(4, 10, __("Getting the list of directories and files"));
    }
    $list = ftp_getlist($conn_id, $net2ftp_globals["directory"]);
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // ------------------------------------
    // Close connection
    // ------------------------------------
    ftp_closeconnection($conn_id);
    // ------------------------------------
    // Sort the list
    // ------------------------------------
    $list_directories = sort_list($list["directories"]);
    $list_files = sort_list($list["files"]);
    $list_symlinks = sort_list($list["symlinks"]);
    $list_unrecognized = sort_list($list["unrecognized"]);
    $warning_directory = $list["stats"]["warnings"];
    $directory = $list["stats"]["newdirectory"];
    $directory_html = htmlEncode2($directory);
    $directory_url = urlEncode2($directory);
    $directory_js = javascriptEncode2($directory);
    $updirectory = upDir($directory);
    $updirectory_html = htmlEncode2($updirectory);
    $updirectory_url = urlEncode2($updirectory);
    $updirectory_js = javascriptEncode2($updirectory);
    // ------------------------------------
    // Calculate the list of HTTP URLs
    // ------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        $list_links_js = ftp2http($net2ftp_globals["directory"], $list_files, "no");
        $list_links_url = ftp2http($net2ftp_globals["directory"], $list_files, "yes");
    }
    // ------------------------------------
    // Consumption message
    // ------------------------------------
    $warning_consumption = "";
    if (checkConsumption() == false) {
        $warning_consumption .= "<b>" . __("Daily limit reached: you will not be able to transfer data") . "</b><br /><br />\n";
        $warning_consumption .= __("In order to guarantee the fair use of the web server for everyone, the data transfer volume and script execution time are limited per user, and per day. Once this limit is reached, you can still browse the FTP server but not transfer data to/from it.") . "<br /><br />\n";
        $warning_consumption .= __("If you need unlimited usage, please install net2ftp on your own web server.") . "<br />\n";
    }
    // ------------------------------------
    // Browse message
    // ------------------------------------
    if ($net2ftp_settings["message_browse"] != "" && $net2ftp_settings["message_browse"] != "Setting message_browse does not exist") {
        $warning_message = $net2ftp_settings["message_browse"];
    }
    // ------------------------------------
    // Directory tree
    // ------------------------------------
    $directory_exploded = explode("/", stripDirectory($directory));
    if ($directory != "/" && checkAuthorizedDirectory("/") == true) {
        $directory_tree = "<a href=\"javascript:submitBrowseForm('/','','browse','main');\">root</a> ";
    } else {
        $directory_tree = "root ";
    }
    $directory_goto = "";
    for ($i = 0; $i < sizeof($directory_exploded) - 1; $i++) {
        $directory_goto = glueDirectories($directory_goto, $directory_exploded[$i]);
        $directory_goto_url = urlEncode2($directory_goto);
        if (checkAuthorizedDirectory($directory_goto) == true) {
//.........这里部分代码省略.........
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:101,代码来源:browse.inc.php

示例6: 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
    // -------------------------------------------------------------------------
    $filename_extension = get_filename_extension($net2ftp_globals["entry"]);
    // ------------------------
    // Set the state2 variable depending on the file extension !!!!!
    // ------------------------
    if (getFileType($net2ftp_globals["entry"]) == "IMAGE") {
        $filetype = "image";
    } elseif ($filename_extension == "swf") {
        $filetype = "flash";
    } else {
        $filetype = "text";
    }
    // Form name, back and forward buttons
    $formname = "ViewForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // Next screen
    $nextscreen = 2;
    // -------------------------------------------------------------------------
    // Text
    // -------------------------------------------------------------------------
    if ($filetype == "text") {
        // Title
        $title = __("View file %1\$s", $net2ftp_globals["entry"]);
        // ------------------------
        // geshi_text
        // ------------------------
        setStatus(2, 10, __("Reading the file"));
        $geshi_text = ftp_readfile("", $net2ftp_globals["directory"], $net2ftp_globals["entry"]);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ------------------------
        // geshi_language
        // ------------------------
        $geshi_language = "";
        $list_language_extensions = array('html4strict' => array('html', 'htm'), 'javascript' => array('js'), 'css' => array('css'), 'php' => array('php', 'php5', 'phtml', 'phps'), 'perl' => array('pl', 'pm', 'cgi'), 'sql' => array('sql'), 'java' => array('java'), 'actionscript' => array('as'), 'ada' => array('a', 'ada', 'adb', 'ads'), 'apache' => array('conf'), 'asm' => array('ash', 'asm'), 'asp' => array('asp'), 'bash' => array('sh'), 'c' => array('c', 'h'), 'c_mac' => array('c'), 'caddcl' => array(), 'cadlisp' => array(), 'cpp' => array('cpp'), 'csharp' => array(), 'd' => array(''), 'delphi' => array('dpk'), 'diff' => array(''), 'email' => array('eml', 'mbox'), 'lisp' => array('lisp'), 'lua' => array('lua'), 'matlab' => array(), 'mpasm' => array(), 'nsis' => array(), 'objc' => array(), 'oobas' => array(), 'oracle8' => array(), 'pascal' => array('pas'), 'python' => array('py'), 'qbasic' => array('bi'), 'smarty' => array('tpl'), 'vb' => array('bas'), 'vbnet' => array(), 'vhdl' => array(), 'visualfoxpro' => array(), 'xml' => array('xml'));
        while (list($language, $extensions) = each($list_language_extensions)) {
            if (in_array($filename_extension, $extensions)) {
                $geshi_language = $language;
                break;
            }
        }
        // ------------------------
        // geshi_path
        // ------------------------
        $geshi_path = NET2FTP_APPLICATION_ROOTDIR . "/plugins/geshi/geshi/";
        // ------------------------
        // Call geshi
        // ------------------------
        setStatus(4, 10, __("Parsing the file"));
        $geshi = new GeSHi($geshi_text, $geshi_language, $geshi_path);
        $geshi->set_encoding(__("iso-8859-1"));
        $geshi->set_header_type(GESHI_HEADER_PRE);
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
        //		$geshi->enable_classes();
        $geshi->set_overall_style('border: 2px solid #d0d0d0; background-color: #f6f6f6; color: #000066; padding: 10px;', true);
        $geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
        $geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
        $geshi->set_tab_width(4);
        $geshi_text = $geshi->parse_code();
    } elseif ($filetype == "image") {
        $title = __("View image %1\$s", htmlEncode2($net2ftp_globals["entry"]));
        $image_url = printPHP_SELF("view");
        $image_alt = __("Image") . $net2ftp_globals["entry"];
    } elseif ($filetype == "flash") {
        $title = __("View Macromedia ShockWave Flash movie %1\$s", htmlEncode2($net2ftp_globals["entry"]));
        $flash_url = printPHP_SELF("view");
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:84,代码来源:view.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: if

								foreach ($seasonSplit[0] as $season) { if (!isset($season[0])) break; // PHP BUG?!?!
							?>
							<div class="contentbox normalbox seasons">
								<h3>Season <?php printf("%02d", $season[0]->getSeason())?> <a href="show.php?showid=<?=$season[0]->getShowID()?>" class="subscribe dldmissingeps"><span>Download missing episodes</span></a></h3>
								<ul>
									<?php
									foreach($season as $episode) { ?><li><a href="episode.php?showid=<?=$episode->getShowID()?>&amp;season=<?=$episode->getSeason()?>&amp;id=<?=$episode->getEpisodeID()?>"><span><?php printf("%02d", $episode->getEpisodeID())?> - <?=$episode->getTitle()?></span></a><span><?php setStatus($episode) ?></span></li>
									<?php } ?>
								</ul>
							</div>
							<? } ?>
						</div>
						<div class="contentright">
							<?php 
								foreach ($seasonSplit[1] as $season) { if (!isset($season[0])) break; // PHP BUG?!?!
							?>
							<div class="contentbox normalbox seasons">
								<h3>Season <?php printf("%02d", $season[0]->getSeason())?> <a href="show.php?showid=<?=$season[0]->getShowID()?>" class="subscribe dldmissingeps"><span>Download missing episodes</span></a></h3>
								<ul>
									<?php
									foreach($season as $episode) { ?><li><a href="episode.php?showid=<?=$episode->getShowID()?>&amp;season=<?=$episode->getSeason()?>&amp;id=<?=$episode->getEpisodeID()?>"><span><?php printf("%02d", $episode->getEpisodeID())?> - <?=$episode->getTitle()?></span></a><span><?php setStatus($episode) ?></span></li>
									<?php } ?>
								</ul>
							</div>
							<? } ?>
						</div>
					</div>
<?php
				}
	include 'footer.php';
?>
开发者ID:Alwnikrotikz,项目名称:mytvondemand,代码行数:31,代码来源:show.php

示例9: getStatus

function getStatus()
{
    global $response;
    global $userid;
    global $status;
    global $startOffline;
    global $processFurther;
    global $channelprefix;
    global $language;
    global $cookiePrefix;
    global $announcementpushchannel;
    global $bannedUserIDs;
    if ($userid > 10000000) {
        $sql = getGuestDetails($userid);
    } else {
        $sql = getUserDetails($userid);
    }
    $query = mysqli_query($GLOBALS['dbh'], $sql);
    if (defined('DEV_MODE') && DEV_MODE == '1') {
        echo mysqli_error($GLOBALS['dbh']);
    }
    if (mysqli_num_rows($query) > 0) {
        $chat = mysqli_fetch_assoc($query);
        if (!empty($_REQUEST['callbackfn'])) {
            $_SESSION['cometchat']['startoffline'] = 1;
        }
        if ($startOffline == 1 && empty($_SESSION['cometchat']['startoffline'])) {
            $_SESSION['cometchat']['startoffline'] = 1;
            $chat['status'] = 'offline';
            setStatus('offline');
            $_SESSION['cometchat']['cometchat_sessionvars']['buddylist'] = 0;
            $processFurther = 0;
        } else {
            if (empty($chat['status'])) {
                $chat['status'] = 'available';
            } else {
                if ($chat['status'] == 'away') {
                    $chat['status'] = 'available';
                    setStatus('available');
                }
                if ($chat['status'] == 'offline') {
                    $processFurther = 0;
                    $_SESSION['cometchat']['cometchat_sessionvars']['buddylist'] = 0;
                }
            }
        }
        if (empty($chat['message'])) {
            $chat['message'] = $status[$chat['status']];
        }
        if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php")) {
            include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "announcements" . DIRECTORY_SEPARATOR . "config.php";
        }
        $chat['message'] = html_entity_decode($chat['message']);
        $ccmobileauth = 0;
        if (!empty($_REQUEST['callbackfn']) && $_REQUEST['callbackfn'] == 'ccmobiletab') {
            $ccmobileauth = md5($_SESSION['basedata'] . 'cometchat');
        }
        if (empty($chat['ch'])) {
            if (defined('KEY_A') && defined('KEY_B') && defined('KEY_C')) {
                $key = KEY_A . KEY_B . KEY_C;
            }
            $chat['ch'] = md5($chat['userid'] . $key);
        }
        $s = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => fetchLink($chat['link']), 'a' => getAvatar($chat['avatar']), 's' => $chat['status'], 'm' => $chat['message'], 'push_channel' => 'C_' . md5($channelprefix . "USER_" . $userid . BASE_URL), 'ccmobileauth' => $ccmobileauth, 'push_an_channel' => $announcementpushchannel, 'webrtc_prefix' => $channelprefix, 'ch' => $chat['ch'], 'ls' => $chat['lastseen'], 'lstn' => $chat['lastseensetting']);
        if (in_array($chat['userid'], $bannedUserIDs)) {
            $s['b'] = 1;
        }
        $response['userstatus'] = $_SESSION['cometchat']['user'] = $s;
    } else {
        if (USE_CCAUTH != 1) {
            $response['loggedout'] = '1';
            $response['logout_message'] = $language[30];
            setcookie($cookiePrefix . 'guest', '', time() - 3600, '/');
            setcookie($cookiePrefix . 'state', '', time() - 3600, '/');
            unset($_SESSION['cometchat']);
        }
    }
}
开发者ID:albertoneto,项目名称:localhost,代码行数:78,代码来源:cometchat_shared.php

示例10: net2ftp_module_printBody


//.........这里部分代码省略.........
            clearstatcache();
            // for filesize
            $packagelist_local = @fread($handle_local, filesize($packagelistfile_local));
            @fclose($handle_local);
        }
        // Issue an error message if no list could be read
        if ($packagelist_net2ftp != "") {
            $packagelist = $packagelist_net2ftp;
        } elseif ($packagelist_local != "") {
            $packagelist = $packagelist_local;
        } else {
            $errormessage = __("Unable to get the list of packages");
            setErrorVars(false, $errormessage, debug_backtrace(), __FILE__, __LINE__);
            return false;
        }
        // ----------------------------------------------
        // Security code
        // Random key generator by goochivasquez -at- gmail (15-Apr-2005 11:53)
        // ----------------------------------------------
        // Random key generator
        $keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
        $length = 20;
        $security_code = "";
        for ($i = 0; $i < $length; $i++) {
            $security_code .= substr($keychars, rand(1, strlen($keychars)), 1);
        }
        // Random key generator
        $keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
        $length = 5;
        $tempdir_extension = "";
        for ($i = 0; $i < $length; $i++) {
            $tempdir_extension .= substr($keychars, rand(1, strlen($keychars)), 1);
        }
        $tempdir_ftp = glueDirectories($net2ftp_globals["directory"], "net2ftp_temp_") . $tempdir_extension;
        // ----------------------------------------------
        // Replace certain values
        // ----------------------------------------------
        $text = str_replace("NET2FTP_SECURITY_CODE", $security_code, $text);
        $text = str_replace("NET2FTP_TEMPDIR_EXTENSION", $tempdir_extension, $text);
        $text = str_replace("NET2FTP_PACKAGELIST", $packagelist, $text);
        $text = str_replace("NET2FTP_FTP_SERVER", $net2ftp_globals["ftpserver"], $text);
        $text = str_replace("NET2FTP_FTPSERVER_PORT", $net2ftp_globals["ftpserverport"], $text);
        $text = str_replace("NET2FTP_USERNAME", $net2ftp_globals["username"], $text);
        $text = str_replace("NET2FTP_DIRECTORY", $net2ftp_globals["directory"], $text);
        // ----------------------------------------------
        // Open connection
        // ----------------------------------------------
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($conn_id == false) {
            return false;
        }
        // ----------------------------------------------
        // Create temporary /net2ftp_temp directory
        // ----------------------------------------------
        setStatus(4, 10, __("Creating a temporary directory on the FTP server"));
        ftp_newdirectory($conn_id, $tempdir_ftp);
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
        }
        // ----------------------------------------------
        // Chmodding the temporary /net2ftp_temp directory to 777
        // ----------------------------------------------
        setStatus(6, 10, __("Setting the permissions of the temporary directory"));
        $sitecommand = "chmod 0777 " . $tempdir_ftp;
        $ftp_site_result = @ftp_site($conn_id, $sitecommand);
        // ----------------------------------------------
        // Put a .htaccess in the /net2ftp_temp directory to avoid anyone else reading the contents it
        // (Works only for Apache web servers...)
        // ----------------------------------------------
        ftp_writefile($conn_id, $tempdir_ftp, ".htaccess", "deny from all");
        if ($net2ftp_result["success"] == false) {
            setErrorVars(true, "", "", "", "");
        }
        // ----------------------------------------------
        // Write the net2ftp installer script to the FTP server
        // ----------------------------------------------
        setStatus(8, 10, __("Copying the net2ftp installer script to the FTP server"));
        ftp_writefile($conn_id, $net2ftp_globals["directory"], "net2ftp_installer.php", $text);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ----------------------------------------------
        // Close connection
        // ----------------------------------------------
        ftp_closeconnection($conn_id);
        // ----------------------------------------------
        // Variables for screen 1
        // ----------------------------------------------
        // URL to the installer script
        $list_files[1]["dirfilename_js"] = "net2ftp_installer.php?security_code=" . $security_code;
        $ftp2http_result = ftp2http($net2ftp_globals["directory"], $list_files, "no");
        $net2ftp_installer_url = $ftp2http_result[1];
    }
    // end if
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:GTAWWEKID,项目名称:tsiserver.us,代码行数:101,代码来源:install.inc.php

示例11: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the copy/move/delete 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["ftpserver2"]) == true) {
        $net2ftp_globals["ftpserver2"] = validateFtpserver($_POST["ftpserver2"]);
    } else {
        $net2ftp_globals["ftpserver2"] = "";
    }
    if (isset($_POST["ftpserverport2"]) == true) {
        $net2ftp_globals["ftpserverport2"] = validateFtpserverport($_POST["ftpserverport2"]);
    } else {
        $net2ftp_globals["ftpserverport2"] = "";
    }
    if (isset($_POST["username2"]) == true) {
        $net2ftp_globals["username2"] = validateUsername($_POST["username2"]);
    } else {
        $net2ftp_globals["username2"] = "";
    }
    if (isset($_POST["password2"]) == true) {
        $net2ftp_globals["password2"] = validatePassword($_POST["password2"]);
    } else {
        $net2ftp_globals["password2"] = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    if ($net2ftp_globals["state2"] == "copy") {
        $title = __("Copy directories and files");
    } elseif ($net2ftp_globals["state2"] == "move") {
        $title = __("Move directories and files");
    } elseif ($net2ftp_globals["state2"] == "delete") {
        $title = __("Delete directories and files");
    }
    // Form name, back and forward buttons
    $formname = "CopyMoveDeleteForm";
    $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 to the source server
        // ---------------------------------------
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id_source = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // ---------------------------------------
        // Open connection to the target server, if it is different from the source server, or if the username
        // is different (different users may have different authorizations on the same FTP server)
        // ---------------------------------------
        if (($net2ftp_globals["ftpserver2"] != "" || $net2ftp_globals["username2"] != "") && ($net2ftp_globals["ftpserver2"] != $net2ftp_globals["ftpserver"] || $net2ftp_globals["username2"] != $net2ftp_globals["username"])) {
            $conn_id_target = ftp_openconnection2();
            // Note: ftp_openconnection2 cleans the input values
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        } else {
            $conn_id_target = $conn_id_source;
        }
        // ---------------------------------------
        // Copy, move or delete the files and directories
        // ---------------------------------------
        ftp_copymovedelete($conn_id_source, $conn_id_target, $list, $net2ftp_globals["state2"], 0);
        // ---------------------------------------
        // Close the connection to the source server
        // ---------------------------------------
        ftp_closeconnection($conn_id_source);
        // ---------------------------------------
        // Close the connection to the target server, if it is different from the source server
        // ---------------------------------------
        if ($conn_id_source != $conn_id_target) {
            ftp_closeconnection($conn_id_target);
        }
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
开发者ID:rohdoor,项目名称:Zpanel-net2ftp,代码行数:98,代码来源:copymovedelete.inc.php

示例12: online_users

                break;
            case 'online_users':
                $out = online_users(session::USER_REGULAR);
                break;
            case 'getHistory':
                $out = getHistory();
                break;
            case 'getUpdates':
                $out = getUpdates();
                break;
            default:
                setStatus($out, 'fail', 'invalid type.');
                break;
        }
    } else {
        setStatus($out, 'fail', 'query not set.');
    }
}
header('Content-type: text/plain');
echo json_encode($out, JSON_PRETTY_PRINT);
function setStatus($out, $msg, $error = NULL)
{
    $out['status'] = $msg;
    if (!is_null($error)) {
        $out['error'] = $error;
    }
}
function online()
{
    return OnlineUser::with('user')->get();
}
开发者ID:helloworldprojects,项目名称:Autism,代码行数:31,代码来源:api.php

示例13: addComment

 protected function addComment()
 {
     if (!$this->data["permission"]) {
         $this->sendFlashMessage("You do not have permission add comments to pack with ID " . $this->data["pack"]->getId() . ".", "error");
     } else {
         if (isset($_POST["text"])) {
             $comment = new Comment();
             $comment->setText($_POST["text"]);
             $comment->setUser($this->data["loggedUser"]);
             $comment->setPack($this->data["pack"]);
             if ($comment->save() <= 0) {
                 $failures = $comment->getValidationFailures();
                 var_dump($failures);
                 exit;
                 setStatus("error");
                 if (count($failures) > 0) {
                     foreach ($failures as $failure) {
                         $this->sendFlashMessage("Your comment has not been added. " . $failure->getMessage(), "error");
                     }
                 }
             }
         } else {
             setHTTPStatusCode("400");
         }
         $this->viewString(json_encode($this->data["response"]));
     }
 }
开发者ID:xfreddiex,项目名称:code-sharer,代码行数:27,代码来源:PackController.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, $net2ftp_output;
    if (isset($_POST["troubleshoot_ftpserver"]) == true) {
        $troubleshoot_ftpserver = validateFtpserver($_POST["troubleshoot_ftpserver"]);
    } else {
        $troubleshoot_ftpserver = "";
    }
    if (isset($_POST["troubleshoot_ftpserverport"]) == true) {
        $troubleshoot_ftpserverport = validateFtpserverport($_POST["troubleshoot_ftpserverport"]);
    } else {
        $troubleshoot_ftpserverport = "";
    }
    if (isset($_POST["troubleshoot_username"]) == true) {
        $troubleshoot_username = validateUsername($_POST["troubleshoot_username"]);
    } else {
        $troubleshoot_username = "";
    }
    if (isset($_POST["troubleshoot_password"]) == true) {
        $troubleshoot_password = validatePassword($_POST["troubleshoot_password"]);
    } else {
        $troubleshoot_password = "";
    }
    if (isset($_POST["troubleshoot_directory"]) == true) {
        $troubleshoot_directory = validateDirectory($_POST["troubleshoot_directory"]);
    } else {
        $troubleshoot_directory = "";
    }
    if (isset($_POST["troubleshoot_passivemode"]) == true) {
        $troubleshoot_passivemode = validatePassivemode($_POST["troubleshoot_passivemode"]);
    } else {
        $troubleshoot_passivemode = "";
    }
    $troubleshoot_ftpserver_html = htmlEncode2($troubleshoot_ftpserver);
    $troubleshoot_ftpserverport_html = htmlEncode2($troubleshoot_ftpserverport);
    $troubleshoot_username_html = htmlEncode2($troubleshoot_username);
    $troubleshoot_directory_html = htmlEncode2($troubleshoot_directory);
    $troubleshoot_passivemode_html = htmlEncode2($troubleshoot_passivemode);
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Troubleshoot an FTP server");
    // Form name
    $formname = "AdvancedForm";
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Next screen
        $nextscreen = 2;
        // Back and forward buttons
        $back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
        $forward_onclick = "document.forms['" . $formname . "'].submit();";
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Back and forward buttons
        $back_onclick = "document.forms['" . $formname . "'].state.value='advanced_ftpserver'; document.forms['" . $formname . "'].submit();";
        // Initial checks
        if ($troubleshoot_passivemode != "yes") {
            $troubleshoot_passivemode = "no";
        }
        // Connect
        setStatus(1, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_connect("{$troubleshoot_ftpserver}", $troubleshoot_ftpserverport);
        // Login with username and password
        setStatus(2, 10, __("Logging into the FTP server"));
        $ftp_login_result = ftp_login($conn_id, $troubleshoot_username, $troubleshoot_password);
        // Passive mode
        if ($troubleshoot_passivemode == "yes") {
            setStatus(3, 10, __("Setting the passive mode"));
            $ftp_pasv_result = ftp_pasv($conn_id, TRUE);
        } else {
            $ftp_pasv_result = true;
        }
        // Get the FTP system type
        setStatus(4, 10, __("Getting the FTP system type"));
        $ftp_systype_result = ftp_systype($conn_id);
        // Change the directory
        setStatus(5, 10, __("Changing the directory"));
        $ftp_chdir_result = ftp_chdir($conn_id, $troubleshoot_directory);
        // Get the current directory from the FTP server
        setStatus(6, 10, __("Getting the current directory"));
        $ftp_pwd_result = ftp_pwd($conn_id);
        // Try to get a raw list
        setStatus(7, 10, __("Getting the list of directories and files"));
        $ftp_rawlist_result = ftp_rawlist($conn_id, "-a");
        if (sizeof($ftp_rawlist_result) <= 1) {
            $ftp_rawlist_result = ftp_rawlist($conn_id, "");
        }
        // Parse the list
        setStatus(8, 10, __("Parsing the list of directories and files"));
        for ($i = 0; $i < sizeof($ftp_rawlist_result); $i++) {
            $parsedlist[$i] = ftp_scanline($troubleshoot_directory, $ftp_rawlist_result[$i]);
        }
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:advanced_ftpserver.inc.php

示例15: net2ftp_module_printBody

function net2ftp_module_printBody()
{
    // --------------
    // This function prints the upload screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    $file_counter = 0;
    $archive_counter = 0;
    // Normal upload
    if (isset($_FILES["file"]) == true && is_array($_FILES["file"]) == true) {
        foreach ($_FILES["file"]["name"] as $key => $val) {
            if ($val != "") {
                $file_counter = $file_counter + 1;
                $uploadedFilesArray["{$file_counter}"]["name"] = validateEntry($val);
                $uploadedFilesArray["{$file_counter}"]["tmp_name"] = $_FILES["file"]["tmp_name"][$key];
                $uploadedFilesArray["{$file_counter}"]["size"] = $_FILES["file"]["size"][$key];
            }
            // end if
        }
        // end foreach
    }
    if (isset($_FILES["archive"]) == true && is_array($_FILES["archive"]) == true) {
        foreach ($_FILES["archive"]["name"] as $key => $val) {
            if ($val != "") {
                $archive_counter = $archive_counter + 1;
                $uploadedArchivesArray["{$archive_counter}"]["name"] = validateEntry($val);
                $uploadedArchivesArray["{$archive_counter}"]["tmp_name"] = $_FILES["archive"]["tmp_name"][$key];
                $uploadedArchivesArray["{$archive_counter}"]["size"] = $_FILES["archive"]["size"][$key];
            }
            // end if
        }
        // end foreach
    }
    // Upload via SWFUpload Flash applet or using the OpenLaszlo skin
    if (isset($_FILES["Filedata"]) == true && is_array($_FILES["Filedata"]) == true) {
        $file_counter = $file_counter + 1;
        $uploadedFilesArray["{$file_counter}"]["name"] = $_FILES["Filedata"]["name"];
        $uploadedFilesArray["{$file_counter}"]["tmp_name"] = $_FILES["Filedata"]["tmp_name"];
        $uploadedFilesArray["{$file_counter}"]["size"] = $_FILES["Filedata"]["size"];
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    // The title is different for screen 1 and screen 2 - see below
    // Form name, back and forward buttons
    $formname = "UploadForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Encoding type
    $enctype = "enctype=\"multipart/form-data\"";
    // Next screen
    $nextscreen = 2;
    // Maxima
    $max_filesize = $net2ftp_settings["max_filesize"];
    $max_filesize_net2ftp = $max_filesize / 1024;
    $max_upload_filesize_php = @ini_get("upload_max_filesize");
    $max_execution_time = @ini_get("max_execution_time");
    // -------------------------------------------------------------------------
    // Variables for screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // Title
        $title = __("Upload files and archives");
    } elseif ($net2ftp_globals["screen"] == 2) {
        // Title
        $title = __("Upload more files and archives");
        // ---------------------------------------
        // Check the files and move them to the net2ftp temp directory
        // The .txt extension is added
        // ---------------------------------------
        if (sizeof($uploadedFilesArray) > 0 || sizeof($uploadedArchivesArray) > 0) {
            setStatus(1, 10, __("Checking files"));
            if (isset($uploadedFilesArray) == true) {
                $acceptedFilesArray = acceptFiles($uploadedFilesArray);
                if ($net2ftp_result["success"] == false) {
                    return false;
                }
            }
            if (isset($uploadedArchivesArray) == true) {
                $acceptedArchivesArray = acceptFiles($uploadedArchivesArray);
                if ($net2ftp_result["success"] == false) {
                    return false;
                }
            }
        }
        // ---------------------------------------
        // Transfer files
        // ---------------------------------------
        if (isset($acceptedFilesArray) == true && $acceptedFilesArray != "all_uploaded_files_are_too_big" && sizeof($acceptedFilesArray) > 0) {
            setStatus(0, 10, __("Transferring files to the FTP server"));
            ftp_transferfiles($acceptedFilesArray, $net2ftp_globals["directory"]);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
        // ---------------------------------------
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:upload.inc.php


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