예제 #1
0
    $sth = $dbh->prepare($query);
    try {
        $sth->execute(array($_SESSION['userid'], $_REQUEST['typecnt']));
        echo "<h2>campos do registo {$_REQUEST['typecnt']}</h2>";
        echo "<table border=\"1\" cellspacing=\"5\">\n";
        echo "<tr>\n";
        echo "<th>campocnt</th>";
        echo "<th>nome</th>";
        echo "<th></th>";
        echo "</tr>\n";
        foreach ($sth as $row) {
            echo "<tr>\n";
            //echo("<td>{$row['idregpag']}</td>\n");
            echo "<td>{$row['campocnt']}</td>\n";
            echo "<td>{$row['nome']}</td>\n";
            echo "<td>" . generate_anchor('Remover', $remove_url . $row['typecnt'] . "&campocnt=" . $row['campocnt']) . "</td>\n";
            echo "</tr>\n";
        }
        echo "</table>\n";
        $dbh->commit();
    } catch (PDOException $e) {
        echo "<p>ERROR: {$e->getMessage()}</p>";
    }
    if (isset($db)) {
        $dbh = null;
    }
} else {
    ?>
    <form method = "get" action = "<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
예제 #2
0
function emit_news($en_newspath, $lang_newspath, $oldnews)
{
    global $top_dir;
    // a little debugging
    echo "<!-- in news/news-script.php: top_dir = {$top_dir} -->\n";
    echo "<!-- lang-path: {$lang_newspath} ; en-path: {$en_newspath} -->\n";
    # Be sure to define the following path to newsdirs
    if (!$en_newspath) {
        exit;
    }
    if (!$lang_newspath) {
        exit;
    }
    // This is how many news items to display on the main page.
    // Everything after this is displayed on the "oldnews" page.
    $cutoff = 10;
    $newsfiles = get_news($en_newspath, $lang_newspath);
    if ($oldnews) {
        $newsfile = array_slice($newsfiles, $cutoff, -1);
    } else {
        $newsfile = array_slice($newsfiles, 0, $cutoff);
    }
    //  Output  files  to  browser
    $filecount = 0;
    for (reset($newsfile); $key = key($newsfile); next($newsfile)) {
        $fa = file($key);
        $n = count($fa);
        $anchor = generate_anchor($key);
        print_news_item($fa, $n, $newsfile, $key, $anchor);
    }
}
예제 #3
0
파일: atom.php 프로젝트: sss/gnucash-htdocs
    $fa = file($key);
    $n = count($fa);
    $title = strip_tags(chop($fa[0]));
    $update_date = chop($fa[1]);
    ?>
  <entry>
    <id>urn:x-gnucash:news:<?php 
    echo urlencode($key);
    ?>
</id>
    <title><?php 
    echo $title;
    ?>
</title>
    <link rel="alternate" href="http://www.gnucash.org/#n-<?php 
    echo generate_anchor($key);
    ?>
" />
    <author>
      <name>GnuCash Developers</name>
      <email>gnucash-devel@gnucash.org</email>
    </author>
    <updated><?php 
    echo date_convert_news_to_atom($update_date);
    ?>
</updated>
  </entry>
  <?php 
}
?>
예제 #4
0
    redirect_to_login();
}
$remove_url = get_curr_dir() . "/remove.php?type=1";
$viewpage_url = get_curr_dir() . "/viewpage.php?pageid=";
$activepages_url = get_curr_dir() . '/pages.php';
?>
<p><a href="<?php 
echo get_curr_dir() . "/newpage.php";
?>
">New Page</a>
<table border="1">
<th> Nome </th>
<?php 
$dbh = get_database_handler();
$query = "SELECT utilizador.userid as userid, pagina.pagecounter as pagecounter, pagina.nome as nome\nFROM utilizador, pagina\nWHERE utilizador.userid = pagina.userid AND utilizador.userid=?;";
$sth = $dbh->prepare($query);
try {
    $sth->execute(array($_SESSION['userid']));
    if ($sth->rowCount()) {
        $rows = $sth->fetchAll(PDO::FETCH_ASSOC);
        foreach ($rows as $row) {
            echo '<tr><td>' . $row['nome'] . ' | ' . generate_anchor('Abrir', $viewpage_url . $row['pagecounter']) . ' | ' . generate_anchor('Remover', $remove_url . '&id=' . $row['pagecounter']) . '</td></tr>';
        }
    }
    echo '<p> NOTA: a mostrar paginas ativas e inativas. <a href="' . $activepages_url . '">Clique aqui</a> para versao onde so as paginas ativas sao mostradas.</p>';
} catch (PDOException $e) {
    echo '<p>ERROR: {' . $e->getMessage() . '}</p>';
}
?>
</tr>
</table>
} else {
    redirect_to_login();
}
$remove_url = get_curr_dir() . "/remove.php?type=2";
// expects id=...
$viewregtype_url = get_curr_dir() . "/viewregtype.php?typecnt=";
?>
<p><a href="newregtype.php">Criar tipo de registo</a>

<table border="1">
<tr> <th>Nome</th> <th></th>  <th></th>  </tr>
<?php 
$dbh = get_database_handler();
$query = "SELECT tipo_registo.userid as userid, tipo_registo.typecnt as typecnt, tipo_registo.nome as nome\nFROM utilizador, tipo_registo\nWHERE utilizador.userid = tipo_registo.userid AND utilizador.userid=? AND ativo = 1;";
$sth = $dbh->prepare($query);
try {
    $sth->execute(array($_SESSION['userid']));
    if ($sth->rowCount()) {
        $rows = $sth->fetchAll(PDO::FETCH_ASSOC);
        foreach ($rows as $row) {
            echo '<tr><td>' . $row['nome'] . ' </td><td> ' . generate_anchor('Abrir', $viewregtype_url . $row['typecnt']) . ' </td><td> ' . generate_anchor('Remover', $remove_url . '&id=' . $row['typecnt']) . '</td></tr>';
        }
    }
    //echo '<p> NOTA: remocao tambem funciona se uma pagina estiver inativa. <a href="' . $allpages_url . '">Clique aqui</a> para versao onde todas as paginas sao mostradas.</p>';
} catch (PDOException $e) {
    echo '<p>ERROR: {' . $e->getMessage() . '}</p>';
}
?>
</tr>
</table>