$value) { $$key = $value; // echo "$key: $value
"; } // includes include("common/mysql.inc.php"); include("common/functions.inc.php"); include("common/template.inc.php"); include("common/selects.inc.php"); if(file_exists("wcr_group/includes/multilang.inc.php")) include "wcr_group/includes/multilang.inc.php"; include("wcs/diehard.inc.php"); include("wcs/azuriraj.inc.php"); include("wcs/show.inc.php"); // za prikaz include("wcs/edit.inc.php"); // za unos // config define("_VALID_WCT", 1); $CMT[HOST] = $HOST; $CMT[DATABASE] = $BAZA; $CMT[USERNAME] = $JUZA; $CMT[PASSWORD] = $LOZA; $CMT[tabtable] = "wct_table"; $CMT[tabtr] = "wct_tr"; $CMT[tabtd] = "wct_td"; $CMT[tabattype] = "wct_attype"; $CMT[tabattribute] = "wct_attribute"; $CMT[tabstrkey] = "wct_strkey"; $CMT[tabfilter] = "wct_filter"; $CMT[tabfield] = "wct_field"; $CMT[tabnavigation] = "wct_navigation"; $CMT[tabfile] = "wct_file"; // ovo sve moze bit u nekoj tabeli $CMT[user_table] = "wolf_members"; // potrebno za login $CMT[user_table_id] = "membID"; $CMT[user_table_username] = "nickname"; $CMT[user_table_password] = "passwd"; $CMT[user_table_fullname] = '$rowuser[firstname] $rowuser[lastname]'; // prikazuje ime i prezime $CMT[user_table_myurl] = 'wct_index.php?run=edt&wct=1&rid=$retval[0]'; // link za editiranje $CMT[login_mess] = "prijavi se"; $CMT[logout_mess] = "odjavi se"; $CMT[submit_mess] = "Prihvati"; $CMT[cancel_mess] = "Odustani"; $CMT[required_mess] = "Obavezno upisati"; $CMT[error_in_form] = "Greška kod unosa"; $CMT[reenter_form] = "Ponoviti unos"; $CMT[insert_mess] = "dodaj"; $CMT[update_mess] = "izmjeni"; $CMT[delete_mess] = "obriši"; $CMT[insert_img] = "dodaj"; $CMT[update_img] = "izmjeni"; $CMT[delete_img] = "obriši"; $CMT[noinsert_mess] = "Nemate pravo unosa"; $CMT[noupdate_mess] = "Nemate pravo izmjene"; $CMT[nodelete_mess] = "Nemate pravo brisanja"; $CMT[back_mess] = "Povratak"; // default vrijednosti $CMT[pageitems] = 10; // broj redaka na jednoj strani $CMT[navpages] = 10; // navigacija nudi 10 stranica $CMT[default_template] = "sportski_portal/index.php"; // mora postojati $CMT[css] = "css/default.css"; // css // input vrijednosti $CMT[text_default] = 'size="50" maxlength="50"'; $CMT[textarea_default] = 'cols="50" rows="5"'; $CMT[file_default] = 'size="20"'; /* default postavke (trbaju postojati u .css za tabele koje ispljune ovaj program table.wct sama tabela table.wct td.title naslov tablice table.wct td.header nazivi stupaca table.wct tr.item0 podaci u 1. redu table.wct tr.item1 podaci u 2. redu, naizmjenično */ /* id id tabele */ foreach($HTTP_POST_VARS as $key=>$value) { $$key=$value; // echo "_P $key: $value
"; } /* zbog prelaska sa id na wct: ako drugi siteovi imaju poziv sa id prema ponline zamijeni id sa wct */ if(empty($HTTP_GET_VARS[wct]) || !empty($HTTP_GET_VARS[id])) { $HTTP_GET_VARS[wct] = $HTTP_GET_VARS[id]; } foreach($HTTP_GET_VARS as $key=>$value) { $$key=$value; // echo "_G $key: $value
"; } //die(); /* GET ide nakon POST da ne bi slučajno POST[id] pregazio id koji je najvazniji */ global $VArow; //$VArow[title] = "Adresar Požežana"; // i to treba u bazu $VArow[ISO] = "windows-1250"; if(empty($CMT[wct_css])) $CMT[wct_css] = ""; include("wcs/db_open.php"); global $rowt; if(isset($wct)) // rowt is needed always $rowt=gimme($CMT[tabtable],$wct); if(!empty($rowt[tb_include])) // includes file for this table include($rowt[tb_include]); // $function_call = "show_membID"; // die(function_exists($function_call)); // global (for template) $cookuser = cookie_user(); // cookie_user array $CMT[cookie_user] = $cookuser[0]; // user id u $CMT (pa se vidi svuda) $CMT[cookie_nickname] = $cookuser[2]; // user nick u $CMT (pa se vidi svuda) $CMT[user_privileg] = wct_privileg($cookuser[0]); $CMT[template] = $rowt[tb_template]; $CMT[wct_css] = ""; /* if ($run='row') { foreach($VArow as $key=>$value) { $$key=$value; echo "$key: $value
"; } die($VArow[login]); } */ if(empty($CMT[cookie_user]) && ($CMT[login_required]=="1") && ($run!="login")) { if(function_exists("login_form")) $run="login_form"; else $run = "login_form0"; // default (common/functions.inc.php) /* foreach($CMT as $key=>$value) { $$key=$value; echo "$key: $value
"; } die("Trebao bi se logirati"); */ } if (function_exists("before_run")) before_run(); //die( "$run
"); switch ($run) { case 'tab': // show table if(!empty($wct)) $CMT[maintable] = cmt_table($wct,$filt,"",$HTTP_GET_VARS[start],""); break; case 'row': // show oen row from table (template) // required params // id: table ID // rid: row ID if(empty($wct) || empty($rid)) { } else { $CMT[maintable] = cmt_row($wct,$rid); } break; case 'edt': // edit one row // required params // id: table ID // rid: row ID (0 = new item) $CMT[editor2header] = editor2header(); $CMT[editor2body] = editor2body(); if(empty($wct)) { die("empty ID"); } else { if($rid==0) // insert { if(function_exists("can_insert")) $can_insert = can_insert($CMT[cookie_user]); else $can_insert = 0; if($can_insert) { if(empty($act)) $CMT[maintable] = cms_row($wct,$rid); else $CMT[maintable] = cms_row_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[noinsert_mess],"javascript:history.back()",$CMT[back_mess]); } } else // update { if(function_exists("can_edit")) $can_edit = can_edit($wct,$rid); else $can_edit = 0; if($can_edit) { if(empty($act)) $CMT[maintable] = cms_row($wct,$rid); else $CMT[maintable] = cms_row_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[noupdate_mess],"javascript:history.back()",$CMT[back_mess]); } } } break; case 'del': // delete one row // required params // id: table ID // rid: row ID (0 = new item) if(empty($wct)) { die("empty ID"); } else { if(function_exists("can_delete")) $can_delete = can_delete($wct,$rid); else $can_delete = 0; if($can_delete) { if(empty($act)) $CMT[maintable] = cms_del($wct,$rid); else $CMT[maintable] = cms_del_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[nodelete_mess],"javascript:history.back()",$CMT[back_mess]); } } break; case 'login': // show table /* foreach($HTTP_POST_VARS as $key=>$value) { $$key=$value; echo "$key: $value
"; } die(); */ if(!empty($wct)) { $CMT[maintable] = cmt_login($wct,$rowt); } break; case 'logout': // show table if(!empty($wct)) { $CMT[maintable] = cmt_logout($wct,$rowt); } break; default: if(function_exists($run)) { $CMT[maintable] = $run(); } else { $CMT[maintable] = "No fun!"; } } // template if(empty($CMT[template])) $CMT[template] = $CMT[default_template]; // die($CMT[wct_index]."
".$CMT[template]); if(!empty($HTTP_GET_VARS[prt])) $CMT[template] = $CMT[print_template]; $tblstat = 'wolf_stat'; $stat_id1 = 9; // WCT_INDEX $stat_id2 = $wct; $TZinterval = 1; include ("common/stat.inc.php"); // code snippet, a ne funkcija // registriraj online clanove if(function_exists(register_online)) { register_online(); } include $CMT[template]; // postavlja se iz tb_template // parameters: id, filter, order, start, items include("wcs/db_close.php"); ?>