Jump to content

UnknownPlayer

Members
  • Posts

    269
  • Joined

  • Last visited

    Never

Everything posted by UnknownPlayer

  1. It works, when i remove $input = htmlentities($input);, will that be a problem if that code is removed?
  2. And what is suggestion for this problem, how to fix it?
  3. I have problem, when i put these characters: čšđć in my var to echo it works, but when i use these characters in bbcode($Input) function it does not show that characters, it shows me Ä� or something like that. Or when i put more spaces in var(var goes through bbcode($input) function) it show me Ä this character. How can i fix this problem? This is bbcode function: function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[code\](.*?)\[\/code\]/is', '/\[quote\](.*?)\[\/quote\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[color=(.*?)\](.*?)\[\/color\]/is', '/\[yt\]http:\/\/(?:www\.)?youtube\.com\/watch\?v=(.*?)\[\/yt\]/is', ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<code>$1</code>', '<blockquote>$1</blockquote>', '<img src="$1" style="border:0">', '<a href="$1">$2</a>', '<font style="color:$1">$2</font>', '<object width="580" height="360"> <param name="movie" value="http://www.youtube.com/v/$1?fs=1&hl=sr_RS&border=1" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="580" height="360" src="http://www.youtube.com/v/$1?fs=1&hl=sr_RS&border=1" allowscriptaccess="always" allowfullscreen="true"></embed> </object>', ); return nl2br(preg_replace($search,$replace,$input)); } I think that problem is becouse of tihis: $input = strip_tags($input); $input = htmlentities($input); Help please.
  4. Can you write me code ? I need to put str_replace("watch?v=", "v/", $1) in this array, and i dont know how to do that?
  5. I have this function: function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[color=(.*?)\](.*?)\[\/color\]/is', '/\[yt\](.*?)\[\/yt\]/is', ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1" style="border:0">', '<a href="$1">$2</a>', '<font style="color:$1">$2</font>', '<object width="660" height="405"> <param name="movie" value="'.str_replace("watch?v=", "v/", $1).'" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="660" height="405" src="'.str_replace("watch?v=", "v/", $1).'" allowscriptaccess="always" allowfullscreen="true"></embed> </object>', ); return nl2br(preg_replace($search,$replace,$input)); } There is an error on code: <param name="movie" value="'.str_replace("watch?v=", "v/", $1).'" /> and on: <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="660" height="405" src="'.str_replace("watch?v=", "v/", $1).'" allowscriptaccess="always" allowfullscreen="true"> How can i use str_replace in this situation ? :S
  6. Another problem about this :S please help function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[color=(.*?)\](.*?)\[\/color\]/is', '/\[yt\](.*?)\[\/yt\]/is', ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1" style="border:0">', '<a href="$1">$2</a>', '<font style="color:$1">$2</font>', '<object width="660" height="405"> <param name="movie" value="'.str_replace("watch?v=", "v/", $1).'" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="660" height="405" src="'.str_replace("watch?v=", "v/", $1).'" allowscriptaccess="always" allowfullscreen="true"></embed> </object>', ); return nl2br(preg_replace($search,$replace,$input)); } There is error on code: <param name="movie" value="'.str_replace("watch?v=", "v/", $1).'" /> and on: <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="660" height="405" src="'.str_replace("watch?v=", "v/", $1).'" allowscriptaccess="always" allowfullscreen="true"> How can i use str_replace in this situation ? :S
  7. I've done that, but can you or someone help me with [yt] tag? This tag work like this, but address of youtube address is http://www.youtube.com/watch?v=A6ZLlk, but on embed link link is http://youtube.com/watch?v=A6ZLlk can someone help me to transfer http://www.youtube.com/watch?v=A6ZLlk to http://youtube.com/watch?v=A6ZLlk ?
  8. How can i put youtube embeding code in bbcode. I mean this code: <object width="660" height="405"> <param name="movie" value="(.*?)\" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="660" height="405" src="(.*?)\" allowscriptaccess="always" allowfullscreen="true"></embed> </object> To put in bbcode to bi like this: [yt]link[/yt] I dont know how to du that becouse i have these /\/\/\/ :S
  9. I have this function: function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[font color=(.*?) size=(.*?) face=(.*?)\](.*?)\[\/font\]/is', ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1">', '<a href="$1">$2</a>', '<font style="color:$1;font-size:$2;font-face:$3">$4</font>', ); return preg_replace($search,$replace,$input); } Now when i use this command($komentar is variable which is loaded from mysql): echo bbcode($komentar); it shows me this error: Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/dotars/public_html/includes/functions.php on line 212 What is wrong here ? :S
  10. It works on comments but not on news :S See pic: Code for News is(where div dont work, part 1): <div class="info clear"> <div style="float:right; text-align:right;"> <a href="kategorije.php?id='.$kat_id.'" class="readmore" >Kategorija: '.$kategorija.'</a> | <a href="http://dota.rs/forum/profile/'.$autor.'/" class="comments" >Autor: '.$autor.'</a> | <a href="vesti.php?id='.$vid.'#Komentari" class="comments" >Komentari('.$br_kom.')</a> | <a href="" class="date" ></a>'.$datum.' </div> </div> And part 2, where div works: <div class="info clear"> <div style="float:left; text-align:left;">Text Here</div> <div style="float:right; text-align:right;"><a href="" class="date" ></a>'.$datum.'</div> </div> Anyway, class info is: .info { margin: 20px 10px 5px 10px; padding: 3px 0; border-top: 1px dashed #EFF0F1; } What is wrong there? :S Why on news it shows in front of text ?
  11. I have this css codes: .align-left { text-align: left; } .align-right { text-align: right; } /* display and additional classes */ .clear { clear: both; } .blue { color: #3791D7; } .info { margin: 20px 10px 5px 10px; padding: 3px 0; border-top: 1px dashed #EFF0F1; } Now i use this code like this: <p class="info align-right clear"><a href="" class="date" ></a>'.$date.'</p> And it looks like this: Now, i wonna put Text in left and date on right, how can i do that, i tryed with: <p class="info align-left clear">Text</p> <p class="info align-right clear"><a href="" class="date" ></a>'.$date.'</p> But it doesn't work. Pls help.
  12. Anyway is there any php code that put icons for bbc code, i mean on ,,, like on forum, and when i click to make selected text for example ? This thing:
  13. I use this bbc code. This is bbccode_function.php: <?php function bbcode($input){ $input = strip_tags($input); $input = htmlentities($input); $search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url=http://(.*?)\](.*?)\[\/url\]/is', '/\[font color=(.*?) size=(.*?) face=(.*?)\](.*?)\[\/font\]/is', '/\[h1\](.*?)\[\/h1\]/is', '/\[special\](.*?)\[\/hat\]/is' ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<img src="$1">', '<a href="$1">$2</a>', '<font style="color:$1;font-size:$2;font-face:$3">$4</font>', '<h1>$1</h1>', '<a href="http://google.com" style="font-size:32pt;text-decoration:blink;color:#FF0099">$1</a>' ); return preg_replace($search,$replace,$input); } ?> And this is test page: <?php include "bbcode_function.php"; $var = "[b]text[/b]"; echo bbcode($var); ?> But when i put <br \> code in $var, it does not goes to new row. I use this bbc code in textarea, and i need when i go in new row in textarea to use that bbc code, or somehow to make that work :S How can i do that?
  14. It doesn't work because PHP_SELF contains the path aswell as the filename, e.g. /my/path/kategorije.php use basename() to remove the path and it will work, like this if(basename($_SERVER['PHP_SELF']) == 'kategorije.php') { // do something } Thanks it works this way. I thought $_SERVER['PHP_SELF'] is file name.. :S
  15. Why this code dont work :S <?php echo ' <ul> <li'; if ($_SERVER['PHP_SELF'] == "kategorije.php") { echo ' id="current"'; } echo '><a href="kategorije.php"><span>Kategorije</span></a></li> </ul>'; ?> Checking if PHP_SELF is "kategorije.php" do not work, why, and what is solution ?
  16. I made a form, like guestbook, and i dont wonna to write in mysql if in comment is just 1 or more spaces, no letters or numbers or chars, just space, how can i fix that?
  17. How can i get user's avatar url from smf forum, and put it to my php code. I need some function, becouse some avatars are external and some are internal(from host), Please help
  18. How can i add a facebook "like" button on every news on my website, my news are going by id, and how can i make that to work when click on like for that news?
  19. Can someone help me about pages like pages in news categori, and there is like 50 news, how can i set to show me in 1 page only 30, and to put in bottom of the page echo Pages: 1,2 and when i click in page 2 to show me rest of news? :S
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.