예제 #1
0
 static function &getTxt($string, $ns = null, $l = null)
 {
     $hash = md5($string);
     $ns = $ns === null ? self::$ns : $ns;
     $l = $l ? $l : L();
     $txts = L::getTxts($ns, $l);
     if (!isset($txts[$hash])) {
         D()->query("INSERT INTO smalltext SET namespace='" . $ns . "', hash = '" . $hash . "', de = " . D()->quote($string) . ", original=" . D()->quote($string) . " ");
         // todo:change to default:en
         $txts[$hash] = '';
     }
     if (!$txts[$hash]) {
         // was before "$txts[$hash] === ''"
         $str = debug ? '*' . $string . '*' : $string;
     } else {
         $str = $txts[$hash];
     }
     if (G()->SET['qg']['smalltexts_counter']->setType('bool')->v) {
         D()->query("UPDATE smalltext SET count = count+1 WHERE hash = '" . $hash . "'");
     }
     return $str;
 }