rtMedia for WordPress, BuddyPress and bbPress - Version 3.2.8

Version Description

  • Fix WordPress MultiSite issue.
  • Shortcode invalid argument issue fix.
Download this release

Release Info

Developer faishal
Plugin Icon 128x128 rtMedia for WordPress, BuddyPress and bbPress
Version 3.2.8
Comparing to
See all releases

Code changes from version 3.2.7 to 3.2.8

app/admin/RTMediaAdmin.php CHANGED
@@ -97,7 +97,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
97
  <table>
98
  <tbody> <?php
99
  $rtMedia_model = new RTMediaModel();
100
- $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} group by media_type";
101
  global $wpdb;
102
  $results = $wpdb->get_results ( $sql );
103
  if ( $results ) {
@@ -455,9 +455,9 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
455
  function rtmedia_regenerate_thumbnail_notice() {
456
  $obj_encoding = new RTMediaEncoding(true);
457
  if ($obj_encoding->api_key) {
458
- $site_option = get_site_option("rtmedia-video-thumb-notice");
459
  if(!$site_option || $site_option != "hide") {
460
- update_site_option("rtmedia-video-thumb-notice", "show");
461
  $videos_without_thumbs = get_video_without_thumbs();
462
  if(isset($videos_without_thumbs) && is_array($videos_without_thumbs) && sizeof($videos_without_thumbs) > 0 ) {
463
  echo '<div class="error rtmedia-regenerate-video-thumb-error">
@@ -484,7 +484,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
484
  }
485
 
486
  function rtmedia_hide_video_thumb_admin_notice() {
487
- if(update_site_option("rtmedia-video-thumb-notice", "hide"))
488
  echo "1";
489
  else
490
  echo "0";
@@ -515,7 +515,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
515
 
516
  function get_video_without_thumbs() {
517
  $rtmedia_model = new RTMediaModel();
518
- $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and cover_art is null";
519
  global $wpdb;
520
  $results = $wpdb->get_col( $sql );
521
  return $results;
@@ -869,7 +869,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
869
  do_action ( 'rtmedia_sanitize_settings', $_POST );
870
 
871
  if ( isset ( $_POST[ 'rtmedia_options' ] ) ) {
872
- update_site_option ( 'rtmedia_options', $_POST[ 'rtmedia_options' ] );
873
  //
874
  // // redirect to settings page in network
875
  wp_redirect (
@@ -896,7 +896,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
896
 
897
  $message = sprintf ( __ ( 'I use @buddypressmedia http://goo.gl/8Upmv on %s', 'rtmedia' ), home_url () );
898
  $addons = '<div id="social" class="row">
899
- <label class="columns large-6 large-offset-3" for="bp-media-add-linkback"><input' . checked ( get_site_option ( 'rtmedia-add-linkback', false ), true, false ) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __ ( 'Add link to footer', 'rtmedia' ) . '</label>
900
  <div class="row">
901
  <div class="columns large-6"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Frtcamp.com%2Fbuddypress-media%2F&amp;send=false&amp;layout=button_count&amp;width=72&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px; margin-top: 5px;" allowTransparency="true"></iframe></div>
902
  <div class="columns large-6"><a href="https://www.facebook.com/sharer/sharer.php?u=http://rtcamp.com/buddypress-media/" class="button" target="_blank"> <i class="icon-facebook"></i> ' . __ ( 'Share', 'rtmedia' ) . '</a></div>
@@ -952,9 +952,9 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
952
 
953
  public function linkback () {
954
  if ( isset ( $_POST[ 'linkback' ] ) && $_POST[ 'linkback' ] ) {
955
- return update_site_option ( 'rtmedia-add-linkback', true );
956
  } else {
957
- return update_site_option ( 'rtmedia-add-linkback', false );
958
  }
959
  die;
960
  }
@@ -963,7 +963,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
963
  if ( $_POST[ 'interested' ] == 'Yes' && ! empty ( $_POST[ 'choice' ] ) ) {
964
  wp_remote_get ( add_query_arg ( array( 'rtmedia-convert-videos-form' => 1, 'choice' => $_POST[ 'choice' ], 'url' => urlencode ( $_POST[ 'url' ] ), 'email' => $_POST[ 'email' ] ), 'http://rtcamp.com/' ) );
965
  } else {
966
- update_site_option ( 'rtmedia-survey', 0 );
967
  }
968
  echo 'Thank you for your time.';
969
  die;
@@ -971,7 +971,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
971
 
972
  public function video_transcoding_survey_response () {
973
  if ( isset ( $_GET[ 'survey-done' ] ) && ($_GET[ 'survey-done' ] == md5 ( 'survey-done' )) ) {
974
- update_site_option ( 'rtmedia-survey', 0 );
975
  }
976
  }
977
 
@@ -983,7 +983,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
983
 
984
  public function upload_filetypes_error () {
985
  global $rtmedia;
986
- $upload_filetypes = get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
987
  $upload_filetypes = explode ( ' ', $upload_filetypes );
988
  $flag = false;
989
  if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
@@ -1037,7 +1037,7 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
1037
 
1038
  public function correct_upload_filetypes () {
1039
  global $rtmedia;
1040
- $upload_filetypes_orig = $upload_filetypes = get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
1041
  $upload_filetypes = explode ( ' ', $upload_filetypes );
1042
  if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
1043
  $not_supported_image = array_diff ( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
@@ -1048,20 +1048,20 @@ if ( ! class_exists ( 'RTMediaAdmin' ) ) {
1048
  }
1049
  if ( $update_image_support ) {
1050
  $upload_filetypes_orig .= $update_image_support;
1051
- update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1052
  }
1053
  }
1054
  }
1055
  if ( isset ( $rtmedia->options[ 'videos_enabled' ] ) && $rtmedia->options[ 'videos_enabled' ] ) {
1056
  if ( ! in_array ( 'mp4', $upload_filetypes ) ) {
1057
  $upload_filetypes_orig .= ' mp4';
1058
- update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1059
  }
1060
  }
1061
  if ( isset ( $rtmedia->options[ 'audio_enabled' ] ) && $rtmedia->options[ 'audio_enabled' ] ) {
1062
  if ( ! in_array ( 'mp3', $upload_filetypes ) ) {
1063
  $upload_filetypes_orig .= ' mp3';
1064
- update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1065
  }
1066
  }
1067
  echo true;
97
  <table>
98
  <tbody> <?php
99
  $rtMedia_model = new RTMediaModel();
100
+ $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} where blog_id='".get_current_blog_id()."' group by media_type";
101
  global $wpdb;
102
  $results = $wpdb->get_results ( $sql );
103
  if ( $results ) {
455
  function rtmedia_regenerate_thumbnail_notice() {
456
  $obj_encoding = new RTMediaEncoding(true);
457
  if ($obj_encoding->api_key) {
458
+ $site_option = rtmedia_get_site_option("rtmedia-video-thumb-notice");
459
  if(!$site_option || $site_option != "hide") {
460
+ rtmedia_update_site_option("rtmedia-video-thumb-notice", "show");
461
  $videos_without_thumbs = get_video_without_thumbs();
462
  if(isset($videos_without_thumbs) && is_array($videos_without_thumbs) && sizeof($videos_without_thumbs) > 0 ) {
463
  echo '<div class="error rtmedia-regenerate-video-thumb-error">
484
  }
485
 
486
  function rtmedia_hide_video_thumb_admin_notice() {
487
+ if(rtmedia_update_site_option("rtmedia-video-thumb-notice", "hide"))
488
  echo "1";
489
  else
490
  echo "0";
515
 
516
  function get_video_without_thumbs() {
517
  $rtmedia_model = new RTMediaModel();
518
+ $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and blog_id = '".get_current_blog_id()."' and cover_art is null";
519
  global $wpdb;
520
  $results = $wpdb->get_col( $sql );
521
  return $results;
869
  do_action ( 'rtmedia_sanitize_settings', $_POST );
870
 
871
  if ( isset ( $_POST[ 'rtmedia_options' ] ) ) {
872
+ rtmedia_update_site_option ( 'rtmedia_options', $_POST[ 'rtmedia_options' ] );
873
  //
874
  // // redirect to settings page in network
875
  wp_redirect (
896
 
897
  $message = sprintf ( __ ( 'I use @buddypressmedia http://goo.gl/8Upmv on %s', 'rtmedia' ), home_url () );
898
  $addons = '<div id="social" class="row">
899
+ <label class="columns large-6 large-offset-3" for="bp-media-add-linkback"><input' . checked ( rtmedia_get_site_option ( 'rtmedia-add-linkback', false ), true, false ) . ' type="checkbox" name="bp-media-add-linkback" value="1" id="bp-media-add-linkback"/> ' . __ ( 'Add link to footer', 'rtmedia' ) . '</label>
900
  <div class="row">
901
  <div class="columns large-6"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Frtcamp.com%2Fbuddypress-media%2F&amp;send=false&amp;layout=button_count&amp;width=72&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px; margin-top: 5px;" allowTransparency="true"></iframe></div>
902
  <div class="columns large-6"><a href="https://www.facebook.com/sharer/sharer.php?u=http://rtcamp.com/buddypress-media/" class="button" target="_blank"> <i class="icon-facebook"></i> ' . __ ( 'Share', 'rtmedia' ) . '</a></div>
952
 
953
  public function linkback () {
954
  if ( isset ( $_POST[ 'linkback' ] ) && $_POST[ 'linkback' ] ) {
955
+ return rtmedia_update_site_option ( 'rtmedia-add-linkback', true );
956
  } else {
957
+ return rtmedia_update_site_option ( 'rtmedia-add-linkback', false );
958
  }
959
  die;
960
  }
963
  if ( $_POST[ 'interested' ] == 'Yes' && ! empty ( $_POST[ 'choice' ] ) ) {
964
  wp_remote_get ( add_query_arg ( array( 'rtmedia-convert-videos-form' => 1, 'choice' => $_POST[ 'choice' ], 'url' => urlencode ( $_POST[ 'url' ] ), 'email' => $_POST[ 'email' ] ), 'http://rtcamp.com/' ) );
965
  } else {
966
+ rtmedia_update_site_option ( 'rtmedia-survey', 0 );
967
  }
968
  echo 'Thank you for your time.';
969
  die;
971
 
972
  public function video_transcoding_survey_response () {
973
  if ( isset ( $_GET[ 'survey-done' ] ) && ($_GET[ 'survey-done' ] == md5 ( 'survey-done' )) ) {
974
+ rtmedia_update_site_option ( 'rtmedia-survey', 0 );
975
  }
976
  }
977
 
983
 
984
  public function upload_filetypes_error () {
985
  global $rtmedia;
986
+ $upload_filetypes = rtmedia_get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
987
  $upload_filetypes = explode ( ' ', $upload_filetypes );
988
  $flag = false;
989
  if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
1037
 
1038
  public function correct_upload_filetypes () {
1039
  global $rtmedia;
1040
+ $upload_filetypes_orig = $upload_filetypes = rtmedia_get_site_option ( 'upload_filetypes', 'jpg jpeg png gif' );
1041
  $upload_filetypes = explode ( ' ', $upload_filetypes );
1042
  if ( isset ( $rtmedia->options[ 'images_enabled' ] ) && $rtmedia->options[ 'images_enabled' ] ) {
1043
  $not_supported_image = array_diff ( array( 'jpg', 'jpeg', 'png', 'gif' ), $upload_filetypes );
1048
  }
1049
  if ( $update_image_support ) {
1050
  $upload_filetypes_orig .= $update_image_support;
1051
+ rtmedia_update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1052
  }
1053
  }
1054
  }
1055
  if ( isset ( $rtmedia->options[ 'videos_enabled' ] ) && $rtmedia->options[ 'videos_enabled' ] ) {
1056
  if ( ! in_array ( 'mp4', $upload_filetypes ) ) {
1057
  $upload_filetypes_orig .= ' mp4';
1058
+ rtmedia_update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1059
  }
1060
  }
1061
  if ( isset ( $rtmedia->options[ 'audio_enabled' ] ) && $rtmedia->options[ 'audio_enabled' ] ) {
1062
  if ( ! in_array ( 'mp3', $upload_filetypes ) ) {
1063
  $upload_filetypes_orig .= ' mp3';
1064
+ rtmedia_update_site_option ( 'upload_filetypes', $upload_filetypes_orig );
1065
  }
1066
  }
1067
  echo true;
app/admin/RTMediaFormHandler.php CHANGED
@@ -261,7 +261,7 @@ class RTMediaFormHandler {
261
  $render_options = apply_filters("rtmedia_general_content_add_itmes",$render_options, $options);
262
  $general_group = array();
263
  $general_group[10] = "UI";
264
- $general_group[30] = "Miscellaneous";
265
  $general_group = apply_filters("rtmedia_general_content_groups", $general_group);
266
  ksort($general_group);
267
  $html = '';
@@ -273,7 +273,7 @@ class RTMediaFormHandler {
273
  foreach ($render_options as $tab => $option) {
274
 
275
  if(!isset($option['group'])) {
276
- $option['group'] = "30";
277
  }
278
 
279
  if($option['group'] != $key) {
261
  $render_options = apply_filters("rtmedia_general_content_add_itmes",$render_options, $options);
262
  $general_group = array();
263
  $general_group[10] = "UI";
264
+ $general_group[90] = "Miscellaneous";
265
  $general_group = apply_filters("rtmedia_general_content_groups", $general_group);
266
  ksort($general_group);
267
  $html = '';
273
  foreach ($render_options as $tab => $option) {
274
 
275
  if(!isset($option['group'])) {
276
+ $option['group'] = "90";
277
  }
278
 
279
  if($option['group'] != $key) {
app/assets/js/rtMedia.backbone.js CHANGED
@@ -637,6 +637,7 @@ jQuery(document).ready(function($) {
637
  $("#rtmedia_comment_ul").append(data);
638
  $("#comment_content").val("");
639
  $("#rt_media_comment_form #rt_media_comment_submit").removeAttr('disabled');
 
640
  }
641
  });
642
 
@@ -648,7 +649,9 @@ jQuery(document).ready(function($) {
648
  //Delete comment
649
  jQuery(document).on('click', '.rtmedia-delte-comment', function(e){
650
  e.preventDefault();
651
- if(!confirm('Are you sure you want to delete this comment ?'))
 
 
652
  return false;
653
  var current_comment = jQuery(this);
654
  var current_comment_parent = current_comment.parent();
@@ -666,9 +669,10 @@ jQuery(document).ready(function($) {
666
  success: function(res) {
667
  if(res !='undefined' && res == 1){
668
  current_comment.closest('li').hide(1000, function(){ current_comment.closest('li').remove(); });
669
- }else
670
  current_comment.css('opacity', '1');
671
-
 
672
  }
673
  });
674
 
637
  $("#rtmedia_comment_ul").append(data);
638
  $("#comment_content").val("");
639
  $("#rt_media_comment_form #rt_media_comment_submit").removeAttr('disabled');
640
+ rtMediaHook.call('rtmedia_js_after_comment_added', []);
641
  }
642
  });
643
 
649
  //Delete comment
650
  jQuery(document).on('click', '.rtmedia-delte-comment', function(e){
651
  e.preventDefault();
652
+ var ask_confirmation = true
653
+ ask_confirmation = rtMediaHook.call('rtmedia_js_delete_comment_confirmation', [ask_confirmation]);
654
+ if(ask_confirmation && !confirm('Are you sure you want to delete this comment ?'))
655
  return false;
656
  var current_comment = jQuery(this);
657
  var current_comment_parent = current_comment.parent();
669
  success: function(res) {
670
  if(res !='undefined' && res == 1){
671
  current_comment.closest('li').hide(1000, function(){ current_comment.closest('li').remove(); });
672
+ }else{
673
  current_comment.css('opacity', '1');
674
+ }
675
+ rtMediaHook.call('rtmedia_js_after_comment_deleted', []);
676
  }
677
  });
678
 
app/helper/RTMediaInteractionModel.php CHANGED
@@ -13,7 +13,7 @@
13
  class RTMediaInteractionModel extends RTDBModel {
14
 
15
  function __construct () {
16
- parent::__construct ( 'rtm_media_interaction' );
17
  }
18
 
19
  function check($user_id = "", $media_id = "", $action = "") {
13
  class RTMediaInteractionModel extends RTDBModel {
14
 
15
  function __construct () {
16
+ parent::__construct ( 'rtm_media_interaction', false, 10, true );
17
  }
18
 
19
  function check($user_id = "", $media_id = "", $action = "") {
app/helper/RTMediaModel.php CHANGED
@@ -8,7 +8,7 @@
8
  class RTMediaModel extends RTDBModel {
9
 
10
  function __construct () {
11
- parent::__construct ( 'rtm_media' );
12
  $this->meta_table_name = "rt_rtm_media_meta";
13
  }
14
 
@@ -47,6 +47,9 @@ class RTMediaModel extends RTDBModel {
47
  $from = " FROM {$this->table_name} ";
48
  $join = "";
49
  $where = " where 2=2 ";
 
 
 
50
  $temp = 65;
51
  foreach ( $columns as $colname => $colvalue ) {
52
  if ( strtolower ( $colname ) == "meta_query" ) {
@@ -55,7 +58,11 @@ class RTMediaModel extends RTDBModel {
55
  $meta_query[ "compare" ] = "=";
56
  }
57
  $tbl_alias = chr ( $temp ++ );
58
- $join .= " LEFT JOIN {$wpdb->prefix}{$this->meta_table_name} as {$tbl_alias} ON {$this->table_name}.id = {$tbl_alias}.media_id ";
 
 
 
 
59
  if ( isset ( $meta_query[ "value" ] ) )
60
  $where .= " AND ({$tbl_alias}.meta_key = '{$meta_query[ "key" ]}' and {$tbl_alias}.meta_value {$meta_query[ "compare" ]} '{$meta_query[ "value" ]}' ) ";
61
  else
@@ -67,10 +74,10 @@ class RTMediaModel extends RTDBModel {
67
  $compare = 'IN';
68
  else
69
  $compare = $colvalue[ 'compare' ];
70
- if ( ! isset ( $colvalue[ 'value' ] ) ) {
71
- $colvalue[ 'value' ] = $colvalue;
72
- }
73
- $col_val_comapare = ($colvalue[ 'value' ]) ? '(\'' . implode ( "','", $colvalue[ 'value' ] ) . '\')' : '';
74
  $where .= " AND {$this->table_name}.{$colname} {$compare} {$col_val_comapare}";
75
  }
76
  else
@@ -165,6 +172,9 @@ class RTMediaModel extends RTDBModel {
165
  AND media_type <> 'album' AND context <> 'group') OR (media_author = $author_id ))
166
  AND media_type = 'album'
167
  AND (context <> 'group' or context is NULL) ";
 
 
 
168
  $where = apply_filters ( 'rtmedia-get-album-where-query', $where, $this->table_name );
169
  $qorder_by = " ORDER BY {$this->table_name}.$order_by ";
170
  $sql .= $where . $qorder_by ;
@@ -182,6 +192,10 @@ class RTMediaModel extends RTDBModel {
182
  if ( is_multisite () )
183
  $order_by = "blog_id" . (($order_by)? "," . $order_by :'');
184
  $sql = "SELECT * FROM {$this->table_name} WHERE id IN(SELECT DISTINCT (album_id) FROM {$this->table_name} WHERE context_id = $group_id AND album_id IS NOT NULL AND media_type != 'album' AND context = 'group') OR (media_type = 'album' AND context_id = $group_id AND context = 'group')";
 
 
 
 
185
  $sql .= " ORDER BY {$this->table_name}.$order_by";
186
 
187
  if ( is_integer ( $offset ) && is_integer ( $per_page ) ) {
@@ -206,6 +220,10 @@ class RTMediaModel extends RTDBModel {
206
  FROM
207
  {$this->table_name} WHERE 2=2 ";
208
 
 
 
 
 
209
  if ( $where_query ) {
210
  foreach ( $where_query as $colname => $colvalue ) {
211
  if ( strtolower ( $colname ) != "meta_query" ) {
@@ -239,7 +257,10 @@ class RTMediaModel extends RTDBModel {
239
 
240
  function get_other_album_count ( $profile_id, $context = "profile" ) {
241
  $global = RTMediaAlbum::get_globals ();
242
- $sql = "select distinct album_id from {$this->table_name} where 2=2 AND context = '{$context}' ";
 
 
 
243
  if ( is_array ( $global ) && count ( $global ) > 0 ) {
244
  $sql .= " and album_id in (";
245
  $sep = "";
8
  class RTMediaModel extends RTDBModel {
9
 
10
  function __construct () {
11
+ parent::__construct ( 'rtm_media', false, 10, true );
12
  $this->meta_table_name = "rt_rtm_media_meta";
13
  }
14
 
47
  $from = " FROM {$this->table_name} ";
48
  $join = "";
49
  $where = " where 2=2 ";
50
+ if( is_multisite() ) {
51
+ $where.= " AND {$this->table_name}.blog_id = '".get_current_blog_id()."' ";
52
+ }
53
  $temp = 65;
54
  foreach ( $columns as $colname => $colvalue ) {
55
  if ( strtolower ( $colname ) == "meta_query" ) {
58
  $meta_query[ "compare" ] = "=";
59
  }
60
  $tbl_alias = chr ( $temp ++ );
61
+ if(is_multisite() ) {
62
+ $join .= " LEFT JOIN {$wpdb->base_prefix}{$this->meta_table_name} as {$tbl_alias} ON {$this->table_name}.id = {$tbl_alias}.media_id ";
63
+ } else {
64
+ $join .= " LEFT JOIN {$wpdb->prefix}{$this->meta_table_name} as {$tbl_alias} ON {$this->table_name}.id = {$tbl_alias}.media_id ";
65
+ }
66
  if ( isset ( $meta_query[ "value" ] ) )
67
  $where .= " AND ({$tbl_alias}.meta_key = '{$meta_query[ "key" ]}' and {$tbl_alias}.meta_value {$meta_query[ "compare" ]} '{$meta_query[ "value" ]}' ) ";
68
  else
74
  $compare = 'IN';
75
  else
76
  $compare = $colvalue[ 'compare' ];
77
+
78
+ $tmpVal = isset ( $colvalue[ 'value' ] ) ? $colvalue[ 'value' ] : $colvalue;
79
+ $col_val_comapare = ( is_array( $tmpVal ) ) ? '(\'' . implode ( "','", $tmpVal ) . '\')' : '(\''.$tmpVal.'\')';
80
+
81
  $where .= " AND {$this->table_name}.{$colname} {$compare} {$col_val_comapare}";
82
  }
83
  else
172
  AND media_type <> 'album' AND context <> 'group') OR (media_author = $author_id ))
173
  AND media_type = 'album'
174
  AND (context <> 'group' or context is NULL) ";
175
+ if( is_multisite() ) {
176
+ $where.= " AND {$this->table_name}.blog_id = '".get_current_blog_id()."' ";
177
+ }
178
  $where = apply_filters ( 'rtmedia-get-album-where-query', $where, $this->table_name );
179
  $qorder_by = " ORDER BY {$this->table_name}.$order_by ";
180
  $sql .= $where . $qorder_by ;
192
  if ( is_multisite () )
193
  $order_by = "blog_id" . (($order_by)? "," . $order_by :'');
194
  $sql = "SELECT * FROM {$this->table_name} WHERE id IN(SELECT DISTINCT (album_id) FROM {$this->table_name} WHERE context_id = $group_id AND album_id IS NOT NULL AND media_type != 'album' AND context = 'group') OR (media_type = 'album' AND context_id = $group_id AND context = 'group')";
195
+
196
+ if( is_multisite() ) {
197
+ $sql.= " AND {$this->table_name}.blog_id = '".get_current_blog_id()."' ";
198
+ }
199
  $sql .= " ORDER BY {$this->table_name}.$order_by";
200
 
201
  if ( is_integer ( $offset ) && is_integer ( $per_page ) ) {
220
  FROM
221
  {$this->table_name} WHERE 2=2 ";
222
 
223
+ if ( is_multisite () ) {
224
+ $query.= " AND {$this->table_name}.blog_id = '".get_current_blog_id()."' ";
225
+ }
226
+
227
  if ( $where_query ) {
228
  foreach ( $where_query as $colname => $colvalue ) {
229
  if ( strtolower ( $colname ) != "meta_query" ) {
257
 
258
  function get_other_album_count ( $profile_id, $context = "profile" ) {
259
  $global = RTMediaAlbum::get_globals ();
260
+ $sql = "select distinct album_id from {$this->table_name} where 2=2 AND context = '{$context}' ";
261
+ if ( is_multisite () ) {
262
+ $sql.= " AND {$this->table_name}.blog_id = '".get_current_blog_id()."' ";
263
+ }
264
  if ( is_array ( $global ) && count ( $global ) > 0 ) {
265
  $sql .= " and album_id in (";
266
  $sep = "";
app/helper/RTMediaSettings.php CHANGED
@@ -147,7 +147,7 @@ if (!class_exists('RTMediaSettings')) {
147
  }
148
 
149
  public function allowed_types() {
150
- $allowed_types = get_site_option('upload_filetypes', 'jpg jpeg png gif');
151
  $allowed_types = explode(' ', $allowed_types);
152
  $allowed_types = implode(', ', $allowed_types);
153
  echo '<span class="description">' . sprintf(__('Currently your network allows uploading of the following file types. You can change the settings <a href="%s">here</a>.<br /><code>%s</code></span>', 'rtmedia'), network_admin_url('settings.php#upload_filetypes'), $allowed_types);
@@ -168,12 +168,12 @@ if (!class_exists('RTMediaSettings')) {
168
  if (isset($_POST['refresh-count'])) {
169
  if ($rtmedia_admin->update_count()) {
170
  if (is_multisite())
171
- update_site_option('rtm-recount-success', __('Recounting of media files done successfully', 'rtmedia'));
172
  else
173
  add_settings_error(__('Recount Success', 'rtmedia'), 'rtm-recount-success', __('Recounting of media files done successfully', 'rtmedia'), 'updated');
174
  } else {
175
  if (is_multisite())
176
- update_site_option('rtm-recount-fail', __('Recounting Failed', 'rtmedia'));
177
  else
178
  add_settings_error(__('Recount Fail', 'rtmedia'), 'rtm-recount-fail', __('Recounting Failed', 'rtmedia'));
179
  }
@@ -187,7 +187,7 @@ if (!class_exists('RTMediaSettings')) {
187
  // }
188
  if (!isset($_POST['rtmedia_options']['videos_enabled']) && !isset($_POST['rtmedia_options']['audio_enabled']) && !isset($_POST['rtmedia_options']['images_enabled'])) {
189
  if (is_multisite())
190
- update_site_option('rtm-media-type', __('Atleast one Media Type Must be selected', 'rtmedia'));
191
  else
192
  add_settings_error(__('Media Type', 'rtmedia'), 'rtm-media-type', __('Atleast one Media Type Must be selected', 'rtmedia'));
193
  $input['images_enabled'] = 1;
@@ -196,13 +196,13 @@ if (!class_exists('RTMediaSettings')) {
196
  $input['default_count'] = intval($_POST['rtmedia_options']['default_count']);
197
  if (!is_int($input['default_count']) || ($input['default_count'] < 0 ) || empty($input['default_count'])) {
198
  if (is_multisite())
199
- update_site_option('rtm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'rtmedia'));
200
  else
201
  add_settings_error(__('Default Count', 'rtmedia'), 'rtm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'rtmedia'));
202
  $input['default_count'] = 10;
203
  }
204
  if (is_multisite())
205
- update_site_option('rtm-settings-saved', __('Settings saved.', 'rtmedia'));
206
  do_action('rtmedia_sanitize_settings', $_POST, $input);
207
  return $input;
208
  }
147
  }
148
 
149
  public function allowed_types() {
150
+ $allowed_types = rtmedia_get_site_option('upload_filetypes', 'jpg jpeg png gif');
151
  $allowed_types = explode(' ', $allowed_types);
152
  $allowed_types = implode(', ', $allowed_types);
153
  echo '<span class="description">' . sprintf(__('Currently your network allows uploading of the following file types. You can change the settings <a href="%s">here</a>.<br /><code>%s</code></span>', 'rtmedia'), network_admin_url('settings.php#upload_filetypes'), $allowed_types);
168
  if (isset($_POST['refresh-count'])) {
169
  if ($rtmedia_admin->update_count()) {
170
  if (is_multisite())
171
+ rtmedia_update_site_option('rtm-recount-success', __('Recounting of media files done successfully', 'rtmedia'));
172
  else
173
  add_settings_error(__('Recount Success', 'rtmedia'), 'rtm-recount-success', __('Recounting of media files done successfully', 'rtmedia'), 'updated');
174
  } else {
175
  if (is_multisite())
176
+ rtmedia_update_site_option('rtm-recount-fail', __('Recounting Failed', 'rtmedia'));
177
  else
178
  add_settings_error(__('Recount Fail', 'rtmedia'), 'rtm-recount-fail', __('Recounting Failed', 'rtmedia'));
179
  }
187
  // }
188
  if (!isset($_POST['rtmedia_options']['videos_enabled']) && !isset($_POST['rtmedia_options']['audio_enabled']) && !isset($_POST['rtmedia_options']['images_enabled'])) {
189
  if (is_multisite())
190
+ rtmedia_update_site_option('rtm-media-type', __('Atleast one Media Type Must be selected', 'rtmedia'));
191
  else
192
  add_settings_error(__('Media Type', 'rtmedia'), 'rtm-media-type', __('Atleast one Media Type Must be selected', 'rtmedia'));
193
  $input['images_enabled'] = 1;
196
  $input['default_count'] = intval($_POST['rtmedia_options']['default_count']);
197
  if (!is_int($input['default_count']) || ($input['default_count'] < 0 ) || empty($input['default_count'])) {
198
  if (is_multisite())
199
+ rtmedia_update_site_option('rtm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'rtmedia'));
200
  else
201
  add_settings_error(__('Default Count', 'rtmedia'), 'rtm-media-default-count', __('"Number of media" count value should be numeric and greater than 0.', 'rtmedia'));
202
  $input['default_count'] = 10;
203
  }
204
  if (is_multisite())
205
+ rtmedia_update_site_option('rtm-settings-saved', __('Settings saved.', 'rtmedia'));
206
  do_action('rtmedia_sanitize_settings', $_POST, $input);
207
  return $input;
208
  }
app/helper/RTMediaSupport.php CHANGED
@@ -178,7 +178,7 @@ if (!class_exists('RTMediaSupport')) {
178
  public function get_plugin_info() {
179
  $active_plugins = (array) get_option( 'active_plugins', array() );
180
  if ( is_multisite() ) {
181
- $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
182
  }
183
  $rtmedia_plugins = array();
184
  foreach ( $active_plugins as $plugin ) {
@@ -252,7 +252,7 @@ if (!class_exists('RTMediaSupport')) {
252
  $debug_info['Template Overrides'] = implode( ', <br/>', $this->rtmedia_scan_template_files(RTMEDIA_PATH . "/templates/") );
253
 
254
  $rtMedia_model = new RTMediaModel();
255
- $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} group by media_type";
256
  global $wpdb;
257
  $results = $wpdb->get_results ( $sql );
258
  if ( $results ) {
@@ -287,7 +287,7 @@ if (!class_exists('RTMediaSupport')) {
287
  }
288
 
289
  public function migration_html($page = '') {
290
- $pending_rtmedia_migrate = get_site_option ( "rtMigration-pending-count" );
291
 
292
  $content = " ";
293
  $flag = true;
178
  public function get_plugin_info() {
179
  $active_plugins = (array) get_option( 'active_plugins', array() );
180
  if ( is_multisite() ) {
181
+ $active_plugins = array_merge( $active_plugins, rtmedia_get_site_option( 'active_sitewide_plugins', array() ) );
182
  }
183
  $rtmedia_plugins = array();
184
  foreach ( $active_plugins as $plugin ) {
252
  $debug_info['Template Overrides'] = implode( ', <br/>', $this->rtmedia_scan_template_files(RTMEDIA_PATH . "/templates/") );
253
 
254
  $rtMedia_model = new RTMediaModel();
255
+ $sql = "select media_type, count(id) as count from {$rtMedia_model->table_name} where blog_id = '".get_current_blog_id()."' group by media_type";
256
  global $wpdb;
257
  $results = $wpdb->get_results ( $sql );
258
  if ( $results ) {
287
  }
288
 
289
  public function migration_html($page = '') {
290
+ $pending_rtmedia_migrate = rtmedia_get_site_option ( "rtMigration-pending-count" );
291
 
292
  $content = " ";
293
  $flag = true;
app/helper/db/RTDBModel.php CHANGED
@@ -4,165 +4,182 @@
4
  * Description of RTDBModel
5
  * Base class for any Database Model like Media, Album etc.
6
  *
7
- * @author faishal
8
  */
9
- class RTDBModel {
10
-
11
- /**
12
- *
13
- * @var type
14
- *
15
- * $table_name - database table linked to the model.
16
- * All the queries will be fired on that table or with the join in this table.
17
- * $per_page - number of rows per page to be displayed
18
- */
19
- public $table_name;
20
- public $per_page;
21
-
22
- /**
23
- *
24
- * @param string $table_name Table name for model
25
- * @param boolean $withprefix Set true if $tablename is with prefix otherwise it will prepend wordpress prefix with "rt_"
26
- */
27
- function __construct($table_name, $withprefix = false, $per_page = 10) {
28
- $this->set_table_name($table_name, $withprefix);
29
- $this->set_per_page($per_page);
30
- }
31
 
32
- /**
33
- *
34
- * @global type $wpdb
35
- * @param string $table_name
36
- * @param type $withprefix
37
- */
38
- public function set_table_name($table_name, $withprefix = false) {
39
- global $wpdb;
40
- if (!$withprefix) {
41
- $table_name = $wpdb->prefix . "rt_" . $table_name;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
- $this->table_name = $table_name;
44
- }
45
 
46
- /**
47
- * set number of rows per page for pagination
48
- * @param type $per_page
49
- */
50
- public function set_per_page($per_page) {
51
- $this->per_page = $per_page;
52
- }
53
-
54
- /**
55
- * Magic Method for getting DB rows by particular column.
56
- * E.g., get_by_<columnName>(params)
57
- * @global type $wpdb
58
- * @param type $name - Added get_by_<coulmname>(value,pagging=true,page_no=1)
59
- * @param type $arguments
60
- * @return type result array
61
- */
62
- function __call($name, $arguments) {
63
- $column_name = str_replace("get_by_", "", strtolower($name));
64
- $paging = false;
65
- $page = 1;
66
- if ($arguments && !empty($arguments)) {
67
- if (!isset($arguments[1])) {
68
- $paging = true;
69
- } else {
70
- $paging = $arguments[1];
71
  }
 
 
 
 
 
 
 
 
 
 
72
 
73
- if (!isset($arguments[2])) {
74
- $page = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  } else {
76
- $page = $arguments[2];
77
  }
 
78
 
79
- $this->per_page = apply_filters("rt_db_model_per_page", $this->per_page, $this->table_name);
80
- $return_array = Array();
81
- $return_array["result"] = false;
 
 
 
 
82
  global $wpdb;
83
- $return_array["total"] = intval($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $this->table_name . " WHERE {$column_name} = %s", $arguments[0])));
84
- if ($return_array["total"] > 0) {
85
- $other = "";
86
- if ($paging) {
87
- $offset = ($page - 1) * $this->per_page;
88
- if ($offset <= $return_array["total"]) {
89
- $other = " LIMIT " . $offset . "," . $this->per_page;
90
- }else{
91
- return false;
92
- }
93
- }
94
- //echo $wpdb->prepare("SELECT * FROM " . $this->table_name . " WHERE {$column_name} = %s {$other}", $arguments[0]);
95
- $return_array["result"] = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $this->table_name . " WHERE {$column_name} = %s {$other}", $arguments[0]), ARRAY_A);
96
  }
97
- return $return_array;
98
- } else {
99
- return false;
100
- }
101
- }
102
 
103
- /**
104
- *
105
- * @global type $wpdb
106
- * @param type $row
107
- * @return type
108
- */
109
- function insert($row) {
110
- global $wpdb;
111
- $insertdata =array();
112
- foreach($row as $key=>$val){
113
- if($val != NULL)
114
- $insertdata[$key]=$val;
115
  }
116
-
117
- $wpdb->insert($this->table_name, $insertdata);
118
- return $wpdb->insert_id;
119
- }
120
 
121
- /**
122
- *
123
- * @global type $wpdb
124
- * @param type $data
125
- * @param type $where
126
- */
127
- function update($data, $where) {
128
- global $wpdb;
129
- return $wpdb->update($this->table_name, $data, $where);
130
- }
131
 
132
- /**
133
- * Get all the rows according to the columns set in $columns parameter.
134
- * offset and rows per page can also be passed for pagination.
135
- * @global type $wpdb
136
- * @param type $columns
137
- * @return type
138
- */
139
- function get($columns, $offset=false, $per_page=false, $order_by= 'id desc') {
140
- $select = "SELECT * FROM {$this->table_name}";
141
- $where = " where 2=2 " ;
142
- foreach ($columns as $colname => $colvalue) {
 
 
 
 
 
 
 
 
 
 
 
143
  $where .= " AND {$this->table_name}.{$colname} = '{$colvalue}'";
144
- }
145
- $sql = $select . $where ;
 
146
 
147
- $sql .= " ORDER BY {$this->table_name}.$order_by";
148
 
149
- if(is_integer($offset) && is_integer($per_page)) {
150
- $sql .= ' LIMIT ' . $offset . ',' . $per_page;
151
- }
152
- global $wpdb;
153
- return $wpdb->get_results($sql);
154
- }
155
 
156
- /**
157
- *
158
- * @global type $wpdb
159
- * @param type $where
160
- * @return type
161
- */
162
- function delete($where) {
163
- global $wpdb;
164
- return $wpdb->delete($this->table_name, $where);
165
- }
166
 
167
 
 
168
  }
4
  * Description of RTDBModel
5
  * Base class for any Database Model like Media, Album etc.
6
  *
7
+ * @author udit
8
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ if(!class_exists('RTDBModel')) {
11
+ class RTDBModel {
12
+
13
+ /**
14
+ *
15
+ * @var type
16
+ *
17
+ * $table_name - database table linked to the model.
18
+ * All the queries will be fired on that table or with the join in this table.
19
+ * $per_page - number of rows per page to be displayed
20
+ */
21
+ public $table_name;
22
+ public $per_page;
23
+ public $mu_single_table;
24
+
25
+ /**
26
+ *
27
+ * @param string $table_name Table name for model
28
+ * @param boolean $withprefix Set true if $tablename is with prefix otherwise it will prepend wordpress prefix with "rt_"
29
+ */
30
+ function __construct($table_name, $withprefix = false, $per_page = 10, $mu_single_table = false ) {
31
+ $this->mu_single_table = $mu_single_table;
32
+ $this->set_table_name($table_name, $withprefix);
33
+ $this->set_per_page($per_page);
34
  }
 
 
35
 
36
+ /**
37
+ *
38
+ * @global type $wpdb
39
+ * @param string $table_name
40
+ * @param type $withprefix
41
+ */
42
+ public function set_table_name( $table_name, $withprefix = false ) {
43
+ global $wpdb;
44
+ if (!$withprefix) {
45
+ $table_name = ( ( $this->mu_single_table ) ? $wpdb->base_prefix : $wpdb->prefix ) . "rt_" . $table_name;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
+ $this->table_name = $table_name;
48
+ }
49
+
50
+ /**
51
+ * set number of rows per page for pagination
52
+ * @param type $per_page
53
+ */
54
+ public function set_per_page($per_page) {
55
+ $this->per_page = $per_page;
56
+ }
57
 
58
+ /**
59
+ * Magic Method for getting DB rows by particular column.
60
+ * E.g., get_by_<columnName>(params)
61
+ * @global type $wpdb
62
+ * @param type $name - Added get_by_<coulmname>(value,pagging=true,page_no=1)
63
+ * @param type $arguments
64
+ * @return type result array
65
+ */
66
+ function __call($name, $arguments) {
67
+ $column_name = str_replace("get_by_", "", strtolower($name));
68
+ $paging = false;
69
+ $page = 1;
70
+ if ($arguments && !empty($arguments)) {
71
+ if (!isset($arguments[1])) {
72
+ $paging = true;
73
+ } else {
74
+ $paging = $arguments[1];
75
+ }
76
+
77
+ if (!isset($arguments[2])) {
78
+ $page = 1;
79
+ } else {
80
+ $page = $arguments[2];
81
+ }
82
+
83
+ $this->per_page = apply_filters("rt_db_model_per_page", $this->per_page, $this->table_name);
84
+ $return_array = Array();
85
+ $return_array["result"] = false;
86
+ global $wpdb;
87
+ $return_array["total"] = intval($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $this->table_name . " WHERE {$column_name} = %s", $arguments[0])));
88
+ if ($return_array["total"] > 0) {
89
+ $other = "";
90
+ if ($paging) {
91
+ $offset = ($page - 1) * $this->per_page;
92
+ if ($offset <= $return_array["total"]) {
93
+ $other = " LIMIT " . $offset . "," . $this->per_page;
94
+ }else{
95
+ return false;
96
+ }
97
+ }
98
+ //echo $wpdb->prepare("SELECT * FROM " . $this->table_name . " WHERE {$column_name} = %s {$other}", $arguments[0]);
99
+ $return_array["result"] = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $this->table_name . " WHERE {$column_name} = %s {$other}", $arguments[0]), ARRAY_A);
100
+ }
101
+ return $return_array;
102
  } else {
103
+ return false;
104
  }
105
+ }
106
 
107
+ /**
108
+ *
109
+ * @global type $wpdb
110
+ * @param type $row
111
+ * @return type
112
+ */
113
+ function insert($row) {
114
  global $wpdb;
115
+ $insertdata =array();
116
+ foreach($row as $key=>$val){
117
+ if($val != NULL)
118
+ $insertdata[$key]=$val;
 
 
 
 
 
 
 
 
 
119
  }
 
 
 
 
 
120
 
121
+ $wpdb->insert($this->table_name, $insertdata);
122
+ return $wpdb->insert_id;
 
 
 
 
 
 
 
 
 
 
123
  }
 
 
 
 
124
 
125
+ /**
126
+ *
127
+ * @global type $wpdb
128
+ * @param type $data
129
+ * @param type $where
130
+ */
131
+ function update($data, $where) {
132
+ global $wpdb;
133
+ return $wpdb->update($this->table_name, $data, $where);
134
+ }
135
 
136
+ /**
137
+ * Get all the rows according to the columns set in $columns parameter.
138
+ * offset and rows per page can also be passed for pagination.
139
+ * @global type $wpdb
140
+ * @param type $columns
141
+ * @return type
142
+ */
143
+ function get($columns, $offset=false, $per_page=false, $order_by= 'id desc') {
144
+ $select = "SELECT * FROM {$this->table_name}";
145
+ $where = " where 2=2 " ;
146
+ foreach ($columns as $colname => $colvalue) {
147
+ if ( is_array ( $colvalue ) ) {
148
+ if ( ! isset ( $colvalue[ 'compare' ] ) )
149
+ $compare = 'IN';
150
+ else
151
+ $compare = $colvalue[ 'compare' ];
152
+ if ( ! isset ( $colvalue[ 'value' ] ) ) {
153
+ $colvalue[ 'value' ] = $colvalue;
154
+ }
155
+ $col_val_comapare = ($colvalue[ 'value' ]) ? '(\'' . implode ( "','", $colvalue[ 'value' ] ) . '\')' : '';
156
+ $where .= " AND {$this->table_name}.{$colname} {$compare} {$col_val_comapare}";
157
+ } else {
158
  $where .= " AND {$this->table_name}.{$colname} = '{$colvalue}'";
159
+ }
160
+ }
161
+ $sql = $select . $where ;
162
 
163
+ $sql .= " ORDER BY {$this->table_name}.$order_by";
164
 
165
+ if(is_integer($offset) && is_integer($per_page)) {
166
+ $sql .= ' LIMIT ' . $offset . ',' . $per_page;
167
+ }
168
+ global $wpdb;
169
+ return $wpdb->get_results($sql);
170
+ }
171
 
172
+ /**
173
+ *
174
+ * @global type $wpdb
175
+ * @param type $where
176
+ * @return type
177
+ */
178
+ function delete($where) {
179
+ global $wpdb;
180
+ return $wpdb->delete($this->table_name, $where);
181
+ }
182
 
183
 
184
+ }
185
  }
app/helper/db/RTDBUpdate.php CHANGED
@@ -3,89 +3,126 @@
3
  /**
4
  * Description of RTDBUpdate
5
  * Required : rt_plugin_info.php
6
- * @author faishal
 
7
  */
8
- class RTDBUpdate {
9
-
10
- /**
11
- *
12
- * @var type String
13
- */
14
- public $db_version;
15
- public $install_db_version;
16
- public $schema_path = '/../../schema/';
17
- public $db_version_option_name;
18
- public $rt_plugin_info;
19
-
20
- /**
21
- * Set db current and installed version and also plugin info in rt_plugin_info variable.
22
- *
23
- * @param type string $current_version Optional if not defined then will use plugin version
24
- */
25
- public function __construct ( $current_version = false ) {
26
- $this->rt_plugin_info = new rt_plugin_info ( RTMEDIA_PATH . 'index.php' );
27
- if ( $current_version == false ) {
28
- $current_version = $this->rt_plugin_info->version;
29
- }
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- $this->db_version = $current_version;
33
- $this->db_version_option_name = $this->get_db_version_option_name ();
34
- $this->install_db_version = $this->get_install_db_version ();
35
- }
 
36
 
37
- public function create_table ( $sql ) {
38
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
39
- dbDelta ( $sql );
40
- }
41
 
42
- public function get_db_version_option_name () {
43
- return strtoupper ( "RT_" . str_replace ( "-", "_", sanitize_title ( $this->rt_plugin_info->name ) ) . "_DB_VERSIONS" );
44
- }
 
 
 
 
 
45
 
46
- public function get_install_db_version () {
47
- return get_site_option ( $this->db_version_option_name, "0.0" );
48
- }
 
49
 
50
- public function check_upgrade () {
51
- return version_compare ( $this->db_version, $this->install_db_version, '>' );
52
- }
53
 
54
- public function do_upgrade () {
55
- if ( version_compare ( $this->db_version, $this->install_db_version, '>' ) ) {
56
- do_action ( "rt_db_upgrade" );
57
- $path = realpath ( dirname ( __FILE__ ) . $this->schema_path );
58
- if ( $handle = opendir ( $path ) ) {
59
- while ( false !== ($entry = readdir ( $handle )) ) {
60
- if ( $entry != "." && $entry != ".." ) {
61
- if ( strpos ( $entry, ".schema" ) !== false && file_exists ( $path . "/" . $entry ) ) {
62
- $this->create_table ( $this->genrate_sql ( $entry, file_get_contents ( $path . "/" . $entry ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  }
 
 
 
 
 
 
65
  }
66
- closedir ( $handle );
67
  }
68
- update_site_option ( $this->db_version_option_name, $this->db_version );
69
  }
70
- }
71
 
72
- static function table_exists ( $table ) {
73
- global $wpdb;
74
 
75
- if ( $wpdb->query ( "SHOW TABLES LIKE '" . $table . "'" ) == 1 ) {
76
- return true;
 
 
 
77
  }
78
 
79
- return false;
80
- }
 
81
 
82
- public function genrate_sql ( $file_name, $file_content ) {
83
- return sprintf ( $file_content, $this->genrate_table_name ( $file_name ) );
84
- }
 
85
 
86
- public function genrate_table_name ( $file_name ) {
87
- global $wpdb;
88
- return $wpdb->prefix . "rt_" . str_replace ( ".schema", "", strtolower ( $file_name ) );
89
  }
90
 
91
- }
3
  /**
4
  * Description of RTDBUpdate
5
  * Required : rt_plugin_info.php
6
+ * @author udit
7
+ * version 1.1
8
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ if ( !class_exists( 'RTDBUpdate' ) ) {
11
+ class RTDBUpdate {
12
+ /**
13
+ *
14
+ * @var type String
15
+ */
16
+ public $db_version;
17
+ public $install_db_version;
18
+ public $schema_path;
19
+ public $plugin_path;
20
+ public $db_version_option_name;
21
+ public $rt_plugin_info;
22
+ public $mu_single_table;
23
+
24
+ /**
25
+ * Set db current and installed version and also plugin info in rt_plugin_info variable.
26
+ *
27
+ * @param type string $current_version Optional if not defined then will use plugin version
28
+ */
29
+ public function __construct($current_version = false, $plugin_path = false, $schema_path = false, $mu_single_table = false) {
30
+
31
+ if ($schema_path != false) {
32
+ $this->schema_path = $schema_path;
33
+ } else {
34
+ $this->schema_path = realpath(dirname(__FILE__) . $this->schema_path);
35
+ }
36
 
37
+ if ($plugin_path != false) {
38
+ $this->plugin_path = $plugin_path;
39
+ } else {
40
+ $this->plugin_path = realpath(dirname(__FILE__) . $this->plugin_path);
41
+ }
42
 
43
+ $this->mu_single_table = $mu_single_table;
 
 
 
44
 
45
+ $this->rt_plugin_info = new rt_plugin_info($this->plugin_path);
46
+ if ($current_version == false) {
47
+ $current_version = $this->rt_plugin_info->version;
48
+ }
49
+ $this->db_version = $current_version;
50
+ $this->db_version_option_name = $this->get_db_version_option_name();
51
+ $this->install_db_version = $this->get_install_db_version();
52
+ }
53
 
54
+ public function create_table($sql) {
55
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
56
+ dbDelta($sql);
57
+ }
58
 
59
+ public function get_db_version_option_name() {
60
+ return strtoupper("RT_" . str_replace("-", "_", sanitize_title($this->rt_plugin_info->name)) . "_DB_VERSIONS");
61
+ }
62
 
63
+ public function get_install_db_version() {
64
+ return ( $this->mu_single_table ) ? get_site_option($this->db_version_option_name, "0.0") : get_option($this->db_version_option_name, "0.0");
65
+ }
66
+
67
+ public function check_upgrade() {
68
+ return version_compare($this->db_version, $this->install_db_version, '>');
69
+ }
70
+
71
+ public function do_upgrade() {
72
+ global $wpdb;
73
+ if (version_compare($this->db_version, $this->install_db_version, '>')) {
74
+ $path = $this->schema_path;
75
+ if ($handle = opendir($path)) {
76
+ while (false !== ($entry = readdir($handle))) {
77
+ if ($entry != "." && $entry != "..") {
78
+ if (strpos($entry, ".schema") !== false && file_exists($path . "/" . $entry)) {
79
+ if( is_multisite() ) {
80
+ $table_name = str_replace( ".schema", "", strtolower( $entry ) );
81
+ $check_table = "SHOW TABLES LIKE '%rt_" . $table_name."'";
82
+ $check_res = $wpdb->get_results( $check_table , ARRAY_N);
83
+ if( $check_res && sizeof($check_res) > 0 && is_array($check_res) && isset($check_res[0][0]) ) {
84
+ $tb_name = $check_res[0][0];
85
+ $table_name = ( ( $this->mu_single_table ) ? $wpdb->base_prefix : $wpdb->prefix ) . "rt_" . $table_name;
86
+ if( $tb_name != $table_name ) {
87
+ $alter_sql = "ALTER TABLE ".$tb_name." RENAME TO ".$table_name;
88
+ $wpdb->query($alter_sql);
89
+ }
90
+ }
91
+ }
92
+ $this->create_table($this->genrate_sql($entry, file_get_contents($path . "/" . $entry)));
93
+ }
94
  }
95
  }
96
+ closedir($handle);
97
+ }
98
+ if ($this->mu_single_table) {
99
+ update_site_option($this->db_version_option_name, $this->db_version);
100
+ } else {
101
+ update_option($this->db_version_option_name, $this->db_version);
102
  }
103
+ do_action("rt_db_upgrade");
104
  }
 
105
  }
 
106
 
107
+ static function table_exists($table) {
108
+ global $wpdb;
109
 
110
+ if ($wpdb->query("SHOW TABLES LIKE '" . $table . "'") == 1) {
111
+ return true;
112
+ }
113
+
114
+ return false;
115
  }
116
 
117
+ public function genrate_sql($file_name, $file_content) {
118
+ return sprintf($file_content, $this->genrate_table_name($file_name));
119
+ }
120
 
121
+ public function genrate_table_name($file_name) {
122
+ global $wpdb;
123
+ return ( ( $this->mu_single_table ) ? $wpdb->base_prefix : $wpdb->prefix ) . "rt_" . str_replace(".schema", "", strtolower($file_name));
124
+ }
125
 
 
 
 
126
  }
127
 
128
+ }
app/helper/db/rt_plugin_info.php CHANGED
@@ -3,53 +3,57 @@
3
  /**
4
  * Description of rt_plugin_info
5
  *
6
- * @author faishal
7
  */
8
- class rt_plugin_info {
9
-
10
- //put your code here
11
- public $plugin_path;
12
- public $name; //'Name' - Name of the plugin, must be unique.
13
- public $title; //'Title' - Title of the plugin and the link to the plugin's web site.
14
- public $desctipriton; //'Description' - Description of what the plugin does and/or notes from the author.
15
- public $authro; //'Author' - The author's name
16
- public $authoruri; //'AuthorURI' - The authors web site address.
17
- public $version; //'Version' - The plugin version number.
18
- public $pluginuri; //'PluginURI' - Plugin web site address.
19
- public $textdomain; //'TextDomain' - Plugin's text domain for localization.
20
- public $domain_path; //'DomainPath' - Plugin's relative directory path to .mo files.
21
- public $network; //'Network' - Boolean. Whether the plugin can only be activated network wide.
22
- public $plugin_data;
23
-
24
- public function __construct($path = NULL) {
25
- $this->set_current_plugin_path($path);
26
- $this->set_plugin_data();
27
- }
28
 
29
- function get_plugin_data() {
30
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
31
- return @get_plugin_data($this->plugin_path);
32
- }
33
 
34
- function set_plugin_data() {
35
- $this->plugin_data = $this->get_plugin_data();
36
- $this->name = $this->plugin_data["Name"];
37
- $this->title = $this->plugin_data["Title"];
38
- $this->desctipriton = $this->plugin_data["Description"];
39
- $this->author = $this->plugin_data["Author"];
40
- $this->authoruri = $this->plugin_data["AuthorURI"];
41
- $this->version = $this->plugin_data["Version"];
42
- $this->pluginuri = $this->plugin_data["PluginURI"];
43
- $this->textdomain = $this->plugin_data["TextDomain"];
44
- $this->domain_path = $this->plugin_data["DomainPath"];
45
- $this->network = $this->plugin_data["Network"];
46
- }
47
 
48
- function set_current_plugin_path($path) {
49
- if ($path != NULL)
50
- $this->plugin_path = $path;
51
- else
52
- $this->plugin_path = realpath(plugin_dir_path(__FILE__) . "../../index.php");
53
- }
 
 
 
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
 
3
  /**
4
  * Description of rt_plugin_info
5
  *
6
+ * @author udit
7
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ if(!class_exists('rt_plugin_info')) {
10
+ class rt_plugin_info {
 
 
11
 
12
+ //put your code here
13
+ public $plugin_path;
14
+ public $name; //'Name' - Name of the plugin, must be unique.
15
+ public $title; //'Title' - Title of the plugin and the link to the plugin's web site.
16
+ public $desctipriton; //'Description' - Description of what the plugin does and/or notes from the author.
17
+ public $authro; //'Author' - The author's name
18
+ public $authoruri; //'AuthorURI' - The authors web site address.
19
+ public $version; //'Version' - The plugin version number.
20
+ public $pluginuri; //'PluginURI' - Plugin web site address.
21
+ public $textdomain; //'TextDomain' - Plugin's text domain for localization.
22
+ public $domain_path; //'DomainPath' - Plugin's relative directory path to .mo files.
23
+ public $network; //'Network' - Boolean. Whether the plugin can only be activated network wide.
24
+ public $plugin_data;
25
 
26
+ public function __construct($path = NULL) {
27
+ $this->set_current_plugin_path($path);
28
+ $this->set_plugin_data();
29
+ }
30
+
31
+ function get_plugin_data() {
32
+ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
33
+ return @get_plugin_data($this->plugin_path);
34
+ }
35
 
36
+ function set_plugin_data() {
37
+ $this->plugin_data = $this->get_plugin_data();
38
+ $this->name = $this->plugin_data["Name"];
39
+ $this->title = $this->plugin_data["Title"];
40
+ $this->desctipriton = $this->plugin_data["Description"];
41
+ $this->author = $this->plugin_data["Author"];
42
+ $this->authoruri = $this->plugin_data["AuthorURI"];
43
+ $this->version = $this->plugin_data["Version"];
44
+ $this->pluginuri = $this->plugin_data["PluginURI"];
45
+ $this->textdomain = $this->plugin_data["TextDomain"];
46
+ $this->domain_path = $this->plugin_data["DomainPath"];
47
+ $this->network = $this->plugin_data["Network"];
48
+ }
49
+
50
+ function set_current_plugin_path($path) {
51
+ if ($path != NULL)
52
+ $this->plugin_path = $path;
53
+ else
54
+ $this->plugin_path = realpath(plugin_dir_path(__FILE__) . "../../index.php");
55
+ }
56
+
57
+ }
58
  }
59
+
app/importers/RTMediaMigration.php CHANGED
@@ -20,13 +20,13 @@ class RTMediaMigration {
20
  $this->hide_migration_notice ();
21
  wp_safe_redirect ( $_SERVER[ "HTTP_REFERER" ] );
22
  }
23
- if ( get_site_option ( "rt_migration_hide_notice" ) !== false )
24
  return true;
25
 
26
  if ( isset ( $_REQUEST[ "force" ] ) && $_REQUEST[ "force" ] === "true" )
27
  $pending = false;
28
  else
29
- $pending = get_site_option ( "rtMigration-pending-count" );
30
 
31
  if ( $pending === false ) {
32
  $total = $this->get_total_count ();
@@ -34,7 +34,7 @@ class RTMediaMigration {
34
  $pending = $total - $done;
35
  if ( $pending < 0 )
36
  $pending = 0;
37
- update_site_option ( "rtMigration-pending-count", $pending );
38
  }
39
  if ( $pending > 0 ) {
40
  if ( ! (isset ( $_REQUEST[ "page" ] ) && $_REQUEST[ "page" ] == "rtmedia-migration") )
@@ -43,11 +43,11 @@ class RTMediaMigration {
43
  }
44
 
45
  function hide_migration_notice () {
46
- update_site_option ( "rt_migration_hide_notice", true );
47
  }
48
 
49
  function migrate_image_size_fix () {
50
- if ( get_site_option ( "rt_image_size_migration_fix", "" ) == "" ) {
51
  global $wpdb;
52
  $sql = $wpdb->prepare ( "update $wpdb->postmeta set meta_value=replace(meta_value ,%s,%s) where meta_key = '_wp_attachment_metadata';", "bp_media", "rt_media" );
53
  $wpdb->get_row ( $sql );
@@ -144,7 +144,7 @@ class RTMediaMigration {
144
  }
145
 
146
  function get_last_imported () {
147
- $album = get_site_option ( "rtmedia-global-albums" );
148
  $album_id = $album[ 0 ];
149
 
150
  global $wpdb;
@@ -185,7 +185,7 @@ class RTMediaMigration {
185
  $media_count = $wpdb->get_var ( $wpdb->prepare ( $sql, get_current_blog_id () ) );
186
  if ( $flag )
187
  return $media_count - 1;
188
- $state = intval ( get_site_option ( "rtmedia-migration", "0" ) );
189
  if ( $state == 5 ) {
190
  $album_count = intval ( $_SESSION[ "migration_user_album" ] );
191
  $album_count += (isset ( $_SESSION[ "migration_group_album" ] )) ? intval ( $_SESSION[ "migration_group_album" ] ) : 0;
@@ -237,7 +237,7 @@ class RTMediaMigration {
237
  //Call flush_rules() as a method of the $wp_rewrite object
238
  $wp_rewrite->flush_rules ( true );
239
  }
240
- update_site_option ( "rtMigration-pending-count", $pending );
241
  $pending_time = $this->formatSeconds ( $pending );
242
 
243
  echo json_encode ( array( "status" => true, "done" => $done, "total" => $total, "pending" => $pending_time ) );
@@ -245,8 +245,8 @@ class RTMediaMigration {
245
  }
246
 
247
  function manage_album () {
248
- $album = get_site_option ( "rtmedia-global-albums" );
249
- $stage = intval ( get_site_option ( "rtmedia-migration", "0" ) );
250
 
251
  $album_rt_id = $album[ 0 ];
252
 
@@ -279,7 +279,7 @@ class RTMediaMigration {
279
  }
280
  $wpdb->query ( $sql_group );
281
  $stage = 1;
282
- update_site_option ( "rtmedia-migration", $stage );
283
  $this->return_migration ();
284
  }
285
  if ( $stage < 2 ) {
@@ -297,7 +297,7 @@ class RTMediaMigration {
297
  if ( count ( $results ) < 10 ) {
298
  $stage = 2;
299
  }
300
- update_site_option ( "rtmedia-migration", $stage );
301
  $this->return_migration ();
302
  }
303
  if ( $stage < 3 ) {
@@ -321,11 +321,11 @@ class RTMediaMigration {
321
  } else {
322
  $stage = 3;
323
  }
324
- update_site_option ( "rtmedia-migration", $stage );
325
  $this->return_migration ();
326
  } else {
327
  $stage = 3;
328
- update_site_option ( "rtmedia-migration", $stage );
329
  $this->return_migration ();
330
  }
331
  }
@@ -333,7 +333,7 @@ class RTMediaMigration {
333
 
334
  $sql = "update $wpdb->posts set post_type='{$album_post_type}' where post_type='bp_media_album'";
335
  if ( $wpdb->query ( $sql ) !== false ) {
336
- update_site_option ( "rtmedia-migration", "5" );
337
  return true;
338
  }
339
  return false;
@@ -341,7 +341,7 @@ class RTMediaMigration {
341
 
342
  function test () {
343
  if ( ! $this->table_exists ( $this->bmp_table ) ) {
344
- $obj = new RTDBUpdate();
345
  $obj->install_db_version = "0";
346
  $obj->do_upgrade ( true );
347
  }
@@ -466,7 +466,7 @@ class RTMediaMigration {
466
  if ( ! isset ( $_SESSION[ "migration_media" ] ) )
467
  $this->get_total_count ();
468
 
469
- $state = intval ( get_site_option ( "rtmedia-migration" ) );
470
  if ( $state < 5 ) {
471
  if ( $this->manage_album () ) {
472
  $this->migrate_encoding_options ();
@@ -543,8 +543,8 @@ class RTMediaMigration {
543
  'bp_media_kaltura_options' => 'rtmedia-kaltura-options',
544
  );
545
  foreach ( $encoding_mnigration_array as $key => $ma ) {
546
- if ( ($value = get_site_option ( $key )) !== false ) {
547
- update_site_option ( $ma, $value );
548
  }
549
  }
550
  }
@@ -773,7 +773,7 @@ class RTMediaMigration {
773
 
774
  // Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
775
  // We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
776
- if ( defined ( 'UPLOADS' ) && ! ( is_multisite () && get_site_option ( 'ms_files_rewriting' ) ) ) {
777
  $dir = ABSPATH . UPLOADS;
778
  $url = trailingslashit ( $siteurl ) . UPLOADS;
779
  }
@@ -781,7 +781,7 @@ class RTMediaMigration {
781
  // If multisite (and if not the main site in a post-MU network)
782
  if ( is_multisite () && ! ( is_main_site () && defined ( 'MULTISITE' ) ) ) {
783
 
784
- if ( ! get_site_option ( 'ms_files_rewriting' ) ) {
785
  // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
786
  // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
787
  // prevents a four-digit ID from conflicting with a year-based directory for the main site.
20
  $this->hide_migration_notice ();
21
  wp_safe_redirect ( $_SERVER[ "HTTP_REFERER" ] );
22
  }
23
+ if ( rtmedia_get_site_option ( "rt_migration_hide_notice" ) !== false )
24
  return true;
25
 
26
  if ( isset ( $_REQUEST[ "force" ] ) && $_REQUEST[ "force" ] === "true" )
27
  $pending = false;
28
  else
29
+ $pending = rtmedia_get_site_option ( "rtMigration-pending-count" );
30
 
31
  if ( $pending === false ) {
32
  $total = $this->get_total_count ();
34
  $pending = $total - $done;
35
  if ( $pending < 0 )
36
  $pending = 0;
37
+ rtmedia_update_site_option ( "rtMigration-pending-count", $pending );
38
  }
39
  if ( $pending > 0 ) {
40
  if ( ! (isset ( $_REQUEST[ "page" ] ) && $_REQUEST[ "page" ] == "rtmedia-migration") )
43
  }
44
 
45
  function hide_migration_notice () {
46
+ rtmedia_update_site_option ( "rt_migration_hide_notice", true );
47
  }
48
 
49
  function migrate_image_size_fix () {
50
+ if ( rtmedia_get_site_option ( "rt_image_size_migration_fix", "" ) == "" ) {
51
  global $wpdb;
52
  $sql = $wpdb->prepare ( "update $wpdb->postmeta set meta_value=replace(meta_value ,%s,%s) where meta_key = '_wp_attachment_metadata';", "bp_media", "rt_media" );
53
  $wpdb->get_row ( $sql );
144
  }
145
 
146
  function get_last_imported () {
147
+ $album = rtmedia_get_site_option ( "rtmedia-global-albums" );
148
  $album_id = $album[ 0 ];
149
 
150
  global $wpdb;
185
  $media_count = $wpdb->get_var ( $wpdb->prepare ( $sql, get_current_blog_id () ) );
186
  if ( $flag )
187
  return $media_count - 1;
188
+ $state = intval ( rtmedia_get_site_option ( "rtmedia-migration", "0" ) );
189
  if ( $state == 5 ) {
190
  $album_count = intval ( $_SESSION[ "migration_user_album" ] );
191
  $album_count += (isset ( $_SESSION[ "migration_group_album" ] )) ? intval ( $_SESSION[ "migration_group_album" ] ) : 0;
237
  //Call flush_rules() as a method of the $wp_rewrite object
238
  $wp_rewrite->flush_rules ( true );
239
  }
240
+ rtmedia_update_site_option ( "rtMigration-pending-count", $pending );
241
  $pending_time = $this->formatSeconds ( $pending );
242
 
243
  echo json_encode ( array( "status" => true, "done" => $done, "total" => $total, "pending" => $pending_time ) );
245
  }
246
 
247
  function manage_album () {
248
+ $album = rtmedia_get_site_option ( "rtmedia-global-albums" );
249
+ $stage = intval ( rtmedia_get_site_option ( "rtmedia-migration", "0" ) );
250
 
251
  $album_rt_id = $album[ 0 ];
252
 
279
  }
280
  $wpdb->query ( $sql_group );
281
  $stage = 1;
282
+ rtmedia_update_site_option ( "rtmedia-migration", $stage );
283
  $this->return_migration ();
284
  }
285
  if ( $stage < 2 ) {
297
  if ( count ( $results ) < 10 ) {
298
  $stage = 2;
299
  }
300
+ rtmedia_update_site_option ( "rtmedia-migration", $stage );
301
  $this->return_migration ();
302
  }
303
  if ( $stage < 3 ) {
321
  } else {
322
  $stage = 3;
323
  }
324
+ rtmedia_update_site_option ( "rtmedia-migration", $stage );
325
  $this->return_migration ();
326
  } else {
327
  $stage = 3;
328
+ rtmedia_update_site_option ( "rtmedia-migration", $stage );
329
  $this->return_migration ();
330
  }
331
  }
333
 
334
  $sql = "update $wpdb->posts set post_type='{$album_post_type}' where post_type='bp_media_album'";
335
  if ( $wpdb->query ( $sql ) !== false ) {
336
+ rtmedia_update_site_option ( "rtmedia-migration", "5" );
337
  return true;
338
  }
339
  return false;
341
 
342
  function test () {
343
  if ( ! $this->table_exists ( $this->bmp_table ) ) {
344
+ $obj = new RTDBUpdate(false, RTMEDIA_PATH."index.php", RTMEDIA_PATH."app/schema/",true);
345
  $obj->install_db_version = "0";
346
  $obj->do_upgrade ( true );
347
  }
466
  if ( ! isset ( $_SESSION[ "migration_media" ] ) )
467
  $this->get_total_count ();
468
 
469
+ $state = intval ( rtmedia_get_site_option ( "rtmedia-migration" ) );
470
  if ( $state < 5 ) {
471
  if ( $this->manage_album () ) {
472
  $this->migrate_encoding_options ();
543
  'bp_media_kaltura_options' => 'rtmedia-kaltura-options',
544
  );
545
  foreach ( $encoding_mnigration_array as $key => $ma ) {
546
+ if ( ($value = rtmedia_get_site_option ( $key )) !== false ) {
547
+ rtmedia_update_site_option ( $ma, $value );
548
  }
549
  }
550
  }
773
 
774
  // Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
775
  // We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
776
+ if ( defined ( 'UPLOADS' ) && ! ( is_multisite () && rtmedia_get_site_option ( 'ms_files_rewriting' ) ) ) {
777
  $dir = ABSPATH . UPLOADS;
778
  $url = trailingslashit ( $siteurl ) . UPLOADS;
779
  }
781
  // If multisite (and if not the main site in a post-MU network)
782
  if ( is_multisite () && ! ( is_main_site () && defined ( 'MULTISITE' ) ) ) {
783
 
784
+ if ( ! rtmedia_get_site_option ( 'ms_files_rewriting' ) ) {
785
  // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
786
  // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
787
  // prevents a four-digit ID from conflicting with a year-based directory for the main site.
app/main/RTMedia.php CHANGED
@@ -87,26 +87,47 @@ class RTMedia
87
  add_action('init', array($this, 'check_global_album'));
88
  add_action('plugins_loaded', array($this, 'init'), 20);
89
  add_action('plugins_loaded', array($this, 'load_translation'), 10);
90
- add_action('init', array($this, 'admin_init'));
91
  add_action('wp_enqueue_scripts', array('RTMediaGalleryShortcode', 'register_scripts'));
92
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts_styles'), 999);
93
  add_action('rt_db_upgrade', array($this, 'fix_parent_id'));
94
  include(RTMEDIA_PATH . 'app/main/controllers/template/rt-template-functions.php');
95
  add_filter('intermediate_image_sizes_advanced', array($this, 'filter_image_sizes_details'));
96
  add_filter('intermediate_image_sizes', array($this, 'filter_image_sizes'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
-
99
  function fix_parent_id() {
100
- $site_global = get_site_option('rtmedia-global-albums');
101
  if ($site_global && is_array($site_global) && isset($site_global[0])) {
102
  $model = new RTMediaModel();
103
  $album_row = $model->get_by_id($site_global[0]);
104
  if (isset($album_row["result"]) && count($album_row["result"]) > 0) {
105
  global $wpdb;
106
  $row = $album_row["result"][0];
107
- $sql = "update $wpdb->posts p
 
108
  left join
109
- $model->table_name r ON p.ID = r.media_id
110
  set
111
  post_parent = {$row["media_id"]}
112
  where
@@ -114,7 +135,8 @@ class RTMedia
114
  and (p.post_parent = 0 or p.post_parent is NULL)
115
  and not r.id is NULL
116
  and r.media_type <> 'album'";
117
- $wpdb->query($sql);
 
118
  }
119
  }
120
  }
@@ -520,7 +542,6 @@ class RTMedia
520
  * @global BPMediaAdmin $bp_media_admin
521
  */
522
  function init() {
523
-
524
  $this->set_allowed_types(); // Define allowed types
525
  $this->constants(); // Define constants
526
  $this->redirect_on_change_slug();
@@ -620,10 +641,10 @@ class RTMedia
620
  }
621
 
622
  function redirect_on_change_slug() {
623
- $old_slugs = get_site_option("rtmedia_old_media_slug", false, true);
624
- $current_slugs = get_site_option("rtmedia_current_media_slug", false, false);
625
  if ($current_slugs === false) {
626
- update_site_option("rtmedia_current_media_slug", RTMEDIA_MEDIA_SLUG);
627
  return;
628
  }
629
  if ($current_slugs === RTMEDIA_MEDIA_SLUG)
@@ -631,7 +652,7 @@ class RTMedia
631
  if ($old_slugs === false)
632
  $old_slugs = array();
633
  $old_slugs[] = $current_slugs;
634
- update_site_option("rtmedia_current_media_slug", RTMEDIA_MEDIA_SLUG);
635
  }
636
 
637
  /**
@@ -678,7 +699,7 @@ class RTMedia
678
  }
679
 
680
  function update_db() {
681
- $update = new RTDBUpdate();
682
  /* Current Version. */
683
  if (!defined('RTMEDIA_VERSION'))
684
  define('RTMEDIA_VERSION', $update->db_version);
@@ -869,7 +890,11 @@ function get_rtmedia_user_link($id) {
869
  }
870
 
871
  function rtmedia_update_site_option($option_name, $option_value) {
872
- update_site_option($option_name, $option_value);
 
 
 
 
873
  }
874
 
875
  function get_rtmedia_group_link($group_id) {
@@ -878,12 +903,25 @@ function get_rtmedia_group_link($group_id) {
878
  }
879
 
880
  function rtmedia_get_site_option($option_name, $default = false) {
881
- $return_val = get_site_option($option_name);
882
- if ($return_val === false) {
883
- if (function_exists("bp_get_option")) {
884
- $return_val = bp_get_option($option_name, $default);
885
- rtmedia_update_site_option($option_name, $return_val);
886
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
887
  }
888
  if ($default !== false && $return_val === false) {
889
  $return_val = $default;
87
  add_action('init', array($this, 'check_global_album'));
88
  add_action('plugins_loaded', array($this, 'init'), 20);
89
  add_action('plugins_loaded', array($this, 'load_translation'), 10);
90
+ add_action('plugins_loaded', array($this, 'admin_init'));
91
  add_action('wp_enqueue_scripts', array('RTMediaGalleryShortcode', 'register_scripts'));
92
  add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts_styles'), 999);
93
  add_action('rt_db_upgrade', array($this, 'fix_parent_id'));
94
  include(RTMEDIA_PATH . 'app/main/controllers/template/rt-template-functions.php');
95
  add_filter('intermediate_image_sizes_advanced', array($this, 'filter_image_sizes_details'));
96
  add_filter('intermediate_image_sizes', array($this, 'filter_image_sizes'));
97
+ add_filter("site_option_upload_filetypes",array(&$this, "filter_allow_mime_type_mu"),1,1);
98
+ }
99
+ function filter_allow_mime_type_mu($options){
100
+ $allowed_types = array();
101
+ $this->allowed_types = apply_filters ( 'rtmedia_allowed_types', $this->allowed_types );
102
+ foreach ( $this->allowed_types as $type ) {
103
+ if ( $type[ 'extn' ] != "" && call_user_func ( "is_rtmedia_upload_" . $type[ "name" ] . "_enabled" ) ) {
104
+ foreach ( $type[ 'extn' ] as $extn ) {
105
+ $allowed_types[ ] = $extn;
106
+ }
107
+ }
108
+ }
109
+ $ext = apply_filters ( 'rtmedia_plupload_files_filter', array( array( 'title' => "Media Files", 'extensions' => implode ( ",", $allowed_types ) ) ) );
110
+ $ext_arr = explode("," ,$ext[0]["extensions"]);
111
+ $options = trim($options);
112
+ foreach($ext_arr as $f_ext){
113
+ if( strpos( $options , $f_ext ) === false){
114
+ $options .= " " . $f_ext;
115
+ }
116
+ }
117
+ return $options ;
118
  }
 
119
  function fix_parent_id() {
120
+ $site_global = rtmedia_get_site_option('rtmedia-global-albums');
121
  if ($site_global && is_array($site_global) && isset($site_global[0])) {
122
  $model = new RTMediaModel();
123
  $album_row = $model->get_by_id($site_global[0]);
124
  if (isset($album_row["result"]) && count($album_row["result"]) > 0) {
125
  global $wpdb;
126
  $row = $album_row["result"][0];
127
+ if( isset( $row["media_id"] ) ) {
128
+ $sql = "update $wpdb->posts p
129
  left join
130
+ $model->table_name r ON ( p.ID = r.media_id and blog_id = '".get_current_blog_id()."' )
131
  set
132
  post_parent = {$row["media_id"]}
133
  where
135
  and (p.post_parent = 0 or p.post_parent is NULL)
136
  and not r.id is NULL
137
  and r.media_type <> 'album'";
138
+ $wpdb->query($sql);
139
+ }
140
  }
141
  }
142
  }
542
  * @global BPMediaAdmin $bp_media_admin
543
  */
544
  function init() {
 
545
  $this->set_allowed_types(); // Define allowed types
546
  $this->constants(); // Define constants
547
  $this->redirect_on_change_slug();
641
  }
642
 
643
  function redirect_on_change_slug() {
644
+ $old_slugs = rtmedia_get_site_option("rtmedia_old_media_slug", false, true);
645
+ $current_slugs = rtmedia_get_site_option("rtmedia_current_media_slug", false, false);
646
  if ($current_slugs === false) {
647
+ rtmedia_update_site_option("rtmedia_current_media_slug", RTMEDIA_MEDIA_SLUG);
648
  return;
649
  }
650
  if ($current_slugs === RTMEDIA_MEDIA_SLUG)
652
  if ($old_slugs === false)
653
  $old_slugs = array();
654
  $old_slugs[] = $current_slugs;
655
+ rtmedia_update_site_option("rtmedia_current_media_slug", RTMEDIA_MEDIA_SLUG);
656
  }
657
 
658
  /**
699
  }
700
 
701
  function update_db() {
702
+ $update = new RTDBUpdate(false, RTMEDIA_PATH."index.php", RTMEDIA_PATH."app/schema/",true);
703
  /* Current Version. */
704
  if (!defined('RTMEDIA_VERSION'))
705
  define('RTMEDIA_VERSION', $update->db_version);
890
  }
891
 
892
  function rtmedia_update_site_option($option_name, $option_value) {
893
+ if( is_multisite() ) {
894
+ update_option($option_name, $option_value);
895
+ } else {
896
+ update_site_option($option_name, $option_value);
897
+ }
898
  }
899
 
900
  function get_rtmedia_group_link($group_id) {
903
  }
904
 
905
  function rtmedia_get_site_option($option_name, $default = false) {
906
+ if( is_multisite() ) {
907
+ $return_val = get_option($option_name, $default);
908
+ if( $return_val === false ) {
909
+ $return_val = get_site_option($option_name, $default);
910
+ if( $return_val === false ) {
911
+ if( function_exists( "bp_get_option" ) ) {
912
+ $return_val = bp_get_option($option_name, $default);
913
+ }
914
+ }
915
+ rtmedia_update_site_option( $option_name, $return_val );
916
+ }
917
+ } else {
918
+ $return_val = get_site_option($option_name, $default);
919
+ if ($return_val === false) {
920
+ if (function_exists("bp_get_option")) {
921
+ $return_val = bp_get_option($option_name, $default);
922
+ rtmedia_update_site_option($option_name, $return_val);
923
+ }
924
+ }
925
  }
926
  if ($default !== false && $return_val === false) {
927
  $return_val = $default;
app/main/controllers/activity/RTMediaBuddyPressActivity.php CHANGED
@@ -21,6 +21,7 @@ class RTMediaBuddyPressActivity {
21
  }
22
  add_action ( "bp_init", array( $this, 'non_threaded_comments' ) );
23
  add_action ( "bp_activity_comment_posted", array( $this, "comment_sync" ), 10, 2 );
 
24
  add_filter ( 'bp_activity_allowed_tags', array( &$this, 'override_allowed_tags' ) );
25
  add_filter ( 'bp_get_activity_parent_content', array( &$this, 'bp_get_activity_parent_content' ) );
26
  add_action ( 'bp_activity_deleted_activities', array( &$this, 'bp_activity_deleted_activities' ) );
@@ -65,7 +66,13 @@ class RTMediaBuddyPressActivity {
65
  $content = str_replace ( '<span class="time-since">%s</span>', '', $content );
66
  return $content;
67
  }
68
-
 
 
 
 
 
 
69
  function comment_sync ( $comment_id, $param ) {
70
 
71
  // comment_id 40
@@ -83,7 +90,8 @@ class RTMediaBuddyPressActivity {
83
  if(sizeof($media) == 1 && isset($media[0]->media_id)) {
84
  $media_id = $media[0]->media_id;
85
  $comment = new RTMediaComment();
86
- $comment->add ( array( 'comment_content' => $param[ 'content' ], 'comment_post_ID' => $media_id ) );
 
87
  }
88
  }
89
 
@@ -112,7 +120,7 @@ class RTMediaBuddyPressActivity {
112
  bp_activity_update_meta($activity_id, "bp_activity_text", $updated_content);
113
  $wpdb->update ( $bp->activity->table_name, array( "type" => "rtmedia_update", "content" => $html_content ), array( "id" => $activity_id ) );
114
  $mediaObj = new RTMediaModel();
115
- $sql = "update $mediaObj->table_name set activity_id = '" . $activity_id . "' where id in (" . implode ( ",", $_POST[ "rtMedia_attached_files" ] ) . ")";
116
  $wpdb->query ( $sql );
117
  }
118
  if ( isset ( $_POST[ 'rtmedia-privacy' ] ) ) {
21
  }
22
  add_action ( "bp_init", array( $this, 'non_threaded_comments' ) );
23
  add_action ( "bp_activity_comment_posted", array( $this, "comment_sync" ), 10, 2 );
24
+ add_action ( "bp_activity_delete_comment", array( $this, "delete_comment_sync" ), 10, 2 );
25
  add_filter ( 'bp_activity_allowed_tags', array( &$this, 'override_allowed_tags' ) );
26
  add_filter ( 'bp_get_activity_parent_content', array( &$this, 'bp_get_activity_parent_content' ) );
27
  add_action ( 'bp_activity_deleted_activities', array( &$this, 'bp_activity_deleted_activities' ) );
66
  $content = str_replace ( '<span class="time-since">%s</span>', '', $content );
67
  return $content;
68
  }
69
+ function delete_comment_sync($activity_id, $comment_id){
70
+ global $wpdb;
71
+ $comment_id = $wpdb->get_var($wpdb->prepare("select comment_id from {$wpdb->commentmeta} where meta_key = 'activity_id' and meta_value=%s",$comment_id));
72
+ if($comment_id){
73
+ wp_delete_comment($comment_id , true);
74
+ }
75
+ }
76
  function comment_sync ( $comment_id, $param ) {
77
 
78
  // comment_id 40
90
  if(sizeof($media) == 1 && isset($media[0]->media_id)) {
91
  $media_id = $media[0]->media_id;
92
  $comment = new RTMediaComment();
93
+ $id = $comment->add ( array( 'comment_content' => $param[ 'content' ], 'comment_post_ID' => $media_id ) );
94
+ update_comment_meta($id, 'activity_id', $comment_id);
95
  }
96
  }
97
 
120
  bp_activity_update_meta($activity_id, "bp_activity_text", $updated_content);
121
  $wpdb->update ( $bp->activity->table_name, array( "type" => "rtmedia_update", "content" => $html_content ), array( "id" => $activity_id ) );
122
  $mediaObj = new RTMediaModel();
123
+ $sql = "update $mediaObj->table_name set activity_id = '" . $activity_id . "' where blog_id = '".get_current_blog_id()."' and id in (" . implode ( ",", $_POST[ "rtMedia_attached_files" ] ) . ")";
124
  $wpdb->query ( $sql );
125
  }
126
  if ( isset ( $_POST[ 'rtmedia-privacy' ] ) ) {
app/main/controllers/media/RTMediaAlbum.php CHANGED
@@ -211,7 +211,7 @@ class RTMediaAlbum {
211
  * @return type
212
  */
213
  static function get_globals () {
214
- return get_site_option ( 'rtmedia-global-albums' );
215
  }
216
 
217
  /**
@@ -248,7 +248,7 @@ class RTMediaAlbum {
248
  $album_ids = array( $album_ids );
249
 
250
  $albums = array_merge ( $albums, $album_ids );
251
- update_site_option ( 'rtmedia-global-albums', $albums );
252
  }
253
 
254
  /**
@@ -292,7 +292,7 @@ class RTMediaAlbum {
292
  'post_title' => $title
293
  );
294
  $status = wp_insert_post ( $args );
295
- if ( get_class ( $status ) == 'WP_Error' || $status == 0 ) {
296
  return false;
297
  } else {
298
  /* Action to perform after updating the album */
211
  * @return type
212
  */
213
  static function get_globals () {
214
+ return rtmedia_get_site_option ( 'rtmedia-global-albums' );
215
  }
216
 
217
  /**
248
  $album_ids = array( $album_ids );
249
 
250
  $albums = array_merge ( $albums, $album_ids );
251
+ rtmedia_update_site_option ( 'rtmedia-global-albums', $albums );
252
  }
253
 
254
  /**
292
  'post_title' => $title
293
  );
294
  $status = wp_insert_post ( $args );
295
+ if ( is_wp_error ( $status ) || $status == 0 ) {
296
  return false;
297
  } else {
298
  /* Action to perform after updating the album */
app/main/controllers/media/RTMediaFeatured.php CHANGED
@@ -194,4 +194,4 @@ if ( ! function_exists ( "bp_media_featured" ) ) {
194
  return rtmedia_get_featured ( $user_id );
195
  }
196
 
197
- }
194
  return rtmedia_get_featured ( $user_id );
195
  }
196
 
197
+ }
app/main/controllers/media/RTMediaLike.php CHANGED
@@ -91,6 +91,7 @@ class RTMediaLike extends RTMediaUserInteraction {
91
  }
92
  else{
93
  wp_safe_redirect ($_SERVER["HTTP_REFERER"]);
 
94
  }
95
  return $actions;
96
  }
91
  }
92
  else{
93
  wp_safe_redirect ($_SERVER["HTTP_REFERER"]);
94
+ die();
95
  }
96
  return $actions;
97
  }
app/main/controllers/media/RTMediaMedia.php CHANGED
@@ -115,7 +115,7 @@ class RTMediaMedia {
115
  $row[ 'meta_value' ] = $value;
116
  $status = add_rtmedia_meta ( $id, $key, $value );
117
 
118
- if ( get_class ( $status ) == 'WP_Error' || $status == 0 )
119
  return false;
120
  }
121
  }
@@ -307,7 +307,7 @@ class RTMediaMedia {
307
  /* update the post_parent value in wp_post table */
308
  $status = $wpdb->update ( $wpdb->posts, array( 'post_parent' => $album_id ), array( 'ID' => $media_id ) );
309
 
310
- if ( get_class ( $status ) == 'WP_Error' || $status == 0 ) {
311
  return false;
312
  } else {
313
  /* update album_id, context, context_id and privacy in rtMedia context */
@@ -527,4 +527,4 @@ class RTMediaMedia {
527
  return $activity_id;
528
  }
529
 
530
- }
115
  $row[ 'meta_value' ] = $value;
116
  $status = add_rtmedia_meta ( $id, $key, $value );
117
 
118
+ if ( is_wp_error ( $status ) || $status == 0 )
119
  return false;
120
  }
121
  }
307
  /* update the post_parent value in wp_post table */
308
  $status = $wpdb->update ( $wpdb->posts, array( 'post_parent' => $album_id ), array( 'ID' => $media_id ) );
309
 
310
+ if ( is_wp_error ( $status ) || $status == 0 ) {
311
  return false;
312
  } else {
313
  /* update album_id, context, context_id and privacy in rtMedia context */
527
  return $activity_id;
528
  }
529
 
530
+ }
app/main/controllers/media/RTMediaMeta.php CHANGED
@@ -16,7 +16,7 @@ class RTMediaMeta {
16
  *
17
  */
18
  function __construct() {
19
- $this->model = new RTDBModel('rtm_media_meta');
20
  }
21
 
22
  function get_meta($id=false,$key=false){
16
  *
17
  */
18
  function __construct() {
19
+ $this->model = new RTDBModel('rtm_media_meta', false, 10, true);
20
  }
21
 
22
  function get_meta($id=false,$key=false){
app/main/controllers/privacy/RTMediaPrivacy.php CHANGED
@@ -29,12 +29,12 @@ class RTMediaPrivacy {
29
  }
30
 
31
  function uploader_privacy_ui ( $attr ) {
32
- if ( ! isset ( $attr[ 'privacy' ] ) ) {
33
  $this -> select_privacy_ui () ;
34
  }
35
  }
36
 
37
- function select_privacy_ui ( $echo = true, $select_id = false ) {
38
  global $rtmedia ;
39
 
40
  if ( ! is_rtmedia_privacy_enable () )
@@ -272,7 +272,7 @@ class RTMediaPrivacy {
272
  $user = 0 ;
273
  }
274
 
275
- $where .= " (m.privacy is NULL OR m.privacy <= 0)" ;
276
 
277
  if ( $user ) {
278
  $where .= "OR ((m.privacy=20)" ;
@@ -299,7 +299,7 @@ class RTMediaPrivacy {
299
  $select_sql = str_replace ( "SELECT" , "SELECT DISTINCT" , $select_sql ) ;
300
  }
301
 
302
- $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID LEFT JOIN {$rtmedia_model->table_name} m ON a.id = m.activity_id";
303
  $where_sql = $where_sql . " AND (NOT EXISTS (SELECT m.activity_id FROM {$bp_prefix}bp_activity_meta m WHERE m.meta_key='rtmedia_privacy' AND m.activity_id=a.id) OR ( {$where} ) )";
304
  $newsql = "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}";
305
  return $newsql;
29
  }
30
 
31
  function uploader_privacy_ui ( $attr ) {
32
+ if ( ! isset ( $attr[ 'privacy' ] ) ) {
33
  $this -> select_privacy_ui () ;
34
  }
35
  }
36
 
37
+ function select_privacy_ui ( $echo = true, $select_id = false ) {
38
  global $rtmedia ;
39
 
40
  if ( ! is_rtmedia_privacy_enable () )
272
  $user = 0 ;
273
  }
274
 
275
+ $where .= " (m.privacy is NULL OR m.privacy <= 0) " ;
276
 
277
  if ( $user ) {
278
  $where .= "OR ((m.privacy=20)" ;
299
  $select_sql = str_replace ( "SELECT" , "SELECT DISTINCT" , $select_sql ) ;
300
  }
301
 
302
+ $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID LEFT JOIN {$rtmedia_model->table_name} m ON ( a.id = m.activity_id AND m.blog_id = '". get_current_blog_id()."' ) ";
303
  $where_sql = $where_sql . " AND (NOT EXISTS (SELECT m.activity_id FROM {$bp_prefix}bp_activity_meta m WHERE m.meta_key='rtmedia_privacy' AND m.activity_id=a.id) OR ( {$where} ) )";
304
  $newsql = "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}";
305
  return $newsql;
app/main/controllers/shortcodes/RTMediaUploadShortcode.php CHANGED
@@ -65,7 +65,7 @@ class RTMediaUploadShortcode {
65
  }
66
  }
67
 
68
- if ( self::display_allowed () ) {
69
  if ( ! _device_can_upload () ) {
70
  echo '<p>' . __ ( 'The web browser on your device cannot be used to upload files.' ) . '</p>';
71
  return;
65
  }
66
  }
67
 
68
+ if ( self::display_allowed () || ( isset( $attr['allow_anonymous'] ) && $attr['allow_anonymous'] === true ) ) {
69
  if ( ! _device_can_upload () ) {
70
  echo '<p>' . __ ( 'The web browser on your device cannot be used to upload files.' ) . '</p>';
71
  return;
app/main/controllers/template/RTMediaNav.php CHANGED
@@ -64,7 +64,7 @@ class RTMediaNav {
64
 
65
  if ( function_exists ( "bp_use_wp_admin_bar" ) && ! bp_use_wp_admin_bar () )
66
  return;
67
-
68
  // Bail if this is an ajax request
69
  if ( defined ( 'DOING_AJAX' ) )
70
  return;
@@ -90,15 +90,17 @@ class RTMediaNav {
90
  global $rtmedia;
91
 
92
  foreach ( $rtmedia->allowed_types as $type ) {
93
- if ( ! $rtmedia->options[ 'allowedTypes_' . $type[ 'name' ] . '_enabled' ] )
94
- continue;
95
- $name = strtoupper ( $type[ 'name' ] );
96
- $wp_admin_bar->add_menu ( array(
97
- 'parent' => 'my-account-' . constant ( 'RTMEDIA_MEDIA_SLUG' ),
98
- 'id' => 'my-account-media-' . constant ( 'RTMEDIA_' . $name . '_SLUG' ),
99
- 'title' => $type[ 'plural_label' ],
100
- 'href' => trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/' . constant ( 'RTMEDIA_' . $name . '_SLUG' ) . '/'
101
- ) );
 
 
102
  }
103
  }
104
  }
@@ -225,9 +227,9 @@ class RTMediaNav {
225
 
226
  if ( isset ( $where[ "context" ] ) ) {
227
  if ( $where[ "context" ] == "profile" ) {
228
- update_user_meta ( $user_id, 'rtmedia_counts', $media_count );
229
  } else if ( $where[ "context" ] == "group" && function_exists ( "groups_update_groupmeta" ) ) {
230
- groups_update_groupmeta ( $user_id, 'rtmedia_counts', $media_count );
231
  }
232
  }
233
  return $media_count;
@@ -241,12 +243,12 @@ class RTMediaNav {
241
  if ( ! $profile_id )
242
  return false;
243
  if ( $context == "profile" ) {
244
- $counts = get_user_meta ( $profile_id, 'rtmedia_counts', true );
245
  if ( $counts == false || empty ( $counts ) ) {
246
  $counts = $this->refresh_counts ( $profile_id, array( "context" => $context, 'media_author' => $profile_id ) );
247
  }
248
  } else if ( function_exists ( "groups_get_groupmeta" ) && $context = "group" ) {
249
- $counts = groups_get_groupmeta ( $profile_id, 'rtmedia_counts' );
250
  if ( $counts === false || empty ( $counts ) ) {
251
  $counts = $this->refresh_counts ( $profile_id, array( "context" => $context, 'context_id' => $profile_id ) );
252
  }
64
 
65
  if ( function_exists ( "bp_use_wp_admin_bar" ) && ! bp_use_wp_admin_bar () )
66
  return;
67
+
68
  // Bail if this is an ajax request
69
  if ( defined ( 'DOING_AJAX' ) )
70
  return;
90
  global $rtmedia;
91
 
92
  foreach ( $rtmedia->allowed_types as $type ) {
93
+ if( isset( $rtmedia->options[ 'allowedTypes_' . $type[ 'name' ] . '_enabled' ] ) ) {
94
+ if ( ! $rtmedia->options[ 'allowedTypes_' . $type[ 'name' ] . '_enabled' ] )
95
+ continue;
96
+ $name = strtoupper ( $type[ 'name' ] );
97
+ $wp_admin_bar->add_menu ( array(
98
+ 'parent' => 'my-account-' . constant ( 'RTMEDIA_MEDIA_SLUG' ),
99
+ 'id' => 'my-account-media-' . constant ( 'RTMEDIA_' . $name . '_SLUG' ),
100
+ 'title' => $type[ 'plural_label' ],
101
+ 'href' => trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/' . constant ( 'RTMEDIA_' . $name . '_SLUG' ) . '/'
102
+ ) );
103
+ }
104
  }
105
  }
106
  }
227
 
228
  if ( isset ( $where[ "context" ] ) ) {
229
  if ( $where[ "context" ] == "profile" ) {
230
+ update_user_meta ( $user_id, 'rtmedia_counts_' . get_current_blog_id(), $media_count );
231
  } else if ( $where[ "context" ] == "group" && function_exists ( "groups_update_groupmeta" ) ) {
232
+ groups_update_groupmeta ( $user_id, 'rtmedia_counts_' . get_current_blog_id(), $media_count );
233
  }
234
  }
235
  return $media_count;
243
  if ( ! $profile_id )
244
  return false;
245
  if ( $context == "profile" ) {
246
+ $counts = get_user_meta ( $profile_id, 'rtmedia_counts_' . get_current_blog_id(), true );
247
  if ( $counts == false || empty ( $counts ) ) {
248
  $counts = $this->refresh_counts ( $profile_id, array( "context" => $context, 'media_author' => $profile_id ) );
249
  }
250
  } else if ( function_exists ( "groups_get_groupmeta" ) && $context = "group" ) {
251
+ $counts = groups_get_groupmeta ( $profile_id, 'rtmedia_counts_' . get_current_blog_id() );
252
  if ( $counts === false || empty ( $counts ) ) {
253
  $counts = $this->refresh_counts ( $profile_id, array( "context" => $context, 'context_id' => $profile_id ) );
254
  }
app/main/controllers/template/RTMediaTemplate.php CHANGED
@@ -256,6 +256,7 @@ class RTMediaTemplate {
256
  $rtMediaNav->refresh_counts ( $rtmedia_query->media[ 0 ]->media_author, array( "context" => "profile", 'media_author' => $rtmedia_query->media[ 0 ]->media_author ) );
257
  }
258
  wp_safe_redirect ( get_rtmedia_permalink ( $rtmedia_query->media_query[ 'album_id' ] ) . 'edit/' );
 
259
  } else {
260
  echo __ ( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
261
  }
@@ -292,6 +293,7 @@ class RTMediaTemplate {
292
  }
293
  }
294
  wp_safe_redirect ( $_POST[ '_wp_http_referer' ] );
 
295
  }
296
 
297
  function single_delete () {
@@ -315,8 +317,6 @@ class RTMediaTemplate {
315
  } else {
316
  $parent_link = get_author_posts_url ( $post->media_author );
317
  }
318
-
319
- // do_action('rtmedia_after_delete_media',$rtmedia_query->media[ 0 ]->id);
320
  $redirect_url = $_SERVER[ "HTTP_REFERER" ];
321
 
322
 
@@ -327,8 +327,9 @@ class RTMediaTemplate {
327
  $redirect_url = trailingslashit ( $parent_link ) . "media/";
328
  }
329
  }
330
-
331
- wp_redirect ( $redirect_url );
 
332
  } else {
333
  echo __ ( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
334
  }
256
  $rtMediaNav->refresh_counts ( $rtmedia_query->media[ 0 ]->media_author, array( "context" => "profile", 'media_author' => $rtmedia_query->media[ 0 ]->media_author ) );
257
  }
258
  wp_safe_redirect ( get_rtmedia_permalink ( $rtmedia_query->media_query[ 'album_id' ] ) . 'edit/' );
259
+ die();
260
  } else {
261
  echo __ ( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
262
  }
293
  }
294
  }
295
  wp_safe_redirect ( $_POST[ '_wp_http_referer' ] );
296
+ die();
297
  }
298
 
299
  function single_delete () {
317
  } else {
318
  $parent_link = get_author_posts_url ( $post->media_author );
319
  }
 
 
320
  $redirect_url = $_SERVER[ "HTTP_REFERER" ];
321
 
322
 
327
  $redirect_url = trailingslashit ( $parent_link ) . "media/";
328
  }
329
  }
330
+ $redirect_url = apply_filters( 'rtmedia_before_delete_media_redirect', $redirect_url );
331
+ wp_safe_redirect ( $redirect_url );
332
+ die();
333
  } else {
334
  echo __ ( "Ooops !!! Invalid access. No nonce was found !!", "rtmedia" );
335
  }
app/main/controllers/template/rt-template-functions.php CHANGED
@@ -541,7 +541,7 @@ function rtmedia_comments () {
541
  if( $comment_list != "") {
542
  $html .= $comment_list;
543
  } else {
544
- $html .= "<li id='rtmedia-no-comments'>". __('There are no comments on this media yet.') . "</li>";
545
  }
546
 
547
  $html .= '</ul>';
@@ -877,7 +877,7 @@ function update_video_poster($html,$media,$activity=false){
877
 
878
  function get_video_without_thumbs() {
879
  $rtmedia_model = new RTMediaModel();
880
- $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and cover_art is null";
881
  global $wpdb;
882
  $results = $wpdb-> get_col ( $sql );
883
  return $results;
@@ -924,6 +924,7 @@ function rtmedia_delete_form () {
924
  $html .= '<input type="hidden" name="request_action" id="request_action" value="delete">';
925
  echo $html;
926
  RTMediaMedia::media_nonce_generator ( rtmedia_id (), true );
 
927
  echo '<button type="submit" class="rtmedia-delete-media">' . __ ( 'Delete', 'rtmedia' ) . '</button></form>';
928
  }
929
 
@@ -1003,7 +1004,7 @@ function rtmedia_user_album_list ( $get_all = false ) {
1003
  $global_option = rtmedia_global_album_list ();
1004
  $global_albums = rtmedia_global_albums ();
1005
 
1006
- $global_album = get_site_option ( 'rtmedia-global-albums' );
1007
  $album_objects = $model->get_media ( array( 'media_author' => get_current_user_id (), 'media_type' => 'album' ), false, 'context' );
1008
  $option_group = "";
1009
  $profile_option = "";
@@ -1144,7 +1145,7 @@ function rtmedia_album_edit () {
1144
  ?>
1145
  <div class="reveal-modal-bg" style="display: none"></div>
1146
  <?php
1147
- if ( isset ( $rtmedia_query->media_query ) && ! in_array ( $rtmedia_query->media_query[ 'album_id' ], get_site_option ( 'rtmedia-global-albums' ) ) ) {
1148
  //if ( isset ( $rtmedia_query->media_query[ 'media_author' ] ) && get_current_user_id () == $rtmedia_query->media_query[ 'media_author' ] ) {
1149
  if ( rtmedia_is_album_editable() || is_rt_admin() ) {
1150
  ?>
@@ -1432,7 +1433,14 @@ function rtmedia_admin_premium_page($page) {
1432
  ?>
1433
  <div class="premium-page-container">
1434
  <div class="row">
1435
- <h1 class="premium-title">17 Reasons to buy rtMedia-PRO</h1>
 
 
 
 
 
 
 
1436
  </div>
1437
  <div class="row">
1438
  <div class="columns large-1 rtm-premium-icon-pro"><i class="icon-user icon-3x"></i></div>
@@ -1442,7 +1450,7 @@ function rtmedia_admin_premium_page($page) {
1442
  </div>
1443
  </div>
1444
  <div class="row">
1445
- <div class="columns large-1 rtm-premium-icon-pro"><i class="icon-file icon-3x"></i></div>
1446
  <div class="columns large-10">
1447
  <h2>Document Support</h2>
1448
  <p>You can add, view and download documents like txt, doc, pdf, also add and upload other file types like zip, tar and tar.gz etc.</p>
541
  if( $comment_list != "") {
542
  $html .= $comment_list;
543
  } else {
544
+ $html .= "<li id='rtmedia-no-comments'>". __(apply_filters('rtmedia_single_media_no_comment_messege','There are no comments on this media yet.')) . "</li>";
545
  }
546
 
547
  $html .= '</ul>';
877
 
878
  function get_video_without_thumbs() {
879
  $rtmedia_model = new RTMediaModel();
880
+ $sql = "select media_id from {$rtmedia_model->table_name} where media_type = 'video' and blog_id = '".get_current_blog_id()."' and cover_art is null";
881
  global $wpdb;
882
  $results = $wpdb-> get_col ( $sql );
883
  return $results;
924
  $html .= '<input type="hidden" name="request_action" id="request_action" value="delete">';
925
  echo $html;
926
  RTMediaMedia::media_nonce_generator ( rtmedia_id (), true );
927
+ do_action("rtmedia_media_single_delete_form");
928
  echo '<button type="submit" class="rtmedia-delete-media">' . __ ( 'Delete', 'rtmedia' ) . '</button></form>';
929
  }
930
 
1004
  $global_option = rtmedia_global_album_list ();
1005
  $global_albums = rtmedia_global_albums ();
1006
 
1007
+ $global_album = rtmedia_get_site_option ( 'rtmedia-global-albums' );
1008
  $album_objects = $model->get_media ( array( 'media_author' => get_current_user_id (), 'media_type' => 'album' ), false, 'context' );
1009
  $option_group = "";
1010
  $profile_option = "";
1145
  ?>
1146
  <div class="reveal-modal-bg" style="display: none"></div>
1147
  <?php
1148
+ if ( isset ( $rtmedia_query->media_query ) && ! in_array ( $rtmedia_query->media_query[ 'album_id' ], rtmedia_get_site_option ( 'rtmedia-global-albums' ) ) ) {
1149
  //if ( isset ( $rtmedia_query->media_query[ 'media_author' ] ) && get_current_user_id () == $rtmedia_query->media_query[ 'media_author' ] ) {
1150
  if ( rtmedia_is_album_editable() || is_rt_admin() ) {
1151
  ?>
1433
  ?>
1434
  <div class="premium-page-container">
1435
  <div class="row">
1436
+ <h1 class="premium-title">Reasons to buy rtMedia-PRO</h1>
1437
+ </div>
1438
+ <div class="row">
1439
+ <div class="columns large-1 rtm-premium-icon-pro"><i class="icon-comments icon-3x"></i></div>
1440
+ <div class="columns large-10">
1441
+ <h2>WordPress Comment Attachment</h2>
1442
+ <p>You can attach files to WordPress comments.</p>
1443
+ </div>
1444
  </div>
1445
  <div class="row">
1446
  <div class="columns large-1 rtm-premium-icon-pro"><i class="icon-user icon-3x"></i></div>
1450
  </div>
1451
  </div>
1452
  <div class="row">
1453
+ <div class="columns large-1 rtm-premium-icon-pro"><i class="icon-file-alt icon-3x"></i></div>
1454
  <div class="columns large-10">
1455
  <h2>Document Support</h2>
1456
  <p>You can add, view and download documents like txt, doc, pdf, also add and upload other file types like zip, tar and tar.gz etc.</p>
app/main/controllers/upload/RTMediaUploadEndpoint.php CHANGED
@@ -93,6 +93,7 @@ class RTMediaUploadEndpoint {
93
  }
94
  $redirect_url = apply_filters("rtmedia_simple_file_upload_redirect_url_filter",$redirect_url);
95
  wp_safe_redirect($redirect_url);
 
96
  }
97
  return $media;
98
  }
93
  }
94
  $redirect_url = apply_filters("rtmedia_simple_file_upload_redirect_url_filter",$redirect_url);
95
  wp_safe_redirect($redirect_url);
96
+ die();
97
  }
98
  return $media;
99
  }
app/main/routers/query/RTMediaQuery.php CHANGED
@@ -419,16 +419,22 @@ class RTMediaQuery {
419
  $this->original_query = $query;
420
  $this->query = wp_parse_args ( $query, $this->query );
421
  //Set Json
 
422
  if ( isset ( $_REQUEST[ "rtmedia_shortcode" ] ) ) {
423
  $query_data = $_REQUEST;
424
- $allowed_query = array( "id", "media_id", "media_type", "media_author", "albume_id", "context", "context_id", "global" );
425
  foreach ( $query_data as $key => $val ) {
426
  if ( ! in_array ( $key, $allowed_query ) ) {
427
  unset ( $query_data[ $key ] );
428
  }
429
  }
430
  $this->query = wp_parse_args ( $query_data, $this->query );
431
- }
 
 
 
 
 
 
432
 
433
  if ( isset ( $this->query[ "context" ] ) && $this->query[ "context" ] == "activity" ) {
434
  $this->query[ "activity_id" ] = array( "value" );
419
  $this->original_query = $query;
420
  $this->query = wp_parse_args ( $query, $this->query );
421
  //Set Json
422
+ $allowed_query = array( "id", "media_id", "media_type", "media_author", "album_id", "context", "context_id", "global", "privacy" );
423
  if ( isset ( $_REQUEST[ "rtmedia_shortcode" ] ) ) {
424
  $query_data = $_REQUEST;
 
425
  foreach ( $query_data as $key => $val ) {
426
  if ( ! in_array ( $key, $allowed_query ) ) {
427
  unset ( $query_data[ $key ] );
428
  }
429
  }
430
  $this->query = wp_parse_args ( $query_data, $this->query );
431
+ } else if(isset($this->is_gallery_shortcode) && $this->is_gallery_shortcode === true) {
432
+ foreach ( $this->query as $key => $val ) {
433
+ if ( ! in_array ( $key, $allowed_query ) ) {
434
+ unset ( $this->query[ $key ] );
435
+ }
436
+ }
437
+ }
438
 
439
  if ( isset ( $this->query[ "context" ] ) && $this->query[ "context" ] == "activity" ) {
440
  $this->query[ "activity_id" ] = array( "value" );
app/services/RTMediaEncoding.php CHANGED
@@ -192,6 +192,7 @@ class RTMediaEncoding {
192
  $usage_info = $this->update_usage($_GET['apikey']);
193
  $return_page = add_query_arg(array('page' => 'rtmedia-addons', 'api_key_updated' => $usage_info->plan->name), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php')));
194
  wp_safe_redirect($return_page);
 
195
  }
196
  }
197
 
@@ -463,7 +464,7 @@ class RTMediaEncoding {
463
  $response = $_POST['thumbs'];
464
  $flag = false;
465
  global $wpdb;
466
- $model = new RTDBModel('rtm_media_meta');
467
  $meta_details = $model->get(array('meta_value' => $_REQUEST['job_id'], 'meta_key' => 'rtmedia-encoding-job-id'));
468
  if(!isset($meta_details[0])){
469
  $id = intval($_REQUEST["rt_id"]);
192
  $usage_info = $this->update_usage($_GET['apikey']);
193
  $return_page = add_query_arg(array('page' => 'rtmedia-addons', 'api_key_updated' => $usage_info->plan->name), (is_multisite() ? network_admin_url('admin.php') : admin_url('admin.php')));
194
  wp_safe_redirect($return_page);
195
+ die();
196
  }
197
  }
198
 
464
  $response = $_POST['thumbs'];
465
  $flag = false;
466
  global $wpdb;
467
+ $model = new RTDBModel('rtm_media_meta', false, 10, true);
468
  $meta_details = $model->get(array('meta_value' => $_REQUEST['job_id'], 'meta_key' => 'rtmedia-encoding-job-id'));
469
  if(!isset($meta_details[0])){
470
  $id = intval($_REQUEST["rt_id"]);
index.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
  Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
  Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
7
- Version: 3.2.7
8
  Author: rtCamp
9
  Text Domain: rtmedia
10
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
@@ -108,6 +108,7 @@ spl_autoload_register ( 'rtmedia_autoloader' );
108
  global $rtmedia;
109
  $rtmedia = new RTMedia();
110
 
 
111
  /*
112
  * Look Ma! Very few includes! Next File: /app/main/RTMedia.php
113
  */
4
  Plugin Name: rtMedia for WordPress, BuddyPress and bbPress
5
  Plugin URI: http://rtcamp.com/buddypress-media/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
6
  Description: This plugin adds missing media rich features like photos, videos and audio uploading to BuddyPress which are essential if you are building social network, seriously!
7
+ Version: 3.2.8
8
  Author: rtCamp
9
  Text Domain: rtmedia
10
  Author URI: http://rtcamp.com/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media
108
  global $rtmedia;
109
  $rtmedia = new RTMedia();
110
 
111
+
112
  /*
113
  * Look Ma! Very few includes! Next File: /app/main/RTMedia.php
114
  */
languages/rtmedia-es_ES.mo CHANGED
Binary file
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === rtMedia for WordPress, BuddyPress and bbPress ===
2
- Contributors: rtcamp, rahul286, faishal, JoshuaAbenazer, gagan0123, saurabhshukla, desaiuditd, nitun.lanjewar, rittesh.patel, pushpak.pop, umesh.nevase, suhasgirgaonkar, neerukoul, hrishiv90, kanakiyajay, jarretc
3
  Donate link: http://rtcamp.com/store/rtmedia-pro/
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node, rtMedia, WordPress, bbPress
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: WordPress 3.6
8
  Tested up to: WordPress 3.7 + BuddyPress 1.8.1
9
- Stable tag: 3.2.7
10
 
11
  Add albums, photo, audio/video encoding, privacy, sharing, front-end uploads & more. All this works mobile/tablets devices.
12
 
@@ -131,6 +131,10 @@ http://www.youtube.com/watch?v=dJrykKQGDcs
131
 
132
  Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
133
 
 
 
 
 
134
  = 3.2.7 =
135
  * Update readme
136
  * Add support for simple file uploader in shortcode
@@ -602,8 +606,8 @@ Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_sou
602
 
603
  == Upgrade Notice ==
604
 
605
- = 3.2.7 =
606
- Requires BuddyPress 1.7 or higher, if using BuddyPress. Update readme and simple file upload in shortcode.
607
 
608
  == Sponsors ==
609
 
1
  === rtMedia for WordPress, BuddyPress and bbPress ===
2
+ Contributors: rtcamp, rahul286, faishal, JoshuaAbenazer, gagan0123, saurabhshukla, desaiuditd, nitun.lanjewar, rittesh.patel, pushpak.pop, umesh.nevase, suhasgirgaonkar, neerukoul, hrishiv90, kanakiyajay, jarretc, tobiaskluge
3
  Donate link: http://rtcamp.com/store/rtmedia-pro/
4
  Tags: BuddyPress, media, multimedia, album, audio, songs, music, video, photo, image, upload, share, MediaElement.js, ffmpeg, kaltura, media-node, rtMedia, WordPress, bbPress
5
  License: GPLv2 or later
6
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
  Requires at least: WordPress 3.6
8
  Tested up to: WordPress 3.7 + BuddyPress 1.8.1
9
+ Stable tag: 3.2.8
10
 
11
  Add albums, photo, audio/video encoding, privacy, sharing, front-end uploads & more. All this works mobile/tablets devices.
12
 
131
 
132
  Please visit [rtMedia's Roadmap page](http://rtcamp.com/rtmedia/roadmap/?utm_source=readme&utm_medium=plugin&utm_campaign=buddypress-media "Visit rtMedia's Features page") to get some details about future releases.
133
 
134
+ = 3.2.8 =
135
+ * Fix WordPress MultiSite issue.
136
+ * Shortcode invalid argument issue fix.
137
+
138
  = 3.2.7 =
139
  * Update readme
140
  * Add support for simple file uploader in shortcode
606
 
607
  == Upgrade Notice ==
608
 
609
+ = 3.2.8 =
610
+ Requires BuddyPress 1.7 or higher, if using BuddyPress. Fix WordPress MultiSite issue and Shortcode invalid argument issue fix.
611
 
612
  == Sponsors ==
613
 
templates/media/album-single-edit.php CHANGED
@@ -39,7 +39,7 @@ $rtmedia_media = $media[0];
39
  <input type="button" class="button rtmedia-move" value="<?php echo __('Move','rtmedia'); ?>" />
40
  <input type="submit" name="delete-selected" class="button rtmedia-delete-selected" value="<?php echo __('Delete Selected','rtmedia'); ?>" />
41
  <div class="rtmedia-move-container">
42
- <?php $global_albums = get_site_option('rtmedia-global-albums'); ?>
43
  <?php _e('Move selected media to', 'rtmedia'); ?>
44
  <?php echo '<select name="album" class="rtmedia-user-album-list">'.rtmedia_user_album_list().'</select>'; ?>
45
  <input type="submit" class="rtmedia-move-selected" name="move-selected" value="<?php _e('Move Selected','rtmedia'); ?>" />
39
  <input type="button" class="button rtmedia-move" value="<?php echo __('Move','rtmedia'); ?>" />
40
  <input type="submit" name="delete-selected" class="button rtmedia-delete-selected" value="<?php echo __('Delete Selected','rtmedia'); ?>" />
41
  <div class="rtmedia-move-container">
42
+ <?php $global_albums = rtmedia_get_site_option('rtmedia-global-albums'); ?>
43
  <?php _e('Move selected media to', 'rtmedia'); ?>
44
  <?php echo '<select name="album" class="rtmedia-user-album-list">'.rtmedia_user_album_list().'</select>'; ?>
45
  <input type="submit" class="rtmedia-move-selected" name="move-selected" value="<?php _e('Move Selected','rtmedia'); ?>" />