/[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

Contents of /Radovi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Fri Apr 20 08:25:32 2001 UTC (18 years, 3 months ago) by dpavlin
Branch: MAIN
Branch point for: pliva
Initial revision

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 if (isparam("wb_h")) $p = 0;
9 if (isparam("wb_o")) $p = 15;
10 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 unset($edit);
27 DBQuery("DELETE FROM radovi WHERE (rbr=$del) AND (sif_radnika='$sifra')");
28 }
29 if ($godina && $godina < 1900)
30 if ($godina <= 40) $godina += 2000; else $godina += 1900;
31 $warning = 0;
32 if ($update || $p != $page) {
33 if ($naziv || $komentar || $godina) {
34 if (!$warning) {
35 $naziv = ereg_replace("\r?\n", "\n", ISO_Win($naziv));
36 $komentar = ereg_replace("\r?\n", "\n", ISO_Win($komentar));
37 if ($edit)
38 DBQuery("UPDATE radovi SET naziv_rada_knjige='$naziv',naziv_casopisa='$komentar',godina='$godina' WHERE (sif_radnika='$sifra') AND (rbr=$edit)");
39 else {
40 $id = DBQuery("SELECT MAX(rbr) FROM radovi WHERE (sifra=$id)");
41 $id = $id[0][0] + 1;
42 DBQuery("INSERT INTO radovi (rbr,sif_radnika,naziv_rada_knjige,naziv_casopisa,godina,sif_str_skupa) VALUES ($id,'$sifra','$naziv','$komentar','$godina',0)");
43 }
44 }
45 } else if ($edit)
46 DBQuery("DELETE FROM radovi WHERE (rbr=$edit) AND (sif_radnika='$sifra')");
47 if ($p != $page && !$warning) {
48 DBClose();
49 Header("Location: $pages[$p]".Params($p));
50 exit;
51 }
52 }
53 if (($new || $update) && !$warning)
54 unset($edit, $naziv, $komentar, $godina);
55 $rows = DBQuery("SELECT rbr,naziv_rada_knjige,naziv_casopisa,godina FROM radovi WHERE (sif_str_skupa=0) AND (sif_radnika='$sifra')");
56 DBClose();
57 $vars = array();
58 $fnd = false;
59 for ($i = 0; $i < count($rows); $i++) {
60 list($id, $rad, $kom, $god) = $rows[$i];
61 $rad = HTML_Escape(Win_ISO($rad));
62 $kom = HTML_Escape(Win_ISO($kom));
63 $rad2 = ereg_replace("\r?\n", "<BR>", $rad);
64 $kom2 = ereg_replace("\r?\n", "<BR>", $kom);
65 nepoznato($rad2);
66 nepoznato($kom2);
67 array_push($vars, array(
68 "id" => $id,
69 "link" => $PHP_SELF.Params($page, array("edit" => $id)),
70 "naziv" => $rad2,
71 "komentar" => $kom2,
72 "godina" => $god
73 ));
74 if ($edit && $edit == $id) {
75 $naziv = $rad;
76 $komentar = $kom;
77 $godina = $god;
78 $fnd = true;
79 }
80 }
81 if (!$fnd) unset($edit);
82 include("inc/Smarty.class.php");
83 $tpl = new Smarty;
84 $tpl->template_dir = "./tpl";
85 $tpl->compile_dir = "./tpc";
86 $tpl->assign("action", $PHP_SELF.Params($page,
87 $edit ? array("edit" => $edit) : array()));
88 $tpl->assign("language", $language);
89 $tpl->assign("sifra", $sifra);
90 $tpl->assign("vars", $vars);
91 $tpl->assign("edit", $edit);
92 $tpl->assign("naziv", $naziv);
93 $tpl->assign("komentar", $komentar);
94 $tpl->assign("godina", $godina);
95 $tpl->assign("warning", $warning);
96 $pg = basename($PHP_SELF);
97 $pg = eregi_replace("\.php$", "", $pg);
98 $tpl->display("$pg-$language.tpl");
99 ?>

  ViewVC Help
Powered by ViewVC 1.1.26