function sys_sona_sql($sona) { # --------------------- # s???steemis???na lugemine # old style: sys_sona("s???na") # # sys_sona(array( # sona => "s???na", # tyyp => "custom" # [tyyp_id => "3"] # alternative to tyyp # [lang_id => "1"] # kui vaja k???sida kindla keele s???steemis???na # )) # --------------------- $args = func_get_arg(0); if (is_array($args)) { $sona = $args["sona"]; $tyyp_id = $args["tyyp_id"]; $tyyp = $args["tyyp"] ? $args["tyyp"] : "vana"; $skip_convert = $args["skip_convert"]; $load_all = $args["load_all"]; } else { $sona = $args; $tyyp = "vana"; } # kui keeleparameetrit ei ole, kasuta saidi keelt $keel_id = isset($args['lang_id']) ? $args['lang_id'] : $this->glossary_id; $tyyp = strtolower($tyyp); $sona = $this->db->quote($sona); $sona = preg_replace("/\\s+/", "_", $sona); $sona = strtolower($sona); $tyyp_id = $this->db->quote($tyyp_id); $cash_value = $this->cash(array(klass => "sys_sonad", kood => $sona . "_" . $tyyp . "_" . $tyyp_id . "_" . $keel_id)); if (!strcmp($cash_value, '')) { $sql = "\r\n\t\t\t\tSELECT IF(LENGTH(sona)>0,sona,origin_sona) AS sona, id, sys_sona\r\n\t\t\t\tFROM sys_sona_tyyp, sys_sonad \r\n\t\t\t\tWHERE sys_sonad.sst_id = sys_sona_tyyp.sst_id AND keel='" . $keel_id . "'"; if (($tyyp == 'kujundus' || $tyyp == 'kasutaja' || $tyyp == 'otsing' || $tyyp == 'kalender' || $load_all) && !$this->cash(array(klass => "sys_sonad", kood => $tyyp . "_" . $tyyp_id . "_" . $keel_id . "LOAD_ALL"))) { $load_all = 1; } else { $sql .= " AND UCASE(sys_sona) LIKE UCASE('{$sona}') "; } if ($tyyp) { $sql .= " AND voti='{$tyyp}' "; } elseif ($tyyp_id) { $sql .= " AND tyyp_id='{$tyyp_id}' "; } $sth = new SQL($sql); # T6mbame kogu tyyp cashi: if ($load_all) { $this->cash(array(klass => "sys_sonad", kood => $tyyp . "_" . $tyyp_id . "_" . $keel_id . "LOAD_ALL", sisu => 1)); $this->debug->msg("SYS_SONAD: TYYP='" . $tyyp . "', KEEL ID=" . $keel_id . "; Put all system strings from this type into cache. Total: " . $sth->rows); while ($data = $sth->fetch()) { $mytmp = $this->db->quote($data['sys_sona']); $mytmp = preg_replace("/\\s+/", "_", $mytmp); $mytmp = strtolower($mytmp); $this->cash(array(klass => "sys_sonad", kood => $mytmp . "_" . $tyyp . "_" . $tyyp_id . "_" . $keel_id, sisu => $data['sona'])); if ($sona == $mytmp) { $result = $data; } } } else { $result = $sth->fetch(); } $sys_sona = $result['sona']; $sys_sona_id = $result['id']; $tmp_sys_sona = $sys_sona; if (($this->on_debug || $this->admin) && !$sys_sona && substr($sona, 0, 8) != 'uus_tyyp') { $sys_sona = "[{$sona}]"; //$tmp_sys_sona = $sona; } # $this->debug->msg($sth->debug->get_msgs()); if (!$load_all) { $this->cash(array(klass => "sys_sonad", kood => $sona . "_" . $tyyp . "_" . $tyyp_id . "_" . $keel_id, sisu => $sys_sona)); } unset($load_all); } else { $sys_sona = $cash_value; # $this->debug->msg("SysSona $sona on juba teatud, see on $cash_value"); } if ($this->admin && $tyyp != "admin") { $imgpath = $this->CONF['wwwroot'] . $this->CONF['adm_img_path']; $sys_sona = $this->cookie["mode"] == "editsysword" ? $sys_sona . "\"> <input type=image src=" . $imgpath . "/e.gif border=0 alt=\"Edit\" onclick=\"javascript:void(avapopup('../admin/sys_sonad_loetelu.php?id=" . $sys_sona_id . "&keel=" . $keel_id . "&keeled=all','strukt','400','200','no')); return false;\">" : $sys_sona; } if ($this->admin) { $admkeel = $this->sess_get("keel_admin"); } if (($keel_id == '2' || $admkeel['glossary_id'] == '2') && $this->CONF['cyr_convert_encoding'] && !$skip_convert) { $sys_sona = convert_cyrillic($sys_sona, $this->CONF['cyr_convert_encoding']); } #echo "test:".$admkeel['keel_id']."<br>"; #echo "test=".$this->CONF['cyr_convert_encoding']."<br>"; return $sys_sona; }
# loop over rows foreach($words as $mysona) { if(strlen($mysona[kirjeldus]) < 0) { $mysona[sys_sona] = '<b>!!! - </b>'.$mysona[sys_sona]; } # bold: tee sõna, mida kasutatakse bold-iks # kui tõlge on erinev kui tõlge tootes, siis tee tõlge bold-iks if(trim($mysona[sona]) != trim($mysona[origin_sona])) { $bold = 1;} # kui tõlge puudub üldse (tühistring), siis tee tõlge tootes bold-iks if(trim($mysona[sona]) == '') { $bold_orig = 1;} if ($keel_id=='2' && $site->CONF['cyr_convert_encoding']){ $mysona['sona'] = convert_cyrillic($mysona['sona'], $site->CONF['cyr_convert_encoding']); $mysona['origin_sona'] = convert_cyrillic($mysona['origin_sona'], $site->CONF['cyr_convert_encoding']); } $href = "javascript:void(avapopup('".$site->self."?id=".$mysona[id]."&sst_id=".$mysona[sst_id]."&flt_keel=".$keel_id."','glossary','400','200','no'))"; ?> <tr class="word_row" id="word_row_<?php echo $mysona['id']; ?> "> <td class="word_delete_button_cell invisible"><?php if (can_user_change_translation($mysona['sst_id'])) { ?> <img class="word_delete_button" id="word_delete_button_<?php echo $mysona['id']; ?>