[". $fileName ." (". $lineNumber .")]: Error in query:

". $query .'

'. ''. mysql_error () .'' ); } elseif (Config::read('debug')) { $result = mysql_query ($query, Config::read ('link')) or die ( "Error in query:

". $query .'

'. ''. mysql_error () .'' ); } else { $result = mysql_query ($query, Config::read ('link')); } return $result; } static public function humandate($ulaz,$long=false) { $year=substr($ulaz,0,4); $month=substr($ulaz,5,2); $day=substr($ulaz,8,2); $datum=$day.".".$month.".".$year."."; if($long) $datum.=" ".substr($ulaz,11,5); return $datum; } static public function humantime($ulaz) { if(substr($ulaz,11,5)=="00:00") $datum=""; else $datum=substr($ulaz,11,5)." h"; return $datum; } static public function mysqldate($ulaz) { $day=substr($ulaz,0,2); $month=substr($ulaz,3,2); $year=substr($ulaz,6,4); $datum=$year."-".$month."-".$day; return $datum; } static public function checkSelect($ulaz1,$ulaz2) { if($ulaz1==$ulaz2) return ' selected="selected"'; } static public function checkSilent($ulaz) { if($ulaz==1) return ' checked="checked"'; } static public function checkRadio($ulaz1,$ulaz2) { if($ulaz1==$ulaz2) return ' checked="checked"'; } static public function formatURI($ulaz) { $uniqueuri=trim($ulaz); $uniqueuri = str_replace("&","i",$uniqueuri); $uniqueuri = str_replace("'","",$uniqueuri); $uniqueuri = str_replace(".","",$uniqueuri); $uniqueuri = str_replace(":","",$uniqueuri); $uniqueuri = str_replace("-","",$uniqueuri); $uniqueuri = str_replace(",","",$uniqueuri); $uniqueuri = str_replace("\"","",$uniqueuri); $uniqueuri = str_replace("ć","c",$uniqueuri); $uniqueuri = str_replace("č","c",$uniqueuri); $uniqueuri = str_replace("š","s",$uniqueuri); $uniqueuri = str_replace("ž","z",$uniqueuri); $uniqueuri = str_replace("đ","dj",$uniqueuri); $uniqueuri = str_replace("Č","c",$uniqueuri); $uniqueuri = str_replace("Ć","c",$uniqueuri); $uniqueuri = str_replace("Š","s",$uniqueuri); $uniqueuri = str_replace("Ž","z",$uniqueuri); $uniqueuri = str_replace("Đ","dj",$uniqueuri); $uniqueuri = str_replace(" ","-",$uniqueuri); $uniqueuri=strtolower($uniqueuri); return $uniqueuri; } static public function utf8wordwrap($str, $len=50, $break=" ", $cut=false) { if(empty($str)) return ""; $pattern=""; if(!$cut) $pattern="/(\S{".$len."})/u"; else $pattern="/(.{".$len."})/u"; return preg_replace($pattern, "\${1}".$break, $str); } /** * word-sensitive substring static public function with html tags awareness * @param text The text to cut * @param len The maximum length of the cut string * @returns string **/ static public function mb_substrws( $text, $len=180 ) { if( (mb_strlen($text) > $len) ) { $whitespaceposition = mb_strpos($text," ",$len)-1; if( $whitespaceposition > 0 ) { $chars = count_chars(mb_substr($text, 0, ($whitespaceposition+1)), 1); if ($chars[ord('<')] > $chars[ord('>')]) $whitespaceposition = mb_strpos($text,">",$whitespaceposition)-1; $text = mb_substr($text, 0, ($whitespaceposition+1)); } // close unclosed html tags if( preg_match_all("|<([a-zA-Z]+)|",$text,$aBuffer) ) { if( !empty($aBuffer[1]) ) { preg_match_all("||",$text,$aBuffer2); if( count($aBuffer[1]) != count($aBuffer2[1]) ) { foreach( $aBuffer[1] as $index => $tag ) { if( empty($aBuffer2[1][$index]) || $aBuffer2[1][$index] != $tag) $text .= ''; } } } } } return $text; } static public function getDateSelect ($ids = null, $values = null, $classes = null) { /*$dayOptions = ''; for ($i = 1; i <= 31; $i++) { $dayOptions .= ''; } $monthOptions = ''; for ($i = 1; $i <= 12; $i++) { $monthOptions .= ''. "\n"; }*/ $yearOptions = ''; $currYear = date ('Y'); for ($i = $currYear; $i > $currYear - 120; $i--) { $selected = ''; if (isset ($values[2]) && $values[2] == $i) { $selected = ' selected="selected"'; } $yearOptions .= ''. "\n"; } return ' '; } static public function redirect ($url) { header ('Location: '. $url .''); } } ?> '2010-01-15') { return '

'. __('Hvala na iskazanom interesu za FFF! Sljedeći krug prijava počinje u prosincu 2011. godine, za projekte koji će se realizirati u 2012. godini.') .'

'; } else { if (isset ($_POST['submit'])) { Config::write ('activeTab', 2); // Get data (placeholder for ss validation) $data = array (); foreach ($_POST as $key => $value) { $data[$key] = $value; } if (!isset ($_POST['infoMaterialProduce'])) { $data['infoMaterialProduce'] = '-'; } // Save data $query = " INSERT INTO ". Config::read ('dbprefix') ."applications SET subject_name = '". Tools::dbinput ($data['userCompany']) ."', subject_type = '". Tools::dbinput ($data['userCompanyType']) ."', registration_year = '". Tools::dbinput ($data['userYear']) ."', subject_info = '". Tools::dbinput ($data['userInfo']) ."', contact_name = '". Tools::dbinput ($data['userName']) ."', contact_email = '". Tools::dbinput ($data['userEmail']) ."', web_name = '". Tools::dbinput ($data['webName']) ."', web_goal = '". Tools::dbinput ($data['webGoal']) ."', web_description = '". Tools::dbinput ($data['webDescription']) ."', web_domain = '". Tools::dbinput ($data['webDomain']) ."', visual_identity_exists = '". Tools::dbinput ($data['infoVisualIdentity']) ."', ideal_publish_time = '". Tools::dbinput ($data['infoDueDate']) ."', materials_exist = '". Tools::dbinput ($data['infoMaterial']) ."', can_produce_material = '". Tools::dbinput ($data['infoMaterialProduce']) ."', available_people = '". Tools::dbinput ($data['infoPersonnel']) ."', can_finance = '". Tools::dbinput ($data['infoFinancing']) ."', notes = '". Tools::dbinput ($data['notes']) ."' "; Tools::query ($query, __FILE__, __LINE__); $id = mysql_insert_id (); var_dump ($id); // Upload file and create file link $fileLink = ''; if (isset ($_FILES['infoUpload']) && !empty ($_FILES['infoUpload']['tmp_name'])) { $uploadSuccessful = move_uploaded_file ( $_FILES['infoUpload']['tmp_name'], Config::read ('downloadPath') . $id .'_'. basename ($_FILES ['infoUpload']['name']) ); if (!$uploadSuccessful) { print_r ($_FILES); return false; } $fileLink = Config::read ('sitedomain') .'/'. Config::read ('downloadFolder') . $id .'_'. basename ($_FILES ['infoUpload']['name']); } // Update file link in database // Save data $query = " UPDATE ". Config::read ('dbprefix') ."applications SET file_link = '". Tools::dbinput ($fileLink) ."' WHERE id = '$id' "; Tools::query ($query, __FILE__, __LINE__); // Create email $message = '

Naziv subjekta/organizacije: '. $data['userCompany'] .'

Vrsta subjekta: '. $data['userCompanyType'] .'

Godina registracije: '. $data['userYear'] .'

Informativni opis, misija: '. $data['userInfo'] .'

Ime i prezime kontakt osobe: '. $data['userName'] .'

Email adresa kontakt osobe: '. $data['userEmail'] .'

Naiv web stranica: '. $data['webName'] .'

Cilj web stranica: '. $data['webGoal'] .'

Opis web stranica: '. $data['webDescription'] .'

Planirana domena: '. $data['webDomain'] .'

Postoji li vizualni identitet?: '. $data['infoVisualIdentity'] .'

Koje bi bilo idealno vrijeme objave projekta?: '. $data['infoDueDate'] .'

Postoje li materijali za realizaciju?: '. $data['infoMaterial'] .'

Ako ne, možete li sami proizvesti materijale?: '. $data['infoMaterialProduce'] .'

Koliko osoba/sati možete alocirati za rad na projektu?: '. $data['infoPersonnel'] .'

Možete li financirati eventualne dodatne troškove projekta?: '. $data['infoFinancing'] .'

Priloženi zip file: '. $fileLink .'

Bilješke: '. $data['notes'] .'

'; // Send email $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: ' . $data['userEmail'] . "\r\n"; if (mail (Config::read ('email'), 'Prijava za fff', $message, $headers)) { switch (Config::read ('lang')) { case 'hrv': return '

Hvala na prijavi.

'; default: return '

Thanks for applying.

'; } } } else { return '

'. __('O aplikantu') .'

'. __('O web stranicama') .'

'. __('Dodatne informacije') .'

'. __('Dokumentacija') .'

'. __('Bilješke') .'

'; } } } static public function get404 () { return '

Error 404: Page not found.

'; } } ?>