PageRenderTime 68ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/inc/plugins/automedia.php

https://bitbucket.org/doylecc/automedia-1
PHP | 2427 lines | 1969 code | 226 blank | 232 comment | 383 complexity | c6315204ee4a709333f533fedad7cc64 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * Plugin Name: AutoMedia for MyBB 1.6.*
  4. * Copyright Š 2011 doylecc
  5. * http://community.mybb.com/user-14694.html
  6. *
  7. *This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program. If not, see <http://www.gnu.org/licenses/>
  17. */
  18. // Disallow direct access to this file for security reasons
  19. if(!defined("IN_MYBB"))
  20. {
  21. die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  22. }
  23. //Add Hooks #####################################################################################################
  24. $plugins->add_hook("parse_message", "automedia_run");
  25. $plugins->add_hook("parse_message", "automedia_adult_run");
  26. $plugins->add_hook("parse_message", "automedia_oldyt_run");
  27. $plugins->add_hook("usercp_start", "ucp_automedia_status");
  28. $plugins->add_hook("usercp_start", "userautomedia");
  29. $plugins->add_hook("postbit", "automedia_hide");
  30. $plugins->add_hook("postbit_prev", "automedia_hide");
  31. $plugins->add_hook("postbit_pm", "automedia_hide");
  32. $plugins->add_hook("postbit", "automedia_count");
  33. $plugins->add_hook("postbit_prev", "automedia_count");
  34. $plugins->add_hook("postbit_pm", "automedia_count");
  35. $plugins->add_hook("pre_output_page", "amsigpreview");
  36. $plugins->add_hook("toolbar_container_collect", "automedia_collect");
  37. $plugins->add_hook("toolbar_container_collect", "amplaylist_collect");
  38. //Plugin Info ##################################################################################################
  39. function automedia_info()
  40. {
  41. global $lang;
  42. $lang->load("automedia");
  43. $am_info = array(
  44. "name" => "Auto Media",
  45. "description" => $lang->av_plugin_descr,
  46. "website" => "http://mods.mybb.com/",
  47. "author" => "doylecc",
  48. "authorsite" => "http://community.mybb.com/user-14694.html",
  49. "version" => "1.1.10",
  50. "guid" => "ed9c97754efa977edba8a463ab98272a",
  51. "compatibility" => "14*,16*"
  52. );
  53. //Add cURL status to info
  54. if(automedia_is_installed())
  55. {
  56. $am_info['description'] .= @automedia_curl_status();
  57. }
  58. return $am_info;
  59. }
  60. //Get cURL status ##############################################################################################
  61. function automedia_curl_status()
  62. {
  63. global $lang;
  64. $unsupported = $lang->av_unsupported;
  65. if (!function_exists('curl_init'))
  66. {
  67. $status .= " <ul><li style=\"list-style-image: url(styles/default/images/icons/warning.gif)\">"
  68. .$unsupported
  69. ."</li></ul>\n";
  70. }
  71. else
  72. {
  73. $status = "";
  74. }
  75. return $status;
  76. }
  77. //Plugin installed? ############################################################################################
  78. function automedia_is_installed()
  79. {
  80. global $db;
  81. $query = $db->simple_select('settings','*','name="av_signature"');
  82. $installed = $db->fetch_array($query);
  83. if($installed)
  84. {
  85. return true;
  86. }
  87. return false;
  88. }
  89. //Install the Plugin ###########################################################################################
  90. function automedia_install()
  91. {
  92. global $db, $mybb, $lang;
  93. if($db->field_exists('automedia_use', 'users'))
  94. {
  95. $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP COLUMN automedia_use");
  96. }
  97. // DELETE ALL SETTINGS TO AVOID DUPLICATES
  98. $query = $db->simple_select('settinggroups','gid','name="AutoMedia Sites"');
  99. $ams = $db->fetch_array($query);
  100. $db->delete_query('settinggroups',"gid='".$ams['gid']."'");
  101. $query2 = $db->simple_select('settinggroups','gid','name="AutoMedia Global"');
  102. $amg = $db->fetch_array($query2);
  103. $db->delete_query('settinggroups',"gid='".$amg['gid']."'");
  104. $query3 = $db->simple_select('settinggroups','gid','name="AutoMedia"');
  105. $am = $db->fetch_array($query3);
  106. $db->delete_query('settinggroups',"gid='".$am['gid']."'");
  107. // Delete Settings
  108. $db->delete_query('settings',"gid='".$ams['gid']."'");
  109. $db->delete_query('settings',"gid='".$amg['gid']."'");
  110. $db->delete_query('settings',"gid='".$am['gid']."'");
  111. /**
  112. *
  113. * Add Settings
  114. *
  115. **/
  116. $query = $db->simple_select("settinggroups", "COUNT(*) as rows");
  117. $rows = $db->fetch_field($query, "rows");
  118. // Add Settinggroup for Videosites
  119. $automedia_group = array(
  120. "name" => "AutoMedia Sites",
  121. "title" => "AutoMedia Sites",
  122. "description" => $lang->av_group_sites_descr,
  123. "disporder" =>$rows+2,
  124. "isdefault" => 0
  125. );
  126. $db->insert_query("settinggroups", $automedia_group);
  127. $gid = $db->insert_id();
  128. //Add Settinggroup for Global Settings
  129. $automedia2_group = array(
  130. "name" => "AutoMedia Global",
  131. "title" => "AutoMedia Global",
  132. "description" => $lang->av_group_global_descr,
  133. "disporder" => $rows+1,
  134. "isdefault" => 0
  135. );
  136. $db->insert_query("settinggroups", $automedia2_group);
  137. $gid2 = $db->insert_id();
  138. // Add Settings for Global Settinggroup
  139. $automedia2_1 = array(
  140. "name" => "av_enable",
  141. "title" => $lang->av_enable_title,
  142. "description" => $lang->av_enable_descr,
  143. "optionscode" => "yesno",
  144. "value" => 1,
  145. "disporder" => 1,
  146. "gid" => intval($gid2)
  147. );
  148. $db->insert_query("settings", $automedia2_1);
  149. $automedia2_2 = array(
  150. "name" => "av_guest",
  151. "title" => $lang->av_guest_title,
  152. "description" => $lang->av_guest_descr,
  153. "optionscode" => "yesno",
  154. "value" => 1,
  155. "disporder" => 2,
  156. "gid" => intval($gid2)
  157. );
  158. $db->insert_query("settings", $automedia2_2);
  159. $automedia2_3 = array(
  160. "name" => "av_groups",
  161. "title" => $lang->av_groups_title,
  162. "description" => $lang->av_groups_descr,
  163. "optionscode" => "text",
  164. "value" => 0,
  165. "disporder" => 3,
  166. "gid" => intval($gid2)
  167. );
  168. $db->insert_query("settings", $automedia2_3);
  169. $automedia2_4 = array(
  170. "name" => "av_forums",
  171. "title" => $lang->av_forums_title,
  172. "description" => $lang->av_forums_descr,
  173. "optionscode" => "text",
  174. "value" => 0,
  175. "disporder" => 4,
  176. "gid" => intval($gid2)
  177. );
  178. $db->insert_query("settings", $automedia2_4);
  179. $automedia2_5= array(
  180. "name" => "av_adultsites",
  181. "title" => $lang->av_adultsites_title,
  182. "description" => $lang->av_adultsites_descr,
  183. "optionscode" => "yesno",
  184. "value" => 0,
  185. "disporder" => 5,
  186. "gid" => intval($gid2)
  187. );
  188. $db->insert_query("settings", $automedia2_5);
  189. $automedia2_6 = array(
  190. "name" => "av_adultguest",
  191. "title" => $lang->av_adultguest_title,
  192. "description" => $lang->av_adultguest_descr,
  193. "optionscode" => "yesno",
  194. "value" => 0,
  195. "disporder" => 6,
  196. "gid" => intval($gid2)
  197. );
  198. $db->insert_query("settings", $automedia2_6);
  199. $automedia2_7 = array(
  200. "name" => "av_adultgroups",
  201. "title" => $lang->av_adultgroups_title,
  202. "description" => $lang->av_adultgroups_descr,
  203. "optionscode" => "text",
  204. "value" => 0,
  205. "disporder" => 7,
  206. "gid" => intval($gid2)
  207. );
  208. $db->insert_query("settings", $automedia2_7);
  209. $automedia2_8 = array(
  210. "name" => "av_adultforums",
  211. "title" => $lang->av_adultforums_title,
  212. "description" => $lang->av_adultforums_descr,
  213. "optionscode" => "text",
  214. "value" => 0,
  215. "disporder" => 8,
  216. "gid" => intval($gid2)
  217. );
  218. $db->insert_query("settings", $automedia2_8);
  219. $automedia2_9 = array(
  220. "name" => "av_signature",
  221. "title" => $lang->av_signature_title,
  222. "description" => $lang->av_signature_descr,
  223. "optionscode" => "yesno",
  224. "value" => 0,
  225. "disporder" => 9,
  226. "gid" => intval($gid2)
  227. );
  228. $db->insert_query("settings", $automedia2_9);
  229. // setting if admins only, admins and mods or all users can embed flash files
  230. $automedia2_10 = array(
  231. "name" => "av_flashadmin",
  232. "title" => $lang->av_flashadmin_title,
  233. "description" => $lang->av_flashadmin_descr,
  234. "optionscode" => "radio
  235. admin=Admins
  236. mods=Admins, Supermods, Mods
  237. all=All Users",
  238. "value" => "admin",
  239. "disporder" => 10,
  240. "gid" => intval($gid2)
  241. );
  242. $db->insert_query("settings", $automedia2_10);
  243. // add setting for width of flash files
  244. $automedia2_11 = array(
  245. "name" => "av_flashwidth",
  246. "title" => $lang->av_flashwidth_title,
  247. "description" => $lang->av_flashwidth_descr,
  248. "optionscode" => "text",
  249. "value" => "480",
  250. "disporder" => 11,
  251. "gid" => intval($gid2)
  252. );
  253. $db->insert_query("settings", $automedia2_11);
  254. // add setting for height of flash files
  255. $automedia2_12 = array(
  256. "name" => "av_flashheight",
  257. "title" => $lang->av_flashheight_title,
  258. "description" => $lang->av_flashheight_descr,
  259. "optionscode" => "text",
  260. "value" => "360",
  261. "disporder" => 12,
  262. "gid" => intval($gid2)
  263. );
  264. $db->insert_query("settings", $automedia2_12);
  265. //Add Settings for Videosites Settinggroup
  266. $automedia_1 = array(
  267. "name" => "av_youtube",
  268. "title" => $lang->av_youtube_title,
  269. "description" => $lang->av_youtube_descr,
  270. "optionscode" => "yesno",
  271. "value" => 1,
  272. "disporder" => 1,
  273. "gid" => intval($gid)
  274. );
  275. $db->insert_query("settings", $automedia_1);
  276. $automedia_2 = array(
  277. "name" => "av_dailymotion",
  278. "title" => $lang->av_dailymotion_title,
  279. "description" => $lang->av_dailymotion_descr,
  280. "optionscode" => "yesno",
  281. "value" => 1,
  282. "disporder" => 2,
  283. "gid" => intval($gid)
  284. );
  285. $db->insert_query("settings", $automedia_2);
  286. $automedia_3 = array(
  287. "name" => "av_google",
  288. "title" => $lang->av_google_title,
  289. "description" => $lang->av_google_descr,
  290. "optionscode" => "yesno",
  291. "value" => 1,
  292. "disporder" => 3,
  293. "gid" => intval($gid)
  294. );
  295. $db->insert_query("settings", $automedia_3);
  296. $automedia_4 = array(
  297. "name" => "av_myvideo",
  298. "title" => $lang->av_myvideo_title,
  299. "description" => $lang->av_myvideo_descr,
  300. "optionscode" => "yesno",
  301. "value" => 1,
  302. "disporder" => 4,
  303. "gid" => intval($gid)
  304. );
  305. $db->insert_query("settings", $automedia_4);
  306. $automedia_5 = array(
  307. "name" => "av_clipfish",
  308. "title" => $lang->av_clipfish_title,
  309. "description" => $lang->av_clipfish_descr,
  310. "optionscode" => "yesno",
  311. "value" => 1,
  312. "disporder" => 5,
  313. "gid" => intval($gid)
  314. );
  315. $db->insert_query("settings", $automedia_5);
  316. $automedia_6 = array(
  317. "name" => "av_vimeo",
  318. "title" => $lang->av_vimeo_title,
  319. "description" => $lang->av_vimeo_descr,
  320. "optionscode" => "yesno",
  321. "value" => 1,
  322. "disporder" => 6,
  323. "gid" => intval($gid)
  324. );
  325. $db->insert_query("settings", $automedia_6);
  326. $automedia_7 = array(
  327. "name" => "av_metacafe",
  328. "title" => $lang->av_metacafe_title,
  329. "description" => $lang->av_metacafe_descr,
  330. "optionscode" => "yesno",
  331. "value" => 1,
  332. "disporder" => 7,
  333. "gid" => intval($gid)
  334. );
  335. $db->insert_query("settings", $automedia_7);
  336. $automedia_8 = array(
  337. "name" => "av_trail",
  338. "title" => $lang->av_trail_title,
  339. "description" => $lang->av_trail_descr,
  340. "optionscode" => "yesno",
  341. "value" => 1,
  342. "disporder" => 8,
  343. "gid" => intval($gid)
  344. );
  345. $db->insert_query("settings", $automedia_8);
  346. $automedia_9 = array(
  347. "name" => "av_apple",
  348. "title" => $lang->av_apple_title,
  349. "description" => $lang->av_apple_descr,
  350. "optionscode" => "yesno",
  351. "value" => 1,
  352. "disporder" => 9,
  353. "gid" => intval($gid)
  354. );
  355. $db->insert_query("settings", $automedia_9);
  356. $automedia_10 = array(
  357. "name" => "av_photobucket",
  358. "title" => $lang->av_photobucket_title,
  359. "description" => $lang->av_photobucket_descr,
  360. "optionscode" => "yesno",
  361. "value" => 1,
  362. "disporder" => 10,
  363. "gid" => intval($gid)
  364. );
  365. $db->insert_query("settings", $automedia_10);
  366. $automedia_11 = array(
  367. "name" => "av_divshare",
  368. "title" => $lang->av_divshare_title,
  369. "description" => $lang->av_divshare_descr,
  370. "optionscode" => "yesno",
  371. "value" => 1,
  372. "disporder" => 11,
  373. "gid" => intval($gid)
  374. );
  375. $db->insert_query("settings", $automedia_11);
  376. $automedia_12 = array(
  377. "name" => "av_myspace",
  378. "title" => $lang->av_myspace_title,
  379. "description" => $lang->av_myspace_descr,
  380. "optionscode" => "yesno",
  381. "value" => 1,
  382. "disporder" => 12,
  383. "gid" => intval($gid)
  384. );
  385. $db->insert_query("settings", $automedia_12);
  386. $automedia_13 = array(
  387. "name" => "av_megavideo",
  388. "title" => $lang->av_megavideo_title,
  389. "description" => $lang->av_megavideo_descr,
  390. "optionscode" => "yesno",
  391. "value" => 1,
  392. "disporder" => 13,
  393. "gid" => intval($gid)
  394. );
  395. $db->insert_query("settings", $automedia_13);
  396. $automedia_14 = array(
  397. "name" => "av_yahoo",
  398. "title" => $lang->av_yahoo_title,
  399. "description" => $lang->av_yahoo_descr,
  400. "optionscode" => "yesno",
  401. "value" => 1,
  402. "disporder" => 14,
  403. "gid" => intval($gid)
  404. );
  405. $db->insert_query("settings", $automedia_14);
  406. $automedia_15 = array(
  407. "name" => "av_streetfire",
  408. "title" => $lang->av_streetfire_title,
  409. "description" => $lang->av_streetfire_descr,
  410. "optionscode" => "yesno",
  411. "value" => 1,
  412. "disporder" => 15,
  413. "gid" => intval($gid)
  414. );
  415. $db->insert_query("settings", $automedia_15);
  416. $automedia_16 = array(
  417. "name" => "av_sevenload",
  418. "title" => $lang->av_sevenload_title,
  419. "description" => $lang->av_sevenload_descr,
  420. "optionscode" => "yesno",
  421. "value" => 1,
  422. "disporder" => 16,
  423. "gid" => intval($gid)
  424. );
  425. $db->insert_query("settings", $automedia_16);
  426. $automedia_17 = array(
  427. "name" => "av_facebook",
  428. "title" => $lang->av_facebook_title,
  429. "description" => $lang->av_facebook_descr,
  430. "optionscode" => "yesno",
  431. "value" => 1,
  432. "disporder" => 17,
  433. "gid" => intval($gid)
  434. );
  435. $db->insert_query("settings", $automedia_17);
  436. $automedia_19 = array(
  437. "name" => "av_guba",
  438. "title" => $lang->av_guba_title,
  439. "description" => $lang->av_guba_descr,
  440. "optionscode" => "yesno",
  441. "value" => 1,
  442. "disporder" => 19,
  443. "gid" => intval($gid)
  444. );
  445. $db->insert_query("settings", $automedia_19);
  446. $automedia_20 = array(
  447. "name" => "av_clipshack",
  448. "title" => $lang->av_clipshack_title,
  449. "description" => $lang->av_clipshack_descr,
  450. "optionscode" => "yesno",
  451. "value" => 1,
  452. "disporder" => 20,
  453. "gid" => intval($gid)
  454. );
  455. $db->insert_query("settings", $automedia_20);
  456. $automedia_21 = array(
  457. "name" => "av_mp3",
  458. "title" => $lang->av_mp3_title,
  459. "description" => $lang->av_mp3_descr,
  460. "optionscode" => "yesno",
  461. "value" => 1,
  462. "disporder" => 21,
  463. "gid" => intval($gid)
  464. );
  465. $db->insert_query("settings", $automedia_21);
  466. $automedia_22 = array(
  467. "name" => "av_flv",
  468. "title" => $lang->av_flv_title,
  469. "description" => $lang->av_flv_descr,
  470. "optionscode" => "yesno",
  471. "value" => 1,
  472. "disporder" => 22,
  473. "gid" => intval($gid)
  474. );
  475. $db->insert_query("settings", $automedia_22);
  476. $automedia_23 = array(
  477. "name" => "av_swf",
  478. "title" => $lang->av_swf_title,
  479. "description" => $lang->av_swf_descr,
  480. "optionscode" => "yesno",
  481. "value" => 1,
  482. "disporder" => 23,
  483. "gid" => intval($gid)
  484. );
  485. $db->insert_query("settings", $automedia_23);
  486. $automedia_24 = array(
  487. "name" => "av_divx",
  488. "title" => $lang->av_divx_title,
  489. "description" => $lang->av_divx_descr,
  490. "optionscode" => "yesno",
  491. "value" => 1,
  492. "disporder" => 24,
  493. "gid" => intval($gid)
  494. );
  495. $db->insert_query("settings", $automedia_24);
  496. $automedia_25 = array(
  497. "name" => "av_avi",
  498. "title" => $lang->av_avi_title,
  499. "description" => $lang->av_avi_descr,
  500. "optionscode" => "yesno",
  501. "value" => 1,
  502. "disporder" => 25,
  503. "gid" => intval($gid)
  504. );
  505. $db->insert_query("settings", $automedia_25);
  506. $automedia_26 = array(
  507. "name" => "av_mov",
  508. "title" => $lang->av_mov_title,
  509. "description" => $lang->av_mov_descr,
  510. "optionscode" => "yesno",
  511. "value" => 1,
  512. "disporder" => 26,
  513. "gid" => intval($gid)
  514. );
  515. $db->insert_query("settings", $automedia_26);
  516. $automedia_27 = array(
  517. "name" => "av_real",
  518. "title" => $lang->av_real_title,
  519. "description" => $lang->av_real_descr,
  520. "optionscode" => "yesno",
  521. "value" => 1,
  522. "disporder" => 27,
  523. "gid" => intval($gid)
  524. );
  525. $db->insert_query("settings", $automedia_27);
  526. $automedia_28 = array(
  527. "name" => "av_wmp",
  528. "title" => $lang->av_wmp_title,
  529. "description" => $lang->av_wmp_descr,
  530. "optionscode" => "yesno",
  531. "value" => 1,
  532. "disporder" => 28,
  533. "gid" => intval($gid)
  534. );
  535. $db->insert_query("settings", $automedia_28);
  536. $automedia_29 = array(
  537. "name" => "av_mp4",
  538. "title" => $lang->av_mp4_title,
  539. "description" => $lang->av_mp4_descr,
  540. "optionscode" => "yesno",
  541. "value" => 1,
  542. "disporder" => 29,
  543. "gid" => intval($gid)
  544. );
  545. $db->insert_query("settings", $automedia_29);
  546. $automedia_30 = array(
  547. "name" => "av_mpg",
  548. "title" => $lang->av_mpg_title,
  549. "description" => $lang->av_mpg_descr,
  550. "optionscode" => "yesno",
  551. "value" => 1,
  552. "disporder" => 30,
  553. "gid" => intval($gid)
  554. );
  555. $db->insert_query("settings", $automedia_30);
  556. $automedia_31 = array(
  557. "name" => "av_veoh",
  558. "title" => $lang->av_veoh_title,
  559. "description" => $lang->av_veoh_descr,
  560. "optionscode" => "yesno",
  561. "value" => 1,
  562. "disporder" => 31,
  563. "gid" => intval($gid)
  564. );
  565. $db->insert_query("settings", $automedia_31);
  566. $automedia_32 = array(
  567. "name" => "av_twitvid",
  568. "title" => $lang->av_twitvid_title,
  569. "description" => $lang->av_twitvid_descr,
  570. "optionscode" => "yesno",
  571. "value" => 1,
  572. "disporder" => 32,
  573. "gid" => intval($gid)
  574. );
  575. $db->insert_query("settings", $automedia_32);
  576. $automedia_33 = array(
  577. "name" => "av_brightcove",
  578. "title" => $lang->av_brightcove_title,
  579. "description" => $lang->av_brightcove_descr,
  580. "optionscode" => "yesno",
  581. "value" => 1,
  582. "disporder" => 33,
  583. "gid" => intval($gid)
  584. );
  585. $db->insert_query("settings", $automedia_33);
  586. $automedia_34 = array(
  587. "name" => "av_clipjunkie",
  588. "title" => $lang->av_clipjunkie_title,
  589. "description" => $lang->av_clipjunkie_descr,
  590. "optionscode" => "yesno",
  591. "value" => 1,
  592. "disporder" => 34,
  593. "gid" => intval($gid)
  594. );
  595. $db->insert_query("settings", $automedia_34);
  596. $automedia_35 = array(
  597. "name" => "av_tudou",
  598. "title" => $lang->av_tudou_title,
  599. "description" => $lang->av_tudou_descr,
  600. "optionscode" => "yesno",
  601. "value" => 1,
  602. "disporder" => 35,
  603. "gid" => intval($gid)
  604. );
  605. $db->insert_query("settings", $automedia_35);
  606. $automedia_36 = array(
  607. "name" => "av_collhumor",
  608. "title" => $lang->av_collhumor_title,
  609. "description" => $lang->av_collhumor_descr,
  610. "optionscode" => "yesno",
  611. "value" => 1,
  612. "disporder" => 36,
  613. "gid" => intval($gid)
  614. );
  615. $db->insert_query("settings", $automedia_36);
  616. $automedia_37 = array(
  617. "name" => "av_mtvmov",
  618. "title" => $lang->av_mtvmov_title,
  619. "description" => $lang->av_mtvmov_descr,
  620. "optionscode" => "yesno",
  621. "value" => 1,
  622. "disporder" => 37,
  623. "gid" => intval($gid)
  624. );
  625. $db->insert_query("settings", $automedia_37);
  626. $automedia_38 = array(
  627. "name" => "av_mtvmusic",
  628. "title" => $lang->av_mtvmusic_title,
  629. "description" => $lang->av_mtvmusic_descr,
  630. "optionscode" => "yesno",
  631. "value" => 1,
  632. "disporder" => 38,
  633. "gid" => intval($gid)
  634. );
  635. $db->insert_query("settings", $automedia_38);
  636. $automedia_39 = array(
  637. "name" => "av_bbciplay",
  638. "title" => $lang->av_bbciplay_title,
  639. "description" => $lang->av_bbciplay_descr,
  640. "optionscode" => "yesno",
  641. "value" => 1,
  642. "disporder" => 39,
  643. "gid" => intval($gid)
  644. );
  645. $db->insert_query("settings", $automedia_39);
  646. $automedia_40 = array(
  647. "name" => "av_lustich",
  648. "title" => $lang->av_lustich_title,
  649. "description" => $lang->av_lustich_descr,
  650. "optionscode" => "yesno",
  651. "value" => 1,
  652. "disporder" => 40,
  653. "gid" => intval($gid)
  654. );
  655. $db->insert_query("settings", $automedia_40);
  656. $automedia_41 = array(
  657. "name" => "av_hulu",
  658. "title" => $lang->av_hulu_title,
  659. "description" => $lang->av_hulu_descr,
  660. "optionscode" => "yesno",
  661. "value" => 1,
  662. "disporder" => 41,
  663. "gid" => intval($gid)
  664. );
  665. $db->insert_query("settings", $automedia_41);
  666. $automedia_42 = array(
  667. "name" => "av_viddler",
  668. "title" => $lang->av_viddler_title,
  669. "description" => $lang->av_viddler_descr,
  670. "optionscode" => "yesno",
  671. "value" => 1,
  672. "disporder" => 42,
  673. "gid" => intval($gid)
  674. );
  675. $db->insert_query("settings", $automedia_42);
  676. $automedia_43 = array(
  677. "name" => "av_blip",
  678. "title" => $lang->av_blip_title,
  679. "description" => $lang->av_blip_descr,
  680. "optionscode" => "yesno",
  681. "value" => 1,
  682. "disporder" => 43,
  683. "gid" => intval($gid)
  684. );
  685. $db->insert_query("settings", $automedia_43);
  686. $automedia_44 = array(
  687. "name" => "av_trtube",
  688. "title" => $lang->av_trtube_title,
  689. "description" => $lang->av_trtube_descr,
  690. "optionscode" => "yesno",
  691. "value" => 1,
  692. "disporder" => 44,
  693. "gid" => intval($gid)
  694. );
  695. $db->insert_query("settings", $automedia_44);
  696. $automedia_45 = array(
  697. "name" => "av_break",
  698. "title" => $lang->av_break_title,
  699. "description" => $lang->av_break_descr,
  700. "optionscode" => "yesno",
  701. "value" => 1,
  702. "disporder" => 45,
  703. "gid" => intval($gid)
  704. );
  705. $db->insert_query("settings", $automedia_45);
  706. $automedia_46 = array(
  707. "name" => "av_sapo",
  708. "title" => $lang->av_sapo_title,
  709. "description" => $lang->av_sapo_descr,
  710. "optionscode" => "yesno",
  711. "value" => 1,
  712. "disporder" => 46,
  713. "gid" => intval($gid)
  714. );
  715. $db->insert_query("settings", $automedia_46);
  716. $automedia_47 = array(
  717. "name" => "av_futebol",
  718. "title" => $lang->av_futebol_title,
  719. "description" => $lang->av_futebol_descr,
  720. "optionscode" => "yesno",
  721. "value" => 1,
  722. "disporder" => 47,
  723. "gid" => intval($gid)
  724. );
  725. $db->insert_query("settings", $automedia_47);
  726. $automedia_48 = array(
  727. "name" => "av_trilu",
  728. "title" => $lang->av_trilu_title,
  729. "description" => $lang->av_trilu_descr,
  730. "optionscode" => "yesno",
  731. "value" => 1,
  732. "disporder" => 48,
  733. "gid" => intval($gid)
  734. );
  735. $db->insert_query("settings", $automedia_48);
  736. $automedia_49 = array(
  737. "name" => "av_rutube",
  738. "title" => $lang->av_rutube_title,
  739. "description" => $lang->av_rutube_descr,
  740. "optionscode" => "yesno",
  741. "value" => 1,
  742. "disporder" => 49,
  743. "gid" => intval($gid)
  744. );
  745. $db->insert_query("settings", $automedia_49);
  746. $automedia_50 = array(
  747. "name" => "av_gametube",
  748. "title" => $lang->av_gametube_title,
  749. "description" => $lang->av_gametube_descr,
  750. "optionscode" => "yesno",
  751. "value" => 1,
  752. "disporder" => 50,
  753. "gid" => intval($gid)
  754. );
  755. $db->insert_query("settings", $automedia_50);
  756. $automedia_51 = array(
  757. "name" => "av_gametrail",
  758. "title" => $lang->av_gametrail_title,
  759. "description" => $lang->av_gametrail_descr,
  760. "optionscode" => "yesno",
  761. "value" => 1,
  762. "disporder" => 51,
  763. "gid" => intval($gid)
  764. );
  765. $db->insert_query("settings", $automedia_51);
  766. $automedia_52 = array(
  767. "name" => "av_gamespot",
  768. "title" => $lang->av_gamespot_title,
  769. "description" => $lang->av_gamespot_descr,
  770. "optionscode" => "yesno",
  771. "value" => 1,
  772. "disporder" => 52,
  773. "gid" => intval($gid)
  774. );
  775. $db->insert_query("settings", $automedia_52);
  776. $automedia_53 = array(
  777. "name" => "av_123vid",
  778. "title" => $lang->av_123vid_title,
  779. "description" => $lang->av_123vid_descr,
  780. "optionscode" => "yesno",
  781. "value" => 1,
  782. "disporder" => 53,
  783. "gid" => intval($gid)
  784. );
  785. $db->insert_query("settings", $automedia_53);
  786. $automedia_54 = array(
  787. "name" => "av_goear",
  788. "title" => $lang->av_goear_title,
  789. "description" => $lang->av_goear_descr,
  790. "optionscode" => "yesno",
  791. "value" => 1,
  792. "disporder" => 54,
  793. "gid" => intval($gid)
  794. );
  795. $db->insert_query("settings", $automedia_54);
  796. $automedia_55 = array(
  797. "name" => "av_bofunk",
  798. "title" => $lang->av_bofunk_title,
  799. "description" => $lang->av_bofunk_descr,
  800. "optionscode" => "yesno",
  801. "value" => 1,
  802. "disporder" => 55,
  803. "gid" => intval($gid)
  804. );
  805. $db->insert_query("settings", $automedia_55);
  806. $automedia_56 = array(
  807. "name" => "av_clipmoon",
  808. "title" => $lang->av_clipmoon_title,
  809. "description" => $lang->av_clipmoon_descr,
  810. "optionscode" => "yesno",
  811. "value" => 1,
  812. "disporder" => 56,
  813. "gid" => intval($gid)
  814. );
  815. $db->insert_query("settings", $automedia_56);
  816. $automedia_57 = array(
  817. "name" => "av_funnyordie",
  818. "title" => $lang->av_funnyordie_title,
  819. "description" => $lang->av_funnyordie_descr,
  820. "optionscode" => "yesno",
  821. "value" => 1,
  822. "disporder" => 57,
  823. "gid" => intval($gid)
  824. );
  825. $db->insert_query("settings", $automedia_57);
  826. $automedia_58 = array(
  827. "name" => "av_liveleak",
  828. "title" => $lang->av_liveleak_title,
  829. "description" => $lang->av_liveleak_descr,
  830. "optionscode" => "yesno",
  831. "value" => 1,
  832. "disporder" => 58,
  833. "gid" => intval($gid)
  834. );
  835. $db->insert_query("settings", $automedia_58);
  836. $automedia_59 = array(
  837. "name" => "av_videahu",
  838. "title" => $lang->av_videahu_title,
  839. "description" => $lang->av_videahu_descr,
  840. "optionscode" => "yesno",
  841. "value" => 1,
  842. "disporder" => 59,
  843. "gid" => intval($gid)
  844. );
  845. $db->insert_query("settings", $automedia_59);
  846. $automedia_60 = array(
  847. "name" => "av_imdb",
  848. "title" => $lang->av_imdb_title,
  849. "description" => $lang->av_imdb_descr,
  850. "optionscode" => "yesno",
  851. "value" => 1,
  852. "disporder" => 60,
  853. "gid" => intval($gid)
  854. );
  855. $db->insert_query("settings", $automedia_60);
  856. $automedia_61 = array(
  857. "name" => "av_movshare",
  858. "title" => $lang->av_movshare_title,
  859. "description" => $lang->av_movshare_descr,
  860. "optionscode" => "yesno",
  861. "value" => 1,
  862. "disporder" => 61,
  863. "gid" => intval($gid)
  864. );
  865. $db->insert_query("settings", $automedia_61);
  866. $automedia_63 = array(
  867. "name" => "av_ustream",
  868. "title" => $lang->av_ustream_title,
  869. "description" => $lang->av_ustream_descr,
  870. "optionscode" => "yesno",
  871. "value" => 1,
  872. "disporder" => 63,
  873. "gid" => intval($gid)
  874. );
  875. $db->insert_query("settings", $automedia_63);
  876. $automedia_64 = array(
  877. "name" => "av_blogtv",
  878. "title" => $lang->av_blogtv_title,
  879. "description" => $lang->av_blogtv_descr,
  880. "optionscode" => "yesno",
  881. "value" => 1,
  882. "disporder" => 64,
  883. "gid" => intval($gid)
  884. );
  885. $db->insert_query("settings", $automedia_64);
  886. //Add Profilesetting
  887. $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD COLUMN automedia_use VARCHAR(1) NOT NULL DEFAULT'Y'");
  888. // Refresh settings.php
  889. rebuild_settings();
  890. }
  891. //Uninstall the Plugin #########################################################################################
  892. function automedia_uninstall()
  893. {
  894. global $db;
  895. //Remove the extra column
  896. if($db->field_exists('automedia_use', 'users'))
  897. {
  898. $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP COLUMN automedia_use");
  899. }
  900. // DELETE ALL SETTINGS
  901. $query = $db->simple_select('settinggroups','gid','name="AutoMedia Sites"');
  902. $ams = $db->fetch_array($query);
  903. $db->delete_query('settinggroups',"gid='".$ams['gid']."'");
  904. $query2 = $db->simple_select('settinggroups','gid','name="AutoMedia Global"');
  905. $amg = $db->fetch_array($query2);
  906. $db->delete_query('settinggroups',"gid='".$amg['gid']."'");
  907. $query3 = $db->simple_select('settinggroups','gid','name="AutoMedia"');
  908. $am = $db->fetch_array($query3);
  909. $db->delete_query('settinggroups',"gid='".$am['gid']."'");
  910. // Delete Settings
  911. $db->delete_query('settings',"gid='".$ams['gid']."'");
  912. $db->delete_query('settings',"gid='".$amg['gid']."'");
  913. $db->delete_query('settings',"gid='".$am['gid']."'");
  914. // Refresh settings.php
  915. rebuild_settings();
  916. }
  917. //Activate the Plugin ##########################################################################################
  918. function automedia_activate()
  919. {
  920. global $db, $mybb, $lang;
  921. /**
  922. * Add / Edit Templates
  923. *
  924. **/
  925. require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
  926. find_replace_templatesets("usercp_nav_misc", "#".preg_quote('<tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">AutoMedia</a></td></tr></tbody>')."#s",'</tbody>', '',0);
  927. //delete template editings by a former beta version
  928. find_replace_templatesets('usercp_editsig', '#\n{\$amsigpreview}<br /><br />#', '', 0);
  929. $db->delete_query("templates", "title = 'usercp_automedia'");
  930. find_replace_templatesets("usercp_nav_misc", '#</tbody>#', '<tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">AutoMedia</a></td></tr></tbody>');
  931. $template = array(
  932. "title" => "usercp_automedia",
  933. "template" => $db->escape_string('<html>
  934. <head>
  935. <title>{$mybb->settings[bbname]} - Automedia in Posts</title>
  936. {$headerinclude}
  937. </head>
  938. <body>
  939. {$header}
  940. <form action="usercp.php" method="post">
  941. <table width="100%" border="0" align="center">
  942. <tr>
  943. {$usercpnav}
  944. <td valign="top">
  945. <table border="0" cellspacing="{$theme[borderwidth]}" cellpadding="{$theme[tablespace]}" class="tborder">
  946. <tr>
  947. <td class="thead" colspan="2"><strong>Automedia in Posts</strong></td>
  948. </tr>
  949. <tr>
  950. <td align="center" class="trow1" width="95%">
  951. <select name="automedia">
  952. <option>Yes</option>
  953. <option>No</option>
  954. </select></td>
  955. <td align="center" class="trow1" width="5%">
  956. <div style="float:left">{$ucpset}</div>
  957. </td>
  958. </tr>
  959. </table>
  960. <br />
  961. <div align="center">
  962. <input type="hidden" name="action" value="do_automedia" />
  963. <input type="submit" class="button" name="submit" value="OK" />
  964. </div>
  965. </td>
  966. </tr>
  967. </table>
  968. </form>
  969. {$footer}
  970. </body>
  971. </html>
  972. '),
  973. "sid" => -1
  974. );
  975. $db->insert_query("templates", $template);
  976. // Delete Settings for Justin.TV and Last.fm
  977. $query1 = $db->simple_select("settings", "*", "name='av_lastfm'");
  978. $result1 = $db->num_rows($query1);
  979. if($result1)
  980. {
  981. $db->delete_query('settings', "name='av_justin'");
  982. $db->delete_query('settings', "name='av_lastfm'");
  983. }
  984. // Update plugin from v.1.1.7 to v.1.1.10 add new settings if not exist
  985. $query2 = $db->simple_select("settings", "gid", "name='av_youtube'");
  986. $asgid = $db->fetch_array($query2);
  987. $gid4 = $asgid['gid'];
  988. $query = $db->simple_select("settings", "*", "name='av_soundcloud'");
  989. $result = $db->num_rows($query);
  990. if(!$result)
  991. {
  992. $automedia_65 = array(
  993. "name" => "av_soundcloud",
  994. "title" => $lang->av_soundcloud_title,
  995. "description" => $lang->av_soundcloud_descr,
  996. "optionscode" => "yesno",
  997. "value" => 1,
  998. "disporder" => 65,
  999. "gid" => intval($gid4)
  1000. );
  1001. $db->insert_query("settings", $automedia_65);
  1002. $automedia_66 = array(
  1003. "name" => "av_mefeedia",
  1004. "title" => $lang->av_mefeedia_title,
  1005. "description" => $lang->av_mefeedia_descr,
  1006. "optionscode" => "yesno",
  1007. "value" => 1,
  1008. "disporder" => 66,
  1009. "gid" => intval($gid4)
  1010. );
  1011. $db->insert_query("settings", $automedia_66);
  1012. $automedia_67 = array(
  1013. "name" => "av_wattv",
  1014. "title" => $lang->av_wattv_title,
  1015. "description" => $lang->av_wattv_descr,
  1016. "optionscode" => "yesno",
  1017. "value" => 1,
  1018. "disporder" => 67,
  1019. "gid" => intval($gid4)
  1020. );
  1021. $db->insert_query("settings", $automedia_67);
  1022. rebuild_settings();
  1023. }
  1024. }
  1025. //Deactivate the Plugin ########################################################################################
  1026. function automedia_deactivate()
  1027. {
  1028. global $db, $mybb;
  1029. /**
  1030. *
  1031. * Delete / Restore Templates
  1032. *
  1033. **/
  1034. require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
  1035. $db->delete_query("templates", "title = 'usercp_automedia'");
  1036. find_replace_templatesets("usercp_nav_misc", "#".preg_quote('<tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">AutoMedia</a></td></tr>')."#s",'', '',0);
  1037. }
  1038. // User CP #####################################################################################################
  1039. /**
  1040. *
  1041. * UserCP Enabled Status
  1042. *
  1043. **/
  1044. function ucp_automedia_status()
  1045. {
  1046. global $mybb, $db;
  1047. $auset = $db->escape_string($mybb->user['automedia_use']);
  1048. if ($auset == "Y")
  1049. {
  1050. $ucpstatus = " <b>Status:</b><br /> <img src=\"images/icons/thumbsup.gif\" />";
  1051. }
  1052. else
  1053. {
  1054. $ucpstatus = " <b>Status:</b><br /> <img src=\"images/icons/thumbsdown.gif\" />";
  1055. }
  1056. return $ucpstatus;
  1057. }
  1058. /**
  1059. *
  1060. * UserCP Settings
  1061. *
  1062. **/
  1063. function userautomedia()
  1064. {
  1065. global $header, $headerinclude, $usercpnav, $footer, $mybb, $theme, $db, $lang, $templates;
  1066. if ($mybb->input['action'] == "userautomedia")
  1067. {
  1068. add_breadcrumb($lang->nav_usercp, "usercp.php");
  1069. add_breadcrumb("AutoMedia");
  1070. $ucpset = @ucp_automedia_status();
  1071. eval("\$editprofile = \"".$templates->get("usercp_automedia")."\";");
  1072. output_page($editprofile);
  1073. }
  1074. elseif ($mybb->input['action'] == "do_automedia")
  1075. {
  1076. $uid = intval($mybb->user['uid']);
  1077. $updated_record = array(
  1078. "automedia_use" => $db->escape_string($mybb->input['automedia'])
  1079. );
  1080. if($db->update_query('users', $updated_record, "uid='".$uid."'"))
  1081. {
  1082. redirect("usercp.php?action=userautomedia","AutoMedia Settings updated!");
  1083. }
  1084. }
  1085. else {
  1086. return;
  1087. }
  1088. }
  1089. // Lookup ######################################################################################################
  1090. function get_avmatch($regex,$content)
  1091. {
  1092. preg_match($regex,$content,$matches);
  1093. return $matches[1];
  1094. }
  1095. //Let other youtube mycodes still do their work ##################################################################
  1096. function automedia_oldyt_run($message)
  1097. {
  1098. global $mybb;
  1099. $message = preg_replace("#\[youtube\]http://((?:de|www)\.)?youtube.com/watch\?v=([A-Za-z0-9\-\_]+)\[/youtube\]#i", '<div class=\'am_embed\'><object width=\'425\' height=\'350\'><param name=\'movie\' value=\'http://www.youtube.com/v/$2\' /><embed src=\'http://www.youtube.com/v/$2\' type=\'application/x-shockwave-flash\' width=\'425\' height=\'350\'></embed></object></div>', $message);
  1100. $message = preg_replace("#\[youtube\]([A-Za-z0-9\-\_]+)\[/youtube\]#i", '<div class=\'am_embed\'><object width=\'425\' height=\'350\'><param name=\'movie\' value=\'http://www.youtube.com/v/$1\' /><embed src=\'http://www.youtube.com/v/$1\' type=\'application/x-shockwave-flash\' width=\'425\' height=\'350\'></embed></object></div>', $message);
  1101. $message = preg_replace("#\[yt\]http://((?:de|www)\.)?youtube.com/watch\?v=([A-Za-z0-9\-\_]+)\[/yt\]#i", '<div class=\'am_embed\'><object width=\'425\' height=\'350\'><param name=\'movie\' value=\'http://www.youtube.com/v/$2\' /><embed src=\'http://www.youtube.com/v/$2\' type=\'application/x-shockwave-flash\' width=\'425\' height=\'350\'></embed></object></div>', $message);
  1102. $message = preg_replace("#\[yt\]([A-Za-z0-9\-\_]+)\[/yt\]#i", '<div class=\'am_embed\'><object width=\'425\' height=\'350\'><param name=\'movie\' value=\'http://www.youtube.com/v/$1\' /><embed src=\'http://www.youtube.com/v/$1\' type=\'application/x-shockwave-flash\' width=\'425\' height=\'350\'></embed></object></div>', $message);
  1103. // mp3 playlist mycode
  1104. $message = preg_replace("#\[ampl\](.*?)\[/ampl\]#i", "<div class=\"am_embed\"><object type=\"application/x-shockwave-flash\" data=\"{$mybb->settings['bburl']}/mediaplayer/emff_position_blue.swf\" width=\"100\" height=\"50\" /><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/emff_position_blue.swf\" /><param name=\"FlashVars\" value=\"src=$1\" /></object></div>", $message);
  1105. return $message;
  1106. }
  1107. // Embed the Media Files #######################################################################################
  1108. function automedia_run($message)
  1109. {
  1110. global $db, $mybb, $cache, $post, $pmid, $memprofile, $automedia;
  1111. //Add new mycode for disabling embedding
  1112. $message = preg_replace("#\[amoff\](http://)(.*?)\[/amoff\]#i", '<a name=\'amoff\' href=\'${1}${2}\' id =\'am\' target=\'_blank\'>${1}${2}</a>', $message);
  1113. /**
  1114. * Get the settings for the forums
  1115. */
  1116. $avfid = intval($post['fid']);
  1117. //Find the set fid's in Settings
  1118. $fids = explode(',', $mybb->settings['av_forums']);
  1119. if (in_array($avfid,$fids))
  1120. {
  1121. $efid = false;
  1122. }
  1123. else
  1124. {
  1125. $efid = true;
  1126. }
  1127. /**
  1128. *Get the settings for the usergroups
  1129. */
  1130. //Find the excluded Groups in Settings
  1131. $gid = intval($mybb->user['usergroup']);
  1132. $groups = explode(',', $mybb->settings['av_groups']);
  1133. if (in_array($gid,$groups))
  1134. {
  1135. $egid = true;
  1136. }
  1137. else {
  1138. $egid = false;
  1139. }
  1140. //Find the Users Groups
  1141. $ag = explode(',',$mybb->user['additionalgroups']);
  1142. foreach($ag as $a)
  1143. {
  1144. if (in_array($a,$groups))
  1145. {
  1146. $agid = true;
  1147. }
  1148. else
  1149. {
  1150. $agid = false;
  1151. }
  1152. }
  1153. /**
  1154. * Get the settings for flash width and height
  1155. */
  1156. $width = intval($mybb->settings['av_flashwidth']);
  1157. $height = intval($mybb->settings['av_flashheight']);
  1158. if($width >= 10 && $width <= 1200)
  1159. {
  1160. $width = $width;
  1161. }
  1162. else
  1163. {
  1164. $width = "480";
  1165. }
  1166. if($height >= 10 && $height <= 1000)
  1167. {
  1168. $height = $height;
  1169. }
  1170. else
  1171. {
  1172. $height = "360";
  1173. }
  1174. /**
  1175. * Apply the permissions
  1176. */
  1177. //AutoMedia not disabled in Settings?
  1178. if ($mybb->settings['av_enable'] != 0)
  1179. {
  1180. //Embedding not disabled by using mycode?
  1181. if (!preg_match('/<a name=\"amoff\" href=\"(.*)\" id=\"am\" target=\"_blank\">/isU',$message))
  1182. {
  1183. //AutoMedia allowed for Guests in Settings?
  1184. if ($mybb->settings['av_guest'] != 0 || ($mybb->user['uid'] != 0))
  1185. {
  1186. //Are certain forums set?
  1187. if (!$efid || $mybb->settings['av_forums'] == 0 || defined("IN_PORTAL"))
  1188. {
  1189. //Has the User AutoMedia enabled in User CP?
  1190. if($mybb->user['automedia_use'] != 'N')
  1191. {
  1192. //Groups not excluded in Settings? - Admins can't be excluded in Settings
  1193. if(!$egid && !$agid || $gid == 4)
  1194. {
  1195. /**
  1196. * Embed the files
  1197. */
  1198. // http://www.youtube.com/watch?v=K2oLoBpFmho or http://www.youtube.com/watch?v=cSB2TpeY-2E&feature=related
  1199. if($mybb->settings['av_youtube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?youtube.com/watch\?v=(.{11})">isU',$message))
  1200. {
  1201. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(www.)?youtube.com/watch\?(.*?)v=)(.{11})((\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/$6\" frameborder=\"0\" allowfullscreen></iframe></div>", $message);
  1202. }
  1203. if($mybb->settings['av_youtube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?youtube.com/watch\?(.*?)">isU',$message))
  1204. {
  1205. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(www.)?youtube.com/watch\?(.*?)v=)(.{11})((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"640\" height=\"390\"><param name=\"movie\" value=\"http://www.youtube.com/v/$6&amp;fs=1\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><embed src=\"http://www.youtube.com/v/$6&amp;fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"640\" height=\"390\"></embed></object></div>", $message);
  1206. }
  1207. if($mybb->settings['av_youtube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?youtu.be/(.*?)">isU',$message))
  1208. {
  1209. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(www.)?youtu.be/)(.{11}?)((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/$5$6\" frameborder=\"0\" allowfullscreen></iframe></div>", $message);
  1210. }
  1211. if($mybb->settings['av_youtube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?youtube.com/playlist(.*?)">isU',$message))
  1212. {
  1213. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(www.)?youtube.com/playlist\?(.*?)p=(PL)?)(\w{14,22})((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/p/$7\" frameborder=\"0\" allowfullscreen></iframe></div>", $message);
  1214. }
  1215. // http://www.dailymotion.com/video/xa8h5c_dbo-frusty-offizielles-video_music
  1216. if($mybb->settings['av_dailymotion'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?dailymotion.com/(.*?)">isU',$message))
  1217. {
  1218. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(www.)?dailymotion.com/(.*?)/?video/)(.{3,8}?)_((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'450\' height=\'350\' data=\'http://www.dailymotion.com/swf/${6}&amp;related=0\' type=\'application/x-shockwave-flash\' ><param name=\'movie\' value=\'http://www.dailymotion.com/swf/${6}&amp;related=0\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /></object></div>', $message);
  1219. }
  1220. // http://video.google.com/videoplay?docid=-5152959115771418702
  1221. if($mybb->settings['av_google'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?video.google.(com|co\.uk)/(.*?)">isU',$message))
  1222. {
  1223. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?video.google.(com|co\.uk)/videoplay\?docid=)(\W?)(\d{15,20})(\[/automedia\]|\" target=\"_blank\">(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'400\' height=\'326\' id=\'VideoPlayback\' type=\'application/x-shockwave-flash\' data=\'http://video.google.com/googleplayer.swf?docId=${4}${5}&amp;hl=en\'><param name=\'movie\' value=\'http://video.google.com/googleplayer.swf?docId=${4}${5}&amp;hl=en\' /></object></div>', $message);
  1224. }
  1225. // http://www.metacafe.com/watch/3202541/awkward_moment/
  1226. if($mybb->settings['av_metacafe'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?metacafe\.com/(.*?)\">isU',$message))
  1227. {
  1228. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?metacafe\.com/(?:watch|fplayer)/)(.{7}?)/(((.*?)(/?))(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'400\' height=\'345\' data=\'http://www.metacafe.com/fplayer/${3}/${6}.swf\' type=\'application/x-shockwave-flash\'><param name=\'movie\' value=\'http://www.metacafe.com/fplayer/${3}/${6}.swf\' /></object></div>', $message);
  1229. }
  1230. // http://www.myvideo.de/watch/6096698/Radioaktiv_Comedy_Street
  1231. if($mybb->settings['av_myvideo'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?myvideo\.de/(.*?)\">isU',$message))
  1232. {
  1233. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?myvideo\.de/watch/)(\d{2,9})((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:470px;height:406px;\' type=\'application/x-shockwave-flash\' data=\'http://www.myvideo.de/movie/${3}\'> <param name=\'movie\' value=\'http://www.myvideo.de/movie/${3}\' /> <param name=\'AllowFullscreen\' value=\'false\' /></object></div>', $message);
  1234. }
  1235. // http://www.vimeo.com/2464373
  1236. if($mybb->settings['av_vimeo'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?vimeo\.com/(.*?)\">isU',$message))
  1237. {
  1238. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?vimeo\.com/(\d{1,12})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'400\' height=\'250\' data=\'http://www.vimeo.com/moogaloop.swf?clip_id=${3}&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=\' type=\'application/x-shockwave-flash\'><param name=\'allowfullscreen\' value=\'true\' /><param name=\'allowscriptaccess\' value=\'always\' /><param name=\'movie\' value=\'http://www.vimeo.com/moogaloop.swf?clip_id=${3}&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1\' /></object></div>', $message);
  1239. }
  1240. // http://www.clipfish.de/video/3122529/millennium-force/
  1241. if($mybb->settings['av_clipfish'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?clipfish.de(.*)\">isU',$message))
  1242. {
  1243. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?clipfish\.de/video/)(.{7}?)((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'460\' height=\'375\' data=\'http://www.clipfish.de/videoplayer.swf?as=0&amp;vid=${3}&amp;r=1\' type=\'application/x-shockwave-flash\'><param name=\'movie\' value=\'http://www.clipfish.de/videoplayer.swf?as=0&amp;vid=${3}&amp;r=1\' /></object></div>', $message);
  1244. }
  1245. // http://www.veoh.com/browse/videos/category/comedy/watch/v18562639zWjqnSye
  1246. if($mybb->settings['av_veoh'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?veoh\.com(.*?)\">isU',$message))
  1247. {
  1248. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?veoh\.com/(?:[\w/]*?|videodetails2\.swf\?permalinkId=)(v\d[0-9a-z]*)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:460px;height:345px;\' type=\'application/x-shockwave-flash\' data=\'http://www.veoh.com/veohplayer.swf?permalinkId=${3}&amp;id=anonymous&amp;player=videodetailsembedded&amp;videoAutoPlay=0\'> <param name=\'movie\' value=\'http://www.veoh.com/veohplayer.swf?permalinkId=${3}&amp;id=anonymous&amp;player=videodetailsembedded&amp;videoAutoPlay=0\' /></object></div>', $message);
  1249. }
  1250. //http://s151.photobucket.com/albums/s152/kingsfordsa/?action=view&current=vows.flv
  1251. if($mybb->settings['av_photobucket'] != 0 && preg_match('<a href=\"(http://)([si](\w{1,5}))\.photobucket\.com/albums/((?:[\%\w-]{1,50}/){1,10})(?:\?[^\"]*?current=)?([\%\w-]{1,50}\.(?:pbr|flv))\">isU',$message))
  1252. {
  1253. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)([si](\w{1,5}))\.photobucket\.com/albums/((?:[\%\w-]{1,50}/){1,10})(?:\?[^\"]*?current=)?([\%\w-]{1,50}\.(?:pbr|flv))(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:448px;height:361px;\' type=\'application/x-shockwave-flash\' data=\'http://${3}.photobucket.com/player.swf?file=http://vid${4}.photobucket.com/albums/${5}${6}\'> <param name=\'movie\' value=\'http://${3}.photobucket.com/player.swf?file=http://vid${4}.photobucket.com/albums/${5}${6}\' /></object></div>', $message);
  1254. }
  1255. //http://www.divshare.com/download/7714880-d76
  1256. if($mybb->settings['av_divshare'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?divshare\.com/download/([^\"]*)\">isU',$message))
  1257. {
  1258. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?divshare\.com/download/(.{11}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><b>DivShare Link:</b> <a href=\'http://www.divshare.com/download/${3}\' target=\'_blank\'><b>http://www.divshare.com/download/$3</b></a><br /><br /><b>DivShare Video?</b><br /><object style=\'width:423px;height:319px;\' type=\'application/x-shockwave-flash\' data=\'http://www.divshare.com/flash/video2?myId=${3}\'> <param name=\'movie\' value=\'http://www.divshare.com/flash/video2?myId=${3}\' /> </object><br /><br /><b>DivShare Audio?</b><br /><object style=\'width:335px;height:28px;\' type=\'application/x-shockwave-flash\' data=\'http://www.divshare.com/flash/playlist?myId=${3}\'> <param name=\'movie\' value=\'http://www.divshare.com/flash/playlist?myId=${3}\' /></object></div>', $message);
  1259. }
  1260. //http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=62365647
  1261. if($mybb->settings['av_myspace'] != 0 && preg_match('<a href=\"(http://)(?:vids\.myspace|myspacetv)\.com/index\.cfm\?[^\"]*?VideoID=(\d{1,10})\">isU',$message))
  1262. {
  1263. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:vids\.myspace|myspacetv)\.com/index\.cfm\?[^\"]*?VideoID=(\d{1,10})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:425px;height:360px;\' type=\'application/x-shockwave-flash\' data=\'http://mediaservices.myspace.com/services/media/embed.aspx/m=${3}\'> <param name=\'movie\' value=\'http://mediaservices.myspace.com/services/media/embed.aspx/m=${3}\' /></object></div>', $message);
  1264. }
  1265. //http://www.megavideo.com/?v=CZRADM47
  1266. if($mybb->settings['av_megavideo'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?megavideo\.com/(?:\?[^\"]*?v=|v/)([0-9a-z]{8})\">isU',$message))
  1267. {
  1268. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?megavideo\.com/(?:\?[^\"]*?v=|v/)([0-9a-z]{8})(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:455px;height:370px;\' type=\'application/x-shockwave-flash\' data=\'http://www.megavideo.com/v/${3}.0.0\'> <param name=\'movie\' value=\'http://www.megavideo.com/v/${3}.0.0\' /></object></div>', $message);
  1269. }
  1270. //http://video.yahoo.com/watch/1350163/4656457
  1271. if($mybb->settings['av_yahoo'] != 0 && preg_match('<a href=\"(http://)(?:(?:www|[a-z]{2})\.)?video\.yahoo\.com/watch/(\d*)/(\d+)(?:#thumb=(http[\w\./%\:]+\.jpg))?\">isU',$message))
  1272. {
  1273. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:(?:www|[a-z]{2})\.)?video\.yahoo\.com/watch/(\d*)/(\d+)(?:\#thumb=(http[\w\./%\:]+\.jpg))?(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:512px;height:322px;\' type=\'application/x-shockwave-flash\' data=\'http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40&amp;id=${4}&amp;vid=${3}&amp;lang=en-us&amp;intl=us&amp;embed=1&amp;thumbUrl=${5}\'> <param name=\'movie\' value=\'http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40&amp;id=${4}&amp;vid=${3}&amp;lang=en-us&amp;intl=us&amp;embed=1&amp;thumbUrl=${5}\' /></object></div>', $message);
  1274. }
  1275. //http://videos.streetfire.net/video/1500-HP-Camaro-Street-NRE_703469.htm
  1276. if($mybb->settings['av_streetfire'] != 0 && preg_match('<a href=\"(http://)(?:www\.|videos\.)?streetfire\.net/video/(.*?)\">isU',$message))
  1277. {
  1278. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.|videos\.)?streetfire\.net/video/(.*?)(.{6}?)\.htm(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:430px;height:355px;\' type=\'application/x-shockwave-flash\' data=\'http://videos.streetfire.net/vidiac.swf?video=${4}\'> <param name=\'movie\' value=\'http://videos.streetfire.net/vidiac.swf?video=${4}\' /></object></div>', $message);
  1279. }
  1280. //http://de.sevenload.com/videos/ZWyfb8l-Kill-Bill-Teil-1-2-in-einer-Minute
  1281. if($mybb->settings['av_sevenload'] != 0 && preg_match('<a href=\"(http://)((?:en|tr|de|www)\.)?sevenload.com/(.*?)\">isU',$message))
  1282. {
  1283. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)((?:en|tr|de|www)\.)?sevenload.com/(?:videos|videolar))/(.{7}?)((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:500px;height:314px;\' type=\'application/x-shockwave-flash\' data=\'http://${3}sevenload.com/pl/${4}/500x314/swf\'><param name=\'allowFullscreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /> <param name=\'movie\' value=\'http://${3}sevenload.com/pl/${4}/500x314/swf\' /></object></div>', $message);
  1284. }
  1285. //http://www.facebook.com/video/video.php?v=1114479015472&_fb_noscript=1
  1286. if($mybb->settings['av_facebook'] != 0 && preg_match('<a href=\"(http://)?(www.)?facebook\.com/video/(.*?)\">isU',$message))
  1287. {
  1288. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?facebook\.com/video/video\.php\?v=([0-9a-z]{7,15})(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object style=\'width:480px;height:360px;\' type=\'application/x-shockwave-flash\' data=\'http://www.facebook.com/v/${4}\'><param name=\'allowFullscreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /> <param name=\'movie\' value=\'http://www.facebook.com/v/${4}\' /></object></div>', $message);
  1289. }
  1290. //http://www.guba.com/watch/3000015922/George-Washington?duration_step=0&fields=23&filter_tiny=0&mst=63&pp=40&sb=5&set=-1&sf=0&size_step=0&o=0&sample=1251469427:ffa2ca28f244f50a7456a06f7f1bb0c2ffcb6026
  1291. if($mybb->settings['av_guba'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?guba\.com/watch/(.*?)\">isU',$message))
  1292. {
  1293. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?guba\.com/watch/([0-9]{10})(.*)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object type=\'application/x-shockwave-flash\' data=\'http://www.guba.com/f/root.swf?video_url=http://free.guba.com/uploaditem/${3}/flash.flv&amp;isEmbeddedPlayer=true\' width=\'520\' height=\'360\'><param name=\'movie\' value=\'http://www.guba.com/f/root.swf?video_url=http://free.guba.com/uploaditem/${3}/flash.flv&amp;isEmbeddedPlayer=true\' /></object></div>', $message);
  1294. }
  1295. //http://www.clipshack.com/Clip.aspx?key=78303BB426C9EF24
  1296. if($mybb->settings['av_clipshack'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?clipshack\.com/Clip\.aspx\?key=(.*?)\">isU',$message))
  1297. {
  1298. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?clipshack\.com/Clip\.aspx\?key=([0-9a-f]{16})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object type=\'application/x-shockwave-flash\' data=\'http://www.clipshack.com/player.swf?key=${3}\' width=\'430\' height=\'370\'><param name=\'movie\' value=\'http://www.clipshack.com/player.swf?key=${3}\' /></object></div>', $message);
  1299. }
  1300. //http://www.birding.dk/galleri/stemmermp3/Luscinia%20megarhynchos%201.mp3
  1301. if($mybb->settings['av_mp3'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.mp3\">isU',$message))
  1302. {
  1303. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.mp3)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object type=\"application/x-shockwave-flash\" data=\"{$mybb->settings['bburl']}/mediaplayer/emff_position_blue.swf\" width=\"100\" height=\"50\" /><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/emff_position_blue.swf\" /><param name=\"FlashVars\" value=\"src=$2$3$4.$5/$6\" /></object></div>", $message);
  1304. }
  1305. //www.gugelproductions.de/blog/wp-content/fltest.flv
  1306. if($mybb->settings['av_flv'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.flv\">isU',$message))
  1307. {
  1308. if(THIS_SCRIPT=="private.php")
  1309. {
  1310. $priv = intval($pmid);
  1311. $query = $db->simple_select("privatemessages", "fromid", "pmid='$priv'");
  1312. $privuid = $db->fetch_array($query);
  1313. $puid = intval($privuid['fromid']);
  1314. }
  1315. else if(THIS_SCRIPT=="usercp.php")
  1316. {
  1317. $puid = intval($mybb->user['uid']);
  1318. }
  1319. else if(THIS_SCRIPT=="member.php")
  1320. {
  1321. $puid = intval($memprofile['uid']);
  1322. }
  1323. else
  1324. {
  1325. $puid = intval($post['uid']);
  1326. }
  1327. //Get the posters usergroup
  1328. $query = $db->simple_select("users", "usergroup", "uid='$puid'");
  1329. $postgid = $db->fetch_array($query);
  1330. $pgid = intval($postgid['usergroup']);
  1331. switch($mybb->settings['av_flashadmin'])
  1332. {
  1333. case "admin":
  1334. if($pgid == 4) {
  1335. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.flv)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"flowplayer\" width=\"$width\" height=\"$height\" data=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"flashvars\" value='config={\"clip\":{\"url\":\"$2$3$4/$5\",\"autoPlay\":false}}' /></object></div>", $message);
  1336. }
  1337. break;
  1338. case "mods":
  1339. if($pgid == 3 || $pgid == 4 || $pgid == 6) {
  1340. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.flv)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"flowplayer\" width=\"$width\" height=\"$height\" data=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"flashvars\" value='config={\"clip\":{\"url\":\"$2$3$4/$5\",\"autoPlay\":false}}' /></object></div>", $message);
  1341. }
  1342. break;
  1343. case "all":
  1344. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.flv)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"flowplayer\" width=\"$width\" height=\"$height\" data=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"flashvars\" value='config={\"clip\":{\"url\":\"$2$3$4/$5\",\"autoPlay\":false}}' /></object></div>", $message);
  1345. break;
  1346. }
  1347. }
  1348. //http://www.arcadecabin.com/games/crazy-taxi.swf
  1349. if($mybb->settings['av_swf'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.swf\">isU',$message))
  1350. {
  1351. if(THIS_SCRIPT=="private.php")
  1352. {
  1353. $priv = intval($pmid);
  1354. $query = $db->simple_select("privatemessages", "fromid", "pmid='$priv'");
  1355. $privuid = $db->fetch_array($query);
  1356. $puid = intval($privuid['fromid']);
  1357. }
  1358. else if(THIS_SCRIPT=="usercp.php")
  1359. {
  1360. $puid = intval($mybb->user['uid']);
  1361. }
  1362. else if(THIS_SCRIPT=="member.php")
  1363. {
  1364. $puid = intval($memprofile['uid']);
  1365. }
  1366. else
  1367. {
  1368. $puid = intval($post['uid']);
  1369. }
  1370. //Get the posters usergroup
  1371. $query = $db->simple_select("users", "usergroup", "uid='$puid'");
  1372. $postgid = $db->fetch_array($query);
  1373. $pgid = intval($postgid['usergroup']);
  1374. switch($mybb->settings['av_flashadmin'])
  1375. {
  1376. case "admin":
  1377. if($pgid == 4) {
  1378. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.swf)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"$2$3$4/$5\" /><param name=\"menu\" value=\"true\" /><param name=\"autostart\" value=\"0\" /><embed src=\"$2$3$4/$5\" width=\"$width\" height=\"$height\" type=\"application/x-shockwave-flash\" menu=\"false\" autostart=\"false\"></embed></object></div>", $message);
  1379. }
  1380. break;
  1381. case "mods":
  1382. if($pgid == 3 || $pgid == 4 || $pgid == 6) {
  1383. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.swf)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"$2$3$4/$5\" /><param name=\"menu\" value=\"true\" /><param name=\"autostart\" value=\"0\" /><embed src=\"$2$3$4/$5\" width=\"$width\" height=\"$height\" type=\"application/x-shockwave-flash\" menu=\"false\" autostart=\"false\"></embed></object></div>", $message);
  1384. }
  1385. break;
  1386. case "all":
  1387. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.swf)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"$2$3$4/$5\" /><param name=\"menu\" value=\"true\" /><param name=\"autostart\" value=\"0\" /><embed src=\"$2$3$4/$5\" width=\"$width\" height=\"$height\" type=\"application/x-shockwave-flash\" menu=\"false\" autostart=\"false\"></embed></object></div>", $message);
  1388. break;
  1389. }
  1390. }
  1391. //http://showcase7.divx.com/qvga_TerminatorSalvationTrailer.divx
  1392. if($mybb->settings['av_divx'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.divx\">isU',$message))
  1393. {
  1394. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.divx)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object id=\'ImageWindow\' classid=\'clsid:D050D736-2D21-4723-AD58-5B541FFB6C11\' width=\'500\' height=\'360\'> <param name=\'src\' value=\'${2}${3}${4}.${5}/${6}\' /><param name=\'autostart\' value=\'0\' /><embed src=\'${2}${3}${4}.${5}/${6}\' type=\'video/divx\'width=\'500\' height=\'360\' autostart=\'false\'></embed></object></div>', $message);
  1395. }
  1396. //http://www.hydro-kosmos.de/video/vfrogy.avi
  1397. if($mybb->settings['av_avi'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.avi\">isU',$message))
  1398. {
  1399. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.avi)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object id=\'ImageWindow\' classid=\'clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\' codebase=\'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\' width=\'500\' height=\'360\'><param name=\'src\' value=\'${2}${3}${4}.${5}/${6}\' /><param name=\'AutoStart\' value=\'true\' /><param name=\'ShowTracker\' value=\'true\'><param name=\'ShowControls\' value=\'true\'><param name=\'ShowGotoBar\' value=\'false\'><param name=\'ShowDisplay\' value=\'false\'><param name=\'ShowStatusBar\' value=\'false\'><param name=\'AutoSize\' value=\'false\'><embed name=\'MediaPlayer\' src=\'${2}${3}${4}.${5}/${6}\' type=\'video/avi\' width=\'500\' height=\'360\' autostart=\'true\'></embed></object></div>', $message);
  1400. }
  1401. //http://movies.apple.com/movies/disney/oceans/oceans-tsr1_h.320.mov
  1402. if($mybb->settings['av_mov'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.mov\">isU',$message))
  1403. {
  1404. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.mov)(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object classid=\'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\' codebase=\'http://www.apple.com/qtactivex/qtplugin.cab\' width=\'500\' height=\'360\'> <param name=\'src\' value=\'${2}${3}${4}/${5}${6}\' /><embed src=\'${2}${3}${4}/${5}${6}\' type=\'video/quicktime\' width=\'500\' height=\'360\' pluginspage=\'http://www.apple.com/quicktime/download/\' /></object></div>', $message);
  1405. }
  1406. //http://spacem.at/movie/audio/podcast-2006-08-03-68914.m4v
  1407. if($mybb->settings['av_mov'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.m4v(.*?)\">isU',$message))
  1408. {
  1409. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)/([\w/ &;%\.-]+\.m4v)(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"flowplayer\" width=\"$width\" height=\"$height\" data=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"flashvars\" value='config={\"clip\":{\"url\":\"$2$3$4/$5\",\"autoPlay\":false}}' /></object></div>", $message);
  1410. }
  1411. //http://darfhurl.euro.real.com/darf/?prod=rn_video&amp;filename=p6/RealOne-Europe-20090826-152142-rn_gratis_recording-LeSalondecoiffure-p6EP.rm
  1412. if($mybb->settings['av_real'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.ra?m\">isU',$message))
  1413. {
  1414. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.ra?m)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object id=\'RVOCX\' classid=\'clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\' width=\'500\' height=\'360\'><param name=\'src\' value=\'${2}${3}${4}.${5}/${6}\' /><param name=\'controller\' value=\'true\' /><param name=\'autoplay\' value=\'true\' /><param name="autostart" value="1" /><param name=\'controls\' value=\'ImageWindow\' /><param name=\'console\' value=\'video\' /><embed src=\'${2}${3}${4}.${5}/${6}\' type=\'audio/x-pn-realaudio-plugin\' controls=\'ImageWindow,ControlPanel,StatusBar\' console=\'video\' width=\'500\' height=\'360\' autostart=\'true\'></embed></object></div>', $message);
  1415. }
  1416. //http://www.amd.com/us-en/assets/content_type/DownloadableAssets/T64X2_animation.wmv or http://www.sound-emotion.com/sound-emotioncom/wmamusic/baroqueloop90z.wma
  1417. if($mybb->settings['av_wmp'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.wm[va]\">isU',$message))
  1418. {
  1419. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.wm[va])(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object id=\'ImageWindow\' classid=\'clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\' width=\'500\' height=\'360\'><param name=\'src\' value=\'${2}${3}${4}.${5}/${6}\' /><param name=\'autostart\' value=\'0\' /><embed name=\'MediaPlayer\' src=\'${2}${3}${4}.${5}/${6}\' type=\'video/x-ms-wmv\' width=\'500\' height=\'360\' autostart=\'false\'></embed></object></div>', $message);
  1420. }
  1421. //http://medien.wdr.de/m/1251018000/maus/wdr_fernsehen_die_maus_20090823.mp4
  1422. if($mybb->settings['av_mp4'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.mp4\">isU',$message))
  1423. {
  1424. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.mp4)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"flowplayer\" width=\"$width\" height=\"$height\" data=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" type=\"application/x-shockwave-flash\"><param name=\"movie\" value=\"{$mybb->settings['bburl']}/mediaplayer/flowplayer-3.2.7.swf\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"flashvars\" value='config={\"clip\":{\"url\":\"$2$3$4.$5/$6\",\"autoPlay\":false}}' /></object></div>", $message);
  1425. }
  1426. //http://www.indymedia.ie/attachments/apr2004/downhillmass.mpg
  1427. if($mybb->settings['av_mpg'] != 0 && preg_match('<a href=\"(http://)?(www.)?(.*)\.mpe?g\">isU',$message))
  1428. {
  1429. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?(.*)\.(.*)/([\w/ &;%\.-]+\.mpe?g)(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object id=\'ImageWindow\' classid=\'clsid:CLSID:05589FA1-C356-11CE-BF01-00AA0055595A\' width=\'500\' height=\'360\'><param name=\'src\' value=\'${2}${3}${4}.${5}/${6}\' /><param name=\'autostart\' value=\'0\' /><embed src=\'${2}${3}${4}.${5}/${6}\' type=\'video/mpeg\' width=\'500\' height=\'360\' autostart=\'false\'></embed></object></div>', $message);
  1430. }
  1431. //http://www.twitvid.com/BBF3D
  1432. if($mybb->settings['av_twitvid'] != 0 && preg_match('<a href=\"(http://)?(www.)?twitvid\.com/(.*)\">isU',$message))
  1433. {
  1434. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(www.)?twitvid\.com/)(.{5}?)((.*?)\" target=\"_blank\">)?((.*?)\[/automedia\]|(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'425\' height=\'344\'><param name=\'movie\' value=\'http://www.twitvid.com/player/${4}\' /><param name=\'allowscriptaccess\' value=\'always\' /><param name=\'allowFullScreen\' value=\'true\' /><embed type=\'application/x-shockwave-flash\' src=\'http://www.twitvid.com/player/${4}\' quality=\'high\' allowscriptaccess=\'always\' allowNetworking=\'all\' allowfullscreen=\'true\' wmode=\'transparent\' height=\'344\' width=\'425\'></embed></object></div>', $message);
  1435. }
  1436. //http://link.brightcove.com/services/player/bcpid1119352258?bctid=35782829001
  1437. if($mybb->settings['av_brightcove'] != 0 && preg_match('<a href=\"(http://)?(link.)?brightcove\.com/(.*)\">isU',$message))
  1438. {
  1439. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(link.)?brightcove\.com/services/(?:link|player)/bcpid(\d+)[^\">]*?bctid=?(\d+)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><embed src=\'http://c.brightcove.com/services/viewer/federated_f8/${4}\' bgcolor=\'#FFFFFF\' flashVars=\'videoId=${5}&amp;playerId=${4}&amp;viewerSecureGatewayURL=https://console.brightcove.com/services/amfgateway&amp;servicesURL=http://services.brightcove.com/services&amp;cdnURL=http://admin.brightcove.com&amp;domain=embed&amp;autoStart=false&amp;\' base=\'http://admin.brightcove.com\' name=\'flashObj\' width=\'440\' height=\'373\' seamlesstabbing=\'false\' type=\'application/x-shockwave-flash\' swLiveConnect=\'true\' pluginspage=\'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\'></embed></div>', $message);
  1440. }
  1441. //http://www.clipjunkie.com/Meerkat-Tribal-Council-vid5797.html
  1442. if($mybb->settings['av_clipjunkie'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?clipjunkie\.com/(.*)\">isU',$message))
  1443. {
  1444. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?clipjunkie\.com/(.*?)-vid([0-9]{4})\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'450\' height=\'350\' data=\'http://www.clipjunkie.com/flvplayer/flvplayer.swf?flv=http://videos.clipjunkie.com/videos/${3}-vid${4}.flv&amp;themes=http://www.clipjunkie.com/flvplayer/themes.xml&amp;playList=http://www.clipjunkie.com/playlist.php&amp;config=http://www.clipjunkie.com/skin/config.xml\' type=\'application/x-shockwave-flash\' ><param name=\'movie\' value=\'http://www.clipjunkie.com/flvplayer/flvplayer.swf?flv=http://videos.clipjunkie.com/videos/${3}-vid${4}.flv&amp;themes=http://www.clipjunkie.com/flvplayer/themes.xml&amp;playList=http://www.clipjunkie.com/playlist.php&amp;config=http://www.clipjunkie.com/skin/config.xml\' /></object></div>', $message);
  1445. }
  1446. //http://www.tudou.com/programs/view/Cp9PT_6LGKg/
  1447. if($mybb->settings['av_tudou'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?tudou\.com/(.*)\">isU',$message))
  1448. {
  1449. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?tudou\.com/(?:programs/view/|v/)(.{1,12}?)(/?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'420\' height=\'320\'><param name=\'movie\' value=\'http://www.tudou.com/v/${3}\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'allowscriptaccess\' value=\'always\' /><param name=\'wmode\' value=\'opaque\' /><embed src=\'http://www.tudou.com/v/${3}\' type=\'application/x-shockwave-flash\' allowscriptaccess=\'always\' allowfullscreen=\'true\' wmode=\'opaque\' width=\'420\' height=\'320\'></embed></object></div>', $message);
  1450. }
  1451. //http://www.collegehumor.com/video:1919170
  1452. if($mybb->settings['av_collhumor'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?collegehumor\.com/video(.*)\">isU',$message))
  1453. {
  1454. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?collegehumor\.com/video:(\d{1,12})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'420\' height=\'320\'><param name=\'movie\' value=\'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=${3}\' /><embed src=\'http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=${3}\' type=\'application/x-shockwave-flash\' width=\'420\' height=\'320\'></embed></object></div>', $message);
  1455. }
  1456. //http://www.mtv.com/videos/?vid=430678
  1457. if($mybb->settings['av_mtvmov'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?mtv\.com/videos/\?vid=(.*)\">isU',$message))
  1458. {
  1459. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?mtv\.com/videos/\?vid=(\d{1,12})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><embed src=\'http://media.mtvnservices.com/mgid:uma:video:mtv.com:${3}\' type=\'application/x-shockwave-flash\' flashVars=\'configParams=vid%3D${3}%26uri%3Dmgid%3Auma%3Avideo%3Amtv.com%3A${3}\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'512\' height=\'319\' base=\'.\'></embed></div>', $message);
  1460. }
  1461. //http://www.mtv.com/videos/movie-trailers/491764/the-twilight-saga-eclipse.jhtml#movieId=1617225
  1462. if($mybb->settings['av_mtvmov'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?mtv\.com/videos/movie-trailers/(.*)\">isU',$message))
  1463. {
  1464. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?mtv\.com/videos/movie-trailers/(\d{1,12})/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><embed src=\'http://media.mtvnservices.com/mgid:uma:video:mtv.com:${3}\' type=\'application/x-shockwave-flash\' flashVars=\'configParams=vid%3D${3}%26uri%3Dmgid%3Auma%3Avideo%3Amtv.com%3A${3}\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'512\' height=\'319\' base=\'.\'></embed></div>', $message);
  1465. }
  1466. //http://www.mtvmusic.com/artist/swift__taylor%20t_pain/videos/401599/thug-story
  1467. if($mybb->settings['av_mtvmusic'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?mtvmusic\.com/(.*?)/videos/(.*)\">isU',$message))
  1468. {
  1469. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?mtvmusic\.com/(.*?)videos/(\d{1,9})/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"http://media.mtvnservices.com/mgid:uma:video:mtvmusic.com:$4\" width=\"512\" height=\"319\" type=\"application/x-shockwave-flash\" flashVars=\"dist=http://www.mtvmusic.com\" allowFullScreen=\"true\" AllowScriptAccess=\"always\"></embed></div>", $message);
  1470. }
  1471. //http://www.bbc.co.uk/iplayer/episode/b00m9z9q/1Xtras_Mixtape_with_MistaJam_30_08_2009/
  1472. if($mybb->settings['av_bbciplay'] != 0 && preg_match('<a href=\"(http://)?(?:www\.)?bbc\.co\.uk/iplayer/(?:page/item|episode)/(.*)\">isU',$message))
  1473. {
  1474. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?bbc\.co\.uk/iplayer/(?:page/item|episode)/([a-z0-9]{8})/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'640\' height=\'385\'><param name=\'movie\' value=\'http://www.bbc.co.uk/emp/player.swf?playlist=http://www.bbc.co.uk/iplayer/playlist/${3}&amp;config=http://www.bbc.co.uk/emp/iplayer/config.xml&amp;domId=emp1\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'allowscriptaccess\' value=\'always\' /><embed src=\'http://www.bbc.co.uk/emp/player.swf?playlist=http://www.bbc.co.uk/iplayer/playlist/${3}&amp;config=http://www.bbc.co.uk/emp/iplayer/config.xml&amp;domId=emp1\' type=\'application/x-shockwave-flash\' flashVars=\'configParams=id%3D${3}%26vid%3D${4}%26uri%3Dmgid:uma:video:mtv.com:${4}%26startUri={startUri}\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'640\' height=\'385\'></embed></object></div>', $message);
  1475. }
  1476. //http://lustich.de/videos/sportler/fan-verhindert-tor/
  1477. if($mybb->settings['av_lustich'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?lustich\.de/videos/(.*)\">isU',$message))
  1478. {
  1479. $pattern = "<http://lustich.de/videos/(.*)\" target>";
  1480. preg_match_all($pattern, $message, $links);
  1481. $link = $links[1];
  1482. foreach ($link as $url)
  1483. {
  1484. $site = htmlspecialchars_uni("http://lustich.de/videos/$url");
  1485. //Use cURL and find the video id
  1486. if (!function_exists('curl_init') || !$c = curl_init())
  1487. return false;
  1488. curl_setopt($c, CURLOPT_URL, $site);
  1489. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1490. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1491. $data = utf8_encode(curl_exec($c));
  1492. if (!$data)
  1493. $data = 'not available';
  1494. curl_close($c);
  1495. if($data) {
  1496. $nr = get_avmatch('/<param name=\"movie\" value=\"http:\/\/lustich\.de\/player\/pi\.swf\?id=(.*)\"><\/param>/isU',$data);
  1497. $vid = array($nr);
  1498. }
  1499. $limit = 1;
  1500. foreach ($vid as $id)
  1501. {
  1502. $n = htmlspecialchars_uni($id);
  1503. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?lustich\.de/videos/(.*?)/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"420\" height=\"350\"><param name=\"movie\" value=\"http://lustich.de/player/pe.swf?id=$n\" /><param name=\"wmode\" value=\"transparent\" /><embed wmode=\"transparent\" src=\"http://lustich.de/player/pe.swf?id=$n\" type=\"application/x-shockwave-flash\" width=\"420\" height=\"350\"></embed></object></div>", $message, $limit);
  1504. }
  1505. }
  1506. }
  1507. //http://www.hulu.com/watch/91202/divorcing-jack
  1508. if($mybb->settings['av_hulu'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?hulu\.com/watch/(.*)\">isU',$message))
  1509. {
  1510. $pattern = "<http://www.hulu.com/watch/(.*)\" target>";
  1511. preg_match_all($pattern, $message, $links);
  1512. $link = $links[1];
  1513. foreach ($link as $url)
  1514. {
  1515. $site = htmlspecialchars_uni("http://www.hulu.com/watch/$url");
  1516. //Use cURL and find the video id
  1517. if (!function_exists('curl_init') || !$c = curl_init())
  1518. return false;
  1519. curl_setopt($c, CURLOPT_URL, $site);
  1520. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1521. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1522. $data = utf8_encode(curl_exec($c));
  1523. if (!$data)
  1524. $data = 'not available';
  1525. curl_close($c);
  1526. if($data) {
  1527. $nrh = get_avmatch('/<param name=\"movie\" value=\"http:\/\/www\.hulu\.com\/embed\/(.*)\"><\/param>/isU',$data);
  1528. $vid = array($nrh);
  1529. }
  1530. $limit = 1;
  1531. foreach ($vid as $id)
  1532. {
  1533. $n = htmlspecialchars_uni($id);
  1534. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?hulu\.com/watch/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"500\" height=\"350\"><param name=\"movie\" value=\"http://hulu.com/embed/$n\" /><param name=\"allowFullScreen\" value=\"true\" /><embed wmode=\"transparent\" src=\"http://hulu.com/embed/$n\" type=\"application/x-shockwave-flash\" width=\"500\" height=\"350\"></embed></object></div>", $message, $limit);
  1535. }
  1536. }
  1537. }
  1538. //http://www.traileraddict.com/trailer/inglorious-basterds/interview-quentin-tarantino-ii
  1539. if($mybb->settings['av_trail'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?traileraddict\.com/trailer/(.*)\">isU',$message))
  1540. {
  1541. $pattern = "<http://www.traileraddict.com/trailer/(.*)\" target>";
  1542. preg_match_all($pattern, $message, $links);
  1543. $link = $links[1];
  1544. foreach ($link as $url)
  1545. {
  1546. $site = htmlspecialchars_uni("http://www.traileraddict.com/trailer/$url");
  1547. //Use cURL and find the video id
  1548. if (!function_exists('curl_init') || !$c = curl_init())
  1549. return false;
  1550. curl_setopt($c, CURLOPT_URL, $site);
  1551. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1552. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1553. $data = utf8_encode(curl_exec($c));
  1554. if (!$data)
  1555. $data = 'not available';
  1556. curl_close($c);
  1557. if($data) {
  1558. $nrt = get_avmatch('/<param name=\"movie\" value=\"http:\/\/www\.traileraddict\.com\/emb\/(.*)\"><\/param>/isU',$data);
  1559. $vid = array($nrt);
  1560. }
  1561. $limit = 1;
  1562. foreach ($vid as $id)
  1563. {
  1564. $n = htmlspecialchars_uni($id);
  1565. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?traileraddict\.com/trailer/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"650\" height=\"388\"><param name=\"movie\" value=\"http://www.traileraddict.com/emd/$n\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"http://www.traileraddict.com/emd/$n\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" wmode=\"transparent\" width=\"650\" height=\"388\" allowFullScreen=\"true\"></embed></object></div>", $message, $limit);
  1566. }
  1567. }
  1568. }
  1569. //http://trailers.apple.com/trailers/paramount/gijoeriseofcobra/large.html
  1570. if($mybb->settings['av_apple'] != 0 && preg_match('<a href=\"(http://)(?:trailers\.)?apple\.com/trailers/(.*)\.html\">isU',$message))
  1571. {
  1572. $pattern = "<http://trailers.apple.com/trailers/(.*)\" target>";
  1573. preg_match_all($pattern, $message, $links);
  1574. $link = $links[1];
  1575. foreach ($link as $url)
  1576. {
  1577. $site = htmlspecialchars_uni("http://trailers.apple.com/trailers/$url");
  1578. //Use cURL and find the video id
  1579. if (!function_exists('curl_init') || !$c = curl_init())
  1580. return false;
  1581. curl_setopt($c, CURLOPT_URL, $site);
  1582. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1583. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1584. $data = utf8_encode(curl_exec($c));
  1585. if (!$data)
  1586. $data = 'not available';
  1587. curl_close($c);
  1588. if($data) {
  1589. $nra = get_avmatch('/\'http:\/\/trailers\.apple\.com\/movies\/(.*)\.mov\'/isU',$data);
  1590. $vid = array($nra);
  1591. }
  1592. $limit = 1;
  1593. foreach ($vid as $id)
  1594. {
  1595. $n = htmlspecialchars_uni($id);
  1596. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:trailers\.)?apple\.com/trailers/(.*)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object id=\"ImageWindow\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" width=\"640\" height=\"360\"> <param name=\"src\" value=\"http://trailers.apple.com/movies/$n.mov\" /><param name=\"autostart\" value=\"0\" /><embed src=\"http://trailers.apple.com/movies/$n.mov\" type=\"video/quicktime \"width=\"640\" height=\"360\" autostart=\"false\"></embed></object></div>", $message, $limit);
  1597. }
  1598. }
  1599. }
  1600. //http://www.viddler.com/explore/failblog/videos/253/
  1601. if($mybb->settings['av_viddler'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?viddler\.com/explore/(.*)\">isU',$message))
  1602. {
  1603. $pattern = "<http://www.viddler.com/explore/(.*)\" target>";
  1604. preg_match_all($pattern, $message, $links);
  1605. $link = $links[1];
  1606. foreach ($link as $url)
  1607. {
  1608. $site = htmlspecialchars_uni("http://www.viddler.com/explore/$url");
  1609. //Use cURL and find the video id
  1610. if (!function_exists('curl_init') || !$c = curl_init())
  1611. return false;
  1612. curl_setopt($c, CURLOPT_URL, $site);
  1613. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1614. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1615. $data = utf8_encode(curl_exec($c));
  1616. if (!$data)
  1617. $data = 'not available';
  1618. curl_close($c);
  1619. if($data) {
  1620. $nrv = get_avmatch('/http:\/\/www\.viddler\.com\/player\/(.*)\//isU',$data);
  1621. $vid = array($nrv);
  1622. }
  1623. $limit = 1;
  1624. foreach ($vid as $id)
  1625. {
  1626. $n = htmlspecialchars_uni($id);
  1627. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)?(?:www\.)?viddler\.com/explore/(.*?)/videos/(?:\w{1,12})/(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"437\" height=\"333\" id=\"viddler_$n\"><param name=\"movie\" value=\"http://www.viddler.com/player/$n/\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"http://www.viddler.com/player/$n/\" width=\"437\" height=\"333\" type=\"application/x-shockwave-flash\" allowScriptAccess=\"always\" allowFullScreen=\"true\" name=\"viddler_$n\"></embed></object></div>", $message, $limit);
  1628. }
  1629. }
  1630. }
  1631. //http://blip.tv/file/2588255/
  1632. if($mybb->settings['av_blip'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?blip\.tv/file/(.*)\">isU',$message))
  1633. {
  1634. $pattern = "<http://blip.tv/file/(.*)\" target>";
  1635. preg_match_all($pattern, $message, $links);
  1636. $link = $links[1];
  1637. foreach ($link as $url)
  1638. {
  1639. $site = htmlspecialchars_uni("http://blip.tv/file/$url");
  1640. //Use cURL and find the video id
  1641. if (!function_exists('curl_init') || !$c = curl_init())
  1642. return false;
  1643. curl_setopt($c, CURLOPT_URL, $site);
  1644. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1645. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1646. $data = utf8_encode(curl_exec($c));
  1647. if (!$data)
  1648. $data = 'not available';
  1649. curl_close($c);
  1650. if($data) {
  1651. $nrblip = get_avmatch('/href=\"http:\/\/blip.tv\/play\/(.*)\" \/>/isU',$data);
  1652. $vid = array($nrblip);
  1653. }
  1654. $limit = 1;
  1655. foreach ($vid as $id)
  1656. {
  1657. $n = htmlspecialchars_uni($id);
  1658. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?blip\.tv/file/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"http://blip.tv/play/$n\" type=\"application/x-shockwave-flash\" width=\"480\" height=\"390\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></div>", $message, $limit);
  1659. }
  1660. }
  1661. }
  1662. //http://www.trtube.com/-ayna-sen-unutma-beni--97383.html
  1663. if($mybb->settings['av_trtube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?trtube\.com/(.*)\.html\">isU',$message))
  1664. {
  1665. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?trtube\.com/(.*?)([0-9]{1,8})\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'425\' height=\'350\'><param name=\'allowScriptAccess\' value=\'always\' /><param name=\'movie\' value=\'http://www.trtube.com/mediaplayer_3_15.swf?file=http://www.trtube.com/playlist.php?v=${5}\' /><embed src=\'http://www.trtube.com/mediaplayer_3_15.swf?file=http://www.trtube.com/playlist.php?v=${5}\' type=\'application/x-shockwave-flash\' height=\'350\' width=\'425\'></embed></object></div>', $message);
  1666. }
  1667. //http://www.break.com/index/kid-freaks-out-on-first-roller-coaster-ride.html
  1668. if($mybb->settings['av_break'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?break\.com/[^\"]*?\w+\.html\">isU',$message))
  1669. {
  1670. $pattern = "<http://www.break.com/(.*)\" target>";
  1671. preg_match_all($pattern, $message, $links);
  1672. $link = $links[1];
  1673. foreach ($link as $url)
  1674. {
  1675. $site = htmlspecialchars_uni("http://www.break.com/$url");
  1676. //Use cURL and find the video id
  1677. if (!function_exists('curl_init') || !$c = curl_init())
  1678. return false;
  1679. curl_setopt($c, CURLOPT_URL, $site);
  1680. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1681. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1682. $data = utf8_encode(curl_exec($c));
  1683. if (!$data)
  1684. $data = 'not available';
  1685. curl_close($c);
  1686. if($data) {
  1687. $nrbreak = get_avmatch('/http:\/\/embed\.break\.com\/([0-9]{1,12}?)/isU',$data);
  1688. $vid = array($nrbreak);
  1689. }
  1690. $limit = 1;
  1691. foreach ($vid as $id)
  1692. {
  1693. $n = htmlspecialchars_uni($id);
  1694. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?break\.com/(.*?)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"464\" height=\"384\"><param name=\"movie\" value=\"http://embed.break.com/$n/\" /><param name=\"allowScriptAccess\" value=\"always\" /><embed src=\"http://embed.break.com/$n/\" width=\"464\" height=\"384\" type=\"application/x-shockwave-flash\" allowScriptAccess=\"always\"></embed></object></div>", $message, $limit);
  1695. }
  1696. }
  1697. }
  1698. //http://videos.sapo.pt/h3zC1Cvy8Q28vEsBD2YW
  1699. if($mybb->settings['av_sapo'] != 0 && preg_match('<a href=\"(http://)(?:videos\.)?sapo\.pt/(.*)">isU',$message))
  1700. {
  1701. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:videos\.)?sapo\.pt/(.{1,30}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'400\' height=\'350\'><param name=\'allowFullScreen\' value=\'true\' /><param name=\'movie\' value=\'http://rd3.videos.sapo.pt/play?file=http://rd3.videos.sapo.pt/${4}/mov/1\' /><embed src=\'http://rd3.videos.sapo.pt/play?file=http://rd3.videos.sapo.pt/${4}/mov/1\' type=\'application/x-shockwave-flash\' allowFullScreen=\'true\' height=\'350\' width=\'400\'></embed></object></div>', $message);
  1702. }
  1703. //http://futebol.videos.sapo.pt/38UEoigpbOyZjyPu4qwn
  1704. if($mybb->settings['av_futebol'] != 0 && preg_match('<a href=\"(http://)(?:futebol\.)(?:videos\.)?sapo\.pt/(.*)">isU',$message))
  1705. {
  1706. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:futebol\.)(?:videos\.)?sapo\.pt/(.{1,30}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'400\' height=\'350\'><param name=\'allowFullScreen\' value=\'true\' /><param name=\'movie\' value=\'http://futebol.videos.sapo.pt/play-bwin?file=http://futebol.videos.sapo.pt/${4}/mov/1\' /><embed src=\'http://futebol.videos.sapo.pt/play-bwin?file=http://futebol.videos.sapo.pt/${4}/mov/1\' type=\'application/x-shockwave-flash\' allowFullScreen=\'true\' height=\'350\' width=\'400\'></embed></object></div>', $message);
  1707. }
  1708. //http://www.trilulilu.ro/PRINCESSE/22f352800f7ff7
  1709. if($mybb->settings['av_trilu'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?trilulilu\.ro/(.*)">isU',$message))
  1710. {
  1711. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?trilulilu\.ro/(.{3,50}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'448\' height=\'371\'><param name=\'movie\' value=\'http://embed.trilulilu.ro/video/${4}/0xe9eff4.swf\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'allowscriptaccess\' value=\'always\' /><embed src=\'http://embed.trilulilu.ro/video/${4}/0xe9eff4.swf\' type=\'application/x-shockwave-flash\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'448\' height=\'371\'></embed></object></div>', $message);
  1712. }
  1713. //http://rutube.ru/tracks/2370874.html?v=73ae0fe7d944c85caa4392d062fd9377
  1714. if($mybb->settings['av_rutube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?rutube\.ru/tracks/(.*)">isU',$message))
  1715. {
  1716. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?rutube\.ru/tracks/([0-9]{3,12}?)\.html\?v=([0-9a-f]{3,50}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'470\' height=\'353\'><param name=\'movie\' value=\'http://video.rutube.ru/${5}\' /><param name=\'wmode\' value=\'window\' /><param name=\'allowFullScreen\' value=\'true\' /><embed src=\'http://video.rutube.ru/${5}\' type=\'application/x-shockwave-flash\' wmode=\'window\' width=\'470\' height=\'353\' allowfullscreen=\'true\'></embed></object></div>', $message);
  1717. }
  1718. //http://www.gametube.org/#/video/smQYBG6dTJ44WXXRIN9hfUGInkE=
  1719. if($mybb->settings['av_gametube'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?gametube\.org/(?:\#/video/)(.*)">isU',$message))
  1720. {
  1721. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?gametube\.org/(?:\#/video/)(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\' width=\'451\' height=\'372\'><param name=\'movie\' value=\'http://www.gametube.org/miniPlayer.swf?vidId=${4}\' /><param name=\'wmode\' value=\'transparent\' /><embed src=\'http://www.gametube.org/miniPlayer.swf?vidId=${4}\' type=\'application/x-shockwave-flash\' wmode=\'transparent\' width=\'451\' height=\'372\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  1722. }
  1723. //http://www.gametrailers.com/video/nissan-gtr-need-for/55935
  1724. if($mybb->settings['av_gametrail'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?gametrailers\.com/(.*?)/([0-9]{1,9}?)">isU',$message))
  1725. {
  1726. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?gametrailers\.com/(.*?)/([0-9]{1,9}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\' id=\'gtembed\' width=\'480\' height=\'392\'><param name=\'allowScriptAccess\' value=\'sameDomain\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'movie\' value=\'http://www.gametrailers.com/remote_wrap.php?mid=${5}\' /><param name=\'quality\' value=\'high\' /><embed src=\'http://www.gametrailers.com/remote_wrap.php?mid=${5}\' swLiveConnect=\'true\' name=\'gtembed\' align=\'middle\' allowScriptAccess=\'sameDomain\' allowFullScreen=\'true\' quality=\'high\' type=\'application/x-shockwave-flash\' width=\'480\' height=\'392\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  1727. }
  1728. //http://www.gamespot.com/xbox360/driving/forzamotorsport3/video/6237914/forza-motorsport-3-video-review
  1729. if($mybb->settings['av_gamespot'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?gamespot\.com/(.*?)/video/([0-9]{1,9}?)/(.*?)">isU',$message))
  1730. {
  1731. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?gamespot\.com/(.*?)/video/([0-9]{1,9}?)/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><embed id=\'mymovie\' width=\'432\' height=\'362\' flashvars=\'playerMode=embedded&amp;movieAspect=4.3&amp;flavor=EmbeddedPlayerVersion&amp;skin=http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/skins/gamespot.png&amp;paramsURI=http://www.gamespot.com/pages/video_player/xml.php?id=${5}&amp;mode=embedded&amp;width=432&amp;height=362/\' wmode=\'transparent\' allowscriptaccess=\'always\' quality=\'high\' name=\'mymovie\' style=\'\' src=\'http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/proteus2.swf\' type=\'application/x-shockwave-flash\'></embed></div>', $message);
  1732. }
  1733. //http://www.123video.nl/playvideos.asp?MovieID=614229
  1734. if($mybb->settings['av_123vid'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?123video\.nl/playvideos(.*?)">isU',$message))
  1735. {
  1736. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?123video\.nl/playvideos\.asp\?MovieID=)(.{6}?)((.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\' width=\'420\' height=\'339\'><param name=\'movie\' value=\'http://www.123video.nl/123video_share.swf?mediaSrc=${4}\' /><param name=\'quality\' value=\'high\' /><embed src=\'http://www.123video.nl/123video_share.swf?mediaSrc=${4}\' quality=\'high\' width=\'420\' height=\'339\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\' /></object></div>', $message);
  1737. }
  1738. //http://www.goear.com/listen/dacf88d/pokerface-pokerface
  1739. if($mybb->settings['av_goear'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?goear\.com/listen(.*?)">isU',$message))
  1740. {
  1741. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?goear\.com/listen/([0-9a-f]{5,10}?)/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width= \"353\" height=\"132\"><embed src=\"http://www.goear.com/files/external.swf?file=$4\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" quality=\"high\" width=\"353\" height=\"132\"></embed></object></div>", $message);
  1742. }
  1743. //http://www.bofunk.com/video/9966/chick_gives_boyfriend_a_snow_job.html
  1744. if($mybb->settings['av_bofunk'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?bofunk\.com/[^\"]*?\w+\.html\">isU',$message))
  1745. {
  1746. $pattern = "<http://www.bofunk.com/(.*)\" target>";
  1747. preg_match_all($pattern, $message, $links);
  1748. $link = $links[1];
  1749. foreach ($link as $url)
  1750. {
  1751. $site = htmlspecialchars_uni("http://www.bofunk.com/$url");
  1752. //Use cURL and find the video id
  1753. if (!function_exists('curl_init') || !$c = curl_init())
  1754. return false;
  1755. curl_setopt($c, CURLOPT_URL, $site);
  1756. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1757. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1758. $data = utf8_encode(curl_exec($c));
  1759. if (!$data)
  1760. $data = 'not available';
  1761. curl_close($c);
  1762. if($data) {
  1763. $nrbofunk = get_avmatch('/<embed src=\"http:\/\/www\.bofunk\.com\/e\/(.*)\" quality=\"high\" /isU',$data);
  1764. $vid = array($nrbofunk);
  1765. }
  1766. $limit = 1;
  1767. foreach ($vid as $id)
  1768. {
  1769. $n = htmlspecialchars_uni($id);
  1770. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?bofunk\.com/video/(.*?)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"http://www.bofunk.com/e/$n\" quality=\"high\" bgcolor=\"#000000\" width=\"446\" height=\"370\" name=\"flvplayer\" align=\"middle\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed></div>", $message, $limit);
  1771. }
  1772. }
  1773. }
  1774. //http://www.clipmoon.com/videos/2190311/lazy-cats.html
  1775. if($mybb->settings['av_clipmoon'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?clipmoon\.com/videos/(.*?)">isU',$message))
  1776. {
  1777. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?clipmoon\.com/videos/([0-9a-f]{1,10}?)/(.*?)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"http://www.clipmoon.com/flvplayer.swf\" FlashVars=\"config=http://www.clipmoon.com/flvplayer.php?viewkey=$4&amp;external=no\" quality=\"high\" bgcolor=\"#000000\" wmode=\"transparent\" width=\"460\" height=\"357\" loop=\"false\" align=\"middle\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" scale=\"exactfit\"></embed></div>", $message);
  1778. }
  1779. //http://www.funnyordie.com/videos/25a35c4142/brendan-fraser-hand-clap-remix
  1780. if($mybb->settings['av_funnyordie'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?funnyordie\.(com|co\.uk)/videos/(.*?)">isU',$message))
  1781. {
  1782. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?funnyordie\.(com|co\.uk)/videos/([0-9a-f]{1,15}?)/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"512\" height=\"328\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" id=\"ordie_player_$5\"><param name=\"movie\" value=\"http://player.ordienetworks.com/flash/fodplayer.swf\" /><param name=\"flashvars\" value=\"key=$5\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><embed width=\"512\" height=\"328\" flashvars=\"key=$5\" allowfullscreen=\"true\" allowscriptaccess=\"always\" quality=\"high\" src=\"http://player.ordienetworks.com/flash/fodplayer.swf\" name=\"ordie_player_$5\" type=\"application/x-shockwave-flash\"></embed></object></div>", $message);
  1783. }
  1784. //http://www.liveleak.com/view?i=6b0_1264510631
  1785. if($mybb->settings['av_liveleak'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?liveleak\.com/view(.*?)">isU',$message))
  1786. {
  1787. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?liveleak\.com/view\?i=(\w{1,25}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"450\" height=\"370\"><param name=\"movie\" value=\"http://www.liveleak.com/e/$4\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\"http://www.liveleak.com/e/$4\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"450\" height=\"370\"></embed></object></div>", $message);
  1788. }
  1789. //http://videa.hu/videok/sport/forma-1-2008-brazil-nagydij-alonso-elozes-eso-vQjWxcm8oYBLh68a
  1790. if($mybb->settings['av_videahu'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?videa\.hu/videok/(.*?)">isU',$message))
  1791. {
  1792. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?videa\.hu/videok/(.*?)-(\w{16}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"448\" height=\"366\"><param name=\"movie\" value=\"http://videa.hu/flvplayer.swf?v=$5\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"allowFullScreen\" value=\"true\" /><embed width=\"448\" height=\"366\" src=\"http://videa.hu/flvplayer.swf?v=$5\" allowscriptaccess=\"always\" allowfullscreen=\"true\" type=\"application/x-shockwave-flash\" /></object></div>", $message);
  1793. }
  1794. //http://www.imdb.com/video/imdb/vi14943257/
  1795. if($mybb->settings['av_imdb'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?imdb\.com/video/(.*?)">isU',$message))
  1796. {
  1797. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?imdb\.com/video/(\w*?)/vi([0-9]{1,12}?)/(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe src=\"http://www.imdb.com/video/$4/vi$5/player\" width=\"640\" height=\"480\" name=\"IMDB Video\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\"></iframe></div>", $message);
  1798. }
  1799. //http://www.movshare.net/video/qf85cptaem4v8
  1800. if($mybb->settings['av_movshare'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?movshare\.net/video/(.*?)">isU',$message))
  1801. {
  1802. //Movshare embed code not working in IE and Opera
  1803. if(isset($_SERVER['HTTP_USER_AGENT'])){
  1804. $agent = htmlspecialchars_uni($_SERVER['HTTP_USER_AGENT']);
  1805. }
  1806. if(!preg_match('/^Opera\//i',$agent) && (!preg_match('/^Mozilla\/4(.*)MSIE/i',$agent)))
  1807. {
  1808. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?movshare\.net/video/(\w{5,18}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe style=\"overflow: hidden; border: 0; width: 720px; height: 362px\" src=\"http://www.movshare.net/embed/$4/?width=720&amp;height=306\" scrolling= \"no\"></iframe></div>", $message);
  1809. }
  1810. }
  1811. //http://www.ustream.tv/channel/pix-wpa-01
  1812. if($mybb->settings['av_ustream'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?ustream\.tv/channel/(.*?)">isU',$message))
  1813. {
  1814. $pattern = "<http://www.ustream.tv/channel/(.*)\" target>";
  1815. preg_match_all($pattern, $message, $links);
  1816. $link = $links[1];
  1817. foreach ($link as $url)
  1818. {
  1819. $site = htmlspecialchars_uni("http://www.ustream.tv/channel/$url");
  1820. //Use cURL and find the video id
  1821. if (!function_exists('curl_init') || !$c = curl_init())
  1822. return false;
  1823. curl_setopt($c, CURLOPT_URL, $site);
  1824. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1825. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1826. $data = utf8_encode(curl_exec($c));
  1827. if (!$data)
  1828. $data = 'not available';
  1829. curl_close($c);
  1830. if($data) {
  1831. $nrustream = get_avmatch('/cid=([0-9]{1,12}?)/isU',$data);
  1832. $vid = array($nrustream);
  1833. }
  1834. $limit = 1;
  1835. foreach ($vid as $id)
  1836. {
  1837. $n = $db->escape_string($id);
  1838. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?ustream\.tv/channel/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"480\" height=\"360\"><param name=\"flashvars\" value=\"autoplay=false&amp;brand=embed&amp;cid=$n\"/><param name=\"bgcolor\" value=\"#000000\"/><param name=\"allowfullscreen\" value=\"true\"/><param name=\"allowscriptaccess\" value=\"always\"/><param name=\"movie\" value=\"http://www.ustream.tv/flash/live/1/$n\"/><embed flashvars=\"autoplay=false&amp;brand=embed&amp;cid=$n\" width=\"480\" height=\"360\" bgcolor=\"#000000\" allowfullscreen=\"true\" allowscriptaccess=\"always\" src=\"http://www.ustream.tv/flash/live/1/$n\" type=\"application/x-shockwave-flash\" /></object></div>", $message, $limit);
  1839. }
  1840. }
  1841. }
  1842. //http://www.blogtv.com/Shows/1059925/Ze_vYeNGbWFEZu7xYe7&pos=ancr
  1843. if($mybb->settings['av_blogtv'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?blogtv\.com/(.*?)">isU',$message))
  1844. {
  1845. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?blogtv\.com/(.*)/(\w*)(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed width=\"445\" height=\"374\" src=\"http://www.blogtv.com/vb/$5\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\"></embed></div>", $message);
  1846. }
  1847. //http://soundcloud.com/skreamizm/skream-future-funk-teaser
  1848. if($mybb->settings['av_soundcloud'] != 0 && preg_match('<a href=\"(http://)?soundcloud\.com/(.*?)">isU',$message))
  1849. {
  1850. $pattern = "<http://soundcloud.com/(.*)\" target>";
  1851. preg_match_all($pattern, $message, $links);
  1852. $link = $links[1];
  1853. foreach ($link as $url)
  1854. {
  1855. $site = htmlspecialchars_uni("http://soundcloud.com/$url");
  1856. //Use cURL and find the video id
  1857. if (!function_exists('curl_init') || !$c = curl_init())
  1858. return false;
  1859. curl_setopt($c, CURLOPT_URL, $site);
  1860. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1861. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1862. $data = utf8_encode(curl_exec($c));
  1863. if (!$data)
  1864. $data = 'not available';
  1865. curl_close($c);
  1866. if($data) {
  1867. $nrsstream = get_avmatch('/data-sc-track=\"(.*)\"><div class=/isU',$data);
  1868. $vid = array($nrsstream);
  1869. }
  1870. $limit = 1;
  1871. foreach ($vid as $id)
  1872. {
  1873. $n = $db->escape_string($id);
  1874. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?soundcloud\.com/(.*?)/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object height=\"81\" width=\"100%\"> <param name=\"movie\" value=\"http://player.soundcloud.com/player.swf?url=http://api.soundcloud.com/tracks/$n&amp;secret_url=false\"></param> <param name=\"allowscriptaccess\" value=\"always\"></param> <embed allowscriptaccess=\"always\" height=\"81\" src=\"http://player.soundcloud.com/player.swf?url=http://api.soundcloud.com/tracks/$n&amp;secret_url=false\" type=\"application/x-shockwave-flash\" width=\"100%\"></embed> </object></div>", $message, $limit);
  1875. }
  1876. }
  1877. }
  1878. //http://www.mefeedia.com/video/33461653
  1879. if($mybb->settings['av_mefeedia'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?mefeedia\.com/video/(.*?)">isU',$message))
  1880. {
  1881. //Mefeedia embed code not working in Chrome
  1882. if(isset($_SERVER['HTTP_USER_AGENT'])){
  1883. $agent = htmlspecialchars_uni($_SERVER['HTTP_USER_AGENT']);
  1884. }
  1885. if(strpos($agent, 'Chrome') == false)
  1886. {
  1887. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?mefeedia\.com/video/([0-9]{1,12}?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><iframe scrolling=\"no\" frameborder=\"0\" width=\"640\" height=\"450\" src=\"http://www.mefeedia.com/video/$4&amp;iframe\"></iframe></div>", $message);
  1888. }
  1889. }
  1890. //http://www.wat.tv/video/the-pretty-reckless-just-tonight-360an_2zicp_.html
  1891. if($mybb->settings['av_wattv'] != 0 && preg_match('<a href=\"(http://)(?:www\.)?wat\.tv/video/(.*?)\.html">isU',$message))
  1892. {
  1893. $pattern = "<http://www.wat.tv/video/(.*)\" target>";
  1894. preg_match_all($pattern, $message, $links);
  1895. $link = $links[1];
  1896. foreach ($link as $url)
  1897. {
  1898. $site = htmlspecialchars_uni("http://www.wat.tv/video/$url");
  1899. //Use cURL and find the video id
  1900. if (!function_exists('curl_init') || !$c = curl_init())
  1901. return false;
  1902. curl_setopt($c, CURLOPT_URL, $site);
  1903. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  1904. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  1905. curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0");
  1906. $data = utf8_encode(curl_exec($c));
  1907. if (!$data)
  1908. $data = 'not available';
  1909. curl_close($c);
  1910. if($data) {
  1911. $nrwat = get_avmatch('/<link rel=\"video_src\" href=\"(.*)\"/isU',$data);
  1912. $vid = array($nrwat);
  1913. }
  1914. $limit = 1;
  1915. foreach ($vid as $id)
  1916. {
  1917. $n = $db->escape_string($id);
  1918. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?wat\.tv/video/(.*?)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"480\" height=\"270\"><param name=\"movie\" value=\"$n\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowScriptAccess\" value=\"always\"></param><embed src=\"$n\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"270\"></embed></object></div>", $message, $limit);
  1919. }
  1920. }
  1921. }
  1922. return $message;
  1923. }
  1924. }
  1925. }
  1926. }
  1927. }
  1928. }
  1929. }
  1930. //Embed Adult Site Videos #############################################################################################
  1931. function automedia_adult_run($message)
  1932. {
  1933. global $db, $mybb, $cache, $post, $automedia_adult;
  1934. //Add new mycode for disabling embedding
  1935. $message = preg_replace("#\[amoff\](http://)(.*?)\[/amoff\]#i", '<a name=\'amoff\' href=\'${1}${2}\' id =\'am\' target=\'_blank\'>${1}${2}</a>', $message);
  1936. //Find the set fid's in Adult Settings
  1937. $avfid = intval($post['fid']);
  1938. $adfids = explode(',', $mybb->settings['av_adultforums']);
  1939. if (in_array($avfid,$adfids))
  1940. {
  1941. $adultfid = false;
  1942. }
  1943. else
  1944. {
  1945. $adultfid = true;
  1946. }
  1947. /**
  1948. *Get the settings for the usergroups
  1949. */
  1950. //Find the allowed Adult primary groups in Settings
  1951. $gid = intval($mybb->user['usergroup']);
  1952. $adultgroups = explode(',', $mybb->settings['av_adultgroups']);
  1953. if (in_array($gid,$adultgroups))
  1954. {
  1955. $adultgid = false;
  1956. }
  1957. else
  1958. {
  1959. $adultgid = true;
  1960. }
  1961. //Find the allowed Adult secondary groups in Settings
  1962. $adag = explode(',', $mybb->user['additionalgroups']);
  1963. foreach($adag as $ad)
  1964. {
  1965. if (in_array($ad,$adultgroups))
  1966. {
  1967. $adultaddgid = false;
  1968. }
  1969. else
  1970. {
  1971. $adultaddgid = true;
  1972. }
  1973. }
  1974. /**
  1975. * Apply the permissions
  1976. */
  1977. //Adultsites enabled?
  1978. if($mybb->settings['av_adultsites'] != 0)
  1979. {
  1980. //Has the User AutoMedia enabled in User CP?
  1981. if($mybb->user['automedia_use'] != 'N')
  1982. {
  1983. //Embedding not disabled by using mycode?
  1984. if (!preg_match('/<a name=\"amoff\" href=\"(.*)\" id=\"am\" target=\"_blank\">/isU',$message))
  1985. {
  1986. //Adultsites allowed for Guests in Settings?
  1987. if ($mybb->settings['av_adultguest'] != 0 || ($mybb->user['uid'] != 0))
  1988. {
  1989. // User in allowed group? Admins always allowed, 0 = all groups allowed
  1990. if(!$adultgid || !$adultaddgid || $gid == 4 || $mybb->settings['av_adultgroups'] == 0)
  1991. {
  1992. //Forum set for adult sites?
  1993. if(!$adultfid || $mybb->settings['av_adultforums'] == 0)
  1994. {
  1995. /**
  1996. * Embed the files
  1997. */
  1998. //http://www.redtube.com/12528
  1999. if(preg_match('<a href=\"(http://)(?:www\.)?redtube\.com/(?:\d{1,8})\">isU',$message))
  2000. {
  2001. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?redtube\.com/(.{1,8})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'434\' height=\'344\'><param name=\'movie\' value=\'http://embed.redtube.com/player/\' /><param name=\'FlashVars\' value=\'id=${4}&amp;style=redtube\' /><embed src=\'http://embed.redtube.com/player/?id=${4}&amp;style=redtube\' pluginspage=\'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\' type=\'application/x-shockwave-flash\' height=\'344\' width=\'434\'></embed></object></div>', $message);
  2002. }
  2003. //http://www.xvideos.com/video221033/daisy_marie_is_so_cute
  2004. if(preg_match('<a href=\"(http://)(?:www\.)?xvideos\.com/video(?:\d{1,12})/(.*?)\">isU',$message))
  2005. {
  2006. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?xvideos\.com/video([0-9]{1,12})/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'510\' height=\'400\' classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\' ><param name=\'quality\' value=\'high\' /><param name=\'bgcolor\' value=\'#000000\' /><param name=\'allowScriptAccess\' value=\'always\' /><param name=\'movie\' value=\'http://static.xvideos.com/swf/flv_player_site_v4.swf\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'flashvars\' value=\'id_video=${4}\' /><embed src=\'http://static.xvideos.com/swf/flv_player_site_v4.swf\' allowscriptaccess=\'always\' width=\'510\' height=\'400\' menu=\'false\' quality=\'high\' bgcolor=\'#000000\' allowfullscreen=\'true\' flashvars=\'id_video=${4}\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  2007. }
  2008. //http://www.porn8.com/free-porn/video/3b878c4e2c/Hailey-Jade-in-POV-Casting-Couch-11-Scene-3-from-VideosZ.video
  2009. if(preg_match('<a href=\"(http://)(?:www\.)?porn8\.com/free-porn/video/(?:\w{1,15})/(.*?)\">isU',$message))
  2010. {
  2011. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?porn8\.com/free-porn/video/([0-9a-f]{1,15})/(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object width=\'450\' height=\'370\' ><param name=\'movie\' value=\'http://www.porn8.com/flv/flvplayer.swf\' /><param name=\'FlashVars\' value=\'config=http://www.porn8.com/vidcolem/${4}/\' /><param name=\'quality\' value=\'high\' /><param name=\'bgcolor\' value=\'#000000\' /><param name=\'allowFullScreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /><embed src=\'http://www.porn8.com/flv/flvplayer.swf\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'450\' height=\'370\' quality=\'high\' bgcolor=\'#000000\' FlashVars=\'config=http://www.porn8.com/vidcolem/${4}/\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  2012. }
  2013. //http://www.keezmovies.com/video/amateur-brunette-blows-hubby-447981 or http://www.keezmovies.com/447981
  2014. if(preg_match('<a href=\"(http://)(?:www\.)?keezmovies\.com/(.*)\">isU',$message))
  2015. {
  2016. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?keezmovies\.com/([0-9]{1,15})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object type=\'application/x-shockwave-flash\' data=\'http://km-static.phncdn.com/flash/player_embed.swf?cache=002\' width=\'508\' height=\'416\' ><param name=\'movie\' value=\'http://http://www.keezmovies.com/inc/players/v1/player.swf\' /><param name=\'bgcolor\' value=\'#000000\' /><param name=\'allowfullscreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /><param name=\'FlashVars\' value=\'options=http://www.keezmovies.com/embed_player.php?id=${4}\' /><embed src=\'http://www.keezmovies.com/inc/players/v1/player.swf\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'508\' height=\'416\' bgcolor=\'#000000\' FlashVars=\'options=http://www.keezmovies.com/embed_player.php?id=${4}\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  2017. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)(?:www\.)?keezmovies\.com/video/(.*?)-([0-9]{1,15})(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", '<div class=\'am_embed\'><object type=\'application/x-shockwave-flash\' data=\'http://km-static.phncdn.com/flash/player_embed.swf?cache=002\' width=\'508\' height=\'416\' ><param name=\'movie\' value=\'http://http://www.keezmovies.com/inc/players/v1/player.swf\' /><param name=\'bgcolor\' value=\'#000000\' /><param name=\'allowfullscreen\' value=\'true\' /><param name=\'allowScriptAccess\' value=\'always\' /><param name=\'FlashVars\' value=\'options=http://www.keezmovies.com/embed_player.php?id=${5}\' /><embed src=\'http://www.keezmovies.com/inc/players/v1/player.swf\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'508\' height=\'416\' bgcolor=\'#000000\' FlashVars=\'options=http://www.keezmovies.com/embed_player.php?id=${5}\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object></div>', $message);
  2018. }
  2019. //http://www.xxxymovies.com/watch/8379/Latin_wife_to_do_his_taxes_or_him.html
  2020. $pattern = "<http://www.xxxymovies.com/watch/(.*)\" target>";
  2021. if(preg_match($pattern, $message))
  2022. {
  2023. preg_match_all($pattern, $message, $links);
  2024. $link = $links[1];
  2025. foreach ($link as $url)
  2026. {
  2027. $site = htmlspecialchars_uni("http://www.xxxymovies.com/watch/$url");
  2028. //Use cURL and find the video id
  2029. if (!function_exists('curl_init') || !$c = curl_init())
  2030. return false;
  2031. curl_setopt($c, CURLOPT_URL, $site);
  2032. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  2033. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  2034. $data = utf8_encode(curl_exec($c));
  2035. if (!$data)
  2036. $data = 'not available';
  2037. curl_close($c);
  2038. if($data) {
  2039. $nrxxx = get_avmatch('/fo\.addVariable\(\"videoid\", \"([0-9a-f]{1,50}?)/isU',$data);
  2040. $vid = array($nrxxx);
  2041. }
  2042. $limit = 1;
  2043. foreach ($vid as $id)
  2044. {
  2045. $n = htmlspecialchars_uni($id);
  2046. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?xxxymovies\.com/watch/(.*?)\.html(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"http://www.xxxymovies.com/embed/$n/\" loop=\"false\" width=\"480\" height=\"384\" allowfullscreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></div>", $message, $limit);
  2047. }
  2048. }
  2049. }
  2050. //http://www.pornhub.com/view_video.php?viewkey=395131153
  2051. $pattern = "<http://www.pornhub.com/(.*)\" target>";
  2052. if(preg_match($pattern, $message))
  2053. {
  2054. preg_match_all($pattern, $message, $links);
  2055. $link = $links[1];
  2056. foreach ($link as $url)
  2057. {
  2058. $site = htmlspecialchars_uni("http://www.pornhub.com/$url");
  2059. //Use cURL and find the video id
  2060. if (!function_exists('curl_init') || !$c = curl_init())
  2061. return false;
  2062. curl_setopt($c, CURLOPT_URL, $site);
  2063. curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  2064. curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0");
  2065. curl_setopt($c, CURLOPT_TIMEOUT, 3);
  2066. $data = utf8_encode(curl_exec($c));
  2067. if (!$data)
  2068. $data = 'not available';
  2069. curl_close($c);
  2070. if($data) {
  2071. $nrph = get_avmatch('/video\.php\?id=([0-9]{1,10}?)/isU',$data);
  2072. $vid = array($nrph);
  2073. }
  2074. $limit = 1;
  2075. foreach ($vid as $id)
  2076. {
  2077. $n = htmlspecialchars_uni($id);
  2078. $message = preg_replace("#(\[automedia\]|<a href=\"(http://)(?:www\.)?pornhub\.com/view(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object type=\"application/x-shockwave-flash\" data=\"http://ph-static.phncdn.com/flash/embed_player_v1.3.swf\" width=\"608\" height=\"476\"><param name=\"movie\" value=\"http://ph-static.phncdn.com/flash/embed_player_v1.3.swf\" /><param name=\"bgColor\" value=\"#000000\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"FlashVars\" value=\"options=http://www.pornhub.com/embed_player.php?id=$n\"/></object></div>", $message, $limit);
  2079. }
  2080. }
  2081. }
  2082. //http://latex.vidz.com/video/Pink_Ink_scene_1/vidz_porn_videos_blowjob_boots_brunette_doggystyle_gonzo_kissing_latex_long-hair_on-top_pussy-licking_shaved_smalltits_tattoo/?s=5244&n=111&p=-59
  2083. if(preg_match('<a href=\"(.*?)\.vidz\.com/video/(.*?)\">isU',$message))
  2084. {
  2085. $message = preg_replace("#(\[automedia\]|(<a href=\")?(http://)?(.*?)\.vidz\.com/video/(.*?)s=([0-9]{1,8})(.*?)(\-?)([0-9]{1,5})(.*?)(\[/automedia\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object width=\"640\" height=\"472\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\"http://webdata.vidz.com/demo/swf/FlashPlayerV2.swf\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"flashvars\" value=\"id_scene=$6&amp;id_niche=$8$9&amp;type=free\" /><embed src=\"http://webdata.vidz.com/demo/swf/FlashPlayerV2.swf\" allowscriptaccess=\"always\" width=\"640\" height=\"472\" menu=\"false\" quality=\"high\" bgcolor=\"#000000\" allowfullscreen=\"true\" flashvars=\"id_scene=$6&amp;id_niche=$8$9&amp;type=free\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></div>", $message);
  2086. }
  2087. return $message;
  2088. }
  2089. }
  2090. }
  2091. }
  2092. }
  2093. }
  2094. }
  2095. //Embedding disabled in signatures #############################################################################
  2096. function automedia_hide($post)
  2097. {
  2098. global $mybb, $lang, $settings, $automedia;
  2099. $lang->load("automedia");
  2100. if ($mybb->settings['av_signature'] != 1)
  2101. {
  2102. $post['signature'] = preg_replace("!<div class=\'am_embed\'>(.*?)</div>!i", "{$lang->av_sigreplace}", $post['signature']);
  2103. $post['signature'] = preg_replace("!<div class=\"am_embed\">(.*?)</div>!i", "{$lang->av_sigreplace}", $post['signature']);
  2104. $post['signature'] = preg_replace("!<object(.*?)</object>!i", "{$lang->av_sigreplace}", $post['signature']);
  2105. $post['signature'] = preg_replace("!<embed(.*?)</embed>!i", "{$lang->av_sigreplace}", $post['signature']);
  2106. $post['signature'] = preg_replace("!<iframe src=\"http://www.imdb.com/video/(.*?)</iframe>!i", "{$lang->av_sigreplace}", $post['signature']);
  2107. $post['signature'] = preg_replace("!<iframe style=\"overflow: hidden; border: 0; width: 720px; height: 362px\" src=\"http://www.movshare.net/embed/(.*?)</iframe>!i", "{$lang->av_sigreplace}", $post['signature']);
  2108. }
  2109. }
  2110. // Message in User CP signature preview and Profile if embedding in signatures is disabled #################################
  2111. function amsigpreview($page)
  2112. {
  2113. global $mybb, $lang, $settings, $amsigpreview, $templates;
  2114. $lang->load("automedia");
  2115. if(THIS_SCRIPT=="usercp.php" || THIS_SCRIPT=="member.php")
  2116. {
  2117. if ($mybb->settings['av_signature'] != 1)
  2118. {
  2119. $page = preg_replace("!<div class=\'am_embed\'>(.*?)</div>!i", "{$lang->av_sigreplace}", $page);
  2120. $page = preg_replace("!<div class=\"am_embed\">(.*?)</div>!i", "{$lang->av_sigreplace}", $page);
  2121. }
  2122. }
  2123. }
  2124. //Use MyBB 1.6.* maxpostvideos settings
  2125. function automedia_count($post)
  2126. {
  2127. global $mybb, $lang, $settings, $automedia;
  2128. $lang->load("automedia");
  2129. // Get the permissions of the user who is making this post or thread
  2130. $permissions = user_permissions($post['uid']);
  2131. // Check if this post contains more videos than the forum allows
  2132. if($post['savedraft'] != 1 && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)
  2133. {
  2134. // And count the number of all videos in the message.
  2135. $automedia_count = substr_count($post['message'], "am_embed");
  2136. $vids_count = substr_count($post['message'], "video_embed");
  2137. $all_count = $automedia_count + $vids_count;
  2138. if($all_count > $mybb->settings['maxpostvideos'])
  2139. {
  2140. // Throw back a message if over the count as well as the maximum number of videos per post.
  2141. $post['message'] = "<div style=\"color:#FF0000\"><strong><u>{$lang->av_vidcount} {$mybb->settings['maxpostvideos']}</u></strong></div>";
  2142. }
  2143. }
  2144. }
  2145. /**
  2146. * The Hook Function for toolbar-container plugin
  2147. * -----------------
  2148. * Function to fill the items attribute of the ItemCollector object
  2149. * that declared on toolbar_contanier plugin. This function only executed
  2150. * when Toolbar Container plugin is active.
  2151. *
  2152. * @param ItemCollector &$ic
  2153. * @return void
  2154. */
  2155. function automedia_collect(&$ic) {
  2156. global $lang, $mybb;
  2157. $lang->load("automedia");
  2158. // the javascript callback function
  2159. // called when button clicked
  2160. $callback = "
  2161. var ask_me = prompt('Video Audio Link', '');
  2162. if (ask_me == null) return;
  2163. if (ask_me != '') {
  2164. ask_me = ask_me;
  2165. }
  2166. // inject to editor
  2167. clickableEditor.performInsert('[amoff]' + ask_me + '[/amoff]', '', true, false);
  2168. ";
  2169. $toolbar = array(
  2170. 'id' => 'automedia_v116', // make sure it's unique, add version number to make sure
  2171. 'name' => 'automedia',
  2172. 'image' => 'amoff.png',
  2173. 'callback' => $callback,
  2174. 'title' => $lang->av_amoff
  2175. );
  2176. $ic->collect_item($toolbar);
  2177. }
  2178. function amplaylist_collect(&$ic) {
  2179. global $lang, $mybb;
  2180. $lang->load("automedia");
  2181. // the javascript callback function
  2182. // called when button clicked
  2183. $callback = "
  2184. var ask_me = prompt('Playlist Links', '');
  2185. if (ask_me == null) return;
  2186. if (ask_me != '') {
  2187. ask_me = ask_me;
  2188. }
  2189. // inject to editor
  2190. clickableEditor.performInsert('[ampl]' + ask_me + '[/ampl]', '', true, false);
  2191. ";
  2192. $toolbar = array(
  2193. 'id' => 'automedia_v117', // make sure it's unique, add version number to make sure
  2194. 'name' => 'automedia',
  2195. 'image' => 'ampl.png',
  2196. 'callback' => $callback,
  2197. 'title' => 'MP3 Playlist'
  2198. );
  2199. $ic->collect_item($toolbar);
  2200. }
  2201. ?>