Esempio n. 1
0
     $settingsNew = '"githubLocalPaths"	=> array(';
     // Redo the arrays using the form data
     for ($i = 0; $i < count($oldLocal); $i++) {
         if ($_POST['githubLocalPath' . $i] != "") {
             $settingsNew .= '"' . injClean(xssClean($_POST['githubLocalPath' . $i], "html")) . '",';
         }
     }
     // Rtrim off the last comma
     $settingsNew = rtrim($settingsNew, ',');
     $settingsNew .= '),' . PHP_EOL;
     // Now do the same for the remote paths
     $settingsNew .= '"githubRemotePaths"	=> array(';
     // Redo the arrays using the form data
     for ($i = 0; $i < count($oldRemote); $i++) {
         if ($_POST['githubRemotePath' . $i] != "") {
             $settingsNew .= '"' . injClean(xssClean($_POST['githubRemotePath' . $i], "html")) . '",';
         }
     }
     // Rtrim off the last comma
     $settingsNew = rtrim($settingsNew, ',');
     $settingsNew .= '),' . PHP_EOL;
 }
 if ($_GET['action'] != "choose") {
     // Now we have a new settingsNew string to use
     // we can update the path arrays in the settings file
     // Identify the bit to replace
     $repPosStart = strpos($settingsContents, '"githubLocalPaths"');
     $repPosEnd = strpos($settingsContents, '"previousFiles"');
     // Compile our new settings
     $settingsContents = substr($settingsContents, 0, $repPosStart) . $settingsNew . substr($settingsContents, $repPosEnd, strlen($settingsContents));
     // Now update the config file
Esempio n. 2
0
    // ===============================================
    // UPDATING & REMOVING PLUS UPDATE CONFIG SETTINGS
    // ===============================================
    if ($_GET['action'] != "choose" && $_GET['action'] != "edit") {
        // Look at each of the existing FTP sites
        for ($i = 0; $i < count($oldFTPSites); $i++) {
            // Updating
            if ($_GET['action'] == "update" && $i == $_GET['ftpSiteRef']) {
                $settingsNew .= '	array(
		"site" => "' . injClean($_POST['ftpSiteNEW']) . '",
		"host" => "' . injClean($_POST['ftpHostNEW']) . '",
		"user" => "' . injClean($_POST['ftpUserNEW']) . '",
		"pass" => "' . injClean($_POST['ftpPassNEW']) . '",
		"pasv" => ' . injClean($_POST['ftpPASVNEW']) . ',
		"mode" => "' . injClean($_POST['ftpModeNEW']) . '",
		"root" => "' . injClean($_POST['ftpRootNEW']) . '"
	),
';
                // Deleting
            } elseif ($_GET['action'] == "remove" && $i == $_GET['ftpSiteRef']) {
                // Do nothing, so we ignore this entry now
                // Entry is as before
            } else {
                $settingsNew .= '	array(
		"site" => "' . $oldFTPSites[$i]['site'] . '",
		"host" => "' . $oldFTPSites[$i]['host'] . '",
		"user" => "' . $oldFTPSites[$i]['user'] . '",
		"pass" => "' . $oldFTPSites[$i]['pass'] . '",
		"pasv" => ' . ($oldFTPSites[$i]['pasv'] ? 'true' : 'false') . ',
		"mode" => "' . ($oldFTPSites[$i]['mode'] == 'FTP_ASCII' ? 'FTP_ASCII' : 'FTP_BINARY') . '",
		"root" => "' . $oldFTPSites[$i]['root'] . '"