Exemplo n.º 1
0
te("File");
?>
</th>
  <th><?php 
te("Associations");
?>
</th>
</tr>
</thead>
<tbody>
<?php 
$i = 0;
/// print actions list
while ($r = $sth->fetch(PDO::FETCH_ASSOC)) {
    $i++;
    $nlinks = countfileidlinks($r['id'], $dbh);
    $type = $r['typedesc'];
    if ($type == "invoice") {
        $type = "<span style='color:#0076A0'>{$type}</span>";
    }
    if (!($i % 2)) {
        $cl = "class=dark";
    } else {
        $cl = "";
    }
    echo "\n<tr {$cl} id='trid{$r['id']}'>";
    echo "<td><a class='editid' href='{$scriptname}?action=editfile&amp;id=" . $r['id'] . "'>{$r['id']}</a></td>\n";
    echo "<td style='padding-left:2px;padding-right:2px;'>{$type}</td>\n";
    echo "<td style='padding-left:2px;padding-right:2px;'>{$r['title']}</td>\n";
    echo "<td><a class='smaller' target=_blank href='{$uploaddirwww}{$r['fname']}'>{$r['fname']}</a></td>\n";
    if (!$nlinks) {
Exemplo n.º 2
0
    $sql = "insert into items ({$cols}) " . " select {$cols} from items " . " where id={$_GET['cloneid']}";
    $sth = db_exec($dbh, $sql);
    $lastid = $dbh->lastInsertId();
    $newid = $lastid;
    echo "<script>document.location='{$scriptname}?action=edititem&id={$newid}'</script>";
    echo "<a href='{$scriptname}?action=edititem&amp;id={$newid}'>Go here</a></body></html>";
    exit;
}
/* delete associated file */
if (isset($_GET['delfid'])) {
    /* displayed from showfiles() */
    //remove file link
    $sql = "DELETE from item2file where itemid={$id} AND fileid=" . $_GET['delfid'];
    $sth = db_exec($dbh, $sql);
    //check if others point to this file
    $nlinks = countfileidlinks($_GET['delfid'], $dbh);
    if ($nlinks == 0) {
        delfile($_GET['delfid'], $dbh);
    }
    //echo "$nlinks DELETED ".$_GET['delfid'];
    echo "<script>window.location='{$scriptname}?action={$action}&id={$id}'</script> ";
    echo "<br><a href='{$scriptname}?action={$action}&id={$id}'>Go here</a></body></html>";
    exit;
}
//check for arguments
if (!isset($_GET['id'])) {
    echo "edititem:missing arguments";
    exit;
}
/* update item data */
//if came here from a form post, update db with new values
Exemplo n.º 3
0
te("Filename");
?>
:</td><td><a target=_blank href="<?php 
echo $uploaddirwww . $r['fname'];
?>
"><?php 
echo $r['fname'];
?>
</a></td></tr>
    <tr><td title='Number of items/software/invoices/etc which reference this file'
            class="tdt"><?php 
te("Associations");
?>
:</td> <td><b><?php 
if ($_GET['id'] != "new") {
    echo countfileidlinks($_GET['id'], $dbh);
}
?>
</b></td></tr>
    <tr><td class="tdt"><?php 
te("Uploaded by");
?>
:</td> <td><?php 
echo $r['uploader'];
?>
 on <?php 
if (!empty($r['uploaddate'])) {
    echo date($dateparam . " H:m", $r['uploaddate']);
}
?>
</td></tr>