PageRenderTime 64ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/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

Large files files are truncated, but you can click here to view the full file

  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 h…

Large files files are truncated, but you can click here to view the full file