예제 #1
0
파일: display.php 프로젝트: exviva/flip
function display_create_project_conf_form($project_name, $ocp_id, $orgs)
{
    //$orgs is an array with seperate different orgs' names at each index- with addslashes (by magic_quotes)
    ?>
<table width="90%">
<tr>
	<td align="center" class="naglowek">Zaraz utworzysz projekt<hr></td>
</tr>
<tr>
	<td>
	<table>
	<tr>
		<td align="right"><b>Nazwa projektu:</b></td>
		<td align="left"><?php 
    echo htmlspecialchars(stripslashes($project_name));
    ?>
</td>
	</tr>
	<tr>
		<td align="right"><b>OCP:</b></td>
		<td align="left"><?php 
    display_link_to_user($ocp_id);
    ?>
</td>
	</tr>
<?php 
    if (!empty($orgs)) {
        ?>
	<tr>
		<td align="right" valign="top"><b>Ogranizacje ju¿ kontaktowane:</b></td>
		<td align="left">
<?php 
        $contacted_orgs = get_contacted_orgs($orgs);
        if ($contacted_orgs === false) {
            echo 'B³±d bazy danych, spróbuj pó¼niej.';
        } else {
            if (empty($contacted_orgs)) {
                echo '-';
            } else {
                foreach ($contacted_orgs as $org_id) {
                    display_link_to_org($org_id);
                    echo "<br>\n";
                }
            }
        }
        ?>
		</td>
	</tr>
	<tr>
		<td align="right" valign="top"><b>Nowe ogranizacje:</b></td>
		<td align="left">
<?php 
        $new_orgs = get_new_orgs($orgs);
        if (empty($new_orgs)) {
            echo '-';
        } else {
            foreach ($new_orgs as $org) {
                echo htmlspecialchars(stripslashes($org)) . "<br>\n";
            }
        }
        ?>
        </td>
	</tr>
<?php 
    }
    ?>
	<tr>
		<td align="right"><form action="create_project_form.php" method="post">
		<input type="hidden" name="project_name" value="<?php 
    echo htmlspecialchars(stripslashes($project_name));
    ?>
">
		<input type="hidden" name="ocp_id" value="<?php 
    echo $ocp_id;
    ?>
">
		<input type="hidden" name="orgs" value="<?php 
    echo htmlspecialchars(join("\n", array_map('stripslashes', $orgs)));
    ?>
">
		<input type="submit" value="Wstecz"></form>
		</td>
		<td align="left">
		<form action="create_project.php" method="post">
		<input type="hidden" name="confirmed" value="yes">
		<input type="hidden" name="project_name" value="<?php 
    echo htmlspecialchars(stripslashes($project_name));
    ?>
">
		<input type="hidden" name="ocp_id" value="<?php 
    echo $ocp_id;
    ?>
">
		<input type="hidden" name="orgs" value="<?php 
    echo htmlspecialchars(join("\n", array_map('stripslashes', $orgs)));
    ?>
">
		<input type="submit" value="Zatwierd¼">
		</form>
		</td>
	</tr>
	</table>
	</td>
</tr>
</table>
<?php 
}
예제 #2
0
    display_warning('Wype³nij poprawnie formularz!');
    exit;
} else {
    if (project_exists($_POST['project_name'])) {
        display_warning('Projekt o nazwie ' . htmlspecialchars(stripslashes($_POST['project_name'])) . ' ju¿ istnieje!');
        exit;
    }
}
if (isset($_POST['confirmed'])) {
    if (!insert_project($_POST['project_name'], $_POST['ocp_id'])) {
        display_warning('Utworzenie projektu zakoñczone niepowodzeniem!');
        exit;
    }
    $orgs = str_replace("\r", '', $_POST['orgs']);
    $orgs = explode("\n", $orgs);
    $new_orgs = get_new_orgs($orgs);
    if (!insert_new_orgs($new_orgs)) {
        display_warning('Dodanie nowych organizacji zakoñczone niepowodzeniem!');
        exit;
    }
    if (!insert_orgs_into_project($orgs, get_project_id($_POST['project_name']))) {
        display_warning('Przypisanie organizacji do projektu zakoñczone niepowodzeniem!');
        exit;
    }
    display_warning('Stworzenie projektu ' . htmlspecialchars(stripslashes($_POST['project_name'])) . ' zakoñczone sukcesem!');
} else {
    $orgs = str_replace("\r", '', $_POST['orgs']);
    $orgs = explode("\n", $orgs);
    $orgs = array_map('trim', $orgs);
    $upper_orgs = array();
    foreach ($orgs as $o) {