Пример #1
0
 /**
  * Delete residual suffixes
  */
 static function step3()
 {
     $word = self::$buffer;
     $rv_index = self::$rv_index;
     $first_char_len = max(strlen(mb_substr(substr($word, $rv_index), 0, 1, "UTF-8")), 1);
     if (preg_search('/(os|a|o|á|í|ó)$/u', $word, $rv_index + $first_char_len) != -1) {
         $word = preg_offset_replace('/(os|a|o|á|í|ó)$/u', '', $word, $rv_index + $first_char_len);
     } else {
         if (($loc = preg_search('/gu(e|é)$/u', $word)) != -1 && $loc >= $rv_index - 1) {
             $word = preg_replace('/u(e|é)$/u', '', $word);
         } else {
             if (($loc = preg_search('/(e|é)$/u', $word, $rv_index + $first_char_len)) != -1) {
                 $word = preg_replace('/(e|é)$/u', '', $word);
             }
         }
     }
     self::$buffer = $word;
 }
Пример #2
0
        session_start();
        if ($securitycode == '' || strtolower($securitycode) != strtolower($_SESSION['code'])) {
            catcherror($lnc[165]);
        }
    }
    $sitename = safe_convert(trimplus($sitename));
    $siteurl = safe_convert(trimplus($siteurl));
    $sitelogo = safe_convert(trimplus($sitelogo));
    $siteintro = safe_convert(trimplus($siteintro));
    if (!$sitename || !$siteurl) {
        catcherror($lnc[179]);
    }
    $siteurl = urlconvert($siteurl);
    $sitelogo = urlconvert($sitelogo);
    $siteid = time() . rand(0, 10);
    if (preg_search($sitename, $forbidden['banword']) || preg_search($siteintro, $forbidden['banword']) || preg_search($siteurl, $forbidden['banword']) || preg_search($sitename, $forbidden['suspect']) || preg_search($siteintro, $forbidden['suspect']) || preg_search($siteurl, $forbidden['suspect'])) {
        catcherror($lnc[214]);
    }
    $addline = "<?PHP exit();?><|>{$siteid}<|>{$sitename}<|>{$siteurl}<|>{$sitelogo}<|>{$siteintro}<|>\n";
    $filename = "data/cache_applylinks.php";
    $oldcontent = @readfromfile($filename);
    $content = $addline . $oldcontent;
    if (!writetofile($filename, $content)) {
        catcherror($lnc[7] . $filename);
    } else {
        catchsuccess($lnc[180], "{$lnc[163]}|index.php");
    }
}
if ($job == 'ajaxverify') {
    acceptrequest('savecookie,securitycode');
    $savecookie = floor($savecookie);
Пример #3
0
         $limitmore = "AND `property`<>2";
     }
     $originblog = $blog->getbyquery("SELECT * FROM `{$db_prefix}blogs` WHERE `blogid`='{$v_id}' AND `property`<>1  AND `property`<>3 {$limitmore}");
     if ($originblog['blogid'] != $v_id) {
         $cancel = $lnc[211];
     } else {
         $allowedgp = @explode('|', $originblog['permitgp']);
         if ($originblog['permitgp'] != '' && !@in_array($userdetail['usergroup'], $allowedgp)) {
             $cancel = $lnc[211];
         }
     }
 } else {
     checkpermission('LeaveMessage');
 }
 catcherror($cancel);
 if (preg_search($openid_url, $forbidden['banword']) || preg_search($openid_url, $forbidden['keep'])) {
     $cancel = $lnc[158];
 }
 if ($config['validation'] == 1) {
     if ($db_defaultsessdir != 1) {
         session_save_path("./{$db_tmpdir}");
     }
     session_cache_limiter("private, must-revalidate");
     session_start();
     if ($v_security == '' || strtolower($v_security) != strtolower($_SESSION['code'])) {
         $cancel = $lnc[165];
     }
 }
 catcherror($cancel);
 $v_content = urlencode($v_content);
 $v_replier = urlencode($openid_url);
Пример #4
0
function checksafe($str)
{
    $array_searches = array('fopen', 'eval', 'fsockopen', '_COOKIE', '_SESSION', 'writetofile', 'fwrite', 'fput', 'exec', 'Location', 'opendir', 'readdir', 'unlink', 'rmdir', 'mkdir', 'chmod', 'rename', 'mysql_', 'mysqli_', 'file_get_contents', 'file_put_contents', 'tmpfile', 'copy');
    return preg_search($str, $array_searches);
}
Пример #5
0
 /**
  * Used to strip suffixes off word
  */
 static function backwardSuffix()
 {
     /*
     Step 1:
     Search for the longest among the following suffixes,
     (a) em   ern   er
     (b) e   en   es
     (c) s (preceded by a valid s-ending)
     */
     $word = self::$buffer;
     $a1_index = preg_search('/(ern|er|em)$/u', $word);
     $b1_index = preg_search('/(en|es|e)$/u', $word);
     $s_ending = self::$s_ending;
     $c1_index = preg_search("/([{$s_ending}]s)\$/u", $word);
     if ($c1_index != -1) {
         $c1_index++;
     }
     $infty = strlen($word) + 1;
     $index1 = $infty;
     $option_used1 = '';
     if ($a1_index != -1 && $a1_index < $index1) {
         $option_used1 = 'a';
         $index1 = $a1_index;
     }
     if ($b1_index != -1 && $b1_index < $index1) {
         $option_used1 = 'b';
         $index1 = $b1_index;
     }
     if ($c1_index != -1 && $c1_index < $index1) {
         $option_used1 = 'c';
         $index1 = $c1_index;
     }
     /*
         and delete if in R1. (Of course the letter of the valid s-ending is
         not necessarily in R1.) If an ending of group (b) is deleted, and
         the ending is preceded by niss, delete the final s. (For example,
         äckern -> äck, ackers -> acker, armes -> arm,
         bedürfnissen -> bedürfnis)
     */
     if ($index1 != $infty && self::$r1_index != -1) {
         if ($index1 >= self::$r1_index) {
             $word = substr($word, 0, $index1);
             if ($option_used1 == 'b') {
                 if (preg_search('/niss$/u', $word) != -1) {
                     $word = mb_substr($word, 0, mb_strlen($word) - 1);
                 }
             }
         }
     }
     /*
     Step 2:
     Search for the longest among the following suffixes,
     (a) en   er   est
     (b) st (preceded by a valid st-ending, itself preceded by at least 3
     letters)
     */
     $a2_index = preg_search('/(en|er|est)$/u', $word);
     $st_ending = self::$st_ending;
     $b2_index = -1;
     $pattern = "/(.{3}[{$st_ending}]st)\$/u";
     if (preg_match($pattern, $word, $matches, PREG_OFFSET_CAPTURE)) {
         $b2_index = $matches[0][1];
     }
     if ($b2_index != -1) {
         $b2_index += strlen($matches[0][0]) - 2;
     }
     $index2 = $infty;
     $option_used2 = '';
     if ($a2_index != -1 && $a2_index < $index2) {
         $option_used2 = 'a';
         $index2 = $a2_index;
     }
     if ($b2_index != -1 && $b2_index < $index2) {
         $option_used2 = 'b';
         $index2 = $b2_index;
     }
     /*
     and delete if in R1.
     (For example, derbsten -> derbst by step 1, and derbst -> derb by
     step 2, since b is a valid st-ending, and is preceded by just 3 letters)
     */
     if ($index2 != $infty && self::$r1_index != -1) {
         if ($index2 >= self::$r1_index) {
             $word = substr($word, 0, $index2);
         }
     }
     /*
     Step 3: d-suffixes (*)
     Search for the longest among the following suffixes, and perform
     the action indicated.
     end   ung
         delete if in R2
         if preceded by ig, delete if in R2 and not preceded by e
     ig   ik   isch
         delete if in R2 and not preceded by e
     lich   heit
         delete if in R2
         if preceded by er or en, delete if in R1
     keit
         delete if in R2
         if preceded by lich or ig, delete if in R2
     */
     $a3_index = preg_search('/(end|ung)$/', $word);
     $b3_index = preg_search('/[^e](ig|ik|isch)$/', $word);
     $c3_index = preg_search('/(lich|heit)$/', $word);
     $d3_index = preg_search('/(keit)$/', $word);
     if ($b3_index != -1) {
         $b3_index++;
     }
     $index3 = $infty;
     $option_used3 = '';
     if ($a3_index != -1 && $a3_index < $index3) {
         $option_used3 = 'a';
         $index3 = $a3_index;
     }
     if ($b3_index != -1 && $b3_index < $index3) {
         $option_used3 = 'b';
         $index3 = $b3_index;
     }
     if ($c3_index != -1 && $c3_index < $index3) {
         $option_used3 = 'c';
         $index3 = $c3_index;
     }
     if ($d3_index != -1 && $d3_index < $index3) {
         $option_used3 = 'd';
         $index3 = $d3_index;
     }
     if ($index3 != $infty && self::$r2_index != -1) {
         if ($index3 >= self::$r2_index) {
             $word = substr($word, 0, $index3);
             $option_index = -1;
             $option_subsrt = '';
             if ($option_used3 == 'a') {
                 $option_index = preg_search('/[^e](ig)$/u', $word);
                 if ($option_index != -1) {
                     $option_index++;
                     if ($option_index >= self::$r2_index) {
                         $word = substr($word, 0, $option_index);
                     }
                 }
             } else {
                 if ($option_used3 == 'c') {
                     $option_index = preg_search('/(er|en)$/u', $word);
                     if ($option_index != -1) {
                         if ($option_index >= self::$r1_index) {
                             $word = substr($word, 0, $option_index);
                         }
                     }
                 } else {
                     if ($option_used3 == 'd') {
                         $option_index = preg_search('/(lich|ig)$/u', $word);
                         if ($option_index != -1) {
                             if ($option_index >= self::$r2_index) {
                                 $word = substr($word, 0, $option_index);
                             }
                         }
                     }
                 }
             }
         }
     }
     self::$buffer = $word;
 }
Пример #6
0
}
if ($job == 'search') {
    if ($mbcon['searchon'] == 0) {
        catcherror($lnc[217]);
    }
    checkpermission('AllowSearch');
    //Check post interval
    $lastsearch = $_COOKIE['lastsearch'];
    if (time() - $lastsearch < $permission['SearchInterval']) {
        catcherror($lnc[218] . $permission['SearchInterval'] . $lnc[219]);
    }
    acceptrequest('keyword,searchmethod');
    if (strlen($keyword) < $mbcon['keymin'] || strlen($keyword) > $mbcon['keymax'] || !$searchmethod) {
        catcherror($lnc[220]);
    }
    if (preg_search($keyword, $forbidden['nosearch'])) {
        catcherror($lnc[221]);
    }
    $keyword = safe_convert($keyword);
    if ($searchmethod != 1 && $searchmethod != 5 && $permission['FulltextSearch'] != 1) {
        catcherror($lnc[222]);
    }
    switch ($searchmethod) {
        case 1:
            $target_table = "{$db_prefix}blogs";
            $target_column = "title";
            $target_id = "blogid";
            $extralimit = $permission['SeeHiddenEntry'] == 1 ? " AND `property`<>'3'" : " AND `property`<=1";
            break;
        case 2:
            $target_table = "{$db_prefix}blogs";
Пример #7
0
 /**
  * If the word ends in an s, not preceded by a, i, o, u, è or s, delete it.
  */
 static function step4()
 {
     $word = self::$buffer;
     if (preg_search('/([^aiouès])s$/u', $word) >= 0) {
         $word = preg_replace('/([^aiouès])s$/u', '$1', $word);
     }
     $e1_index = preg_search('/ion$/u', $word);
     if ($e1_index >= self::$r2_index && preg_search('/[st]ion$/u', $word) >= self::$rv_index) {
         $word = substr($word, 0, $e1_index);
     } else {
         $e2_index = preg_search('/(ier|ière|Ier|Ière)$/u', $word);
         if ($e2_index != -1 && $e2_index >= self::$rv_index) {
             $word = substr($word, 0, $e2_index) . "i";
         } else {
             if (preg_search('/e$/u', $word) >= self::$rv_index) {
                 $word = preg_replace('/e$/u', '', $word);
                 //delete last e
             } else {
                 if (preg_search('/guë$/u', $word) >= self::$rv_index) {
                     $word = preg_replace('/guë$/u', 'gu', $word);
                 }
             }
         }
     }
     self::$buffer = $word;
 }