/[hr-web]/Radovi.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /Radovi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Wed Jun 13 09:13:42 2001 UTC (18 years, 5 months ago) by ravilov
Branch: MAIN
Changes since 1.2: +2 -2 lines
Dodao novi ekran (Patenti).

1 dpavlin 1.1 <?php
2     include("inc/global.php");
3     if (!Auth()) exit;
4     $page = CalcPage($PHP_SELF);
5     $p = $page;
6     if (isparam("wb_p")) $p--;
7     if (isparam("wb_OK")) $p++;
8 ravilov 1.3 if (isparam("wb_h")) $p = $PG_HOME;
9     if (isparam("wb_o")) $p = $PG_OVERVIEW;
10 dpavlin 1.1 include("inc/conn.php");
11     DBOpen();
12     $del = 0;
13     reset($HTTP_GET_VARS);
14     while ($var = key($HTTP_GET_VARS)) {
15     next($HTTP_GET_VARS);
16     if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
17     $del = $match[1];
18     }
19     reset($HTTP_POST_VARS);
20     while ($var = key($HTTP_POST_VARS)) {
21     next($HTTP_POST_VARS);
22     if (!eregi('^del_([0-9]+)$', $var, $match)) continue;
23     $del = $match[1];
24     }
25     if ($del) {
26     DBQuery("DELETE FROM radovi WHERE (rbr=$del) AND (sif_radnika='$sifra')");
27 dpavlin 1.2 if (!$DBH->errstr && $edit != $del) unset($edit);
28 dpavlin 1.1 }
29 dpavlin 1.2 YearFix($godina);
30 dpavlin 1.1 $warning = 0;
31     if ($update || $p != $page) {
32     if ($naziv || $komentar || $godina) {
33     if (!$warning) {
34     $naziv = ereg_replace("\r?\n", "\n", ISO_Win($naziv));
35     $komentar = ereg_replace("\r?\n", "\n", ISO_Win($komentar));
36     if ($edit)
37     DBQuery("UPDATE radovi SET naziv_rada_knjige='$naziv',naziv_casopisa='$komentar',godina='$godina' WHERE (sif_radnika='$sifra') AND (rbr=$edit)");
38     else {
39 dpavlin 1.2 $id = DBQuery("SELECT MAX(rbr) FROM radovi");
40 dpavlin 1.1 $id = $id[0][0] + 1;
41     DBQuery("INSERT INTO radovi (rbr,sif_radnika,naziv_rada_knjige,naziv_casopisa,godina,sif_str_skupa) VALUES ($id,'$sifra','$naziv','$komentar','$godina',0)");
42     }
43     }
44     } else if ($edit)
45     DBQuery("DELETE FROM radovi WHERE (rbr=$edit) AND (sif_radnika='$sifra')");
46 dpavlin 1.2 if ($p != $page && !$warning && !$DBH->errstr) {
47 dpavlin 1.1 DBClose();
48     Header("Location: $pages[$p]".Params($p));
49     exit;
50     }
51     }
52 dpavlin 1.2 if (($new || $update) && !$warning && !$DBH->errstr)
53 dpavlin 1.1 unset($edit, $naziv, $komentar, $godina);
54 dpavlin 1.2 $rows = DBQuery("SELECT rbr,naziv_rada_knjige,naziv_casopisa,godina FROM radovi WHERE (sif_str_skupa=0) AND (sif_radnika='$sifra') ORDER BY godina");
55 dpavlin 1.1 $vars = array();
56     $fnd = false;
57     for ($i = 0; $i < count($rows); $i++) {
58     list($id, $rad, $kom, $god) = $rows[$i];
59     $rad = HTML_Escape(Win_ISO($rad));
60     $kom = HTML_Escape(Win_ISO($kom));
61     $rad2 = ereg_replace("\r?\n", "<BR>", $rad);
62     $kom2 = ereg_replace("\r?\n", "<BR>", $kom);
63     nepoznato($rad2);
64     nepoznato($kom2);
65     array_push($vars, array(
66     "id" => $id,
67     "link" => $PHP_SELF.Params($page, array("edit" => $id)),
68     "naziv" => $rad2,
69     "komentar" => $kom2,
70     "godina" => $god
71     ));
72     if ($edit && $edit == $id) {
73 dpavlin 1.2 if (!$warning) {
74     $naziv = $rad;
75     $komentar = $kom;
76     $godina = $god;
77     }
78 dpavlin 1.1 $fnd = true;
79     }
80     }
81     if (!$fnd) unset($edit);
82 dpavlin 1.2 DBClose();
83     $tpl = new MySmarty($page, $edit ? array("edit" => $edit) : array());
84 dpavlin 1.1 $tpl->assign("vars", $vars);
85     $tpl->assign("edit", $edit);
86     $tpl->assign("naziv", $naziv);
87     $tpl->assign("komentar", $komentar);
88     $tpl->assign("godina", $godina);
89     $tpl->assign("warning", $warning);
90 dpavlin 1.2 $tpl->show();
91 dpavlin 1.1 ?>

  ViewVC Help
Powered by ViewVC 1.1.26