Advertisement
Guest User

Untitled

a guest
May 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1.         while (($pos = strpos($content, "[code;id=")) !== false) {
  2.               $i = 0;
  3.               $sc_id = "";
  4.               while (($content{$pos+9+$i}) != "]") {
  5.                     $sc_id .= $content{$pos+9+$i};
  6.                     $i++;
  7.               }
  8.               $sql  = "select code_lang_id, code, lang_symbol from site_codes ";
  9.               $sql .= "left join site_codes_lang on (site_codes.code_lang_id = site_codes_lang.lang_id) ";
  10.               $sql .= "where code_id = '".DBText($sc_id)."'";
  11.               $qry_code = new Query($sql);
  12.               $qry_code->Open();
  13.               if (!$qry_code->EOF) {
  14.                  $the_code = $qry_code->GetValue("code");
  15.                  $code_lang = $qry_code->GetValue("lang_symbol");
  16.                  $replace = DrawCodeBlock($the_code, "code_block_"+$sc_id, $code_lang, 450, true);
  17.                  $content = str_ireplace("[code;id=".$sc_id."]",$replace,$content);
  18.               }else{
  19.                  $content = str_ireplace("[code;id=".$sc_id."]","",$content);
  20.               }
  21.               $qry_code->Close();
  22.         }
  23.      }
  24.      $qry->Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement