コード例 #1
0
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;
}
コード例 #2
0
function internalServerError($msg)
{
    setStatus(500, "Internal Server Error");
    setContentTypeJson();
    echo '{"error":"' . $msg . '"}';
    die;
}
コード例 #3
0
function validateUser()
{
    if (!isValidSessionId(getCookie(COOKIE_SESSION_ID))) {
        setStatus("401", "Unauthorized");
        die;
    } else {
        debug("Validated user");
    }
}
コード例 #4
0
function resultToJsonObject($result)
{
    $row = $result->fetch_assoc();
    if ($row) {
        encodeData($row);
        setContentTypeJson();
        echo json_encode($row);
    } else {
        setStatus(404, "Not Found");
    }
}
コード例 #5
0
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) {
            $directory_tree .= "/<a href=\"javascript:submitBrowseForm('" . $directory_goto_url . "','','browse','main');\">" . htmlEncode2($directory_exploded[$i]) . "</a> ";
        } else {
            $directory_tree .= "/" . $directory_exploded[$i] . " ";
        }
    }
    $directory_tree .= "/" . $directory_exploded[sizeof($directory_exploded) - 1];
    // ------------------------------------
    // Language
    // ------------------------------------
    $language_onchange = "document.BrowseForm.language.value=document.forms['BrowseForm'].language2.options[document.forms['BrowseForm'].language2.selectedIndex].value; submitBrowseForm('{$directory_js}', '', 'browse', 'main');";
    // ------------------------------------
    // Skin
    // ------------------------------------
    $skin_onchange = "document.BrowseForm.skin.value=document.forms['BrowseForm'].skin2.options[document.forms['BrowseForm'].skin2.selectedIndex].value; submitBrowseForm('{$directory_js}', '', 'browse', 'main');";
    // ------------------------------------
    // $rowcounter counts the total nr of rows
    // ------------------------------------
    $rowcounter = 0;
    // ------------------------------------
    // Column spans
    // ------------------------------------
    $action_colspan = 1;
    if ($net2ftp_settings["functionuse_view"] == "yes") {
        $action_colspan++;
    }
    if ($net2ftp_settings["functionuse_edit"] == "yes") {
        $action_colspan++;
    }
    if ($net2ftp_settings["functionuse_update"] == "yes") {
        $action_colspan++;
    }
    // Total nr of columns
    $total_colspan = $action_colspan + 9;
    // ------------------------------------
    // Name, Type, Size, ...
    // Determine the sort criteria and direction (ascending/descending)
    // ------------------------------------
    $sortArray["dirfilename"]["text"] = __("Name");
    $sortArray["type"]["text"] = __("Type");
    $sortArray["size"]["text"] = __("Size");
    $sortArray["owner"]["text"] = __("Owner");
    $sortArray["group"]["text"] = __("Group");
    $sortArray["permissions"]["text"] = __("Perms");
    $sortArray["mtime"]["text"] = __("Mod Time");
    $icon_directory = $net2ftp_globals["application_rootdir_url"] . "/skins/" . $net2ftp_globals["skin"] . "/images/mime";
    // Loop over all the sort possibilities
    while (list($key, $value) = each($sortArray)) {
        // The list is sorted by the current $key
        // Print the icon representing the current sortorder
        // Print the link to sort using the other sortorder
        if ($net2ftp_globals["sort"] == $key) {
            // Ascending
            if ($net2ftp_globals["sortorder"] == "ascending") {
                $sortArray[$key]["title"] = __("Click to sort by %1\$s in descending order", $value["text"]);
                $sortArray[$key]["onclick"] = "do_sort('" . $key . "','descending');";
                $icon = "ascend.png";
                $alt = __("Ascending order");
            } else {
                $sortArray[$key]["title"] = __("Click to sort by %1\$s in ascending order", $value["text"]);
                $sortArray[$key]["onclick"] = "do_sort('" . $key . "','ascending');";
                $icon = "descend.png";
                $alt = __("Descending order");
            }
        } else {
            $sortArray[$key]["title"] = __("Click to sort by %1\$s in ascending order", $value["text"]);
            $sortArray[$key]["onclick"] = "do_sort('" . $key . "','ascending');";
            $icon = "";
            $alt = "";
        }
        // The icon to be printed is determined above
        // Now, print the full HTML depending on the browser agent, version and platform
        if ($icon != "") {
            if ($net2ftp_globals["browser_agent"] == "IE" && ($net2ftp_globals["browser_version"] == "5.5" || $net2ftp_globals["browser_version"] == "6") && $net2ftp_globals["browser_platform"] == "Win") {
                $sortArray[$key]["icon"] = "<img src=\"{$icon_directory}/spacer.gif\"   alt=\"{$alt}\" style=\"border: 0px; width: 16px; height: 16px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$icon_directory}/{$icon}', sizingMethod='scale');\" />\n";
            } else {
                $sortArray[$key]["icon"] = "<img src=\"{$icon_directory}/{$icon}\"        alt=\"{$alt}\" style=\"border: 0px; width: 16px; height: 16px;\" />\n";
            }
        } else {
            $sortArray[$key]["icon"] = "";
        }
    }
    // ------------------------------------
    // popup - FormAndFieldname
    // ------------------------------------
    if (isset($_POST["FormAndFieldName"]) == true) {
        $FormAndFieldName = validateGenericInput($_POST["FormAndFieldName"]);
    } else {
        $FormAndFieldName = "";
    }
    // ------------------------------------
    // Action URL
    // Used for Up, Subdirectories, Files (download + actions)
    // ------------------------------------
    $action_url = printPHP_SELF("actions");
    // ------------------------------------
    // Data transfer statistics
    // Print this only if the consumption statistics are available (logging must be on, using a MySQL database)
    // ------------------------------------
    if (isset($net2ftp_globals["consumption_ipaddress_datatransfer"]) == true || isset($net2ftp_globals["consumption_ftpserver_datatransfer"]) == true) {
        $print_consumption = true;
        $consumption_ipaddress_datatransfer = formatFilesize($net2ftp_globals["consumption_ipaddress_datatransfer"]);
        $consumption_ftpserver_datatransfer = formatFilesize($net2ftp_globals["consumption_ftpserver_datatransfer"]);
    } else {
        $print_consumption = false;
    }
    // ------------------------------------
    // HTTP URL
    // ------------------------------------
    $list_files_tmp[1]["dirfilename_url"] = "";
    $httplink = ftp2http($directory, $list_files_tmp, "no");
    // -------------------------------------------------------------------------
    // Print the output - part 2
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["state2"] == "main") {
        setStatus(6, 10, __("Printing the list of directories and files"));
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/browse_main.template.php";
    } elseif ($net2ftp_globals["state2"] == "popup") {
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/browse_popup.template.php";
    }
}
コード例 #6
0
ファイル: view.inc.php プロジェクト: rohdoor/Zpanel-net2ftp
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";
}
コード例 #7
0
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";
}
コード例 #8
0
ファイル: show.php プロジェクト: Alwnikrotikz/mytvondemand
								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';
?>
コード例 #9
0
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']);
        }
    }
}
コード例 #10
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the chmod 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 = "";
    }
    // -------------------------------------------------------------------------
    // Variables for all screens
    // -------------------------------------------------------------------------
    // Title
    $title = __("Install software packages");
    // Form name, back and forward buttons
    $formname = "InstallForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // -------------------------------------------------------------------------
    // Screen 1
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["screen"] == 1) {
        // ----------------------------------------------
        // Read the net2ftp installer script template $text
        // ----------------------------------------------
        $templatefile = $net2ftp_globals["application_rootdir"] . "/modules/install/net2ftp_installer.txt";
        $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 = 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);
        // ----------------------------------------------
        // Read the list of packages
        // ----------------------------------------------
        $packagelistfile_net2ftp = "http://www.net2ftp.com/package_list.txt";
        $packagelistfile_local = $net2ftp_globals["application_rootdir"] . "/modules/install/package_list.txt";
        // Get the list of packages from net2ftp.com
        $handle_net2ftp = @fopen($packagelistfile_net2ftp, "r");
        clearstatcache();
        // for filesize
        $packagelist_net2ftp = @fread($handle_net2ftp, filesize($packagelistfile_net2ftp));
        @fclose($handle_net2ftp);
        // If net2ftp.com can't be reached, get it from the local installation
        if ($packagelist_net2ftp == false) {
            $handle_local = @fopen($packagelistfile_local, "r");
            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";
}
コード例 #11
0
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";
}
コード例 #12
0
ファイル: api.php プロジェクト: helloworldprojects/Autism
                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();
}
コード例 #13
0
 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"]));
     }
 }
コード例 #14
0
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]);
        }
        // end for
        // Quiting; ftp_quit doesn't return a value
        setStatus(9, 10, __("Logging out of the FTP server"));
        ftp_quit($conn_id);
    }
    // end if
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    setStatus(10, 10, __("Printing the result"));
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
コード例 #15
0
ファイル: upload.inc.php プロジェクト: jprice/EHCP
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;
            }
        }
        // ---------------------------------------
        // Unzip archives and transfer the files (create subdirectories if needed)
        // ---------------------------------------
        if (isset($acceptedArchivesArray) == true && $acceptedArchivesArray != "all_uploaded_files_are_too_big" && sizeof($acceptedArchivesArray) > 0) {
            // Set the status
            setStatus(0, 10, __("Decompressing archives and transferring files"));
            // Add information to $acceptedArchivesArray
            for ($i = 1; $i <= sizeof($acceptedArchivesArray); $i = $i + 1) {
                $acceptedArchivesArray[$i]["targetdirectory"] = $net2ftp_globals["directory"];
            }
            // Unzip the archive and transfer the files
            ftp_unziptransferfiles($acceptedArchivesArray);
            if ($net2ftp_result["success"] == false) {
                return false;
            }
        }
    }
    // end elseif
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["skin"] == "openlaszlo") {
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.html.template.php";
    } else {
        require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
    }
}
コード例 #16
0
ファイル: redirector.php プロジェクト: nextraztus/c64xyz
}
$s1 = $dbh->prepare('SELECT * FROM redirect WHERE short_url=?');
$s1->bindValue(1, $qs);
try {
    $s1->execute();
} catch (Exception $e) {
    //database error, not much we can do
    return false;
}
if (!($row = $s1->fetch())) {
    loghit($dbh, "Redirect not found: qs={$qs}");
    return false;
} else {
    if ($row['warning_page']) {
        //TODO: show warning page
        loghit($dbh, "Showing warning page: qs={$qs}");
    } else {
        switch ($row['http_response']) {
            case '301':
            case '302':
            case '303':
                header("Location: {$row['target']}", true, $row['http_response']);
                break;
            default:
                setStatus($row['http_response']);
                break;
        }
        loghit($dbh, "Success: qs={$qs}");
        return true;
    }
}
コード例 #17
0
function getStatus()
{
    global $response;
    global $userid;
    global $status;
    global $startOffline;
    global $processFurther;
    $sql = getUserStatus($userid);
    $query = mysql_query($sql);
    if (defined('DEV_MODE') && DEV_MODE == '1') {
        echo mysql_error();
    }
    $chat = mysql_fetch_array($query);
    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']];
    }
    $chat['message'] = html_entity_decode($chat['message']);
    $s = array('message' => $chat['message'], 'status' => $chat['status']);
    $response['userstatus'] = $s;
}
コード例 #18
0
ファイル: findstring.inc.php プロジェクト: klr2003/sourceread
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
        // ------------
        // Convert the wildcard character * in the filename by the wildcard .* that can be read by preg_match
        // So this *.* becomes this .*..*
        $searchoptions["filename"] = str_replace("*", ".*", $searchoptions["filename"]);
        // Convert the mtime to a unix timestamp
        $searchoptions["modified_from"] = strtotime($searchoptions["modified_from"]);
        $searchoptions["modified_to"] = strtotime($searchoptions["modified_to"]);
        // Open connection
        setStatus(2, 10, __("Connecting to the FTP server"));
        $conn_id = ftp_openconnection();
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Find the files
        $result = array();
        setStatus(4, 10, __("Searching the files..."));
        $result = ftp_processfiles("findstring", $conn_id, $net2ftp_globals["directory"], $list, $searchoptions, $result, 0);
        if ($net2ftp_result["success"] == false) {
            return false;
        }
        // Close connection
        ftp_closeconnection($conn_id);
        if (sizeof($result) == 0) {
            $net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was not found in the selected directories and files.", $searchoptions["string"]);
        } else {
            $net2ftp_output["findstring"][] = __("The word <b>%1\$s</b> was found in the following files:", $searchoptions["string"]);
        }
    }
    // end if
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
コード例 #19
0
									<td><b><span class="titulo style14">Escola</span></b>
                
								    <hr></td>
								</tr>
					</table>					</tr>
					<tr>
      <td width="4" valign="top">&nbsp;</td>
      <td colspan="2" id="cbConsultor"><p class="style10 style11"><strong>Consultor</strong><br>
          <?php 
echo $dados["consultor"];
?>
      </p>          </td>

      <td colspan="2" class="style7 style11 style10"><strong>Status<br>
      </strong><span class="style10 style11"><?php 
echo setStatus($dados["status"]);
?>
</span></td>
      </tr>
<tr>
						<td>&nbsp;</td>
						<td colspan="2" class="style11 style10" id="txtCNPJ"><strong>CNPJ<br>
						</strong><span class="style10 style11"><?php 
echo $dados["cnpj"];
?>
</span></td>
						<td colspan="2" class="style10 style11 style1 style4 texto"><strong>Insc Est<br>
						</strong><span class="style10 style11"><?php 
echo $dados["insc_est"];
?>
</span></td>
コード例 #20
0
function getStatus()
{
    global $response;
    global $userid;
    global $status;
    global $startOffline;
    global $processFurther;
    $sql = getUserStatus($userid);
    $query = mysql_query($sql);
    if (defined('DEV_MODE') && DEV_MODE == '1') {
        echo mysql_error();
    }
    $chat = mysql_fetch_array($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']];
    }
    $chat['message'] = html_entity_decode($chat['message']);
    if ($userid > 10000000) {
        $sql = "select name from cometchat_guests where id='" . $userid . "'";
        $query = mysql_query($sql);
        if (defined('DEV_MODE') && DEV_MODE == '1') {
            echo mysql_error();
        }
        $guestname = mysql_fetch_array($query);
        $guestname = $guestname['name'];
        if (function_exists('processName')) {
            $guestname = processName($guestname);
        }
        $s = array('userid' => $userid, 'message' => $chat['message'], 'status' => $chat['status'], 'guestname' => $guestname);
    } else {
        $s = array('userid' => $userid, 'message' => $chat['message'], 'status' => $chat['status']);
    }
    $response['userstatus'] = $s;
}
コード例 #21
0
ファイル: cometchat_receive.php プロジェクト: rodino25/tsv2
function getStatus()
{
    global $response;
    global $userid;
    global $status;
    global $startOffline;
    global $processFurther;
    global $chromeReorderFix;
    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']);
    }
    $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']];
    }
    $chat['message'] = html_entity_decode($chat['message']);
    $s = array('id' => $chat['userid'], 'n' => $chat['username'], 'l' => fetchLink($chat['link']), 'a' => getAvatar($chat['userid']), 's' => $chat['status'], 'm' => $chat['message']);
    $response['userstatus'] = $s;
}
コード例 #22
0
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";
}
コード例 #23
0
            continue;
        }
        $q3 = sprintf("INSERT INTO appearances (show_fk,person_fk,appear_dt) VALUES (%d,%d,'%s')", $row["show_pk"], $person_pk, $row["dt1"]);
        $result3 = $conn->query($q3);
        $appear_pk = "";
        $appear_pk = $conn->insert_id;
        if ($appear_pk == "") {
            setStatus($pk, 6);
            continue;
        }
        $q3 = sprintf("INSERT INTO media (appear_fk,media_type,media_code,media_url,media_title,media_desc) VALUES (%d,%d,'%s','%s','%s','%s')", $appear_pk, $row["media_type"], $row["media_code"], $row["media_url"], $row["media_title"], $row["media_desc"]);
        $result3 = $conn->query($q3);
        $media_pk = "";
        $media_pk = $conn->insert_id;
        if ($media_pk == "") {
            setStatus($pk, 7);
            continue;
        }
    }
}
$result = $conn->query($q);
if (!$myId) {
    $myId = $conn->insert_id;
}
if ($myId) {
    if ($myNotes) {
        $q = sprintf("INSERT INTO show_notes VALUES (%d,'%s') ON DUPLICATE KEY UPDATE show_notes = '%s'", $myId, addslashes($myNotes), addslashes($myNotes));
    } else {
        $q = sprintf("DELETE FROM show_notes WHERE show_fk = %d", $myId);
    }
    $conn->query($q);
コード例 #24
0
        if (trim($row["media_code"] == "")) {
            echo "*****";
            setStatus($pk, 8);
            continue;
        }
    }
    $dtPieces = explode("/", $row["dt"]);
    if (!checkdate($dtPieces[0], $dtPieces[1], $dtPieces[2])) {
        setStatus($pk, 4);
        continue;
    }
    $people = explode("|", $row["people"]);
    foreach ($people as $p) {
        if ($p == "") {
            continue;
        }
        echo "Person: {$p} <br>";
        $q3 = sprintf("INSERT INTO data_in_records SELECT *, '%s' FROM data_in WHERE load_pk = %d", $p, $pk);
        echo "{$q3} <br>";
        if (!$conn->query($q3)) {
            $conn->query("DELETE FROM data_in_records WHERE load_pk = {$pk}");
            setStatus($pk, 5);
            continue 2;
        }
    }
    setStatus($pk, 1);
}
?>


コード例 #25
0
ファイル: main.inc.php プロジェクト: klr2003/sourceread
function net2ftp($action)
{
    // --------------
    // This function is the main net2ftp function; it is the interface between 3rd party
    // scripts (CMS, control panels, etc), and the internal net2ftp modules and plugins.
    //
    // This function is called 5 times per pageload: to send the HTTP headers, to print
    // the javascript code, to print the CSS code, to print the body onload actions and
    // finally to print the body content.
    // --------------
    // -------------------------------------------------------------------------
    // Check that "sendHttpHeaders" action is only executed once
    // Check that no other actions can be executed if "sendHttpHeaders" has not yet been executed
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        if (defined("NET2FTP_SENDHTTPHEADERS") == true) {
            echo "Error: please call the net2ftp(\$action) function only once with \$action = \"sendHttpHeaders\"!";
            return false;
        } else {
            define("NET2FTP_SENDHTTPHEADERS", 1);
        }
    } else {
        if (defined("NET2FTP_SENDHTTPHEADERS") == false) {
            echo "Error: please call the net2ftp(\$action) function first with \$action = \"sendHttpHeaders\"!";
            return false;
        }
    }
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_result, $net2ftp_messages;
    // Set the NET2FTP constant which is used to check if template files are called by net2ftp
    if (defined("NET2FTP") == false) {
        define("NET2FTP", 1);
    }
    // Initialize the global variables
    if ($action == "sendHttpHeaders") {
        $net2ftp_globals = array();
        $net2ftp_messages = array();
        $net2ftp_output = array();
        $net2ftp_result["success"] = true;
        $net2ftp_result["errormessage"] = "";
        $net2ftp_result["debug_backtrace"] = "";
        $net2ftp_result["exit"] = false;
        $net2ftp_settings = array();
    }
    // -------------------------------------------------------------------------
    // If an error occured during a previous execution of net2ftp(), return false
    // and let index.php print the error message
    // -------------------------------------------------------------------------
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // -------------------------------------------------------------------------
    // Input checks
    // -------------------------------------------------------------------------
    if ($action != "sendHttpHeaders" && $action != "printJavascript" && $action != "printCss" && $action != "printBodyOnload" && $action != "printBody") {
        $net2ftp_result["success"] = false;
        $net2ftp_result["errormessage"] = "The \$action variable has an unknown value: {$action}.";
        $net2ftp_result["debug_backtrace"] = debug_backtrace();
        logError();
        return false;
    }
    // -------------------------------------------------------------------------
    // Read settings files
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        require NET2FTP_APPLICATION_ROOTDIR . "/settings.inc.php";
        require NET2FTP_APPLICATION_ROOTDIR . "/settings_authorizations.inc.php";
        require NET2FTP_APPLICATION_ROOTDIR . "/settings_screens.inc.php";
    }
    // -------------------------------------------------------------------------
    // Main directories
    // -------------------------------------------------------------------------
    $net2ftp_globals["application_rootdir"] = NET2FTP_APPLICATION_ROOTDIR;
    if (NET2FTP_APPLICATION_ROOTDIR_URL == "/") {
        $net2ftp_globals["application_rootdir_url"] = "";
    } else {
        $net2ftp_globals["application_rootdir_url"] = NET2FTP_APPLICATION_ROOTDIR_URL;
    }
    $net2ftp_globals["application_includesdir"] = $net2ftp_globals["application_rootdir"] . "/includes";
    $net2ftp_globals["application_languagesdir"] = $net2ftp_globals["application_rootdir"] . "/languages";
    $net2ftp_globals["application_modulesdir"] = $net2ftp_globals["application_rootdir"] . "/modules";
    $net2ftp_globals["application_pluginsdir"] = $net2ftp_globals["application_rootdir"] . "/plugins";
    $net2ftp_globals["application_skinsdir"] = $net2ftp_globals["application_rootdir"] . "/skins";
    $net2ftp_globals["application_tempdir"] = $net2ftp_globals["application_rootdir"] . "/temp";
    // -------------------------------------------------------------------------
    // Set basic settings
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        // Run the script to the end, even if the user hits the stop button
        ignore_user_abort();
        // Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
        // DON'T REGISTER IT HERE YET, as this causes errors on newer versions of PHP; first include the function libraries
        //		register_shutdown_function("net2ftp_shutdown");
        // Set the error reporting level
        if ($net2ftp_settings["error_reporting"] == "ALL") {
            error_reporting(E_ALL);
        } elseif ($net2ftp_settings["error_reporting"] == "NONE") {
            error_reporting(0);
        } else {
            error_reporting(E_ERROR | E_WARNING | E_PARSE);
        }
        // Timer: start
        $net2ftp_globals["starttime"] = microtime();
        $net2ftp_globals["endtime"] = microtime();
    }
    // Set the PHP temporary directory
    //	putenv("TMPDIR=" . $net2ftp_globals["application_tempdir"]);
    // -------------------------------------------------------------------------
    // Function libraries:
    // 1. Libraries which are always needed
    // 2. Register global variables
    // 3. Function libraries which are needed depending on certain variables
    // // --> Do this only once, when $action == "sendHttpHeaders"
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        // 1. Libraries which are always needed
        require_once $net2ftp_globals["application_includesdir"] . "/authorizations.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/consumption.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/database.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/errorhandling.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/filesystem.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/html.inc.php";
        require_once $net2ftp_globals["application_includesdir"] . "/StonePhpSafeCrypt.php";
        require_once $net2ftp_globals["application_languagesdir"] . "/languages.inc.php";
        require_once $net2ftp_globals["application_skinsdir"] . "/skins.inc.php";
        // 1. Define functions which are used, but which did not exist before PHP version 4.3.0
        if (version_compare(phpversion(), "4.3.0", "<")) {
            require_once $net2ftp_globals["application_includesdir"] . "/before430.inc.php";
        }
        // 2. Register global variables (POST, GET, GLOBAL, ...)
        require_once $net2ftp_globals["application_includesdir"] . "/registerglobals.inc.php";
        // 3. Function libraries which are needed depending on certain variables
        if ($net2ftp_globals["state"] == "upload" || $net2ftp_globals["state"] == "unzip") {
            require_once $net2ftp_globals["application_includesdir"] . "/pclerror.lib.php";
            require_once $net2ftp_globals["application_includesdir"] . "/pcltar.lib.php";
            require_once $net2ftp_globals["application_includesdir"] . "/pcltrace.lib.php";
            require_once $net2ftp_globals["application_includesdir"] . "/pclzip.lib.php";
        }
        if ($net2ftp_globals["state"] == "advanced_ftpserver" || $net2ftp_globals["state"] == "advanced_parsing" || $net2ftp_globals["state"] == "advanced_webserver" || $net2ftp_globals["state"] == "browse" || $net2ftp_globals["state"] == "copymovedelete" || $net2ftp_globals["state"] == "chmod" || $net2ftp_globals["state"] == "calculatesize" || $net2ftp_globals["state"] == "downloadzip" || $net2ftp_globals["state"] == "findstring" || $net2ftp_globals["state"] == "followsymlink" || $net2ftp_globals["state"] == "install" || $net2ftp_globals["state"] == "zip") {
            require_once $net2ftp_globals["application_includesdir"] . "/browse.inc.php";
        }
        if ($net2ftp_globals["state"] == "downloadzip" || $net2ftp_globals["state"] == "zip") {
            require_once $net2ftp_globals["application_includesdir"] . "/zip.lib.php";
        }
        // 4. Load the plugins
        require_once $net2ftp_globals["application_pluginsdir"] . "/plugins.inc.php";
        $net2ftp_globals["activePlugins"] = getActivePlugins();
        net2ftp_plugin_includePhpFiles();
        // 5. Load the language file
        includeLanguageFile();
    }
    // -------------------------------------------------------------------------
    // Execute function shutdown() if the script reaches the maximum execution time (usually 30 seconds)
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        register_shutdown_function("net2ftp_shutdown");
    }
    // -------------------------------------------------------------------------
    // Log access
    // --> Do this only once, when $action == "sendHttpHeaders"
    // -------------------------------------------------------------------------
    if ($action == "sendHttpHeaders") {
        logAccess();
        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;
    }
}
コード例 #26
0
ファイル: index.inc.php プロジェクト: brt-tito/rex-news
        break;
    case 'conf':
        $file = $Basedir . '/conf.inc.php';
        break;
    default:
        $file = $Basedir . '/entries.inc.php';
}
// Allgemeine Funktionen aufrufen bei Listenansicht (Offline stellen etc.)
switch ($func) {
    case 'setstatus':
        $oid = rex_request('oid', 'int');
        $statusfield = rex_request('statusfield', 'string');
        $oldstatus = rex_request('oldstatus', 'int');
        $minstatus = rex_request('minstatus', 'int', 0);
        $maxstatus = rex_request('maxstatus', 'int');
        if (setStatus(TBL_NEWS, $oid, $statusfield, $oldstatus, $minstatus, $maxstatus)) {
            echo rex_info('Statusupdate erfolgreich');
        } else {
            echo rex_warning('Statusupdate nicht erfolgreich');
        }
        $func = '';
        break;
    case 'delete':
        $postparams = implode(",", $_POST['ids']);
        $sql = new rex_sql();
        $sql->setTable(TBL_NEWS);
        $sql->setWhere('id IN (' . $postparams . ')');
        $success = $sql->delete();
        if ($sql->getRows() > 0) {
            echo rex_info('Die Datensätze wurden gelöscht');
        } else {
コード例 #27
0
function checkOthers()
{
    global $snmp, $cmdargs, $periods, $criticals, $warnings, $unknowns, $normals;
    if (isset($cmdargs['skip-others']) && $cmdargs['skip-others']) {
        return;
    }
    _log("========== Others check start ==========", LOG__DEBUG);
    try {
        if ($snmp->useFoundry_Chassis()->isQueueOverflow()) {
            _log("Error - queue overflow indicated", LOG__VERBOSE);
            setStatus(STATUS_CRITICAL);
            $criticals .= "Queue overflow indicated. ";
        } else {
            _log("OK - queue overflow not indicated", LOG__VERBOSE);
        }
    } catch (\OSS_SNMP\Exception $e) {
        /* not supported on this platform */
    }
    try {
        if ($snmp->useFoundry_Chassis()->isBufferShortage()) {
            _log("Error - buffer shortage indicated", LOG__VERBOSE);
            setStatus(STATUS_CRITICAL);
            $criticals .= "Buffer shortage indicated. ";
        } else {
            _log("OK - buffer shortage not indicated", LOG__VERBOSE);
        }
    } catch (\OSS_SNMP\Exception $e) {
        /* not supported on this platform */
    }
    try {
        if ($snmp->useFoundry_Chassis()->isDMAFailure()) {
            _log("Error - DMA failure indicated", LOG__VERBOSE);
            setStatus(STATUS_CRITICAL);
            $criticals .= "DMA failure indicated. ";
        } else {
            _log("OK - DMA failure not indicated", LOG__VERBOSE);
        }
    } catch (\OSS_SNMP\Exception $e) {
        /* not supported on this platform */
    }
    try {
        if ($snmp->useFoundry_Chassis()->isResourceLow()) {
            _log("Error - low resources indicated", LOG__VERBOSE);
            setStatus(STATUS_CRITICAL);
            $criticals .= "Low resources indicated. ";
        } else {
            _log("OK - low resources not indicated", LOG__VERBOSE);
        }
    } catch (\OSS_SNMP\Exception $e) {
        /* not supported on this platform */
    }
    try {
        if ($snmp->useFoundry_Chassis()->isExcessiveError()) {
            _log("Error - excessive errors indicated", LOG__VERBOSE);
            setStatus(STATUS_CRITICAL);
            $criticals .= "Excessive errors indicated. ";
        } else {
            _log("OK - excessive errors not indicated", LOG__VERBOSE);
        }
    } catch (\OSS_SNMP\Exception $e) {
        /* not supported on this platform */
    }
    _log("========== Others check end ==========", LOG__DEBUG);
}
コード例 #28
0
function net2ftp_module_printBody()
{
    // --------------
    // This function prints the raw FTP command screen
    // --------------
    // -------------------------------------------------------------------------
    // Global variables
    // -------------------------------------------------------------------------
    global $net2ftp_settings, $net2ftp_globals, $net2ftp_messages, $net2ftp_result, $net2ftp_output;
    if (isset($_POST["command"]) == true) {
        $command = $_POST["command"];
    } else {
        $command = "CWD {$directory_html}\nPWD\n";
    }
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    // Title
    $title = __("Send arbitrary FTP commands");
    // Form name, back and forward buttons
    $formname = "RawForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='advanced';document.forms['" . $formname . "'].screen.value='1';document.forms['" . $formname . "'].submit();";
    $forward_onclick = "document.forms['" . $formname . "'].submit();";
    // Open connection
    setStatus(2, 10, __("Connecting to the FTP server"));
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // Explode list of commands to an array
    $command_exploded = explode("\n", $command);
    // Remove the empty lines
    $new_command_nr = 0;
    for ($command_nr = 0; $command_nr < sizeof($command_exploded); $command_nr++) {
        if (trim($command_exploded[$command_nr]) != "") {
            $command_exploded_trimmed[$new_command_nr] = trim($command_exploded[$command_nr]);
            $new_command_nr++;
        }
    }
    // Send arbitrary FTP command
    $command_total = sizeof($command_exploded_trimmed);
    for ($command_nr = 0; $command_nr < $command_total; $command_nr++) {
        setStatus($command_nr + 1, $command_total, __("Sending FTP command %1\$s of %2\$s", $command_nr + 1, $command_total));
        $ftp_raw_result[$command_nr] = ftp_raw($conn_id, trim($command_exploded_trimmed[$command_nr]));
    }
    // Close connection
    ftp_closeconnection($conn_id);
    // Get the messages
    for ($command_nr = 0; $command_nr < sizeof($command_exploded_trimmed); $command_nr++) {
        for ($line_nr = 0; $line_nr < sizeof($ftp_raw_result[$command_nr]); $line_nr++) {
            $net2ftp_output["ftp_raw"][] = $ftp_raw_result[$command_nr][$line_nr] . "\n";
        }
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}
コード例 #29
0
function net2ftp_shutdown()
{
    // --------------
    // This function is registered through register_shutdown_function, so that it would be
    // executed when the script reaches the maximum execution time.
    //
    // The function displays a warning message, and deletes temporary files.
    // --------------
    // -------------------------------------------------------------------------
    // Global variables and settings
    // -------------------------------------------------------------------------
    global $net2ftp_globals, $net2ftp_settings, $net2ftp_result;
    // -------------------------------------------------------------------------
    // Delete the temporary files which were not deleted automatically
    // -------------------------------------------------------------------------
    if (isset($net2ftp_globals["tempfiles"]) == true) {
        for ($i = 0; $i < sizeof($net2ftp_globals["tempfiles"]); $i++) {
            delete_dirorfile($net2ftp_globals["tempfiles"][$i]);
        }
    }
    // end if
    // -------------------------------------------------------------------------
    // Store the consumption counter values in the database
    // -------------------------------------------------------------------------
    putConsumption();
    // -------------------------------------------------------------------------
    // Print a message to tell the user that the script was halted
    // -------------------------------------------------------------------------
    $time_taken = timer();
    $max_execution_time = @ini_get("max_execution_time");
    // - Check if the $max_execution_time is > 0, because on some PHP configs it is -1 (more
    // specifically: when PHP is run as CGI module).
    // - Check the time taken versus the maximum execution time, because on Windows + Apache
    // servers, the shutdown function is always called, even if the maximum execution time
    // was not reached.
    if ($max_execution_time > 0 && $time_taken > $max_execution_time - 1) {
        if (isStatusbarActive() == true && function_exists("setStatus") == true) {
            setStatus(10, 10, __("Script halted"));
        }
        $text = "";
        $text .= "<b>" . __("Your task was stopped") . "</b><br /><br />\n";
        $text .= __("The task you wanted to perform with net2ftp took more time than the allowed %1\$s seconds, and therefor that task was stopped.", $max_execution_time) . "<br />\n";
        $text .= __("This time limit guarantees the fair use of the web server for everyone.") . "<br /><br />\n";
        $text .= __("Try to split your task in smaller tasks: restrict your selection of files, and omit the biggest files.") . "<br /><br />\n";
        if ($net2ftp_settings["net2ftpdotcom"] == "yes") {
            $text .= __("If you really need net2ftp to be able to handle big tasks which take a long time, consider installing net2ftp on your own server.");
        }
        if ($net2ftp_globals["state"] == "jupload") {
            echo $text;
        } else {
            echo "<div class=\"warning-box\"><div class=\"warning-text\">{$text}</div></div>\n\n";
        }
    }
}
コード例 #30
0
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["list"]) == true) {
        $list = getSelectedEntries($_POST["list"]);
    } else {
        $list = "";
    }
    // -------------------------------------------------------------------------
    // Variables
    // -------------------------------------------------------------------------
    // Title
    $title = __("Size of selected directories and files");
    // Form name, back and forward buttons
    $formname = "CalculateSizeForm";
    $back_onclick = "document.forms['" . $formname . "'].state.value='browse';document.forms['" . $formname . "'].state2.value='main';document.forms['" . $formname . "'].submit();";
    // Open connection
    setStatus(2, 10, __("Connecting to the FTP server"));
    $conn_id = ftp_openconnection();
    if ($net2ftp_result["success"] == false) {
        return false;
    }
    // Calculate the size
    $options = array();
    $result['size'] = 0;
    $result['skipped'] = 0;
    $result = ftp_processfiles("calculatesize", $conn_id, $net2ftp_globals["directory"], $list, $options, $result, 0);
    // Close connection
    ftp_closeconnection($conn_id);
    // Print message
    $net2ftp_output["calculatesize"][] = __("The total size taken by the selected directories and files is:") . " <b>" . formatFilesize($result['size']) . "</b> (" . $result['size'] . " Bytes)";
    if ($result['skipped'] > 0) {
        $net2ftp_output["calculatesize"][] = __("The number of files which were skipped is:") . " <b>" . $result['skipped'] . "</b>";
    }
    // -------------------------------------------------------------------------
    // Print the output
    // -------------------------------------------------------------------------
    require_once $net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/manage.template.php";
}